WMSPanel agent works closely with Wowza server so we literally feel its pulse. That's why one of the first features was server offline/online notification. Moving forward we got requests from customers asking for the same for incoming RTMP streams monitoring. Basically people need to know when the stream becomes un-available and get notified about that.
Having been notified about RTMP publish or unpublish event, we can inform a customer about the failure or recover. This kind of events may happen very often, especially if you have thousands of streams. That's why using email is inappropriate in this case.
That's why we implemented this as a push API.
If you want to use the notifications API, the major steps for starting using this are as follows:
Agent uses POST request to call your URL. Your script MUST get request body first.
Request body will looks like this(without formatting of course):
You can find a small PHP sample of processing the incoming request in out github samples repo. Please also check full XSD for agent request.
Go to Control / API Settings and choose Global push API tab.
So now you can set up a testing stream (or use existing one) and then publish it to get notified by the panel via the script. In the given example you'll have new log entry.
WMSPanel provides a test handler you can use for trying your calls.
This option will work perfectly with Wowza streams control functionality already available in WMSPanel.
Having been notified about RTMP publish or unpublish event, we can inform a customer about the failure or recover. This kind of events may happen very often, especially if you have thousands of streams. That's why using email is inappropriate in this case.
That's why we implemented this as a push API.
If you want to use the notifications API, the major steps for starting using this are as follows:
- Create a processing script on your web site and check its availability.
- Add a processing script URL in WMSPanel.
- Test the solution.
Having those steps complete, you'll have the script is automatically called each time our agent gets publish or un-publish event from all servers registered in WMSPanel.
1. Create a processing script
Agent uses POST request to call your URL. Your script MUST get request body first.
Request body will looks like this(without formatting of course):
{"ApiSyncRequest": {"ID": "1111-222-333-444,
"Signature": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTg",
"Puzzle": "42342-33434-343434-34343",
"Publish": {
"VHostName": "_defaultVHost_",
"AppName": "live",
"AppInstanceName": "_default_",
"StreamName": "stream.stream"
}
}}
"Signature" is what your script MAY check to make sure that is was WMSPanel agent who sent it.
Signature = BASE64(MD5(ID + Puzzle + Token))
You can find a small PHP sample of processing the incoming request in out github samples repo. Please also check full XSD for agent request.
2. Set up API in WMSPanel
Go to Control / API Settings and choose Global push API tab.
Setting up API handler for Wowza unpublish/publish notifications. |
Here define the following:
A few seconds after you click on Save, the first sync-up will be sent to your handler.
API parameters also include Token field as well as Enable mutual authorization check box. Those should be used if you'd like to use signature as described in section 1 above.
You may also make per-server setup. Just click on Servers push API tab to be able to define same settings for each individual server.
- Enter handler URL into Streams (un)publish handler URL field;
- Click on Enable publish/unpublish notifications (Wowza only) checkbox;
- Select Request format or leave default "JSON" value;
- Enter Sync interval or leave default 30 seconds.
A few seconds after you click on Save, the first sync-up will be sent to your handler.
API parameters also include Token field as well as Enable mutual authorization check box. Those should be used if you'd like to use signature as described in section 1 above.
You may also make per-server setup. Just click on Servers push API tab to be able to define same settings for each individual server.
3. Test the complete solution
So now you can set up a testing stream (or use existing one) and then publish it to get notified by the panel via the script. In the given example you'll have new log entry.
WMSPanel provides a test handler you can use for trying your calls.
This option will work perfectly with Wowza streams control functionality already available in WMSPanel.
This feature is also available for Nimble Streamer, and it works similar to the above feature. Read this article for details.
WMSPanel API reference, Pay-per-view for Wowza Media Server github API code samples, Downtime notifications push API,
Related documentation
WMSPanel API reference, Pay-per-view for Wowza Media Server github API code samples, Downtime notifications push API,
Do you guys have a more direct sample of how to implement the script into a PHP page? Like how you have concise sample code for the WMSAuth system.. Thanks!
ReplyDeleteAs I mentioned, the post is updated with the link to a new samples repo: https://github.com/WMSPanel/wmspanel-api-samples
DeletePlease use stream-un-publish-notify.php as a very basic sample.
Please kindly let us know if you make any improvements to it so we could share to the wider audience.
Yes, we'll provide some PHP sample soon in this post. It will be uploaded to our github account: https://github.com/WMSPanel.
ReplyDeleteMeanwhile please drop an email to sales so we could inform you about it and check your account's API settings.
Thanks for your interest!