Sangoma Phones when used with DPMA
SIP Configuration
Configuration of a phone via the Desk Phone module for Asterisk alone is not enough to enable calling between the phone and Asterisk. As with any SIP device that connects to Asterisk, each Sangoma phone needs a corresponding entry in Asterisk's SIP configuration.  Further, use of DPMA assumes that out-of-call MESSAGE support has been enabled, and will require some specific "general" section parameters.
chan_pjsip
For chan_pjsip, a number of different types are configured, notably a transport, an aor, an auth, and an endpoint.  The endpoint is the entity referenced in the DPMA for line configuration.  A minimum pjsip.conf entry for a Sangoma phone then would look like:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
Â
[101]
type = aor
max_contacts = 1
mailboxes = 101@default
Â
[101]
type = auth
auth_type = userpass
password = 101
username = 101
Â
[101]
type = endpoint
aors=101
auth=101
callerid=Malcolm Davenport
context = testing
disallow = all ; Good practice dictates disallowing codecs first, and then allowing only the ones we want
allow = g722 ; 16kHz at 64kbps
allow = ulaw ; 8kHz at 64kbps, North America
allow = alaw ; 8kHz at 64kbps, Worldwide
allow = g726 ; 8kHz at 32kbps
allow = g729 ; 8kHz at 8kbps - NOTE: This codec should not generally be enabled without installing Sangoma's G.729 transcoding module for Asterisk
allow = slin ; 8kHz at 128kbps - NOTE: This codec should generally not be used outside of a LAN
allow = slin16 ; 16kHz at 256kbps - NOTE: This codec should generally not be used outside of a LAN
direct_media = yes
trust_id_inbound = yes
send_pai = yes
Additionally, as Sangoma phones make use of the out-of-call messaging capabilities within Asterisk, a modification to the [general] section of Asterisk's chan_pjsip configuration file must be made as well.  The modification is the definition of an endpoint, e.g. "dpma_endpoint," to bind to for the creation of outbound MESSAGE packets, as well as the configuration of chan_pjsip's "global" options to use this endpoint.
Thus, the settings are:
PJSIP General Section Requirements
[global]
type = global
default_outbound_endpoint = dpma_endpoint
Â
[dpma_endpoint]
type=endpoint
chan_sip
For chan_sip, Asterisk provides two types of entities within SIP: peers and friends. Use of either type is permissible, when configuring a Sangoma phone; however, use of the peer type means that Asterisk will not correctly match incoming calls where more than one SIP identity is assigned to the same phone (IP address). General practice then means that the friend type is the most flexible - as it matches on the From: username, whereas peer matches on IP and port (unless insecure=port has been set).
A minimum sip.conf entry for a Sangoma phone then would look like:
SIP Configuration Entry Example
[mydigiumphone]
type = friend ; Use of "friend" is good practice, generally
nat = force_rport ; Good security practice dictates enabling nat support by default in both the general and individual phone sections
host = dynamic ; Dynamic in this case since the device is registering with us
secret = UseGoodPasswords ; Always use good passwords
disallow = all ; Good practice dictates disallowing codecs first, and then allowing only the ones we want
allow = g722 ; 16kHz at 64kbps
allow = ulaw ; 8kHz at 64kbps, North America
allow = alaw ; 8kHz at 64kbps, Worldwide
allow = g726 ; 8kHz at 32kbps
allow = g729 ; 8kHz at 8kbps - NOTE: This codec should not generally be enabled without installing Sangoma's G.729 transcoding module for Asterisk
allow = slin ; 8kHz at 128kbps - NOTE: This codec should generally not be used outside of a LAN
allow = slin16 ; 16kHz at 256kbps - NOTE: This codec should generally not be used outside of a LAN
context = myfancycontext ; The context that incoming calls from this device will arrive into
mailbox = mydigiumphone@default ; The voicemail box associated with the Sangoma phone
Additionally, as Sangoma phones make use of the out-of-call messaging capabilities within Asterisk, certain modifications to the [general] section of Asterisk's chan_sip configuration file must be made as well:
Out of call messages must be accepted
The context for out of call messages should be "dpma_message_context"
Message Request authentication must be disabled
Thus, the settings are:
SIP General Section Requirements
Additionally, use of the callcounter SIP configuration option is required for BLF state to properly operate. Thus:
Additional SIP General Section Requirements
callcounter may also be specified per-peer, instead of generally.
1.0.0-beta1 versions of res_digium_phone.so require that outofcall_message_context be set to phone_context. Versions after 1.0.0-beta1 default to dpma_message_context. If phone applications and provisioning are not working properly, please check the setting of outofcall_message_context.
Voicemail Configuration
All Sangoma Phones are provided with a Msgs hard button which calls the Voicemail application (visible in the list of Applications on the phone as well). When a Sangoma phone is not connected to the Desk Phone module for Asterisk, the Voicemail application simply dials a SIP URI, as configured, like any other SIP phone. However, if the Sangoma phone is connected to DPMA and Asterisk is correctly configured, then the Msgs button will instead load a Visual Voicemail application that provides an enhanced user experience.
To configure Asterisk correctly, simply ensure that a mailbox entry in Asterisk's Voicemail configuration (voicemail.conf) matches the mailbox configuration parameter for a Sangoma Phone in res_digium_phone.conf, e.g.:
voicemail.conf
Voicemail Configuration Example for Voicemail Application
res_digium_phones.conf
Digium Phones Configuration Example for Voicemail Application
Parking
When used in combination with DPMA, Sangoma phones provide both a parking application as well as one-touch parking. The parking application allows the phone to retrieve a list of all parking lots present on the Asterisk server, along with the calls that are currently parked in each lot. From this list then, a phone may retrieve any parked call. The one-touch parking feature is a softkey on the phone's display that appears when a call is connected. The softkey transfers the connected call (attended or blind) to whatever parking lot extension the phone is configured to use.
In attended transfer mode, once the parking operation is completed, Asterisk will play a prompt back to the parker, indicating the lot number to which the call was parked, and the phone will hang up. That lot number may then be dialed in order to retrieve the call, or one may use the phone's Parking application to browse and directly retrieve a parked call.
In blind transfer mode, the default, once a park is completed, the phone will display a text message on its screen, indicating the lot number in which the call was parked, and the phone will hang up. One may then use the phone's Parking application to browse and directly retrieve a parked call.
res_parking.conf
Asterisk enables call parking by default with the res_parking.conf parameters:
res_parking.conf Configuration Example for Parking Application
res_digium_phone.conf
The corresponding res_digium_phone.conf configuration parameters are:
Digium Phones Configuration Example for Parking Application
BLF Subscription to a Parking slot
BLF keys on phones are commonly tied to slots in Parking Lots, such that when a caller is waiting in a particular slot, e.g. 701, the lamp for a BLF tied to that parking slot is lit and the user may press the BLF button to retrieve the parked call from the lot.
Tying the status of a BLF lamp to the activity of a parking slot does not require setting the parking_exten, but it does require enabling Asterisk's parking feature, as well as a proper dialplan hint and a proper subscription URI on the Sangoma phone.
If parking_exten is not configured for a Sangoma phone, then DPMA will not enable the one-touch parking feature of the Sangoma phone.
Dialplan hint
An example dialplan hint for watching status of a parking slot is:
Remember to include the context to which calls are parked into the same dialplan context as the Sangoma phone, as well as the Hint
Â
Dialplan Example for Parking slot Hint
Contacts subscribe_to URI
An example contacts XML file subscribe_to URI for watching parking slot 701:
Contacts Subscription URI for parking slot 701
Handling multiple parking lots
Beginning with the 1.4 release of DPMA, Sangoma phones can be explicitly told which lots, inside of the Parking application, to present to the user. This is accomplished with the new "parking" phone application type within the DPMA configuration. Presented here is an example of configuring three phones, A, B, and C, to view one (A and B) or multiple (C) lots. Note that the Park softkey must still be mapped to park within a single lot only.
Begin by configuring res_digium_phone.conf. We will specify two parking applications, one that is tied to lot parkinglot_sales and another that is tied to parkinglot_support.
Then, still within res_digium_phone.conf, each of our three phones is configured to look at a particular lot. Phone C sees both lots.
Asterisk's res_parking.conf, which controls the built-in Parking feature of Asterisk, needs definitions for the lots parkinglot_salse and parkinglot_support.
Then, in extensions.conf, defined contexts for the parking lots:
And in the extension in which the Sangoma phones exist, included those contexts:
Thus, Phone A has a softkey that transfers to 800 and it can see other people parked in the "Sales" lot.
Phone B has a softkey that transfers to 850 and it can see other people parked in the "Support" lot.
Phone C has a softkey that transfers to 800 and it can see people parked in either lot.
Call Recording
When used with DPMA, Sangoma phones can perform one touch call recording. Enabled in res_digium_phone.conf by the record_own_calls phone configuration parameter, one touch call recording presents a "Record" softkey on the phone's interface whenever the phone is on a call. If activated by the user, Asterisk begins recording both legs of the current call at the server-side and the softkey changes to "Stop Record." Pressing the "Stop Record" softkey directs Asterisk to cease recording the call, and the softkey returns to the "Record" state. Pressing the softkey again at this state will initiate a second, and separate recording session.
Recorded calls are stored by Asterisk in the Cust5 voicemail folder. This folder may be accessed directly by dialing the standard Asterisk voicemail application or by pressing the "Msgs" key on the phone, browsing to the folder list and selecting the "Recordings" folder. The "Recordings" folder, as presented by the Messaging application is mapped directly to the Cust5 folder by DPMA. Recorded calls may be listened to, moved to other folders, or forwarded to other users on the system.
Call Queues Application
Sangoma phones, when used with DPMA, have a built-in Queues application that allows for interaction with Asterisk's app_queue queue application. The Queues application on the phone is configured in the phone configuration section of res_digium_phone.conf by applying a queue application type to the configuration. The queue application has a number of parameters to control the queue, the member's name, the member's location, permission level, and login/out extensions.
The application, when loaded on the phone, provides 3 levels of permission: status, overview and details; each of which encompasses the previous permission's capabilities. The status view allows agents to manipulate their Pause status and their login/logout status on a per-queue basis or for all queues. The overview level allows agents or managers to also view, per queue, the number of members logged in / total assigned to a queue, the number of members on a call, the number of callers waiting, the total number of calls into the queue, the number of answered calls, and the number of abandoned calls. Additional statistical information within the overview section of the application is only available when Sangoma phones are used with Switchvox. The details level allows agents or managers to also view, per queue, the total number of waiting calls, the number of available/total members, the callers waiting in a queue with position and wait time, and the members on-call status.
User Presence
When used with DPMA, Sangoma Phones are capable of seeing both device status and user presence. Device status is simply the device state one can subscribe to over SIP SUBSCRIBE, that maps directly to a hint in the diaplan. User presence is an entirely new concept to Asterisk, and expands upon the usage of dialplan hints, allowing them to represent both device state and user presence at the same time. Sangoma Phones not connected to DPMA are capable of only Available and DND (Phone returns 486 to Asterisk) status. Sangoma Phones using DPMA are capable of much more, with a Status application that allows users to change their presence on the server, opening up new methods for call routing based on user-presence, and not merely device presence.
Defining User Presence in Asterisk
The fundamentals of how user presence is represented in Asterisk mirrors the concepts currently used with device state. Device state changes are triggered by device state providers.
Example Device State provider mapped to extension.
Using the same pattern, user presence is changed by a CustomPresence user presence provider. A CustomPresence provider works in the same way a Custom device state provider does. CustomPresence providers are both defined and updated using a dialplan function, PRESENCE_STATE().
Example Device State and Presence State providers mapped to a single extension.
Manipulating User Presence through Dialplan and AMI
PRESENCE_STATE() Dialplan Function
User presence information is modified through the use of the PRESENCE_STATE() dialplan function. This function allows a custom user presence provider's information to be both read and written via the dialplan and AMI.
Write Syntax
Â
Valid State Values for Digium Phones
Â
Valid Options
Read Syntax
Â
Valid read fields arguments
Â
Valid read options
Dialplan Examples
Dialplan Write Examples
Example1:Â Set Batman's state to "Away" with the subtype "In the batcave" with the message, "Making a new batch of batarangs".
Example2:Â Building on example1, now set Batman's state to "Extended Away" (xa) with no subtype while maintaining the message "Making a new batch of batarangs"
Example3:Â Setting the state as available without providing a subtype or message string. This will clear any previous message strings.
Example4:Â Set complex subtype and message strings using base64 encoding.
PRESENCE_STATE Read Examples
SUBTYPE
MESSAGE
BASE64_SUBTYPE
BASE64_MESSAGE
AMI Examples
Example1:Â Setting both the user state and message using SetVar action in conjunction with PRESENCE_STATE() dialplan function.
Example2:Â Setting state information that must be base64 encoded because it contains newlines and/or commas.
Example3:Â Reading user state and message using GetVar action.
Example4:Â Reading subtype and message fields as base64 values.
User Presence in DPMA
DPMA does all of the user presence manipulation of the CustomPresence providers behind the scenes. Phones subscribe to a set of user extensions to receive both device state and user presence updates. DPMA is in change of defining the hints the phones subscribe to, and mapping those hints to the correct device state and presence state providers. When a phone user updates their user presence, DPMA internally updates that user's CustomPresence provider to reflect the change using the PRESENCE_STATE() dialplan function. This results in any watcher of the hint mapped to that CustomPresence provider receiving an update indicating the new user presence.
DPMA Read Status Diaplan Example
In this example, the User Presence of device 100 is evaluated for the dnd and the xa (Extended Away) status. In the event that either of those statuses is true, the dialplan will route to the "dnd" label. In the even that both are false, the dialplan will route to the "notdnd" label.
Â