Introduction
Sometimes we need to restart the encoding channel in a regular basis, i.e daily or weekly.
On the CMP encoder, this can be done through configuring some schedule events. But the schedule could happen in the 2 recurring types: Daily & Weekly.
This document will introduce the steps to configure Schedule Task to invoke API to restart the encoding channel/stream in a more flexible frequency.
The same procedures can be applied to invoke any other functions provided by the Cisco AnyResLive (Spinnaker Message Service) API.
Prerequisites
Requirements
- Administrator access to the Cisco AnyResLive encoder
- Understanding of how the Batch file and script work on Windows
Components Used
- wget
- windows batch script
- windows task scheduler
- Spinnaker Message Service API
Configuration Steps
1, Download the wget from http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe and install it on the Audio encoder, the application will be installed under C:\Program Files\GnuWin32\bin
2, After installing wget on the encoder, add the path “C:\Program Files\GnuWin32\bin” to the system Variable

3, Enable the Message Service from the Encoder management GUI: System-->Message Service

4, Create a folder C:\Schedule_Restart_Channels under C drive.
Under folder created, create XML file named: Restart_Channel1.xml (more xml files could be created if needed) copy the below content into the files, the only thing need to change for each channel is the <Channel> item below:
<?xml version="1.0" encoding="UTF-8"?>
<SpinnakerService>
<GUID>46140015-27b9-46ea-abfa-de980eae387te</GUID>
<Target>
<Name>SPINNAKER</Name>
</Target>
<Command>
<Restart>
<Channel>1</Channel>
<Stream>0</Stream>
</Restart>
</Command>
</SpinnakerService>
Notes:
<GUID> could be any value, the default one in the file should be fine
<Traget> please use the computer name of the Encoder
<Channel> Put the channel number for which needs to be restarted
<Stream> Put 0 here so it will restart all the streams under the channel
5, Under folder created in step 3, create a batch file Restart_Channels.bat with the below content
@echo off
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
wget http://<encoder ip>:8099/encNode/ --post-file="RestartChannel1.xml" --header="Content-Type: application/soap+xml" --output-document=Restart_Status_ch1_%mydate%.xml
Notes:
- Please change the ip address of the encoder accordingly.
- The --post-file option needs to use the XML file created in step 4, if there are more than 1 XML file to be used then please create more lines to run wget accordinly
- The restart status will be saved under the same folder in XML file named: Restart_Status_ch<x>_<date>.xml
6, Create a Windows schedule event:
Control Panel —> Scheduled Task, select the batch file created in step 5 to execute (now it can be scheduled to happen once a weekly only).
When it requires to enter the password, please input the password for the admin user.

Verification
1) Check the restart status XML files created under the folder: C:\Schedule_Restart_Channels, the XML file will have the response result:
<Response>
<Result>Restart successful</Result>
<Error>0</Error>
</Response>
2) Check the application log on the encoder, the following information type event (SMS Message Received) will be recorded:

References
WGET to post XML file and get the output:
http://stackoverflow.com/questions/1244433/tool-to-post-xml-string-to-webservice-for-testing
Please download the sample script and XML files in the attachment below
If you need more assistance on AnyResLive API please contact Cisco TAC