Showing posts with label CISCO & Asterisk Integration.. Show all posts
Showing posts with label CISCO & Asterisk Integration.. Show all posts

Cisco & Asterisk Integration Guide.

Posted: Wednesday, April 16, 2014 by Unknown in Labels:
0

Asterisk & CISCO Call Manager Integration.

Posted: Monday, March 17, 2014 by Unknown 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.

Asterisk & Call Manager Express Integration.

Posted: Sunday, November 17, 2013 by Unknown in Labels:
0

-In this article I’ll go over how to build a SIP Trunk between Asterisk and CISCO Call Manager Express(CME) to allow Full-Duplex communication between both of them.

-To achieve this kind of setup (Toll-bypass) you need to configure CME to register with Asterisk as a SIP-User Agent (SIP-UA) also you must configure Asterisk to register with CME for Full-Duplex connectivity.

Configure a trunk from CME to Asterisk:
Enable SIP and allow SIP to SIP connections:
-Very simple, we just enable the SIP protocol and configure CME bridge SIP connections.
CME(config)#voice service voip
CME(conf-voi-serv)#allow-connections sip to sip
CME(conf-voi-serv)#sip
Configure G711alaw/G711ulaw Codec voice class:
-Usually you will use the G729 Codec over the WAN but unfortunately it's NOT enabled by default on Asterisk so to avoid Codec mismatch it's recommend to use at least one common Codec.
-Asterisk has a native support for G711alaw/G711ulaw Codec so you need to configure a voice class for these Codec to be negotiated with Asterisk.
CME(config)#voice class codec 1
CME(config-class)#codec preference 1 g711ulaw
CME(config-class)#codec preference 2 g711alaw
Configure a SIP Dial-Peer pointing to Asterisk:
-Configure a Dial-Peer pointing to Asterisk using SIP also configure the Codecs that will be negotiated over the trunk using the Codec voice class created at the previous step.
-The "dtmf-relay" command allows you to define how to relay the Dtmf-Tones.

CME(config)#dial-peer voice 1 voip
CME(config-dial-peer)#destination-pattern .T
CME(config-dial-peer)#session protocol sipv2
CME(config-dial-peer)#session target ipv4:192.168.1.200
CME(config-dial-peer)#voice-class codec 1
CME(config-dial-peer)#dtmf-relay sip-notify rtp-nte
CME(config-dial-peer)#no shut

Configure a SIP-User Agent (SIP-UA) Account to register with Asterisk:
-Configure CME to act as a SIP-UA and set the account username/password that will be used to register with the Asterisk Server.
-Both of the "credentials" and the "authentication" commands are using different authentication standard to authenticate the same account.
-The "register" command gives you the ability to specify " Registration Timeout Retry Timer ".
-The "sip-server" command allows you to define the SIP port number used on the SIP server.This is useful only if you are using custom SIP port number on your Asterisk server which is NOT recommended.
-The "keepalive" command Sets the time interval between sending Options message requests when the SIP server is active or down.
CME(config)#sip-ua
CME(config-sip-ua)#credentials username CMEUSER password CMEPASS realm 192.168.1.200
CME(config-sip-ua)#authentication username CMEUSER password CMEPASS
CME(config-sip-ua)#registrar ipv4:192.168.1.200 expires 3600
CME(config-sip-ua)#sip-server ipv4:192.168.1.200:5060
CME(config-sip-ua)#keepalive target ipv4:192.168.1.200
On Asterisk configure a SIP account to be used by CME to register it's SIP-UA account.
-Now CME will try to register with Asterisk using the SIP-UA account but it will fail since there is NO SIP account configured on Asterisk for successful registration.
-In the FreePBX GUI:Go to "Connectivity">"Trunk">"Add SIP Trunk" and configure the "Outgoing Settings" as follows.

Verify the SIP-UA registration on CME and Asterisk. 
-Use the " Show sip-ua registration status " command on CME to verify the registration process.
CME#sh sip-ua register status
Line          peer           expires(sec)  registered
============  =============  ============  ===========
CMEUSER       -1               2745          yes
-Use the " sip show users " command on Asterisk to verify the registration process.
Asterisk*CLI> sip show users
Username                   Secret           Accountcode      Def.Context      ACL  ForcerPort
CMEUSER                    CMEPASS                           from-trunk-sip-  No   Yes

Tip:The order of the configuration is critical.The SIP DP should be configured before the SIP-UA to trigger the CME registration.

Configure a trunk from Asterisk to CME:
-This step covers the configuration required to register Asterisk with CME.
-The configuration includes configuring CME as a registrar server to accept incoming SIP registration requests and creating the account that will be used by Asterisk to register with CME.
Configure CME as a registrar server and define the VOIP interface.
-Use the "sip" command to enable the SIP protocol.This should be done before to enable the SIP-UA client on CME.
-Use the "bind" command to define the VOIP interface used for both of SIP signaling and media processing.
-Use the "registrar server" command to enable CME to act as a registrar server and process incoming registration requests on it's VOIP interface.
CME(config)#voice service voip
CME(conf-voi-serv)# sip
CME(conf-serv-sip)#bind all source-interface fastEthernet 0/0
CME(conf-serv-sip)#registrar server
Configure the "max-dn" and the "max-pool".
-Configure the maximum DN and the maximum pool number that CME can provision.
CME(config)#voice register global
CME(config-register-global)#max-dn 2
CME(config-register-global)#max-pool 2
Configure the pool ID.
-The "id" will be the Asterisk IP Address.
Notice: For the SIP registrar server to identify the SIP endpoints by IP Address it should NOT be configured in CME mode.
CME(config)#voice register pool 1
CME(config-register-pool)# id ip 192.168.1.200
Configure the account that will be used by Asterisk to register with CME.
-Next configure the credentials that will be used by Asterisk to login and register with asterisk.
Tip:The "Username" MUST be a number just not to receive an "Invalid destination-pattern" error message when Asterisk tries to register.
CME(config)#username 12345 password 0 ASTERISKPASS
In the FreePBX GUI edit the trunk configuration by adding the register string in form of "Username:Password@IP Address".
verify Asterisk registration on Asterisk and CME.
-Use the “sip show registry" on Asterisk to verify the registration process.
Asterisk*CLI> sip show registry
Host                                    dnsmgr Username       Refresh State                Reg.Time
192.168.1.100:5060                      N      12345              105 Registered           Sun, 17 Nov 2013 07:47:21
1 SIP registrations.
-Use the “sh voice register pool 1" on CME to verify the registration process.
CME#sh voice register pool 1
Pool Tag 1
Config:
  Ip address is 192.168.1.200, Mask is 0.0.0.0
  Proxy Ip address is 0.0.0.0
  DTMF Relay is disabled
  kpml signal is enabled
Statistics:
  Active registrations  : 1
  Total Registration Statistics
    Registration requests  : 3
    Registration success   : 3
    Registration failed    : 0
    unRegister requests    : 2
    unRegister success     : 2
    unRegister failed      : 0
Verify the entire configuration in the FreePBX GUI.
-The "IP Trunk Online" represents the incoming trunk from CME to Asterisk.
-The "IP Trunk Registrations" represents the outgoing trunk from Asterisk to CME .
 
Summary:As you see the configuration process can be summarized in two stages. First,configure CME as a SIP-UA to register with Asterisk. Second,Configure Asterisk to register with CME and authenticate using the account that you configure in the global configuration mode.This account will be used as a service account to authorize Asterisk to register with CME.