Sangoma Phones and Voicemail Functions
Send To, Transfer To and Dial Voicemail
Sangoma phones, when configured, have specific "to Voicemail" functionality that appears on a dedicated softkey during incoming calls.
Versions of firmware prior to 1.4 had voicemail dialing and transferring capability mapped to a special softkey inside the contacts application, as controlled by the "has_voicemail" contacts option. This option has been replaced by dedicated <action> definitions as documented on the Smart BLF page and its examples.
For DPMA, this functionality is controlled by the "send_to_vm" phone configuration option in res_digium_phone.conf. This option is enabled by default by DPMA. It is disabled by default for phones provisioned manually. To enable manually-provisioned phones to use this functionality, the send_to_vmail keymap must be enabled. Further, the Send and Transfer capability require the use of Asterisk 11 or greater - or "-digiumphones" branches of older versions - due to the DIVERSION header support requirement.
Incoming Calls
On an incoming call, Sangoma phones present four softkeys to the user:
Answer - which causes the phone to answer the incoming call
Ignore - which causes the phone to send a 603 REJECT back to Asterisk
Transfer - which allows the callee to transfer the caller to a different extension
Send VM - which allows the callee to transfer the caller directly to the callee's voicemail box.
When the Send VM softkey is pressed, the phone sends a DIVERSION header to Asterisk that contains a REDIRECTING reason "send_to_vm."
Dialplan example
The following presents a dialplan example of using the DIVERSION header and the X-Digium-Call-Feature header to handle Send to VM, Transfer to VM, and Direct VM dial.
Example: Example dialplan for Send To, Transfer To, and Dial Voicemail
exten => 301,1,NoOp() same => n,GotoIf($["${REDIRECTING(reason)}" = "send_to_vm" | "${PJSIP_HEADER(read,X-Digium-Call-Feature)}" = "feature_send_to_vm"]?vm:notvm) same => n(vm),Voicemail(301) same => n,Hangup() same => n(notvm),Dial(PJSIP/301,20) same => n,Dial(PJSIP/301home,20) same => n,Voicemail(301)
The first step in this example performs no operation.
The second step in this example performs a GotoIf. If true, it jumps to the "vm" priority label. If false, it jumps to the "notvm" priority label. Two cases are evaluated. The first case:
${REDIRECTING(reason)}" = "send_to_vm"
checks for the presence of the "send_to_vm" DIVERSION header. This occurs when the phone user performs a Send To or a Transfer to Voicemail. The second case:
${PJSIP_HEADER(read,X-Digium-Call-Feature)}" = "feature_send_to_vm"
checks for the presence of the "feature_send_to_vm" X-Digium-Call-Feature header. This occurs when the phone user directly dials a contact's voicemail from the Contacts application.
If either case is true, meaning that the phone user wanted to either Send To, Transfer To, or directly dial another user's voicemail box, then the dialplan will jump to the "vm" priority. If both cases are false, the dialplan will jump to the "notvm" priority.
The third step is the "vm" priority label. It calls voicemail box 301.
The fourth step follows the vm priority label. If the vm priority label is reached, because the call was supposed to go to a destination, and we've completed the voicemail application from the third step, this step explicitly hangs up the call - not normally necessary, but included for the sake of completion.
The fifth step is the "notvm" priority label. It calls SIP peer 301.
The sixth step in this example, the Dialing of PJSIP endpoint 301home, will be reached if the callee, on an incoming call, presses the "Ignore" softkey. In that case, the caller has called extension 301 without a DIVERSION or X-Digium-Call-Feature header, so the dialplan has proceeded to Dial PJSIP endpoint 301. Asterisk receives a 603 REJECT when the callee presses the Ignore softkey. Asterisk then continues in the dialplan to the next step, which in this case is dialing a different PJSIP endpoint, 301home.
The seventh step calls the voicemail application, but only after the call has also completed the sixth step of dialing PJSIP endpoint 301home.