Hello.
I need to wait for registration after I have sent push message from a dialplan (using AGI).
How can I do that, and how reliable the result will be?
I have seen similar question, where OP was advised to use DEVICE_STATE functon.
But I cannot find information - what exactly that function do?
Does it pings a peer in some way?
And is it possible to do the same thing from AGI script (which is called from dialplan)?
Because checking device state inn AGI script is more suitable for me.
But, even if DEVICE_STATE returns device state from some cache, is it possible to wait for sertainly fresh registration?
And by fresh Imean second or two ago.
What does it mean? How it retrieves device state?
Sends a request to the device?
Or checks a local cache for information about last registration?
What exactly the function do?
And can it behaviour be emulated in an AGI program?
Again, thanks for help.
Could you explain or provide a link do a documentation, where described a method of calling GET VARIABLE from AGI script (I am using python, but i guess it should be possible with other languages).
Should I just write GET VARIABLE <…> to stdout and then read from stdin, or I should do it in some other way?
And which variable should I read to get peer status?
And Is there a way to get time of last registration (preferrably from AGI script)?
Checking the variable PJSIP_AOR to get the contacts for the user, then checking them individually using PJSIP_CONTACT
The above loop also check the user agent, as we want to specifically look for our own softphone application, and for the AGI class used, it’s my own construction, but the function names should be descriptive enough to tell you what you need to do in what order, and I’ve put the relevant information on how to get the information, above.
If you check the contacts BEFORE sending the notification, then enters a loop checking the contacts after it’s sent, you can just compare the before and after lists, to spot new registrations. However, you MIGHT have situations, where the client is already registered before the notification is sent. (Eg. the application is already open on the device) Keep that in mind, and make some sort of escape from you loop, in a relevant maner, either looking for a specific registration, a specific user agent, or just any registration at all.