This section contains instructions for a correct set-up of Abilis CPX and Asterisk interconnection.
| ![[Tip]](../images/tip.png) | 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. | 
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 Context | Asterisk Parameter | Description | Value | 
|---|---|---|---|
| general | allow | Allowed 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. | 
| general | trunkfreq | Frequency for metatrunking bandwidth optimization, in milliseconds. | 40 | 
| general | trunktimestamps | Individual miniframe timestamp inside metatrunk frame. | yes | 
| abilis | type | User rights ( to call and be called ). | friend | 
| abilis | username | The username with which Asterisk presents itself to Abilis. | Value of USERparameter in Abilis
              Users table. | 
| abilis | secret | The password with which Asterisk authenticates to Abilis, and vice versa Abilis authenticates to Asterisk. | Value of PWDandIAX-REM-PASSparameters in Abilis CPX Users
              table. For simplicity we use a single user in Asterisk (the
              context abilis), and this requires that in AbilisPWDandIAX-REM-PASSare
              set identical. | 
| abilis | host | The Abilis IP Address or FQDN. | <ABILIS_IP_ADDRESS> or <ABILIS_FQDN> | 
| abilis | trunk | Allow metatrunking | yes | 
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]](../images/tip.png) | 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 resoures and more IP addresses the suggested
            configuration is  | 

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:10COMMAND 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:yesCOMMAND EXECUTED
Below the result is displayed (emphasized parameters are the values different from 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 ofUSERin Abilis secret=swordfish ;the same ofPWDandIAX-REM-PASSin Abilis host=192.168.1.254 ;Abilis static address context=from-abilis ;name of the desired context fromextensions.conftrunk=yes ;enable trunking
| ![[Caution]](../images/caution.png) | Caution | 
|---|---|
| Remember to reload the Asterisk service. | 
Abilis and Asterisk interconnection is now correctly configured.

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 EXECUTEDor set it to DYNAMIC if the user is already
      present.
[14:49:07] ABILIS_CPX:s user:asterisk iax-host:dynamic
COMMAND EXECUTEDThe 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]](../images/caution.png) | Caution | 
|---|---|
| Remember to reload the Asterisk service. | 
Abilis and Asterisk interconnection is now correctly configured.
In order to route calls to and from the CTIIAX resource, adding the appropriate routings in the CTIR table is needed.
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 is 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 CtoV or CtoI 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 type:vtoi poi:* cdi:*COMMAND EXECUTED [14:49:28] ABILIS_CPX:a ctir pr:1 type:ctoi sr:* cdi:*COMMAND EXECUTED [14:50:06] ABILIS_CPX:a ctir pr:2 type:itoc ds:test cdi:* next:limitedCOMMAND EXECUTED [14:50:08] ABILIS_CPX:a ctir pr:3 type:itov poo:g1 cdi:*COMMAND EXECUTED [14:50:15] ABILIS_CPX:d ctir- Not Saved (SAVE CONF), Not Refreshed (INIT) --------------------------------- Last change: 28/05/2015 09:41:16 CET ---+-----+-----------------+---------+--------------------+-------------------- PR |[DESCR] |TYPE |POI/SR [SR] |POO/DS |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 | |RGI |RGO |FMRLY|FAXSP|MODSP|FMLVL|ECM |UDT |IG |OG |SG |DL |DH |CODERS |CODERSOUT |TI1 .. TI5 ------------------------------------------------------------------------------- 0 VtoI * CtiIax * * ------------------------------------------------------------------------------- 1 CtoI * CtiIax * * ------------------------------------------------------------------------------- 2 ItoC CtiIax test * * LIMITED ANY NO Dft * * ------------------------------------------------------------------------------- 3 ItoV CtiIax G1 * * -------------------------------------------------------------------------------
| ![[Tip]](../images/tip.png) | Tip | 
|---|---|
| Set  | 
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 is 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 ItoC
        and CtoI routings will negotiate for the “C” side any
        coder with maximal speed up 6400 bps.
[15:26:02] ABILIS_CPX:a ctir pr:0 type:vtoi poi:* cdi:* sp:64000COMMAND EXECUTED [15:26:10] ABILIS_CPX:a ctir pr:1 type:ctoi sr:* cdi:* spout:64000 codersout:G.711COMMAND EXECUTED [15:26:22] ABILIS_CPX:a ctir pr:2 type:itoc ds:test cdi:* next:limited sp:64000 coders:g.711 spout:6400 codersout:*,sysCOMMAND EXECUTED [15:26:36] ABILIS_CPX:a ctir pr:3 type:itov poo:g1 cdi:* sp:64000COMMAND EXECUTED [15:26:44] ABILIS_CPX:d ctir- Not Saved (SAVE CONF), Not Refreshed (INIT) --------------------------------- - Not Saved (SAVE CONF), Not Refreshed (INIT) --------------------------------- Last change: 28/05/2015 09:42:59 CET ---+-----+-----------------+---------+--------------------+-------------------- PR |[DESCR] |TYPE |POI/SR [SR] |POO/DS |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 | |RGI |RGO |FMRLY|FAXSP|MODSP|FMLVL|ECM |UDT |IG |OG |SG |DL |DH |CODERS |CODERSOUT |TI1 .. TI5 ------------------------------------------------------------------------------- 0 VtoI * CtiIax * * NO ANY NO Dft * * 64000 Sys Sys Sys Sys Sys * * ------------------------------------------------------------------------------- 1 CtoI * CtiIax * * NO ANY NO Dft * * 6400 Sys * * Sys Sys * * 64000 * * * NO Sys * * * * Sys AUTO AUTO Sys Sys NO * G.711 ------------------------------------------------------------------------------- 2 ItoC CtiIax test * * LIMITED ANY NO Dft * * 64000 Sys Sys Sys Sys Sys * * 6400 * * * NO Sys * * * * Sys AUTO AUTO Sys Sys NO G.711 *,Sys ------------------------------------------------------------------------------- 3 ItoV CtiIax G1 * * NO ANY NO Dft * * 64000 Sys Sys Sys Sys Sys * * -------------------------------------------------------------------------------
| ![[Tip]](../images/tip.png) | Tip | 
|---|---|
| To allow G.729A you have to set
           | 
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:80COMMAND EXECUTED [15:42:21] ABILIS_CPX:s ctir pr:2 dj:0 mj:80 djout:sys mjout:sysCOMMAND EXECUTED
| ![[Tip]](../images/tip.png) | Tip | 
|---|---|
| 
 | 
When transcoding takes place in IoC and CtoI, with G.711 toward 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 fmrelay:noCOMMAND EXECUTED [15:48:35] ABILIS_CPX:s ctir pr:1 fmrelay:noCOMMAND EXECUTED [15:49:01] ABILIS_CPX:s ctir pr:2 fmrelay:noCOMMAND EXECUTED [15:49:29] ABILIS_CPX:s ctir pr:3 fmrelay:noCOMMAND EXECUTED