48.5. Connecting Abilis and Asterisk

This section contains instructions for a correct set-up of Abilis CPX and Asterisk interconnection.

[Tip]Tip

Abilis generates the alerting tone after RINGING when ALERTING without progress in-band-info is received from CTIR. The audio is sent after RINGING acknowledgment. Alerting tone is generated according to CTISYS tones configuration.

48.5.1. Checklist of parameters

Below there are the parameters which Abilis MUST send to Asterisk to allow him to complete the general context and to add the Abilis context in /etc/asterisk/iax.conf file.

Asterisk ContextAsterisk ParameterDescriptionValue
generalallowAllowed codecs. In local environment G.711 should be used; in Internet environment G.729 is the best choice but licence from Digium costs 10$ for each IAX2 channel. G.711 is required for IAX FAX.alaw”, and “G729” if available.
generaltrunkfreqFrequency for metatrunking bandwidth optimization, in milliseconds.40
generaltrunktimestampsIndividual miniframe timestamp inside metatrunk frame.yes
abilistypeUser rights (to call and be called).friend
abilisusernameThe username with which Asterisk presents itself to Abilis.Value of USER parameter in Abilis Users table.
abilissecretThe password with which Asterisk authenticates to Abilis, and vice versa Abilis authenticates to Asterisk.Value of PWD and IAX-REM-PASS parameters in Abilis CPX Users table. For simplicity, we use a single user in Asterisk (the context abilis), and this requires that in Abilis PWD and IAX-REM-PASS are set identical.
abilishostThe Abilis IP Address or FQDN.<ABILIS_IP_ADDRESS> or <ABILIS_FQDN>
abilistrunkAllow metatrunkingyes

48.5.2. Activation of the CTIIAX resource

For the activation of the CTIIAX resource refer to Section 48.1.1, “Activating the CTIIAX resource”.

In common use, you don't need to configure all the listed parameters, many of them belong to the IAX protocol advanced options. The basic options are:

  • ACT: to activate the resource.

  • sesnum: to define the amount of simultaneous connections.

  • SRCADD: source IP address for outgoing connections [R-ID: the source IP address of the outgoing datagrams will be set to the current RouterID value; OUT-IP: the source IP address of the outgoing datagrams will be set on the base of the output IP interface; 1-126.x.x.x, 128-223.x.x.x: the source IP address of the outgoing datagrams will be set to the selected value; IP-nnn: use the current IPADD of the specified IP resource].

    [Tip]Tip

    If Abilis has only one IP resource (and therefore only one IP address) , you can use the default value; otherwise if Abilis has more IP resources and more IP addresses the suggested configuration is OUT-IP.

48.5.3. Example 1: Abilis and Asterisk have static IP addresses

Assumptions:

  • Abilis has the static IP address 192.168.1.254.

  • Asterisk has the static IP address 192.168.1.100.

  • Abilis has an IAX user called “asterisk” with password “swordfish”.

  • Asterisk provides advanced services like IVR and voice mail: suppose that 10 sessions are needed.

Now you have to create an IAX user representing Asterisk.

[14:49:07] ABILIS_CPX:a user:asterisk pwd:swordfish iax:yes iax-host:192.168.1.100 iax-maxses-bid:10

COMMAND EXECUTED

[14:49:07] ABILIS_CPX:s user:asterisk iax-number:* iax-trunk:yes iax-rem-user:abilis iax-rem-pass:swordfish iax-rem-auth:md5 iax-rem-reg:yes

COMMAND EXECUTED

Below the result is displayed (emphasized parameters are the values different from the defaults):

[14:49:07] ABILIS_CPX:d user:asterisk


- Not Saved (SAVE CONF) -------------------------------------------------------
Parameter:          | Value:
--------------------+----------------------------------------------------------
USER:                 asterisk
REAL-NAME:            asterisk
ID:                   9             <Read Only>
PWD:                  ***
ACT:                  YES
GROUP:                
CTIP:                 #
CLUS:                 #
ADDRBOOK-SYNC:        SYS           
ADDRBOOK-NUMBER:      AUTO          
ADDRBOOK-OUTDIAL:     NONE          
ADDRBOOK-PUB-ENABLED: SYS           
OPC-ROLE:             USER
OPC-VIEW:             *
OPC-HIDE-NUMBERS:     NO
OPC-MONITOR:          NONE
OPC-PRIVACY:          NO
CHAT:                 NO    
CHAT-USER:            SYS
CHAT-PWD:             SYS
IAX:                  YES   
IAX-HOST:             192.168.001.100
IAX-SRCADD:           SYS
IAX-PORT:             4569
IAX-IP-PERMIT:        *
IAX-MAXSES-BID:       10
IAX-MAXSES-IN:        0
IAX-MAXSES-OUT:       0
IAX-NUMBER:           *
IAX-ADDRBOOK-NUM:     IAX-NUMBER
IAX-CG-NUM:           AUTO
IAX-FWD-CG-NUM:       CALLER
IAX-CTIP-TYPE:        SYS
IAX-RG-IN:            SYS
IAX-ROUTE-BY-SD:      NO            
IAX-PROVIDE-SG:       NO
IAX-CLIP-RULE:        SYS
IAX-BUSY-NOCHAN:      NO
IAX-LCS-GROUP:        NONE
IAX-CPO:              SYS
IAX-CPO-STATE:        SYS
IAX-CPO-DROP:         SYS
IAX-SS:               NO
IAX-SS-PICKUP:        GROUPS
IAX-SS-PRES-CG:       YES
IAX-SS-CF-DND:        YES
IAX-SS-VM:            YES
IAX-CONTEXT:          
IAX-PROVIDE-NAME:     BLANK
IAX-AUTH:             SYS
IAX-NETSTATS:         SYS
IAX-TRUNK:            YES
IAX-TRUNK-FREQ:       SYS
IAX-TRUNK-TS:         SYS
IAX-CHAN-FREQ:        SYS
IAX-TRANSFER:         SYS
IAX-DISC-AUDIO:       SYS
IAX-HTML-IN:          SYS
IAX-HTML-OUT:         SYS
IAX-REM-USER:         abilis
IAX-REM-PASS:         ********
IAX-REM-AUTH:         MD5
IAX-REM-REG:          YES           
-------------------------------------------------------------------------------

The CTIIAX table, used to route calls toward IAX users, gets automatically populated with a unique route because you set IAX-NUMBER:*.

[14:49:07] ABILIS_CPX:d ctiiax numbers

Total:1         Iax-Number:1         Static:0         

NUMx: [IAX-NUMBER:]       USER:                             Provenience:
------------------------------------------------------------------------
*                      asterisk                               IAX-NUMBER

The asterisk configuration file /etc/asterisk/extensions.conf must contain a context for managing the calls. For our convenience, we use here the name from-abilis:

[from-abilis]
exten => 123,1,Answer()           ; answer, play, hangup
exten => 123,2,Playback(welcome)
exten => 123,3,Hangup

exten => 222,1,Answer()           ; answer, play, forward call to another number (999)
exten => 222,2,Playback(welcome)
exten => 222,3,Dial(IAX2/abilis/999)

The asterisk configuration file /etc/asterisk/iax.conf must be modified to include the following lines in the general context:

[general]
disallow=all           ; first disallow every coder
allow=alaw             ; then enable only G.711 A-law
trunkfreq=40           ; trunkfrequency 40 msec
trunktimestamps=yes    ; individual miniframes timestamp

And the following lines in the abilis context:

[abilis]
type=friend
username=asterisk       ;the same of USER in Abilis
secret=swordfish        ;the same of PWD and IAX-REM-PASS in Abilis
host=192.168.1.254      ;Abilis static address
context=from-abilis     ;name of the desired context from extensions.conf
trunk=yes               ;enable trunking
[Caution]Caution

Remember to reload the Asterisk service.

Abilis and Asterisk interconnection is now correctly configured.

48.5.4. Example 2: Abilis has a static address and Asterisk has a dynamic address

Assumptions:

  • Abilis has the static IP address 192.168.1.254.

  • Asterisk has a dynamic IP address.

  • Abilis has an IAX user called “asterisk” with password “swordfish”.

  • Asterisk provides advanced services like IVR and voice mail: suppose that 10 sessions are needed.

The steps are the same as in the Section 48.5.3, “Example 1: Abilis and Asterisk have static IP addresses”, there is just one parameter different in Abilis and one directive to add in Asterisk configuration.

Add the user:

[14:49:07] ABILIS_CPX:a user:asterisk pwd:swordfish iax:yes

COMMAND EXECUTED

Or set it to DYNAMIC if the user is already present.

[14:49:07] ABILIS_CPX:s user:asterisk iax-host:dynamic

COMMAND EXECUTED

The Abilis user configuration differs from Section 48.5.3, “Example 1: Abilis and Asterisk have static IP addresses” by the fields emphasized below :

[14:49:07] ABILIS_CPX:d user:asterisk

- Not Saved (SAVE CONF) -------------------------------------------------------
Parameter:          | Value:
--------------------+----------------------------------------------------------
USER:                 asterisk
REAL-NAME:            asterisk
ID:                   9             <Read Only>
PWD:                  ***
ACT:                  YES
GROUP:                
CTIP:                 #
CLUS:                 #
ADDRBOOK-SYNC:        SYS           
ADDRBOOK-NUMBER:      AUTO          
ADDRBOOK-OUTDIAL:     NONE          
ADDRBOOK-PUB-ENABLED: SYS           
OPC-ROLE:             USER
OPC-VIEW:             *
OPC-HIDE-NUMBERS:     NO
OPC-MONITOR:          NONE
OPC-PRIVACY:          NO
CHAT:                 NO    
CHAT-USER:            SYS
CHAT-PWD:             SYS
IAX:                  YES   
IAX-HOST:             DYNAMIC
IAX-SRCADD:           SYS
IAX-PORT:             (DYNAMIC)
IAX-IP-PERMIT:        *
IAX-MAXSES-BID:       1
IAX-MAXSES-IN:        0
IAX-MAXSES-OUT:       0
IAX-NUMBER:           *
IAX-ADDRBOOK-NUM:     IAX-NUMBER
IAX-CG-NUM:           AUTO
IAX-FWD-CG-NUM:       CALLER
IAX-CTIP-TYPE:        SYS
IAX-RG-IN:            SYS
IAX-ROUTE-BY-SD:      NO            
IAX-PROVIDE-SG:       NO
IAX-CLIP-RULE:        SYS
IAX-BUSY-NOCHAN:      NO
IAX-LCS-GROUP:        NONE
IAX-CPO:              SYS
IAX-CPO-STATE:        SYS
IAX-CPO-DROP:         SYS
IAX-SS:               NO
IAX-SS-PICKUP:        GROUPS
IAX-SS-PRES-CG:       YES
IAX-SS-CF-DND:        YES
IAX-SS-VM:            YES
IAX-CONTEXT:          
IAX-PROVIDE-NAME:     BLANK
IAX-AUTH:             SYS
IAX-NETSTATS:         SYS
IAX-TRUNK:            YES
IAX-TRUNK-FREQ:       SYS
IAX-TRUNK-TS:         SYS
IAX-CHAN-FREQ:        SYS
IAX-TRANSFER:         SYS
IAX-DISC-AUDIO:       SYS
IAX-HTML-IN:          SYS
IAX-HTML-OUT:         SYS
IAX-REM-USER:         abilis
IAX-REM-PASS:         ********
IAX-REM-AUTH:         MD5
IAX-REM-REG:          YES           
-------------------------------------------------------------------------------

The asterisk configuration file /etc/asterisk/iax.conf must be modified to include in the general context the register directive:

[general]
disallow=all           ; first disallow every coder
allow=alaw             ; then enable only G.711 A-law
trunkfreq=40           ; trunk frequency 40 msec
trunktimestamps=yes    ; individual miniframes timestamp

register=>asterisk:swordfish@192.168.1.254  ;activate registration TO abilis
[Caution]Caution

Remember to reload the Asterisk service.

Abilis and Asterisk interconnection is now correctly configured.

48.5.5. CTI Routings configuration

In order to route calls to and from the CTIIAX resource, adding the appropriate routings in the CTIR table is needed.

48.5.5.1. Any coder, transcoding disallowed

In this example, every call arriving from ISDN/POTS/GSM/CLUSTER is routed to IAX users, and every call arriving from IAX users is first sent to cluster test; in case of failure (NEXT:LIMITED) it's attempted on ISDN/POTS/GSM group G1.

In this situation any coder with maximal speed 6400 (the default for SP parameter) is allowed, but transcoding is disallowed, which means that the same coder must be used in Asterisk and in the Abilis where a CTI routing will terminate the call to an ISDN/POTS/GSM port or to another IAX user.

Cluster test is only useful to the example, any cluster can be used.

[14:49:07] ABILIS_CPX:a ctir pr:0 poi:* out:iax cdi:*

COMMAND EXECUTED

[14:49:28] ABILIS_CPX:a ctir pr:1 sr:* out:iax cdi:*

COMMAND EXECUTED

[14:50:06] ABILIS_CPX:a ctir pr:2 poi:iax out:test cdi:* next:limited

COMMAND EXECUTED

[14:50:08] ABILIS_CPX:a ctir pr:3 poi:iax out:g1 cdi:*

COMMAND EXECUTED

[14:50:15] ABILIS_CPX:d ctir

Last change: 17/06/2015 10:01:34 CET

---+------+-----------------+---------+--------------------+--------------------
PR |[DESCR]
   |BCI   |POI |SR      |GI |OUT      |CDI                 |CDO
ACT|NEXT        |LAST       |EEC |T301|CGI                 |CGO
EDT|SP    |SC   |DJ   |MJ   |FMDJ|FMMJ|SDI                 |SDO
   |SPOUT |SCOUT|DJOUT|MJOUT|LCS |LCST|SGI                 |SGO
   |                        |BCO      |RGI                 |RGO
   |FMRLY |FAXSP|MODSP|FMLVL|ECM |UDT |IG  |OG  |SG        |DL  |DH
   |CODERS
   |CODERSOUT
   |TI1 .. TI5
--------------------------------------------------------------------------------
0   VOICE  *    #        #   Iax       *                    *                   
--------------------------------------------------------------------------------
1   VOICE  #    *        #   Iax       *                    *                   
--------------------------------------------------------------------------------
2   VOICE  Iax  #        #   test      *                    *                   
    LIMITED      ANY         NO   Dft  *                    *                   
--------------------------------------------------------------------------------
3   VOICE  Iax  #        #   G1        *                    *                   
--------------------------------------------------------------------------------
[Tip]Tip

Set SP:8000 in every routing to allow G.729A .

48.5.5.2. Only G.711 on Asterisk, any coder on Cluster, transcoding allowed

In this example, every call arriving from ISDN/POTS/GSM/CLUSTER is routed to IAX users, and every call arriving from IAX users is first sent to cluster test, and in case of failure (NEXT:LIMITED) it's attempted on ISDN/POTS/GSM group G1.

In this situation only G.711 A-law or u-law is possible between Asterisk and Abilis, but since transcoding is enabled by CODERSOUT <> * the CTI routings will negotiate for the “C” side any coder with maximal speed up 6400 bps.

[15:26:02] ABILIS_CPX:a ctir pr:0 poi:* out:iax cdi:* sp:64000

COMMAND EXECUTED

[15:26:10] ABILIS_CPX:a ctir pr:1 sr:* out:iax cdi:* spout:64000 codersout:G.711

COMMAND EXECUTED

[15:26:22] ABILIS_CPX:a ctir pr:2 poi:iax out:test cdi:* next:limited sp:64000 coders:g.711 spout:6400 codersout:*,sys

COMMAND EXECUTED

[15:26:36] ABILIS_CPX:a ctir pr:3 poi:iax out:g1 cdi:* sp:64000

COMMAND EXECUTED

[15:26:44] ABILIS_CPX:d ctir

- Not Saved (SAVE CONF), Not Refreshed (INIT) ---------------------------------
Last change: 17/06/2015 10:01:34 CET

---+------+-----------------+---------+--------------------+--------------------
PR |[DESCR]
   |BCI   |POI |SR      |GI |OUT      |CDI                 |CDO
ACT|NEXT        |LAST       |EEC |T301|CGI                 |CGO
EDT|SP    |SC   |DJ   |MJ   |FMDJ|FMMJ|SDI                 |SDO
   |SPOUT |SCOUT|DJOUT|MJOUT|LCS |LCST|SGI                 |SGO
   |                        |BCO      |RGI                 |RGO
   |FMRLY |FAXSP|MODSP|FMLVL|ECM |UDT |IG  |OG  |SG        |DL  |DH
   |CODERS
   |CODERSOUT
   |TI1 .. TI5
--------------------------------------------------------------------------------
0   VOICE  *    #        #   Iax       *                    *                   
    NO           ANY         NO   Dft  *                    *                   
    64000  Sys   Sys   Sys   Sys  Sys  *                    *                   
--------------------------------------------------------------------------------
1   VOICE  #    *        #   Iax       *                    *                   
    NO           ANY         NO   Dft  *                    *                   
    6400   Sys   Sys   Sys   Sys  Sys  *                    *                   
    64000  *     *     *     NO   Sys  *                    *                   
                             *         *                    *                   
    Sys    AUTO  AUTO  Sys   SYS  NO   Sys  Sys  Sys        Sys  Sys
    Sys
    G.711
--------------------------------------------------------------------------------
2   VOICE  Iax  #        #   test      *                    *                   
    LIMITED      ANY         NO   Dft  *                    *                   
    64000  Sys   Sys   Sys   Sys  Sys  *                    *                   
    6400   *     *     *     NO   Sys  *                    *                   
                             *         *                    *                   
    Sys    AUTO  AUTO  Sys   SYS  NO   Sys  Sys  Sys        Sys  Sys
    G.711
    *,Sys
--------------------------------------------------------------------------------
3   VOICE  Iax  #        #   G1        *                    *                   
    NO           ANY         NO   Dft  *                    *                   
    64000  Sys   Sys   Sys   Sys  Sys  *                    *                   
--------------------------------------------------------------------------------
[Tip]Tip

To allow G.729A you have to set SP:8000 in PR:1 and SPOUT:8000 in PR:2.

48.5.5.2.1. Transcoding optimization

When the Abilis-Asterisk interconnection occurs via local LAN, i.e. with high speed, minimal delays, minimal jitter, the transcoding can be optimized so that the Asterisk side uses minimal jitter, therefore minimal delays, while the WAN side uses the values optimal for WAN link.

This is obtained by properly setting DJ, MJ, DJOUT, MJOUT. For example, type:

[15:32:28] ABILIS_CPX:s ctir pr:1 djout:0 mjout:80

COMMAND EXECUTED

[15:42:21] ABILIS_CPX:s ctir pr:2 dj:0 mj:80 djout:sys mjout:sys

COMMAND EXECUTED
[Tip]Tip

DJ and MJ in PR:1 as well as DJOUT and MJOUT in PR:2 may assume other values appropriate for the WAN link or specifically required by calls matching the routing.

48.5.5.2.2. Fax

When transcoding takes place in IoC and CtoI, with G.711 toward the Asterisk FAX relay can be used! It means that if your asterisk is properly set-up to manage faxes via G.711 coder, you can exchange FAX with following characteristics:

  • Use G.711, 64 kbps plus IP overhead on the Abilis-Asterisk interconnection;

  • Use G3 Fax relay, 2400/4800/9600/14400 kbps plus IP overhead on the WAN link.

If you want to forcedly disable fax relay you have just to set FMRELAY:NO in the desired routing, e.g.:

[15:48:21] ABILIS_CPX:s ctir pr:0 fmrly:no

COMMAND EXECUTED

[15:48:35] ABILIS_CPX:s ctir pr:1 fmrly:no

COMMAND EXECUTED

[15:49:01] ABILIS_CPX:s ctir pr:2 fmrly:no

COMMAND EXECUTED

[15:49:29] ABILIS_CPX:s ctir pr:3 fmrly:no

COMMAND EXECUTED