Asterisk tips call last caller

It often happens that someone is trying to call me but I'm just not available at that moment.. busy in the kitchen or in the bathroom, or whatever..
What I do then usualy is sit at my Computer, look up who has called and call them back.

Okay, with * there is an easier way to do that.
Just add the following to your extensions.conf in the outgoing part:

exten => 1111,1,DBget(number=lastcaller/number)
exten => 1111,2,Answer
exten => 1111,3,SayDigits(${number})
exten => 1111,4,Dial(Capi/XXXXXX:${number})
exten => 1111,5,Hangup



and add this line to your standard incoming extension:

exten => XXXXXX,1,DBput(lastcaller/number=${CALLERIDNUM})


Now when someone calls, their number is stored in asterisks database and you can just dial "1111" to have asterisk read the number to you and then dial it.


1.2 Syntax - Per-extension last caller

    • Added by peakinet on 06/26/05**

The below is another example of how to do this system-wide so that only the person that was called will get their last caller (not the system's last caller). It will also take into account if you did not receive any Caller ID information on the last call, and will offer to automatically connect the user to the last caller by pressing 1. Still needs some work, but I thought I would post it anyway. It works for us.

[app-lastcallreturn]
exten => s,1,Wait,1
exten => s,2,Answer
exten => s,3,Playback(last-num-to-call)
exten => s,4,DBget(number=LCR/${CALLERIDNUM}/lastcall)
exten => s,5,GotoIf($["${number}" = ""]?s-nonum,1)
exten => s,6,SayDigits(${number})
exten => s,7,Wait,.5
exten => s,8,SayDigits(${number})
exten => s,9,Wait,1
exten => s,10,Playback(to-call-num-press)
exten => s,11,Playback(digits/1)
exten => 1,1,Goto(outbound,${number},1)
exten => s-nonum,1,Playback(unidentified-no-callback)
exten => s-nonum,2,Hangup


Obviously you'll need to call it in your outbound context with whatever digits you wish to use to access the application. We use *69 just like the telco standard.

In the example when the caller presses 1 to be connected to the last caller it will send their number to the context "outbound" - change this to suit your needs. Just make sure it's setup so that if your caller ID is only 10-digits it will still process it. Or maybe send it to it's own context. Enjoy!

1.4 Syntax - Per-extension last caller

(Added by cricalix - 2008-01-09)

For 1.4.x, things change a bit (dial codes are for the UK to emulate BT). DBput/get go away, replaced with DB. CALLERIDNUM becomes CALLERID(num)

[last-caller-1471]
exten = 1471,1,Answer
exten = 1471,2,Playback(last-num-to-call)
exten = 1471,3,Set(number=${DB(lastcaller/${CALLERID(num)})}) ; Look up the last caller for this extension
exten = 1471,4,GotoIf($["${number}" = ""]?s-nonum,1:5) ; If $number is blank, jump to unidentified label
exten = 1471,n,Wait,.5
exten = 1471,n,SayDigits(${number})
exten = 1471,n,Wait,1
exten = 1471,n,Playback(weasels-eaten-phonesys)
exten = 1471,n,Hangup
exten = s-nonum,1,Playback(unidentified-no-callback)
exten = s-nonum,n,Playback(vm-goodbye)
exten = s-nonum,n,Hangup



You probably don't want weasels eating your phone system, and you might want to keep peakinet's callback functionality. Also, the VM goodbye isn't said in the same tone as the no-callback.

Then on the stdexten macro (or whatever one you use for directing incoming extension requests):

[macro-stdexten]
exten = s,1,Set(DB(lastcaller/${ARG1})=${CALLERID(num)})
exten = s,2,Dial(${ARG2},20)
exten = s,n,Goto(s-${DIALSTATUS},1)


It often happens that someone is trying to call me but I'm just not available at that moment.. busy in the kitchen or in the bathroom, or whatever..
What I do then usualy is sit at my Computer, look up who has called and call them back.

Okay, with * there is an easier way to do that.
Just add the following to your extensions.conf in the outgoing part:

exten => 1111,1,DBget(number=lastcaller/number)
exten => 1111,2,Answer
exten => 1111,3,SayDigits(${number})
exten => 1111,4,Dial(Capi/XXXXXX:${number})
exten => 1111,5,Hangup



and add this line to your standard incoming extension:

exten => XXXXXX,1,DBput(lastcaller/number=${CALLERIDNUM})


Now when someone calls, their number is stored in asterisks database and you can just dial "1111" to have asterisk read the number to you and then dial it.


1.2 Syntax - Per-extension last caller

    • Added by peakinet on 06/26/05**

The below is another example of how to do this system-wide so that only the person that was called will get their last caller (not the system's last caller). It will also take into account if you did not receive any Caller ID information on the last call, and will offer to automatically connect the user to the last caller by pressing 1. Still needs some work, but I thought I would post it anyway. It works for us.

[app-lastcallreturn]
exten => s,1,Wait,1
exten => s,2,Answer
exten => s,3,Playback(last-num-to-call)
exten => s,4,DBget(number=LCR/${CALLERIDNUM}/lastcall)
exten => s,5,GotoIf($["${number}" = ""]?s-nonum,1)
exten => s,6,SayDigits(${number})
exten => s,7,Wait,.5
exten => s,8,SayDigits(${number})
exten => s,9,Wait,1
exten => s,10,Playback(to-call-num-press)
exten => s,11,Playback(digits/1)
exten => 1,1,Goto(outbound,${number},1)
exten => s-nonum,1,Playback(unidentified-no-callback)
exten => s-nonum,2,Hangup


Obviously you'll need to call it in your outbound context with whatever digits you wish to use to access the application. We use *69 just like the telco standard.

In the example when the caller presses 1 to be connected to the last caller it will send their number to the context "outbound" - change this to suit your needs. Just make sure it's setup so that if your caller ID is only 10-digits it will still process it. Or maybe send it to it's own context. Enjoy!

1.4 Syntax - Per-extension last caller

(Added by cricalix - 2008-01-09)

For 1.4.x, things change a bit (dial codes are for the UK to emulate BT). DBput/get go away, replaced with DB. CALLERIDNUM becomes CALLERID(num)

[last-caller-1471]
exten = 1471,1,Answer
exten = 1471,2,Playback(last-num-to-call)
exten = 1471,3,Set(number=${DB(lastcaller/${CALLERID(num)})}) ; Look up the last caller for this extension
exten = 1471,4,GotoIf($["${number}" = ""]?s-nonum,1:5) ; If $number is blank, jump to unidentified label
exten = 1471,n,Wait,.5
exten = 1471,n,SayDigits(${number})
exten = 1471,n,Wait,1
exten = 1471,n,Playback(weasels-eaten-phonesys)
exten = 1471,n,Hangup
exten = s-nonum,1,Playback(unidentified-no-callback)
exten = s-nonum,n,Playback(vm-goodbye)
exten = s-nonum,n,Hangup



You probably don't want weasels eating your phone system, and you might want to keep peakinet's callback functionality. Also, the VM goodbye isn't said in the same tone as the no-callback.

Then on the stdexten macro (or whatever one you use for directing incoming extension requests):

[macro-stdexten]
exten = s,1,Set(DB(lastcaller/${ARG1})=${CALLERID(num)})
exten = s,2,Dial(${ARG2},20)
exten = s,n,Goto(s-${DIALSTATUS},1)


Created by: taggy, Last modification: Mon 14 of May, 2012 (21:29 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+