Asterisk Call from File

i want to use the call from file system.

the file.call looks like this:

;------------------------------------

Channel: Dongle/dongle0/07xxxxxxxx

MaxRetries: 2

RetryTime: 60

WaitTime: 30

Context: testing

Extension: 07xxxxxxxx

CallerID: 07xxxxxxxy

Priority: 1

;------------------------------------

extension.cof like this:

;--------------------------------------------------------------------------

[testing]

exten => s,1,Answer()

exten => s,n(lbl_testing_0),Set(TIMEOUT(response)=10)

exten => s,n,Set(TIMEOUT(digit)=1)

exten => s,n,Background(custom/nice_sound)

exten => s,n,WaitExten(10,m())

exten => s,n,Hangup()

exten => 1,1,SayDigits(1)

exten => 1,n,Playback(tts/sound1)

;exten => 1,n,System(/bin/echo "peresed key 1 and save in txt and mysql after" >> /var/spool/asterisk/key1.txt)

exten => 1,n,MYSQL(Connect connid 127.0.0.1 asterisk password asterisk)

exten => 1,n,MYSQL(Query resultid ${connid} INSERT INTO `keys` (`key`,`number`,`date`) VALUES (${EXTEN},${CALLERID(num)},now()))

exten => 1,n,MYSQL(Disconnect ${connid})

exten => 1,n(lbl_testing_1),Hangup()

exten => 2,1,SayDigits(3)

exten => 2,n,Playback(tts/sound2)

exten => 2,n,Goto(1,lbl_testing_1)

exten => 3,1,SayDigits(3)

exten => 3,n,Playback(tts/sound3)

exten => 3,n,Goto(1,lbl_testing_1)

exten => 4,1,Playback(tts/sound4)

exten => 4,n,Goto(s,lbl_testing_0)

exten => i,1,Playback(invalidValue)

exten => i,n,Goto(s,lbl_testing_0)

exten => t,1,Playback(timeout)

exten => t,n,Goto(s,lbl_testing_0)

exten => 111,1,Dial(PJSIP/111)

exten => 111,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?lbl_testing_3:)

exten => 111,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?lbl_testing_3:)

exten => 111,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?lbl_testing_3:)

exten => 111,n(lbl_testing_2),Hangup()

exten => 111,n(lbl_testing_3),VoiceMail(testing@111,s)

exten => 111,n,Goto(lbl_testing_2)

;--------------------------------------------------------------------------

Somehow it works.

The question is: how do i put this dialplan only in the file.call and no longer use [testing] from extension.conf and all the settings to make it in that file.call that i automatically move to /var/spool/asterisk/outgoing

I tried like this:

;------------------------------------

Channel: Dongle/dongle0/07xxxxxxxx

MaxRetries: 2

RetryTime: 60

WaitTime: 30

Extension: 07xxxxxxxx

CallerID: 07xxxxxxxy

Application: Playback

Data: custom/nice_sound

;------------------------------------

but i can't find how to add the rest of the dialplan settings and save in mysql

does anyone know how? is it possible to work like this or i'm too dreamy?

thank you very much!

1 Answer

Call files designed to make call request. It not intended to use as dialplan replacement.

There is no way to put complex dialplan in callfile.

Only things you can do is set some variables via Set: construction and use CDR for mysql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest