Return to MENU while in a call

Can someone point me to an example dialplan where I can have users retun to a menu while a call is established?

exten SIP/200 dials exten SIP/210
call established
exten 200 presses #100 and asterisk imediately hangs up on exten 210 and gets an ATA or someone at SIP/100.


In a first view you can do that with DeadAgi and some script. You can do this per example:


.... [test] exten => 1234,1,Swift(Felicidades tienes Cepstral PIRATA!) exten => 1234,2,Swift(Este texto es demasiado largo para su lectura) ...... ......... exten => 4321,1,answer() exten => 4321,2,VoiceChanger(-5.0) exten => 4321,3,parrot() exten => 4321,4,hangup() exten => 4321,5,stopvoicechanger() exten => h,1,DeadAgi(dial.agi) ......



/usr/sbin/asterisk -rx “originate sip/yourexten extension 1234@default”[/code]

With this code every hangupcall within context test will execute the script dial.agi, and the script dial to your extension defined and answer with some prompt with Swift application.

Here the problem is that every hangup call will do that…

This way, the script would only be called on ext 1234, thus not hanging up on everyone.

BUt I will have to try it. Looking for a cleaner solution though. Like if I press # now, that will allow me to transfer a call, so I know that any connected call is listening for a #. I need something like that but to direct it to another extension.

Basically Im running a system() command with a perl script depending on what # is dialed so that my Asterisk - teamspeak connection can change channells on the teamspeak server.

exten => 1234,1,goto(test2,s,1)

[test2] ;(not included in default dialplan)
exten => s,1,answer()
exten => s,2,VoiceChanger(-5.0)
exten => s,3,parrot()
exten => s,4,hangup()
exten => s,5,stopvoicechanger()
exten => h,1,DeadAgi(dial.agi)

And alas…AsteiskW32 doesnt appear to support the originate command

When you press # you can transfer because this feature is configured in /etc/asterisk/features.conf and you can configure a custom feauture. If Asteriskw32 has the feautures.conf you can read how enable custom features.


you have to use application maps that are defined in the features.conf file.

This then will let callers press a key and return


Yup, its in there… thank you for setting me on the right path. Ill see if I can make some sense of it.

Here is an example in how implement that:


[applicationmap] testfeature => *9,self,dial,sip/4110 testfeature2 => *3,self,Playback,tt-weasels


[internals] exten => _4XXX,1,Set(__DYNAMIC_FEATURES=testfeature#testfeature2) exten => _4XXX,2,dial(sip/${EXTEN})

output cli for feature *3:

Executing [4100@default:1] Set("SIP/4101-08d3ca08", "__DYNAMIC_FEATURES=testfeature#testfeature2") in new stack -- Executing [4100@default:2] Dial("SIP/4101-08d3ca08", "sip/4100") in new stack -- Called 4100 -- SIP/4100-08d3e030 is ringing -- SIP/4100-08d3e030 answered SIP/4101-08d3ca08 -- <SIP/4100-08d3e030> Playing 'tt-weasels' (language 'es') -- <SIP/4101-08d3ca08> Playing 'tt-weasels' (language 'es')

This work on asterisk 1.4.26. I remember in asterisk 1.6.X need to define in GLOBAL context like this:

Ive been googling it, and your ex is helpful. AsteriskW32 is version It is beyond me why they havent updated it, but there we have it. I have run into a few things that are a bit different aleady in most ex I find, but am working it out.

I’ve got a dial plan for a bot I made that connects to TeamSpeak via a system() call to a perl script. in this way I can call my number and dial the bot’s extension and I connect to TeamSpeak via my cell or whatever. When I hang up the bot then logs off. Now all I really want to do is press a number to run a system() command which in turn runs another perl script that will change channels in teamspeak. I got everything woking, but just need to plug in the application map so that the caller can run the script.

Ill give it a go an report back

Thanks again!

Thanks for your help. I have got it working by using your example and this line in features.conf

txtbotaway => *1,caller,System,perl.exe …/usr/bin/tscommands/ ;change to the away channel

an in extensions.conf

exten => 3000,1,Set(DYNAMIC_FEATURES=txtbotaway)

I had to change a few default featues to make it compatible with my dial plan as well. At first I couldnt unerstand why the default test feature #9 to play tt-monkeys wasnt working. Well its because default # is transfer and so we never could get to #9. Maybe the example shoul of thought of that…oh well.

I also tried to set it up as a macro as well… in features.conf:

txtbotaway => *1,caller,Macro,TXTBOTAWAY

and in extensions.conf:

exten => s,1,System(perl.exe …/usr/bin/tscommands/
exten => i,1,Hangup
exten => t,1,Hangup
exten => h,1,System(perl.exe …/usr/bin/tscommands/
exten => h,2,Hangup

but when I run this the CLI makes this complaint:

macro 'TXTBOTAWAY lacks ‘s’ extension, priority 1

and nothing happens. Interesting because there is clearly an s, 1 priority

mmm appears the word “macro” is case sensitive, so change: [MACRO-TXTBOTAWAY] by [macro-TXTBOTAWAY], it should work.

YUP that did it. Case sensative. Everything is working great! Thanks for your help and example!