Multiple DISA (different contexts) from IVR

Hi,

I’m running on FreePBX 15.0.16.75 and i would like to have one entry of my IVR to execute the DISA command, but i have multiple DISA entries because each is tied to a different custom context.

The idea is that if the user dials in and uses code 1234 the context “custom-context-1234” will be used but if instead the user uses code 5678 then another context would be used.

I had this setup previously by using a password file where each code was bound to a different context.

While trying to implement this from the UI now i see that the IVR will force me to select the specific DISA code so it i won’t be able to use any of my other DISA configurarations unless i use a different code in the IVR.

I would really like to move away from using custom files and scripts.

Any ideas?

Thanks

Nope - i honestly don’t see a way to do that without custom code.

You alternative would be to submit a feature request and ask that the code you are currently using be added to the default system. This, of course, means that you need to supply a ‘camera ready’ version of the code you want to use, including management pages, etc. If, on the other hand, you just send in the idea, you’re likely to see your suggestion come back as a commercial module, and a pricey one (my guess) because the application space for the idea is so tight.

FreePBX is “mostly” open source, and this is how many of the features we see every day were added. Someone’s going to have to do the work…

If you had five DISA, could you not make one IVR. Each IVR option is your “password” for each DISA.
IVR-1
Option 1234 -> DISA 1234
Option 5678 -> DISA 5678

You do not need a password for the DISA, since the password is the IVR prompt.

Is that hat you are trying to do?

In reality, my feature request would be simple: just allow the IVR destination to go into DISA without any direct specification of which code to use, the input from the user should match the code of the DISA which in turn would match the context and rest of the options to use.

Hi, i was able to accomplish this and i figured to share it just in case somebody else has a similar need.

Step #1: Create Custom Destination, set the target to macro-dial-in,1,1

Step #2: Use the Config Edit to create a new file with your passcodes and contexts. Ours is “/etc/asterisk/disa_file.conf” with this sample content:

1234
5678
;1234|context1|
;5678|context2|

Step #3: Modify extensions_custom.conf and add this code:

[macro-dial-in]
exten => 1,1,Answer
exten => 1,n,Authenticate(/etc/asterisk/disa_file.conf,a,4) 
exten => 1,n,Set(passcode=${CDR(accountcode)})
exten => 1,n,Noop(Passcode Code: ${passcode})
exten => 1,n,Set(regex="(${passcode}(\|.*?))")
exten => 1,n,Set(filetext=${FILE(/etc/asterisk/disa_file.conf)})
exten => 1,n,Set(linetext=$["${filetext}" =~ ${regex}]) 
exten => 1,n,Set(contextname=${CUT(linetext,|,2)})
exten => 1,n,Noop(Context Name: ${contextname})
exten => 1,n,Gosub(sub-record-check,s,1(disa,${EXTEN},dontcare))
exten => 1,n,Set(_DISA=disa^1^newcall)
exten => 1,n(newcall),Set(_DISACONTEXT=${contextname})
exten => 1,n,Set(_KEEPCID=TRUE)
exten => 1,n,Set(_HANGUP=${TRUNK_OPTIONS})
exten => 1,n,Set(TIMEOUT(digit)=5)
exten => 1,n,Set(TIMEOUT(response)=10)
exten => 1,n,DISA(no-password,disa-dial)
exten => 1,n(end),Hangup

This is how it works: Authenticate will match the entered passcode by the caller to a number in the file. If valid, this number will become the CDR(accountcode)

A regular expression is created to match the passcode + “|”

The same file that has the passcodes (etc/asterisk/disa_file.conf) is read completely, the bottom section has some comments that matches a passcode to a context (unfortunately you cannot have this as a comment on the same line as the passcode since Authenticate will try to match the input to each full line.

Then the regular expression is applied to the whole file to get the line that matches the passcode (which came from the account code) and the pipe (|) . CUT is used to strip the pipe which leaves the context we need.

The rest of the function is pretty much the standard DISA call from FreePBX, but we just change the context to our contextname variable.

Step #4: Create the Entry on your IVR for the Custom Destination created on Step #1

Enjoy and good luck!

Camilo

3 Likes

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