
Askozia - Call Route Editor
As I wrote earlier , we have been using IP ASC Askozia based on Asterisk for about a year in our office.
Askozia is a commercial product, the price of which is equal to the cost of one IP phone.
Today I want to tell more about the call route editor, which is included in the extended version of Askozia.
The editor allows you to create an unlimited number of Asterisk dialplans using a simple visual designer. To build routes, more than 60 separate modules are used. Each module is translated into one or several Asterisk dialplan commands, and the route itself generates the necessary configuration files that are used by the telephone system core to process calls.
Each route is assigned a separate extension number, and the admin panel itself looks like this:

Let's take a closer look at a few typical templates and the code that they generate:

With an incoming call, the system picks up the phone, plays a greeting, which can be specified in a special unit or recorded immediately using the phone, after which it waits 5 seconds to dial the extension number. Further, depending on the specified number, a call is made to one or another subscriber. If you enter the wrong number, the block with the letter i will work, if you don’t dial anything within 5 seconds, then the t block will work. Accordingly, in the last two cases, the subscriber will hear a busy signal.
This call route creates the following Asterisk dialplan:

This unit allows you to receive more calls. If all agents are busy with the conversation, the subscriber is put on hold and waits until one of the agents is free and can handle the call, if within 600 seconds no agent was able to process the call, the subscriber will hear a busy signal.
This call route creates the following Asterisk dialplan:
Queue setup:

The example allows you to record all conversations with an internal number and send them to the e-mail specified in the settings of the sending module.
This call route creates the following Asterisk dialplan:

This diagram shows an example of call routing depending on the time of day and day of the week. For example, during business hours all calls go to the secretary, and after hours to voicemail.

In this route, a speech generation mechanism is used, which allows the subscriber to speak the phrases specified in the module settings. Unfortunately, only in English, therefore, for Russian-speaking subscribers, these blocks can be replaced by playing pre-recorded fragments of speech.
This call route creates the following Asterisk dialplan:
Agree that writing a call route using the constructor is much more convenient than simple coding, however, in most cases, you need to understand how Asterisk dialplans are written and work in order to build a more or less working call route.
More information about Askoizia can be found at http://www.askozia.ru. A
description of all modules is available at http://wiki.askozia.ru
Askozia is a commercial product, the price of which is equal to the cost of one IP phone.

The editor allows you to create an unlimited number of Asterisk dialplans using a simple visual designer. To build routes, more than 60 separate modules are used. Each module is translated into one or several Asterisk dialplan commands, and the route itself generates the necessary configuration files that are used by the telephone system core to process calls.
Each route is assigned a separate extension number, and the admin panel itself looks like this:

Let's take a closer look at a few typical templates and the code that they generate:
A simple example of a voice menu

With an incoming call, the system picks up the phone, plays a greeting, which can be specified in a special unit or recorded immediately using the phone, after which it waits 5 seconds to dial the extension number. Further, depending on the specified number, a call is made to one or another subscriber. If you enter the wrong number, the block with the letter i will work, if you don’t dial anything within 5 seconds, then the t block will work. Accordingly, in the last two cases, the subscriber will hear a busy signal.
This call route creates the following Asterisk dialplan:
Expand code
[CALLFLOW-1401202953509d662fafd39]
; Askozia call flow - CALLFLOW-1401202953509d662fafd39
exten => CALLFLOW-START,1(module-1),Answer(0)
exten => CALLFLOW-START,n(module-2),Background(/storage/usbdisk1/askoziapbx/media/sounds/cfe/cfe_uploaded_file_1358338827)
exten => CALLFLOW-START,n,WaitExten(5)
exten => 1,1(module-3),Goto(CALLFLOW-1401202953509d662fafd39-SUB-3,submodule,1)
exten => 2,1(module-4),Goto(CALLFLOW-1401202953509d662fafd39-SUB-4,submodule,1)
exten => i,1(module-5),Goto(CALLFLOW-1401202953509d662fafd39-SUB-5,submodule,1)
exten => t,1(module-12),Goto(CALLFLOW-1401202953509d662fafd39-SUB-12,submodule,1)
[CALLFLOW-1401202953509d662fafd39-SUB-3]
exten => submodule,1(module-6),Dial(SIP/101,10,go)
exten => submodule,n(module-9),Hangup()
[CALLFLOW-1401202953509d662fafd39-SUB-4]
exten => submodule,1(module-7),Dial(SIP/102,10,go)
exten => submodule,n(module-10),Hangup()
[CALLFLOW-1401202953509d662fafd39-SUB-5]
exten => submodule,1(module-8),Busy(3)
exten => submodule,n(module-11),Hangup()
[CALLFLOW-1401202953509d662fafd39-SUB-12]
exten => submodule,1(module-13),Busy(3)
exten => submodule,n(module-14),Hangup()
Example of a simple call queue with 3 static agents

This unit allows you to receive more calls. If all agents are busy with the conversation, the subscriber is put on hold and waits until one of the agents is free and can handle the call, if within 600 seconds no agent was able to process the call, the subscriber will hear a busy signal.
This call route creates the following Asterisk dialplan:
Expand code
[CALLFLOW-1401202953509d662fafd39]
; Askozia call flow - CALLFLOW-1401202953509d662fafd39
exten => CALLFLOW-START,1(module-1),Answer(0)
exten => CALLFLOW-START,n,QueueLog(CALLFLOW-1401202953509d662fafd39-QUEUE-2,${UNIQUEID},NONE,CALLERID,${CALLERID(all)},,${CUSTOM1},${CUSTOM2},${CUSTOM3})
exten => CALLFLOW-START,n(module-2),Queue(CALLFLOW-1401202953509d662fafd39-QUEUE-2,Ct,,,600)
exten => CALLFLOW-START,n,QueueLog(CALLFLOW-1401202953509d662fafd39-QUEUE-2,${UNIQUEID},NONE,QUEUETIMEOUT,${CDR(duration)},${CDR(billsec)})
exten => CALLFLOW-START,n(module-8),Busy(3)
exten => CALLFLOW-START,n(module-9),Hangup()
Queue setup:
Expand code
[CALLFLOW-1401202953509d662fafd39-QUEUE-2]
music = default
strategy=ringall
timeout=10
wrapuptime=30
ringinuse=yes
periodic-announce-frequency = 20
announce-holdtime=no
joinempty=no
leavewhenempty=no
member => SIP/101
member => SIP/102
member => SIP/103
Recording and sending a conversation by e-mail

The example allows you to record all conversations with an internal number and send them to the e-mail specified in the settings of the sending module.
This call route creates the following Asterisk dialplan:
Expand code
[CALLFLOW-1401202953509d662fafd39]
; Askozia call flow - CALLFLOW-1401202953509d662fafd39
exten => CALLFLOW-START,1(module-1),Answer(0)
exten => CALLFLOW-START,n(module-2),Monitor(wav,/tmp/monitor-${UNIQUEID},m)
exten => CALLFLOW-START,n(module-3),Dial(SIP/101,10,go)
exten => CALLFLOW-START,n(module-4),StopMonitor()
exten => CALLFLOW-START,n,System(sleep 1)
exten => CALLFLOW-START,n,Set(MONITOR_FILENAME=/tmp/monitor-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Date: \`date\`" > /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "To: rec@mail.ru" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Subject: AskoziaPBX Notification: Monitored call, Caller: ${CALLERID(all)}" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "From: AskoziaPBX call flow " >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "X-Mailer: AskoziaPBX" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Type: multipart/mixed\; boundary=\"EMAIL-44c364e83c7e7fd0bb50b238094a1780\"\n" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "--EMAIL-44c364e83c7e7fd0bb50b238094a1780" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Type: text/plain\; format=flowed\; charset=UTF-8" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Disposition: inline" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Transfer-Encoding: 8bit\n" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Your Records" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "--EMAIL-44c364e83c7e7fd0bb50b238094a1780" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Type: audio/x-wav\; name=\"monitor-${UNIQUEID}.wav\"" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Transfer-Encoding: base64" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "Content-Disposition: attachment\; filename=\"monitor-${UNIQUEID}.wav\"" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(uuencode -m /tmp/monitor-${UNIQUEID}.wav monitor-${UNIQUEID}.wav >> /tmp/email-attachment-${UNIQUEID})
exten => CALLFLOW-START,n,System(cat /tmp/email-attachment-${UNIQUEID} | tail +2 >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(echo "--EMAIL-44c364e83c7e7fd0bb50b238094a1780--" >> /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(/usr/bin/msmtp -C /etc/msmtp.conf -t < /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(rm -f /tmp/email-${UNIQUEID})
exten => CALLFLOW-START,n,System(rm -f /tmp/email-attachment-${UNIQUEID})
exten => CALLFLOW-START,n,System(rm -f /tmp/.monitor-${UNIQUEID}.wav)
exten => CALLFLOW-START,n(module-5),Hangup()
Scheduled Routing

This diagram shows an example of call routing depending on the time of day and day of the week. For example, during business hours all calls go to the secretary, and after hours to voicemail.

In this route, a speech generation mechanism is used, which allows the subscriber to speak the phrases specified in the module settings. Unfortunately, only in English, therefore, for Russian-speaking subscribers, these blocks can be replaced by playing pre-recorded fragments of speech.
This call route creates the following Asterisk dialplan:
Expand code
[CALLFLOW-1401202953509d662fafd39]
; Askozia call flow - CALLFLOW-1401202953509d662fafd39
exten => CALLFLOW-START,1(module-2),Answer(0)
exten => CALLFLOW-START,n(module-6),NoOp(TimeSwitch module: 2))
exten => CALLFLOW-START,n,GotoIfTime(09:00-16:00,mon-fri,*,*?module-8)
exten => CALLFLOW-START,n,Goto(module-9)
exten => CALLFLOW-START,n(module-8),Playback(/storage/usbdisk1/askoziapbx/media/sounds/cfe/speech_8_CALLFLOW-1401202953509d662fafd39)
exten => CALLFLOW-START,n(module-11),Dial(SIP/101,10,go)
exten => CALLFLOW-START,n(module-13),Hangup()
exten => CALLFLOW-START,n(module-9),Playback(/storage/usbdisk1/askoziapbx/media/sounds/cfe/speech_9_CALLFLOW-1401202953509d662fafd39)
exten => CALLFLOW-START,n(module-10),Hangup()
Designer demonstration video
Conclusion
Agree that writing a call route using the constructor is much more convenient than simple coding, however, in most cases, you need to understand how Asterisk dialplans are written and work in order to build a more or less working call route.
More information about Askoizia can be found at http://www.askozia.ru. A
description of all modules is available at http://wiki.askozia.ru