Checking phones state in PBX.

Getting started with the SIP Sorcery
Post Reply
tomhanks
Posts: 3
Joined: Mon Mar 14, 2016 10:46 am

Checking phones state in PBX.

Post by tomhanks » Mon Mar 14, 2016 10:59 am

Hi Everyone, I'm new and I need to achieve one task, but I'm bit confused with so many possibilities in Sip Sorcery so I need a bit help.

I need to "connect" to PBX and ask PBX what numbers he has registered and have information every time when there is new call to one of registered numbers and every time when there is disconnect, and when phone which was registered is now unregistered/broken. I know the sip standard only in the basic degree, but I've heard that sip supports such a information exchange.

Please give me at least list of steps which I need to do, to achieve that :)

User avatar
Aaron
Site Admin
Posts: 4551
Joined: Thu Jul 12, 2007 12:13 am

Re: Checking phones state in PBX.

Post by Aaron » Tue Mar 22, 2016 8:46 am

Assuming it's SIP PBX you can get a list of contacts registered to a specific SIP account by sending a REGISTER request. The response to a REGISTER request should include a list of all the current bindings, for more info see https://tools.ietf.org/html/rfc3261#section-10.3. Note that most likely the REGISTER request would have to be authenticated so that would mean you'd need the password for every SIP account you wanted to check the status on.

There are also the SIP events with which you can subscribe to certain events and receive NOTIFY requests when they occur. Support for SIP events is patchy.

tomhanks
Posts: 3
Joined: Mon Mar 14, 2016 10:46 am

Re: Checking phones state in PBX.

Post by tomhanks » Fri Apr 29, 2016 1:13 pm

Sorry for late response, but I thought that I won't have answer so I stopped checking. Currently this task was delayed in my company, so I don't have it implemented yet, and I'm still looking for the answer. In meanwhile I have read some RFC and I decided that it should be the second thing about which you write - sip events. More precisely, I need to subscribe not presence events, about which I have read in RFC, but somehow events about call flow. How can I subscribe to such events using sip sorcery?

User avatar
Aaron
Site Admin
Posts: 4551
Joined: Thu Jul 12, 2007 12:13 am

Re: Checking phones state in PBX.

Post by Aaron » Sun May 01, 2016 12:05 am

tomhanks wrote:How can I subscribe to such events using sip sorcery?


You subscribe the same way as with other SIP servers which requires a SUBSCRIBE request be sent to the sipsorcery server.

User avatar
Flip
Posts: 82
Joined: Sun Aug 19, 2012 3:53 am

Re: Checking phones state in PBX.

Post by Flip » Sun May 08, 2016 2:24 am

Aaron, are you referring to the option for polling the server with keep alive packets?
e.g. Notify, Subscribe, etc?

@TomHanks it will be in your ATA or softphone. Often people set this to Auto which is not always beneficial.
What device are you using? e.g. multi-FXS gateway? ATA? or... ?

tomhanks wrote:Sorry for late response, but I thought that I won't have answer so I stopped checking. Currently this task was delayed in my company, so I don't have it implemented yet, and I'm still looking for the answer. In meanwhile I have read some RFC and I decided that it should be the second thing about which you write - sip events. More precisely, I need to subscribe not presence events, about which I have read in RFC, but somehow events about call flow. How can I subscribe to such events using sip sorcery?
ISP: Exetel ADSL2+ $60 Bundle. 22.4/1.2Mbps, 200/∞ GB [AAPT] + PSTN Bundle [Telstra].
VSP: Telecube¹, SIPTalk², MyNetFone³ via SIPSorcery & Ol' Voxalot. [OMG! Ewww Yuck!! Avoid DIDLogic!!!
H/W: Asus RT-AC66U; Cisco SPA232D, 3 x SPA302's, 2 x SPA901's, SPA3102; Yealink SIP-T46G.

User avatar
Aaron
Site Admin
Posts: 4551
Joined: Thu Jul 12, 2007 12:13 am

Re: Checking phones state in PBX.

Post by Aaron » Mon May 09, 2016 9:34 am

Flip wrote:Aaron, are you referring to the option for polling the server with keep alive packets?
e.g. Notify, Subscribe, etc?


No. Keep-alives are used to keep NAT connections open rather than subscribing for SIP events. It is true that some SIP user agents send NOTIFY requests as a keep-alive mechanism but in that case they are not strictly part of SIP event subscription.

To correctly set up a SIP subscription it must be initiated with a SIP SUBSCRIBE request and then NOTIFY requests can be set to the subscriber for the desired events.

tomhanks
Posts: 3
Joined: Mon Mar 14, 2016 10:46 am

Re: Checking phones state in PBX.

Post by tomhanks » Fri May 13, 2016 7:36 am

@TomHanks it will be in your ATA or softphone. Often people set this to Auto which is not always beneficial.
What device are you using? e.g. multi-FXS gateway? ATA? or... ?

Architecture is simple - people with hardphones (for example polycom/grandstream/yealink) registered to PBX (say Asterisk) and the application which see phones states (talking/finished call/registered/not registered etc.).

@TomHanks it will be in your ATA or softphone. Often people set this to Auto which is not always beneficial.
What device are you using? e.g. multi-FXS gateway? ATA? or... ?


I know that phone or PBX may be configured not to allow to share these information, but this is not a problem, we have devices and PBX configured to share everything.

I have tested some simple application which has ability to subscribe and notify, and it worked well, I had to register that application in my PBX, I had to subscribe to my hard phone on my desk, but that simple application was able only to notify with PRESENCE event, so every time when new call appeared, or was disconnected I saw presence event, but I didn't now what kind of activity was that.
Now I need to write same thing in C# and I chose SipSorcery to that, but with ability not only to see presence event, but to now exactly what happend in that phone. Actually that task in my company keeps being postponed, so I still didn't start to write code, but in free time I read about achieving that with SIP.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest