📜 ⬆️ ⬇️

Askozia - Call Route Editor

As I wrote earlier , we have been using Asterisk-based IP ATC Askozia 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 you 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. More than 60 separate modules are used to build routes. 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 core of the telephone system to handle calls.


')
Each route is assigned a separate internal number, and the administration panel itself looks like this:



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

A simple example of a voice menu



When an incoming call, the system picks up the phone, plays a greeting, which can be specified in a special block or immediately recorded using the phone, and then waits 5 seconds to dial an extension number. Further, depending on the specified number, a subscriber is called. If you enter the wrong number, the block with the letter i will work, if you haven’t dialed anything for 5 seconds, the block t will work. Accordingly, in the last two cases, the subscriber will hear the "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() 



An example of a simple call queue with 3 static agents



This block allows you to receive more calls. If all agents are busy talking, the subscriber is put on hold in a queue and waits until one of the agents is free and can process the call, if within 600 seconds none of the agents could handle 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 configuration:
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 



Record and send 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 <info@miko.ru>" >> /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 during non-business hours to voice mail.


This route uses a speech generation mechanism that allows the subscriber to pronounce the phrases specified in the module settings. Unfortunately, only in English, so for Russian-speaking subscribers these blocks can be replaced by playing pre-recorded speech fragments.

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() 



Video demonstration of work with the designer





Conclusion

Agree that writing a call route using a 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.

In more detail about Askoizia you can read on the site http://www.askozia.ru
Description of all modules is available at http://wiki.askozia.ru

Source: https://habr.com/ru/post/165971/


All Articles