IVR creation using CLI

Hi
I’m searching a way to create and test an IVR using asterisk CLI.
Is someone can explain or can give me a way to create and test an IVR using CLI ?
Thanks

As Tom already said. It seems like you’d be better off with simple Asterisk…

… Or tell us what you are trying to accomplish - not what are trying to build or setup.

Example: I want callers to reach the PBX, pull the caller info from a database, present the caller with custom IVR options based on the data from the DB.

We are developping an Android application wich will be able to communicate with freepbx so
I want :
-callers to reach the PBX trough an UMTS/GSM Module and call a user trhough freepbx server (this is OK)
-creating an IVR using java script and also be able to pull the caller info from a database as you said (not OK)
This i what we are trying to build

http://www.jcgonzalez.com/asterisk-handle-calls-with-java-example

Thank you.We have tried this but it didn’t work but now I know what It didn’t work.
My last question is to know that is a freepbx extension able to call this fastgai server (one of this extension).
Thanks

Yes, if the extension or the treatment an extension is dialing is programmed to do so.

Okok thank you I tried it and I can call asterisk extension using freepbx extension
Sorry but I have one more question :
To be able to call my freepbx server I proceed like this : I have created an Inbound and Outbound route , on inbound route I have created a route with Any,Any an destination is freepbx extension
So on my phone If I dial for example 226 XX XX XX XX (UMTS/GSM number connected to freepbx) I reach my freepbx server this means that freepbx extension
Since now I want that when I call the UMTS router It points to my fastagi server.
How can I change the extension on my inbound route for this?

Thanks and sorry for the inconvenience

It is in the link I posted above for you. The extensions example.

You will not be able to do this in the GUI, you will need to use the extensions_override.conf file in /etc/asterisk if you would like to use the extension you have programmed in the GUI. The override file will override the behavior of the extension as it is programmed in the GUI. This is useful if you want to see the extension exists in the GUI, but need it to do something more custom.

It seems not to be working I explain you how I proceed I think I probably missed something
First in /etc/asterisk/extensions_override_freepbx.conf I added this lines to be able to use extension 1001
[1001]
exten => _.,1,Noop(Fixing DID using information from SIP TO header)
exten => _.,n,Set(pseudodid=${SIP_HEADER(To)})
exten => _.,n,Set(pseudodid=${CUT(pseudodid,@,1)})
exten => _.,n,Set(pseudodid=${CUT(pseudodid,:,2)})
exten => _.,n,Goto(from-trunk,${pseudodid},1)

In /etc/asterisk/sip_additionnal.conf I have created a new trunk

type=peer
context=1001
secret=1234
username=192.168.20.4
host=dynamic
fromdomain=192.168.20.4
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
insecure=port,invite
qualify=yes

I have also a trunk created using GUI I just want the extension to point to the fastAGI server created.
PS:When typing a fwconsole reload the trunk config disappears

Could you explain me what I have missed?
Thanks

I have also a trunk that I have created on the GUI which file in/etc/asterisk/sip_additional.conf seems like this :
[To_TE2000]
disallow=all
host=192.168.20.4
qualify=yes
allow=ulaw,alaw,gsm
type=peer
context=from-trunk-sip-To_TE2000

Is there just a possibilty to configure our fastagi server to work with this trunk using the 1001 extension?

FreePBX controls sip_additional.conf. To add something you need to add it in the GUI, which it sounds like you figured out.

Did you make an inbound route and point it as extension 1001?

  • Call comes in to FreePBX
  • Inbound route to extension 1001
  • The override script for 1001 points to your AGI action

Where is the AGI call in your dialplan?

[root@lorne14-pro ~]# head /etc/asterisk/sip_additional.conf
;--------------------------------------------------------------------------------;
;          Do NOT edit this file as it is auto-generated by FreePBX.             ;
;--------------------------------------------------------------------------------;
; For information on adding additional paramaters to this file, please visit the ;
; FreePBX.org wiki page, or ask on IRC. This file was created by the new FreePBX ;
; BMO - Big Module Object. Any similarity in naming with BMO from Adventure Time ;
; is totally deliberate.                                                         ;
;--------------------------------------------------------------------------------;
2 Likes

Yes I have made an inbound round and pointed it as extension 1001
It’s seems like my colleague configured the AGI settings on extensions.conf like this: (he uses his laptop to execute the java code and to run the script).

exten => 999,1,Agi(agi://localhost/hello2.agi)
exten => 999,n,Verbose(2,The channel name is ${MYVAR})
exten => 999,n,Playback(thank-you-cooperation)
exten => 999,n,Hangup()
exten => h,1,Verbose(2,Hang-> The channel name is ${MYVAR})
exten => t,1,Verbose(2,timeout t)
exten => T,1,Verbose(2,timeout T)
exten => i,1,Verbose(2,timeout T)

I see the agi call, but it is for extension 999. 1001/2 wouldn’t execute dialplan for 999.

I tried to change 999 to 1001 but when I make a call using my phone(the extension is configured to work with one SIM in the GSM module) I got this error , samething when I use a freepbx extension :
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/To_TE2000-0000000b”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] ExecIf(“SIP/To_TE2000-0000000b”, “0?Set(CDR(recordingfile)=)”) in new stack
– Executing [s@macro-hangupcall:4] NoOp(“SIP/To_TE2000-0000000b”, " montior file= ") in new stack
– Executing [s@macro-hangupcall:5] GotoIf(“SIP/To_TE2000-0000000b”, “1?skipagi”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] Hangup(“SIP/To_TE2000-0000000b”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 7) exited non-zero on ‘SIP/To_TE2000-0000000b’ in macro ‘hangupcall’
== Spawn extension (ext-local, h, 1) exited non-zero on ‘SIP/To_TE2000-0000000b’
– SIP/To_TE2000-0000000b Internal Gosub(crm-hangup,s,1) start
– Executing [s@crm-hangup:1] NoOp(“SIP/To_TE2000-0000000b”, “Sending Hangup to CRM”) in new stack
– Executing [s@crm-hangup:2] NoOp(“SIP/To_TE2000-0000000b”, “HANGUP CAUSE: 34”) in new stack
– Executing [s@crm-hangup:3] ExecIf(“SIP/To_TE2000-0000000b”, “0?Set(__CRM_VOICEMAIL=)”) in new stack
– Executing [s@crm-hangup:4] NoOp(“SIP/To_TE2000-0000000b”, “MASTER CHANNEL: 1575906984.11 = 1575906984.11”) in new stack
– Executing [s@crm-hangup:5] GotoIf(“SIP/To_TE2000-0000000b”, “0?return”) in new stack
– Executing [s@crm-hangup:6] Set(“SIP/To_TE2000-0000000b”, “__CRM_HANGUP=1”) in new stack
– Executing [s@crm-hangup:7] AGI(“SIP/To_TE2000-0000000b”, “sangomacrm.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
– <SIP/To_TE2000-0000000b>AGI Script sangomacrm.agi completed, returning 0
– Executing [s@crm-hangup:8] Return(“SIP/To_TE2000-0000000b”, “”) in new stack
== Spawn extension (ext-local, h, 1) exited non-zero on ‘SIP/To_TE2000-0000000b’
– SIP/To_TE2000-0000000b Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=

extensions.conf

exten => 1001,1,Agi(agi://localhost/hello2.agi)
exten => 1001,n,Verbose(2,The channel name is ${MYVAR})
exten => 1001,n,Playback(thank-you-cooperation)
exten => 1001,n,Hangup()
exten => h,1,Verbose(2,Hang-> The channel name is ${MYVAR})
exten => t,1,Verbose(2,timeout t)
exten => T,1,Verbose(2,timeout T)
exten => i,1,Verbose(2,timeout T)

[root@lorne14-pro ~]# head /etc/asterisk/extensions.conf
;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to ;
; this file must be done via the web gui. There are alternative files to make    ;
; custom modifications.                                                          ;
;--------------------------------------------------------------------------------;

So in what file can I write my AGI script?

/etc/asterisk/extensions_override_freepbx.conf ?

Ohhh I understand now
Thank you

We have tried to create the AGI scrip on /asterisk/extensions_override_freepbx.conf like this :

[general]
static=yes
writeprotect=no

[default]
exten => 2020,1,Answer()
exten => 2020,n,Dial(SIP/2020,20,tr)
exten => 2020,n,Hangup

exten => 2150,1,Playback(thank-you-cooperation)
exten => 2150,n,Hangup()

exten => 2150,1,Agi(agi://192.168.20.3/hello.agi)
exten => 2150,1,Agi(agi://192.168.20.3/hello2.agi)

exten => 2150,n,Verbose(2,The channel name is ${MYVAR})
exten => 2150,n,Playback(thank-you-cooperation)
exten => 2150,n,Hangup()
exten => h,1,Verbose(2,Hang-> The channel name is ${MYVAR})
exten => t,1,Verbose(2,timeout t)
exten => T,1,Verbose(2,timeout T)
exten => i,1,Verbose(2,timeout T)

But when performing a call we got this errors goff1 goff2