pinana : old proposal for distributed sip states in asterisk
DESCRIPTION
An old proposal on how to create distributed states in Asterisk. This was never completed.TRANSCRIPT
DISTRIBUTED CALL STATESMaking Asterisk blinking lamps scale
!V 3 - 2010-07-03
Olle E. Johansson * [email protected] Edvina AB, Sollentuna, Sweden 2008-2009. All rights reserved.
SIPSecurity
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
REQUIREMENTS
• Ability to share device states between Asterisk servers
• Ability to subscribe to status of devices in local Asterisk server as well as remote (as long as they exist in the dial plan)
• Ability to get remote device status in dialplan, like local device states
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
ASTERISK VERSION
• Trunk ( to be integrated)
• Asterisk 1.4/Edvx
• Other versions depends on sponsor’s needs
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
CALL STATES IN SIP
• SIP uses Subscribe/Notify with the Dialog-info event package to distribute call states
• A user agent updates the presence server with PUBLISH
SUBSCRIBE Send me updates
NOTIFY Here’s a requested update
PUBLISH Here’s my changed status
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
ASTERISK CURRENT SUPPORT
• Asterisk 1.4 has support for a variety of event packages for subscriptions, including dialog-info
• Asterisk 1.6 added remote subscriptions, where Asterisk subscribes for mailbox notifications (only)
• Asterisk trunk has limited support for PUBLISH for other event types (call completion/camp-on).
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
IDEA
SIP
Presence server
ast01* ast02*
Asterisk 02 subscribes to remote SIP device status.
exten => 1234,hint,sip-dialog:sip:[email protected]
Asterisk 01 publishes device status updates to presence server.
[general] presenceserver=pres.edvina.net presencedomain=edvina.net ![presence] ; Publish a single extension publish = 1234,sip:[email protected] ; Publish a complete context ; Changes in the context won’t be published publishcontext = internal, edvina.net !!
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
QUEUES
SIP
Presence server
ast01* ast02*
Asterisk 02 subscribes to remote SIP device status.
Asterisk 01 publishes device status updates to presence server.
If you want Mary to join the support queue as a full member, you need to add remote device state !exten => mary,hint,remote-sip-blah-blah exten => mary,1,dial(sip/ast02/mary) !!
Arne
bertil
Cecilia
Mary
John
Piggy
Queue:support
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
NEW QUEUE ARCHITECTURE?
ast01* Queue:support
ast02*
ast03*One server handles queues,
the other servers handles all the agents.
SIP Presence server
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
OFFLOADING ASTERISK
ast01*
ast03*Asterisk publishes call states to presense
server, Phones subscribe to presense server directly instead of Asterisk.
SIP Presence server
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
BENEFITS
• Using a SIP presence server scales
• Other devices can subscribe directly to status with the presence server
• We can add some extra data - Asterisk-specific - to the presence items
• It’s standardized
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
POTENTIAL ISSUES
• Using a proprietary distributed event system might make it easier to add Asterisk functionality and support legacy systems, like flash operator panel
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
TO BE TESTED
• Can we potentially create a dialplan that can handle remote call pickup? • Asterisk supports invite with replaces today. Can we force such an action in
the dialplan and have Asterisk pickup a remote SIP call?
• Yes, provided we send the Asterisk channel ID as call-id
• How would this work with manager events/actions? • We need to spend more time on scenarious here
• Manager support considered out of scope for this first project
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
REALTIME SUPPORT.
• If a new device activates, based on realtime database, will we have to know that and publish the state?
• Can be done for SIP devices in the SIP channel I think
• Using regcontext= we can hook into that part and publish the state
• We need to check how the server aggregates states from different servers
• If a phone reboots, it may register on server A and still have registration on server B. When the registration expires, the state changes - AFTER the other server has said that everything is fine... Food for thought.
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
PUBLISH DEVICE STATES
• Create a subdomain for device states in presence server
• Using dialog-info
• Publish to devicename@domain • SIP/[email protected]
• Simple prefix-based filters in sip-presense.conf
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
PUBLISHING EXT STATES
• We need to map exten@context to a SIP uri • Per extension
• Default mapping per context - map to SIP domain
• Realtime support a requirement
• Maybe add a ”pubhint” in dialplan for XMPP and SIP • exten => olle,pubhint,sip-pidf,sip:[email protected]
• exten => anna, pubhint, sip-dinfo,sips:[email protected]
• exten => brad,pubhint,xmpp,xmpp:[email protected]
© Copyright Edvina AB, Sollentuna, Sweden July 2010. All rights reserved.
Blinking lamps
CONFIGURATION OF MAPPING
[contextname] outboundproxy=<peer or domain> defaultdomain=edvina.net urimap=1236474,sip:[email protected] urimap=12922,sips:[email protected]
sip-publish.conf