Feature Highlight: Asterisk Scripts

Within the Q-Suite we have our dialplan builder with extensive options to route and manipulate calls. The dialplan builder meets the needs of most situations but from time to time you need to get low level and go right into the asterisk dialplan. If it is only a couple of statements the dialplan builder has the Execute command, but when it’s more involved that’s where the Q-Suite’s Asterisk Scripts option comes in.

Using Asterisk Scripts requires knowledge of asterisk and how the Q-Suite interacts with it. Due to this, often the scripts are implemented as custom work completely or partially depending on the client’s knowledge of asterisk and the complexity of the requirements.

These scripts are often used with star codes, and we actually use them to provide common functions in the product by including a few as system wide defaults any tenant can use. However, in addition to using star codes to access the Asterisk Scripts, they can be entered from many points of the system including DIDs, Auto-Attendants, the Dialplan Builder, etc.

Let’s take a look at a couple examples. The first is one that is included by default for checking the voicemail of the current extension. It’s all straight asterisk dialplan statements with the only Q-Suite specifics being the pbx_exten_num and acc variables which are set on each extension as it dials.

;Check Voicemail:
exten => s,1,ExecIf($[“${pbx_exten_num}” == “”],Hangup)
exten => s,n,Voicemailmain(${pbx_exten_num}@ihostpbx-account-${acc}-voicemail,s)
exten => s,n,Hangup

The second and more a bit more complex example is to record an audiofile and insert it into the db for use elsewhere within the system. Just note this was built previously for a client on our 5.6 product line on asterisk 1.4, so it would not directly work in the current line without a few adjustments.

; Record AudioFile:
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n(rerecord),Playback(dictate/record&vm-message&and-prs-pound-whn-finished)
exten => s,n,Wait(1)
exten => s,n,Record(indo-tmp-rec-${pbx_exten_num}.wav)
exten => s,n,Wait(1)
exten => s,n(replay),Background(indo-tmp-rec-${pbx_exten_num})
exten => s,n,Background(silence/1&vm-review)
exten => s,n,WaitExten(10)
exten => s,n,Goto(replay)

; accept.
exten => 1,1,AGI(load_audiofile.agi|${acc}|indo-tmp-rec-${pbx_exten_num}.wav)
exten => 1,n,Playback(vm-msgsaved)
exten => 1,n,SayDigits(${LOADED_AUDIOFILE_ID})
exten => 1,n,Wait(2)
exten => 1,n,Hangup

; replay
exten => 2,1,Goto(s,replay)

; rerecord
exten => 3,1,Goto(s,rerecord)

; invalid
exten => i,1,Goto(s,replay)

In this example it prompts the caller to record a message, plays it back to review it, then give the option to save, review again, or re-record. Similar to the first example we use some Q-Suite specific variables and also an AGI to save the audiofile into the database. Due to the AGI this is not something a client would solely do, so it would either all be custom work or just the AGI would be depending on the needs and experience of the client.

As you can see the Asterisk Scripts feature of the Q-Suite gives powerful direct access to asterisk’s dialplan. Leveraging these along side the numerous other features within Q-Suite allows for solutions to the variety of use cases brought to us by clients across the globe.

One Reply to “Feature Highlight: Asterisk Scripts”

Comments are closed.