sábado, 10 de febrero de 2018

Procedure - Asterisk PBX business automatization with API calls

Could we trigger a business process by a telephone call? yes, we can, with asterisk.



Here we are going to show the basic installation and configuration steps to allow a inconming phone call with DTMF (Dual-Tone Multi-Frequency) to execute an API call to our systems to perform some action.

  • Installation

Basic asterisk installation is done in debian OS (e.g. Ubuntu) simply by executing:

apt-get update -y
apt-get upgrade -y
apt-get install asterisk -y

  • Locution generation

Here, we´ll save in a tipical .wav format some locutions in order to ask interactivelly (IVR) for the code_number like "Please insert the confirmation code" and a finish message in order to close the "conversation", like "thanks, your request has been processed". These media files will be converted to .gsm format by executing sox command in the asterisk server:

sox loc.code_number.wav -t gsm -r 8000 -c 1 /usr/share/asterisk/sounds/en/loc.code_number.gsm
sox loc.finish.wav -t gsm -r 8000 -c 1 /usr/share/asterisk/sounds/en/loc.finish.gsm

  • Configuration

We will use old .conf method to configure our phone call flow, but there are another ways/scriptting methods you can use:

echo -e "[general]
fullname = General
secret = 1234
hassip = yes
context = general_IVR
host = dynamic" > /etc/asterisk/users.conf

echo -e "[general]
bindaddr = 0.0.0.0
host=dynamic
type=friend
allow=all
dtmfmode=info" > /etc/asterisk/sip.conf

echo -e "[general_IVR]
exten => _.,1,Answer()
exten => _.,n,Read(test,loc.code_number,5,skip,2,15)
exten => _.,n,Set(CURL_BODY={\"code_number\":\${test},\"type\":\"phone_general\"})
exten => _.,n,Set(CURL_RESULT=\${CURL(https://postman-echo.com/post,\${CURL_BODY})})
exten => _.,n,Playback(loc.finish,skip)
exten => _.,n,Hangup()" > /etc/asterisk/extensions.conf


  • Phone number

To gain access by a DDI (direct dial-in) telephone number, we´ll contact some Voip provider to give us a phone number and redirect to our SIP configuration (ip, port) with the configured credentials (tipically applying TLS ans RSTP encryption options). However, you can use the Asterisk system from a voip phone client software (phonerlite, zoiper, ...) without any DDI number asociated, so, with no extra charges involved.
 
  • Key benefits

No special apps required to automate things from your mobile phone (you can use any voip app aplication that supports SIP servers to connect with your install).

You can automate internal company processes with simple external phone calls.

You can increase productivity by routing users to destination extensions without human intervention (PBX basic usage, "press 1 for sales, 2 for delivery ...").

You could create an IVR (Interactive voice recognition) systems, (that will require additional external voice recognition capabilities to be configured).


Please, feel free to contact with Sepalo Software if you need more information.


1 comentario: