Author |
|
davidpeek Intermediate
Joined: December 18 2009 Location: United States Posts: 10
|
Posted: April 06 2010 at 2:49pm | IP Logged
|
|
|
Hi Randal,
I'm having a little difficulty understanding how to issue an event notification with SendEventNotification using managed code(VB). I know I'm supposed to save the handle from the SipSubscriptionReceived event but I don't see how to instantiate the VoIPMediaEngine.Notify class in order to use it to call SendEventNotification for the specific destination. I don't see how that works? Can you help? Thanks! =Dave
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: April 07 2010 at 7:00pm | IP Logged
|
|
|
Hello Dave,
Thanks for waiting for this response. It has been busy here…
Instead of trying to explain the details of the managed code SUBSCRIBE/NOTIFY capabilities of the media engine, I thought it would be a good idea to add a new managed code sample to the product. That way you can look at code and shorten your learning curve. There’s nothing like looking at real code to see how everything is supposed to work.
What I did was create a new simple form based vb.NET sample app that will be included in future releases of the LME. Here is a screen shot of the new sample:
Everyone can download the code archive from this link:
SubscribeNotifyVbSampleApp.zip
Summary:
The sample shows the basics of subscribing to SIP events and then generating NOTIFY responses to the event subscriptions. The sample app basically subscribes and notifies itself.
There is additional information in the main form’s vb.NET code module that explains things further. Make sure to look it over.
The sample allows the user to start and stop the media engine. Once the media engine is started, the user can press a GUI button to initiate a SIP SUBSCRIBE request. The subscribe SIP message is transmitted and received by the sample.
In the code, the app handles the SipSubscriptionReceived immediate event. During the processing of this event, the app can deduce if the SUBSRIBE is being requested or is being terminated (it looks at the SIP Expire value). If the expire value is non zero, it’s a SUBSCRIBE start event.
For the app to send out NOTIFY requests, the app need only copy the “NotifyObject” from the “Subscribe Reqest Data” that is passed to the app. View the sample code – you will see exactly what I mean.
Once your app has this “NotifyObject”, you can use it to send SIP NOTIFY requests back to the subscriber by calling the SendEventNotification() member of the “NotifyObject”:
Code:
status = NotifyObj.SendEventNotification(………);
|
|
|
Use the sample like this:
---------------------------------------
Start the sample.
Set your host’s IP and SIP port as required.
Press the “start media engine” button.
Press the “Subscribe” button.
Press the “Notify” button.
As the media engine does it “thing”, you will see the SIP messages streamed to the GUI.
Please let me know if I have missed something.
Thank you Dave,
Randal
|
Back to Top |
|
|
davidpeek Intermediate
Joined: December 18 2009 Location: United States Posts: 10
|
Posted: April 07 2010 at 7:50pm | IP Logged
|
|
|
Hi Randal,
This is great! All my questions are answered and I now see exactly what I need to do. Thanks for creating this sample so quickly!
Thanks,
=Dave
|
Back to Top |
|
|