Asterisk Cisco CallManager Express Integration

Why

The new family of ISR routers provided by Cisco make great media gateways for PSTN connectivity and make a very nice IP enabled key system replacement. Unfortunately, the solution can be pricey and lacks some of the flexibility and functionality of Asterisk.

Our requirement was to integrate two offices, one with a CCME based install and the other a full Asterisk/SIP deployment with IVR and voice mail. The goal was to allow seamless dialing between the two offices maintaining the legacy extension numbers as well as allowing DID to all extensions. The CCME site had no provision for voice mail (without the purchase of a Cisco unity express module and licensing..$$$$) so the goal was also to gain seamless voice mail integration.

Diagram

Image


Cisco Config

(:exclaim:)Warning - I've run into problems getting IOS 12.3(15) working with the following examples. Many of the commands shown were not available; things like the system message command, for example. An upgrade to 12.4(2)T solved the issues. I am running this test of CME on a 3745. Carry on. - RickL

The below is a subset of the full configuration with only the relevant parts, there is no provision for dialing out the PRI etc..etc. nor does it contain any fail over configuration, a sensible configuration would provide a higher precedence call route via the PSTN should the SIP session establishment fail.

There are also many references to e164 numbers... I have replaced our private numbers with a generic 5555xxx range which is no really valid, it should be possible to re-populate the configuration with full e164 numbers but it will probably need some changes at both ends to work properly as I've hacked the config significantly. i suggest using full e164 numbers where possible, it makes the system more extendable and things like ENUM easy.

voice translation-rule 1
rule 1 /^3\(..\)/ /55553\1/

voice translation-profile 4Digits2E164
translate called 1

'; Dial plan for 55553xx via SIP to host 10.0.0.200'

dial-peer voice 100 voip
destination-pattern 55553..
monitor probe icmp-ping
session protocol sipv2
session target ipv4:10.0.0.200
dtmf-relay rtp-nte
codec g711alaw

; Dial Plan for voicemail extentions 10x via sip to host 10.0.0.200
; ip2ip redirects for hairpin calls from Asterisk back to Asterisk voicemail via a 3xx redirect on busy/no answer
; Compatable DTMF for voicemail

dial-peer voice 101 voip
destination-pattern 10.
redirect ip2ip
session protocol sipv2
session target ipv4:10.0.0.200
dtmf-relay rtp-nte
codec g711alaw
no vad

; Dial-peer to allow the calling of the 3xx range of extentions, the number is expanded to the full e164 number via the 4Digits2E164 translation-profile.
; See notes on e164 numbers.

dial-peer voice 102 voip
translation-profile outgoing 4Digits2E164
destination-pattern 3..
monitor probe icmp-ping
session protocol sipv2
session target ipv4:10.0.0.200
dtmf-relay rtp-nte
codec g711alaw

; Incoming calls to 55552xx range via SIP.

dial-peer voice 200 voip
session protocol sipv2
incoming called-number 55552..
dtmf-relay rtp-nte
codec g711alaw

telephony-service
calling-number local
;calling-number local secondary may make life easier, because they are dule line phones you can choose which number is used for caller-id, My choice is to use
;the full number which can then be chomped down to the local extention numbers.
dialplan-pattern 1 55552.. extension-length 3
voicemail 105
transfer-system full-blind

ephone-dn 1 dual-line
number 201 no-reg primary
description 555-5201
call-forward busy 107
call-forward noan 106 timeout 15

ephone-dn 2 dual-line
number 202 no-reg primary
description 555-5202
call-forward busy 107
call-forward noan 106 timeout 15



Asterisk Config

I won't touch on the SIP config, it is assumed you have a working configuration and your sip based phones are available on channel SIP/extension. The contexts shown below will also need to be included or copied into the appropriate places in your existing configuration.

extensions.conf


[0ut-ccme]
exten => _5555XXX,1,Dial(SIP/8${EXTEN}@10.0.0.100,60,t)
;Just a guess but this should work...
exten => _2XX,1,Dial(SIP/5555${EXTEN}@10.0.0.100,60,t)


[ccme]
; The host declaration for your Cisco router should include the statement "context = cme" meaning incoming calls from the source will be contained within this ;(ccme) context.
include => vm
include => phones
include => did

[vm]
;Standard voicemail login prompt
exten => 101,1,VoicemailMain
exten => 101,2,Hangup

;CCME Specific VM
;Voice mail Key on 79xx - need to use the last 3 digits of the CallerID. See notes on "calling-number local secondary" in the telephony-service section
;of the cisco config
exten => 105,1,NoOp,${CALLERIDNUM}
exten => 105,2,Background(silence/1)
exten => 105,3,VoicemailMain(s${CALLERIDNUM:-3})
exten => 105,4,Hangup
exten => 105,104,Hangup

;Transfer on unavailable.
; I playback 1 second of silence to allow the call to establish correctly else the start of the audio gets cut off, if you have silence suppression or something
; I guess you could play a beep.
; Because the call is being transfered the variable ${CALLERIDNUM} contains the number of the calling device not the divice they were calling
; This would mean you would end up in your own or a non existant mailbox, the variable ${RDNIS} contains the number
; the call was redirected from and therefore can be used to specify the correct mailbox number.
exten => 106,1,NoOp,${CALLERIDNUM}
exten => 106,2,NoOp,${RDNIS}
exten => 106,3,Playback(silence/1)
exten => 106,4,Voicemail2(u${RDNIS})
exten => 106,5,Hangup
exten => 106,106,Hangup

;Transfer on busy.
;see notes above, just sets the b flag for the voicemail application to stat the call was busy (as apposed to unavailable).
exten => 107,1,NoOp,${CALLERIDNUM}
exten => 107,2,NoOp,${RDNIS}
exten => 107,3,Playback(silence/1)
exten => 107,4,Voicemail2(b${RDNIS})
exten => 107,5,Hangup
exten => 107,106,Hangup

[phones]
; Internal Extentions
exten => 301,1,Macro(std_ext,SIP/301)
exten => 302,1,Macro(std_ext,SIP/302)

;The macro referenced in above is something similar to
;
;[macro-std_ext]
; exten => s,1,Dial(${ARG1},20,t)
; exten => s,2,Voicemail2(u${MACRO_EXTEN})
; exten => s,3,Hangup
; exten => s,102,Voicemail2(b${MACRO_EXTEN})
; exten => s,103,Hangup

[did]
;The referenced macro just does some caller_id lookups and modification, it could just as easily be a direct sip channel or the std_ext macro above.
exten => 5555300,1,Macro(did,SIP/101) ; Added for convenience/ external voice mail access
exten => 5555301,1,Macro(did,SIP/301) ; Extention 301's DID
exten => 5555302,1,Macro(did,SIP/302) ; Extention 302's DID



MWI (Voicemail) Notes

MWI is not perfect due to a possible bug and RFC compliance issue (discussed here. The solution is quite workable but not ideal, it would be nice to not have to have all the sip registration mess but.. meh..

In my configuration I chose to register the extension number (it get tiresome listening to Alison reading the full e164 number). The following config makes this work.

Cisco
;Defines the sip-ua registration parameters.
sip-ua
registrar ipv4:10.0.0.200 expires 3600 secondary
sip-server ipv4:10.0.0.200

;Defines where the mailbox status messages will be coming from.
telephony-service
voicemail 105
mwi sip-server 10.0.0.200 unsolicited

;Defines 204 as the secondary number (the primary is the e164 number), above in the register line you can see the secondary
;number is the one used for registration
ephone-dn 3 dual-line
number 204

sip.conf
;Each extension must be configured setting the relevant mailbox as described in voicemail.conf
[204]
context=cme
type=friend
host=dynamic
canreinvite=no
mailbox=204

voicemail.conf
201 => 201,Test User,user@company.com
204 => 201,Test User,user@company.com


References

Thanks to Kurt W. Pasewaldt, who's page I found after when searching for information on MWI, Kurt should be credited this information

http://www.pasewaldt.com/cme/cme_index.html

The "redirect ip2ip" is needed in IOS 123.14T or greater because of the following bug reference: CSCef72436.

Kurt Pasewaldt



Another Example

You can see another example with a Cisco 2801 and a VIC2-2BRI-NT/TE on http://vt100.at/?site=doc/105

Harald Klein

Help

Questions relating to the above configuration sould be directed to me at nathanalberti.com
Why

The new family of ISR routers provided by Cisco make great media gateways for PSTN connectivity and make a very nice IP enabled key system replacement. Unfortunately, the solution can be pricey and lacks some of the flexibility and functionality of Asterisk.

Our requirement was to integrate two offices, one with a CCME based install and the other a full Asterisk/SIP deployment with IVR and voice mail. The goal was to allow seamless dialing between the two offices maintaining the legacy extension numbers as well as allowing DID to all extensions. The CCME site had no provision for voice mail (without the purchase of a Cisco unity express module and licensing..$$$$) so the goal was also to gain seamless voice mail integration.

Diagram

Image


Cisco Config

(:exclaim:)Warning - I've run into problems getting IOS 12.3(15) working with the following examples. Many of the commands shown were not available; things like the system message command, for example. An upgrade to 12.4(2)T solved the issues. I am running this test of CME on a 3745. Carry on. - RickL

The below is a subset of the full configuration with only the relevant parts, there is no provision for dialing out the PRI etc..etc. nor does it contain any fail over configuration, a sensible configuration would provide a higher precedence call route via the PSTN should the SIP session establishment fail.

There are also many references to e164 numbers... I have replaced our private numbers with a generic 5555xxx range which is no really valid, it should be possible to re-populate the configuration with full e164 numbers but it will probably need some changes at both ends to work properly as I've hacked the config significantly. i suggest using full e164 numbers where possible, it makes the system more extendable and things like ENUM easy.

voice translation-rule 1
rule 1 /^3\(..\)/ /55553\1/

voice translation-profile 4Digits2E164
translate called 1

'; Dial plan for 55553xx via SIP to host 10.0.0.200'

dial-peer voice 100 voip
destination-pattern 55553..
monitor probe icmp-ping
session protocol sipv2
session target ipv4:10.0.0.200
dtmf-relay rtp-nte
codec g711alaw

; Dial Plan for voicemail extentions 10x via sip to host 10.0.0.200
; ip2ip redirects for hairpin calls from Asterisk back to Asterisk voicemail via a 3xx redirect on busy/no answer
; Compatable DTMF for voicemail

dial-peer voice 101 voip
destination-pattern 10.
redirect ip2ip
session protocol sipv2
session target ipv4:10.0.0.200
dtmf-relay rtp-nte
codec g711alaw
no vad

; Dial-peer to allow the calling of the 3xx range of extentions, the number is expanded to the full e164 number via the 4Digits2E164 translation-profile.
; See notes on e164 numbers.

dial-peer voice 102 voip
translation-profile outgoing 4Digits2E164
destination-pattern 3..
monitor probe icmp-ping
session protocol sipv2
session target ipv4:10.0.0.200
dtmf-relay rtp-nte
codec g711alaw

; Incoming calls to 55552xx range via SIP.

dial-peer voice 200 voip
session protocol sipv2
incoming called-number 55552..
dtmf-relay rtp-nte
codec g711alaw

telephony-service
calling-number local
;calling-number local secondary may make life easier, because they are dule line phones you can choose which number is used for caller-id, My choice is to use
;the full number which can then be chomped down to the local extention numbers.
dialplan-pattern 1 55552.. extension-length 3
voicemail 105
transfer-system full-blind

ephone-dn 1 dual-line
number 201 no-reg primary
description 555-5201
call-forward busy 107
call-forward noan 106 timeout 15

ephone-dn 2 dual-line
number 202 no-reg primary
description 555-5202
call-forward busy 107
call-forward noan 106 timeout 15



Asterisk Config

I won't touch on the SIP config, it is assumed you have a working configuration and your sip based phones are available on channel SIP/extension. The contexts shown below will also need to be included or copied into the appropriate places in your existing configuration.

extensions.conf


[0ut-ccme]
exten => _5555XXX,1,Dial(SIP/8${EXTEN}@10.0.0.100,60,t)
;Just a guess but this should work...
exten => _2XX,1,Dial(SIP/5555${EXTEN}@10.0.0.100,60,t)


[ccme]
; The host declaration for your Cisco router should include the statement "context = cme" meaning incoming calls from the source will be contained within this ;(ccme) context.
include => vm
include => phones
include => did

[vm]
;Standard voicemail login prompt
exten => 101,1,VoicemailMain
exten => 101,2,Hangup

;CCME Specific VM
;Voice mail Key on 79xx - need to use the last 3 digits of the CallerID. See notes on "calling-number local secondary" in the telephony-service section
;of the cisco config
exten => 105,1,NoOp,${CALLERIDNUM}
exten => 105,2,Background(silence/1)
exten => 105,3,VoicemailMain(s${CALLERIDNUM:-3})
exten => 105,4,Hangup
exten => 105,104,Hangup

;Transfer on unavailable.
; I playback 1 second of silence to allow the call to establish correctly else the start of the audio gets cut off, if you have silence suppression or something
; I guess you could play a beep.
; Because the call is being transfered the variable ${CALLERIDNUM} contains the number of the calling device not the divice they were calling
; This would mean you would end up in your own or a non existant mailbox, the variable ${RDNIS} contains the number
; the call was redirected from and therefore can be used to specify the correct mailbox number.
exten => 106,1,NoOp,${CALLERIDNUM}
exten => 106,2,NoOp,${RDNIS}
exten => 106,3,Playback(silence/1)
exten => 106,4,Voicemail2(u${RDNIS})
exten => 106,5,Hangup
exten => 106,106,Hangup

;Transfer on busy.
;see notes above, just sets the b flag for the voicemail application to stat the call was busy (as apposed to unavailable).
exten => 107,1,NoOp,${CALLERIDNUM}
exten => 107,2,NoOp,${RDNIS}
exten => 107,3,Playback(silence/1)
exten => 107,4,Voicemail2(b${RDNIS})
exten => 107,5,Hangup
exten => 107,106,Hangup

[phones]
; Internal Extentions
exten => 301,1,Macro(std_ext,SIP/301)
exten => 302,1,Macro(std_ext,SIP/302)

;The macro referenced in above is something similar to
;
;[macro-std_ext]
; exten => s,1,Dial(${ARG1},20,t)
; exten => s,2,Voicemail2(u${MACRO_EXTEN})
; exten => s,3,Hangup
; exten => s,102,Voicemail2(b${MACRO_EXTEN})
; exten => s,103,Hangup

[did]
;The referenced macro just does some caller_id lookups and modification, it could just as easily be a direct sip channel or the std_ext macro above.
exten => 5555300,1,Macro(did,SIP/101) ; Added for convenience/ external voice mail access
exten => 5555301,1,Macro(did,SIP/301) ; Extention 301's DID
exten => 5555302,1,Macro(did,SIP/302) ; Extention 302's DID



MWI (Voicemail) Notes

MWI is not perfect due to a possible bug and RFC compliance issue (discussed here. The solution is quite workable but not ideal, it would be nice to not have to have all the sip registration mess but.. meh..

In my configuration I chose to register the extension number (it get tiresome listening to Alison reading the full e164 number). The following config makes this work.

Cisco
;Defines the sip-ua registration parameters.
sip-ua
registrar ipv4:10.0.0.200 expires 3600 secondary
sip-server ipv4:10.0.0.200

;Defines where the mailbox status messages will be coming from.
telephony-service
voicemail 105
mwi sip-server 10.0.0.200 unsolicited

;Defines 204 as the secondary number (the primary is the e164 number), above in the register line you can see the secondary
;number is the one used for registration
ephone-dn 3 dual-line
number 204

sip.conf
;Each extension must be configured setting the relevant mailbox as described in voicemail.conf
[204]
context=cme
type=friend
host=dynamic
canreinvite=no
mailbox=204

voicemail.conf
201 => 201,Test User,user@company.com
204 => 201,Test User,user@company.com


References

Thanks to Kurt W. Pasewaldt, who's page I found after when searching for information on MWI, Kurt should be credited this information

http://www.pasewaldt.com/cme/cme_index.html

The "redirect ip2ip" is needed in IOS 123.14T or greater because of the following bug reference: CSCef72436.

Kurt Pasewaldt



Another Example

You can see another example with a Cisco 2801 and a VIC2-2BRI-NT/TE on http://vt100.at/?site=doc/105

Harald Klein

Help

Questions relating to the above configuration sould be directed to me at nathanalberti.com
Created by: alberti_n, Last modification: Thu 27 of Jan, 2011 (23:57 UTC) by kurt
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+