Recalling the phone which opened the Dialplan

Hello, I started using Asterisk 1 week ago, I was reading a lot and until now but I wasn’t finding anything that would help me, to make a Dialplan which later calls the User/phone back and then continues in the new call and not how it works right now for me that it calls me and then hangs up again.

i started setting a small server up, because the Headadmin, is a older Telephone expert and i am more programming etc., and he wanted a small Server to check in several ways if the connections are working, how good they are etc.

if someone wants some code:

exten => 111,1,Answer(100)
exten => 111,n,Playback(beep)
exten => 111,n,Playback(/usr/share/asterisk/sounds/custom/Signal)
exten => 111,n,wait(1)
exten => 111,n,Playback(/usr/share/asterisk/sounds/custom/willkommen_final)
exten => 111,n,Playback(beep)
exten => 111,n,WaitExten(3)
exten => 111,n,Goto(111,1)
exten => 1,1,Noop(user pressed 1)
exten => 1,n,Playback(beep)
exten => 1,n,While(n<10)
exten => 1,n,Playback(/usr/share/asterisk/sounds/custom/MIKESINGER-ESWIRDZEIT_G711.org_)
exten => 1,n,EndWhile()
exten => 1,n,Playback(/usr/share/asterisk/sounds/custom/bye)
exten => 1,n,Hangup()
exten => 2,1,Noop(user pressed 2)
exten => 2,n,Playback(beep)
exten => 2,n,Playback(/usr/share/asterisk/sounds/custom/hinweis)
exten => 2,n,Echo()
exten => 2,n,Playback(/usr/share/asterisk/sounds/custom/bye)
exten => 2,n,Hangup()
exten => 3,1,Noop(user pressed 3)
exten => 3,n,System(echo “Channel: SIP/${CALLERID(num)} \nCallerID: “Klingeltest” <789> \nContext: klingeltest \nExtension: 24 \nMaxRetries: 1 \nRetryTime: 9” > /tmp/${UNIQUEID}.call)
exten => 3,n,Playback(beep)

exten => h,1,System(touch -t 200001010101 /tmp/${UNIQUEID}.call)
exten => h,n,System(sleep 5)
exten => h,n,System(mv /tmp/${UNIQUEID}.call /var/spool/asterisk/outgoing/)

exten => h,n,Wait(3)
exten => h,n,Playback(/usr/share/asterisk/sounds/custom/klingeltest-erfolgreich)
exten => h,n,Playback(/usr/share/asterisk/sounds/custom/bye)
exten => h,n,Hangup

You might want to look at the Originate() application and redo your entire set of hangup (h) handlers. Another context should be handling the Playback() instead.

right now it works better but i still have the problem, that whatever i do the call is made without hanging the old call up which is not suitable for really old phones

any ideas?

exten => 111,1,Answer(100)
exten => 111,n,Playback(beep)
exten => 111,n,Playback(/usr/share/asterisk/sounds/custom/Signal)
exten => 111,n,wait(1)
exten => 111,n,Playback(/usr/share/asterisk/sounds/custom/willkommen_final)
exten => 111,n,Playback(beep)
exten => 111,n,WaitExten(3)
exten => 111,n,Goto(111,1)

exten => 1,1,Noop(user pressed 1)
exten => 1,n,Playback(beep)
exten => 1,n,While(n<10)
exten => 1,n,Playback(/usr/share/asterisk/sounds/custom/MIKESINGER-ESWIRDZEIT_G711.org_)
exten => 1,n,EndWhile()
exten => 1,n,Playback(/usr/share/asterisk/sounds/custom/bye)
exten => 1,n,Hangup()

exten => 2,1,Noop(user pressed 2)
exten => 2,n,Playback(beep)
exten => 2,n,Playback(/usr/share/asterisk/sounds/custom/hinweis)
exten => 2,n,Echo()
exten => 2,n,Playback(/usr/share/asterisk/sounds/custom/bye)
exten => 2,n,Hangup()

exten => 3,1,Noop(user pressed 3)
exten => 3,n,Playback(beep)
exten => 3,n,Noop()
exten => 3,n,Hangup()

exten => h,1,originate(SIP/${CALLERID(num)},exten,ringtest,test,1)
exten => h,n,Hangup()

[ringtest]
exten => test,1,Answer()
exten => test,n,Playback(/usr/share/asterisk/sounds/custom/klingeltest-erfolgreich)
exten => test,n,Playback(/usr/share/asterisk/sounds/custom/bye)
exten => test,n,Hangup()

and because he should just call if the 3 is selected i changed 3 now to this:

exten => 3,1,Noop(user pressed 3)
exten => 3,n,Playback(beep)
exten => 3,n,Noop()
exten => 3,n,originate(SIP/${CALLERID(num)},exten,ringtest,test,1)
exten => 3,n,Hangup()

You might want to take a look at the ‘a’ option to Originate for asynchronous operation. This is available on newer versions of Asterisk (18+ IIRC).

Separate issue (below) is an infinite loop – take a look at INC function to increment the value of n:

a big thank you
it works now as intended

and yeah the loop was just a test for me to see if it would use the n of the extension

Do you know any way to add a function to end a playback from the phone just like # for the Echotest
or another application being able to play a specified audio and then has this choose to quit and not hanging up function?

I suggest opening a new topic for those new questions.

You could probably do this with Background. Used simply, it will cause the dialplan to start trying to read and goto a new extension, but I suspect, if you run it through TryExec, you might be able to inhibit that behaviour.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.