Asterisk & CISCO Call Manager Integration.

Posted: Monday, March 17, 2014 by Mahmoud Ramadan Ali in Labels:
0

-In This article I’ve discussed how to build a SIP Trunk between Asterisk and CISCO Call Manager Express (CME) and in this one i will illustrate how to integrate Asterisk with CISCO Unified Communications Manager.
 
Asterisk & CUCM Integration Prerequisites.
 

-CISCO CM SIP trunk does NOT give you the ability to configure a list of preferred Codecs to be negotiated over the trunk with the other peer.It supports only one Codec and it is G729 which is NOT installed on Asterisk by default. 
-The down side of this behavior is that Asterisk will fail  to negotiate a common Codec to setup the SIP trunk with CUCM because of the Codec mismatch issue which is illustrated clearly in this error message.
chan_sip.c: sip_write: Asked to transmit frame type g729, while native formats is (ulaw) read/write = ulaw/ulaw
channel.c: ast_write: Codec mismatch on channel SIP/9000 setting write format to g729 from ulaw native formats (ulaw)
channel.c: set_format: Unable to find a codec translation path from (ulaw) to (g729)
-The debug message shows that Asterisk is stuck! it can handle calls from a SIP phone on extension 9000 using G711 ulaw but can NOT forward this call over the SIP trunk to CUCM because G729 is NOT present for Codec translation from G711 to G729.
-You can solve this issue simply by installing and configuring the G729 Codec to be used as a valid translation option and the " HOW TO... " beyond the configuration process can be found in This article.

Configure a trunk from CUCM to Asterisk:
-Open up the Call Manager Administration web page Select  Device then Trunk from the men Select the “Add a New Trunk” link from the upper right hand corner of the “Find and List Trunks” page Select “SIP Trunk” as the “Trunk type” and “SIP” as the “Device Protocol” and set the to Default”. Click on the “Next” button and enter the IP address of your Asterisk server in the “Destination Address” field.
-Now open System select Security then SIP Trunk Security Profile and select the Non Secure SIP Trunk Profile and change the  Outgoing Transport Type” to UDP.

Note:For successful call routing you should configure a route pattern or a hunt list to use the configured SIP trunk to point to the Asterisk server if the dialed number matches the Asterisk server dial plan.

Configure a trunk from Asterisk to CUCM: 
-On FreePBX create a SIP Trunk and configure the host to the CUCM IP address and  disallow all the Codes except for G729.
Note:Call routing is a two way configuration process so to get your calls routed to CUCM you should configure  and outbound route that will use the SIP trunk to forward calls to CUCM if the dialed number matches the CUCM dial plan.

Verification:
-The sip show channels command on Asterisk shows that the incoming call from extention 9000 is using G711 ulaw whereas the outgoing leg of the same call has been translated from G711 ulaw to G729 to be send over the trunk to the CUCM server on IP 192.168.1.100.
localhost*CLI> sip show channels
Peer                    User/ANR      Call ID                      Format          Hold     Last Message    Expiry     Peer
192.168.1.100    1001               f9672200-326114    (g729)           No       Tx: ACK                         Trunk To CUCM
192.168.1.10      9000              48d6b123328728a    (ulaw)           No       Rx: ACK                          9000

Summary:The whole idea around successful Asterisk & CUCM integration is the planning phase for the prerequisites including a common Codec to be negotiated between the two peers and configuring UDP as the outgoing transport protocol in the CUCM trunk profile.