Sunday, January 7, 2007

Follow-Me using Asterisk

follow me script to allow Asterisk to ring from your desk phone to a cell phone then back to voicemail. If you are not available to answer the cell phone (or choose not to) it will ring back to Asterisk voicemail.
exten => 1234,1,dial(sip/1234,20)
exten => 1234,2,playback(pls-wait-connect-call)
exten => 1234,3,Setvar(NewCaller=${CALLERIDNUM})
exten => 1234,4,SetCIDNum(0${CALLERIDNUM})
exten => 1234,5,dial(${TRUNK}c/9871234321,20,r)
exten => 1234,6,SetCIDNum(${NewCaller})
exten => 1234,7,voicemail2(u1234@default)
exten => 1234,101,voicemail2(b1234@default)
exten => 1234,102,hangup


Explanations:
exten => 1234,1,dial(sip/1234,20)

* Present the caller with a transfer message to let them know that the system is doing something.

exten => 1234,2,playback(pls-wait-connect-call)

* Set a new variable with the current caller id information

exten => 1234,3,Setvar(NewCaller=${CALLERIDNUM})

* Place a 0 before the caller id number to let the called party know that this is coming as a transfer from the desk phone.

exten => 1234,4,SetCIDNum(0${CALLERIDNUM})

* Dial the cell phone 987-123-4321. Display a ring to the caller until # is pressed on the cell phone.

exten => 1234,5,dial(${TRUNK}c/9871234321,20,r)

* If the called party chooses to not accept the call change the callerid information back.

exten => 1234,6,SetCIDNum(${NewCaller})

* Place the caller into voicemail.

exten => 1234,7,voicemail2(u1245@default)

* If the called party is on the phone just go to voicemail (this may be out of step??).

exten => 1234,101,voicemail2(b1234@default)

exten => 1234,102,hangup

  1. The c after the TRUNK command is what causes the connection to wait until the # key is pressed to complete the call.
  2. You can use something other than ,r which causes the caller to hear ringing while the call is being placed to the cell phone. Using ,m as an option will play music on hold until someone answers.

No comments: