login | register
Sun 07 of Sep, 2008 [22:07 UTC]

voip-info.org

Asterisk cisco FXO

Created by: flavour,Last modification on Sun 11 of Nov, 2007 [08:28 UTC] by Heywood

How to connect a Cisco Router with FXO module to Asterisk

Cisco routers support FXO or FXS voice interface cards (aka VIC). Either SIP or H.323 can be used for call signalling. VICs are installed into low density voice modules (NM-1V, or NM-2V) in a Cisco 2600/3600/3700 router. Data Sheet.

  • REGISTER: Cisco gateway doesn't usually REGISTER with SIP servers, but later versions of IOS can (in order to register FXS ports, for instance)
  • Codecs: Cisco gateway do not support GSM, iLBC & Speex CODECs. Prior to Cisco IOS Software Release 12.0(5)T, VoIP gateways only supported the G.729 and G.711 codecs and only one voice call per DSP. Version 12.0(5)T has added support for G.723 and G.726, and now support up to four voice/fax-relay calls per DSP. More on Cisco DSPs.

Here are the codecs Cisco offers at the router:
clear-channel  Clear Channel 64000 bps
g711alaw       G.711 A Law 64000 bps
g711ulaw       G.711 u Law 64000 bps
g723ar53       G.723.1 ANNEX-A 5300 bps
g723ar63       G.723.1 ANNEX-A 6300 bps
g723r53        G.723.1 5300 bps
g723r63        G.723.1 6300 bps
g726r16        G.726 16000 bps
g726r24        G.726 24000 bps
g726r32        G.726 32000 bps
g728           G.728 16000 bps
g729br8        G.729 ANNEX-B 8000 bps
g729r8         G.729 8000 bps
gsmefr         GSMEFR 12200 bps
gsmfr          GSMFR 13200 bps

Sample configuration

sip.conf
[general]
port=5060
bindaddr=0.0.0.0
;videosupport=yes  ; Gives an error: "process_sdp: Error in codec string 'ideo 0'"
disallow=all
allow=ulaw
context=bogon-calls

[y.y.y.y]
context=pstn-incoming
type=friend
host=y.y.y.y ; IP address of Cisco gateway
dtmfmode=rfc2833
disallow=all
allow=ulaw

[1001]
context=local-phones
type=friend
username=1001
secret=secret
host=dynamic
mailbox=1001

extensions.conf
[bogon-calls]
exten => _.,1,Congestion

[pstn-incoming]
include => lan-phones

[local-phones]
include => lan-phones
include => pstn-outbound

[pstn-outbound]
; Calls starting with 9 have the 9 stripped & are then routed out to the PSTN
;exten => _9.,1,Dial(SIP/${EXTEN:1}@y.y.y.y) ; IP address of Cisco gateway
; 9 stripped by Cisco gateway
exten => _9XXXX,1,Dial,SIP/${EXTEN}@y.y.y.y ; IP address of Cisco gateway
exten => _9XXXX,2,Congestion

[lan-phones]
exten => 1001,1,Dial(SIP/1001,20)
exten => 1001,2,Voicemail(u1001)
exten => 1001,102,Voicemail(b1001)
exten => 1001,103,Hangup

Cisco config
! SIP requires routers to be set to use GMT
clock timezone GMT 0

voice-port 1/0/0
 ! We are in the UK
 cptone GB
 input gain 10
 output attenuation 10
 no comfort-noise
 ! Route all calls into this FXO port on to extension 1001
 connection plar opx 1001

! PSTN gateway (PBX)
! 9 is stripped
dial-peer voice 100 pots
 destination-pattern 9....
! The above line will match anything passed from * to the Cisco starting with a 9, the dial peer then strips the 9 and passes it to the FXO port
! If you want to match any dialed number from * starting with 9, use destination-pattern 9T
 port 1/0/0
 forward-digits 4

dial-peer voice 2 voip
 description Route calls starting with 1 to the Asterisk PBX
 destination-pattern 1...
 session protocol sipv2
 ! x.x.x.x = IP address of *
 session target ipv4:x.x.x.x:5060
 session transport udp
 dtmf-relay rtp-nte
 codec g711ulaw
 ! if clid is present then Asterisk tries to mtach that as a user
 clid strip
 no vad



sip-ua
 retry invite 3
 retry response 3
 retry bye 3
 retry cancel 3
 timers trying 1000
 ! x.x.x.x = IP address of *
 sip-server ipv4:x.x.x.x

If using G729:

Caller ID

The VIC-2FXO voice interface card does not support Caller ID. In order to support that, you will need battery reversal support (in the US, VIC-2FXO-M1; in Europe, VIC-2FXO-M2, etc.). More on Cisco FXO interfaces: http://cisco.com/en/US/products/hw/routers/ps274/products_tech_note09186a00800b53c7.shtml

If you have a VIC-2FXO-M1 and wish to have Caller ID information passed through to Asterisk, you need to set up a null translation rule for that voice port. For example:

translation-rule 1
  rule 1 null null
voice-port 1/0/0
  translate calling 1
  translate called 1
  caller-id enable

This will permit Caller ID information to be passed through to the SIP connection.

Another Take on Caller ID

I may have inadvertently backed into a solution on this issue. I previously had figured out how to make the VIC-2FXO (not VIC-2FXO-M1) work with CallManager 4.1. The issue there was that CLID didn't work with MGCP, but research lead me to a solution that did work for that card with H.323. So, when I converted these ports to SIP for Asterisk, I found that they passed caller ID just fine! Here is the relevant configuration:

voice-port 1/0/0
 output attenuation -1
 no comfort-noise
 connection plar opx 7145551212
 description 71455551212
 caller-id enable

dial-peer voice 1 pots
 incoming called-number .
 destination-pattern .
 port 1/0/0

dial-peer voice 100 voip
 preference 1
 incoming called-number .
 destination-pattern 7145551212
 progress_ind setup enable 3
 session protocol sipv2
 session target ipv4:x.x.x.x:5060
 session transport udp
 dtmf-relay rtp-nte
 codec g711ulaw
 no vad

sip-ua 
 retry invite 3
 retry response 3
 retry bye 3
 retry cancel 3
 timers trying 1000
 sip-server ipv4:x.x.x.x

I haven't yet determined if all of this is in fact required, just that we are using this configuration (with our real numbers of course) and we see caller ID just fine. I hope this helps someone! The IOS version in this case was 12.3(21), which may be an alternate explanation for why various folks say it won't work and yet it in fact did.

See also



Comments

Comments Filter
222

333CallerID doesnt work

by jfinley, Tuesday 09 of January, 2007 [17:58:34 UTC]
I cannot get the callerID to work even after using said example.
222

333CallerID doesnt work

by jfinley, Tuesday 09 of January, 2007 [17:58:27 UTC]
I cannot get the callerID to work even after using said example.
222

333CallerID doesnt work

by jfinley, Tuesday 09 of January, 2007 [17:58:17 UTC]
I cannot get the callerID to work even after using said example.