Send To, Transfer To and Dial Voicemail
Digium phones, when configured, have specific "to Voicemail" functionality that appears on a dedicated softkey during incoming calls.
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.
On an incoming call, Digium 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."
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.
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:
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:
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.