Callback to a certain extension

I have configured my asterisk to ring any incoming call to extension X. What So far, so good. However, I want to include a callback capability using DeadAGI scripts. The problem is the incoming call through a callback scripts will ring extension X and not the extension used to issue a callback function. For instance, if I try a callback function from extension Y, the incoming call by the callback action will ring extension X and not extension Y. So, does anyone know how to achieve this so that the incoming call by a callback action will ring the extension used by the callback function to place the callback call?

pass the ${EXTEN} value to your deadAGI.

like this

exten => s,1,answer
exten => s,n,set(dialback=${EXTEN}

exten => h,1,deadagi(youragi|${dialback})

[quote=“sethsdad0627”]pass the ${EXTEN} value to your deadAGI.[/quote]It doesn’t work. AFAIK, ${EXTEN} is a variable points to the dialed number. What I want is the incoming call, issued through a DeadAGI callback scripts, to ring the extension used to issue a callback function. For instance, if I pick up extension 3 and dial 1800551212. The DeadAGI dialplan scripts will intercept the dialed number (18005551212) and issues an IVR asking me to hang up the call. Once I hung up the call, I expect an incoming call to ring the extension I used to place the call to 18005551212. Currently, the incoming call will ring a certain extension which is x-th floor from extension 3 that was used to placed a call to 18005551212.

Okay. What you need is a live AGI to poll for “dn” (Dialing Number) and pass that back to the dialplan so you can use it for the DeadAGI.

Here’s a quick and dirty perl program
#!/usr/local/bin/perl
use Asterisk::AGI;

the AGI object

my $agi = new Asterisk::AGI;
my %input = $agi->ReadParse();
my $channel = $input{dnid};
print STDOUT "SET VARIABLE CALLCHAN “$channel” ";
exit;

Is there a way to do what you suggested above without using Perl? My asterisk-1.6.1.0 is hosted on a LaFonera FON2100 WiFi router with a limited Flash space.

you should be able to use ${CALLERID(dnid)}, but I haven’t tried that.

I tried that and it gave me back the number I dialed. What I want is the extension number so that I can assign the extension number to the incoming call.

Don’t worry. I believe ${MACRO_EXTEN} is what I have been looking for. It is on pg. 404 of Asterisk: The Future of Telephony, 2nd Ed. ebook. Of course, I am open to any other suggestions. Thank you.

Try CALLERID(num). This should be loaded with the number of the extension you are calling from.

Thank you and this does the exact job I am after.