Extension variable


#1

Hello,

I’m looking for a way to consolidate separate locations into the same voice menu and when it finishes or they hit 0, it will direct the call based on the number that the caller originally dialed. I know this can be done within a macro using the ${MACRO_EXTEN} variable, but is there any variable available that will tell me the original number dialed by the caller?

For instance,

Someone dials my number, 222-222-2222 which transfers to another extension. Is there anyway to recall the dialed number (2222222222) with a variable? I’ using a GotoIf based on the original dialed number to further divert the call.

[incoming]
exten => 2222222222,1,Goto(voicemenu,s,1)

[voicemenu]
exten => s,1,Background(/etc/asterisk/sound/x1)
exten => s,n,Background(/etc/asterisk/sound/x2)
exten => s,n,Background(/etc/asterisk/sound/x3)
exten => s,n,GotoIf($["${???}" = “2222222222”]?xx1,s,1)
exten => s,n,GotoIf($["${???}" = “2222222223”]?xx2,s,1)
exten => 0,1,GotoIf($["${???}" = “2222222222”]?xx1,s,1)

I appreciate any help on the matter. I know a way to do it by setting database variables, but it seems like a messy way to implement it.

Thanks,
Nathan

–EDIT–

I guess I didn’t dig hard enough… Gosub works wonders!