Sunday, October 26, 2008

I have seen a lot of conversation on the forums surrounding how to monitor the status of calls placed into the Parking Orbits. I think that that it would be worthwhile to explore a deeper understanding of the Park Orbits within 3CX as well as how the 3CX Softphone manages to provide this information to us.

SIP SUBSCRIBE and NOTIFY
Let’s begin with a simple explanation of the SIP SUBSCRIBE and SIP NOTIFY messages. At the most basic level, a client sends a SUBSCRIBE message to the PBX for a given extension. When anything on that extension changes (e.g., it starts ringing, is active, is idle, etc) then a SIP NOTIFY message is sent from the PBX to the client who subscribed to the events pertaining to the designated extension. An example of this would be if a receptionist has a BLF light on her phone to tell her the status of the CEO’s phone. In this case the receptionist’s phone has sent a SIP SUBSCRIBE message to the PBX for the CEO’s extension. When the CEO’s extension starts ringing a SIP NOTIFY event is sent from the PBX to the receptionist’s phone to tell it of the event pertaining to the CEO’s extension.

How the 3CX Softphone does it
You have probably noticed that the 3CX Softphone seems to know the status of all the phones as well as of all the active Park Orbits, VoIP Lines, etc. Is this magic? Nope! It’s simply using SIP SUBSCRIBE and SIP NOTIFY events. This of course begs the question, “how does my softphone know what all these extensions are in order to send SIP SUBSCRIBE messages for each one, especially when Park Orbits are created dynamically?” The answer is...it doesn’t. When the 3CX Softphone first launches it sends a SIP SUBSCRIBE message for the special account “any‐dn”. This is basically like saying “I want to SUBSCRIBE to everything.” So, now, anytime any extension, Park Orbit, VoIP Line….has an event, a SIP NOTIFY is sent to the softphone. This allows the softphone to show you Park Orbits dynamically when they are created and destroyed.

Implications to hardware phones
Most hardware IP phones I have seen that indicate they support Park Orbits require these to be some type of true SIP account that it can send a SUBSCRIBE message and receive NOTIFY messages for. Obviously, this won’t work with 3CX at the moment because the Park Orbits are not really true SIP accounts and are created dynamically. In the long run, this is the easier solution.

But, its important to understand what we might be able to do today.

What I do see as an interesting possibility is the creation of an XML application on the IP phone to handle this. What I am envisioning is that on the 3CX webserver side we could create a simple PHP application that sends a SUBSCRIBE message to the PBX for “any‐dn”. Of course, we will then initially receive back a series of SIP NOTIFY messages to give us the status of all the existing DNs. The Park Orbits could be extracted from this and sent back to the XML requester (the phone who made the request to the PHP page). The PHP script can complete by cleanly ending the open SUBSCRIBE conversation.

  1. Phone requests parks.php
  2. Parks.php send SIP request to any-dn
  3. Parks.php receives response (notifys)
  4. Parks.php extracts Park orbits from responses
  5. Parks.php formats XML structure properly for the phone
  6. Parks.php sends output as properly formatted XML structure back to phone
  7. Voila, we see the park orbits on our hardware phone

I believe this would be a very straightforward way to allow a user to monitor park orbits and would not only give us status but also any other information that is sent back in the XML Presence structure that 3CX returns (but that’s an article for another day). There is actually quite a bit we could here.

Happy 3Xing!!!!

Best,

Mike

1 comments:

Anonymous said...

This could be a great workaround to make 3CX work with some phones that only use BLF RLS (lists) like polycom and 3CX didn't support this, maybe you could publish the source of the php and maybe you could add this feature to 3CX.

Thanks