Home > VoIP > Cisco router with FXO as an Asterisk gateway

Cisco router with FXO as an Asterisk gateway

It occured to me that I never wrote up how I managed to get Asterisk working with my Cisco 1760 as an FXO gateway. So, here it is:

I have a Cisco 1760 that began it’s life as a CallManager Express (CME). After a while I transitioned it to an MGCP gateway for CM 4.1 and then just a SIP gateway for the same CM4.1 See, CallerID didn’t work for my VIC with MGCP, but it worked with SIP. Now the router is a SIP gateway for Asterisk, which is my primary system. Verizon comes into the FXO on the router and then is trunked via SIP to Asterisk. So…on to the configs. Here’s the important part of the router config:

!
voice rtp send-recv
!
voice service voip
allow-connections h323 to h323
allow-connections h323 to sip
allow-connections sip to h323
!
!
voice-port 0/0
timing hookflash-out 50
connection plar 401
caller-id enable
!
dial-peer voice 8 pots
destination-pattern 8.T
port 0/0
!
dial-peer voice 400 voip
destination-pattern 4..
session protocol sipv2
session target ipv4:192.168.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:192.168.x.x
!
!
telephony-service
fxo hook-flash
max-conferences 4 gain -6
transfer-system full-blind
transfer-pattern ….

I’m quite certain all of that is not necessary but it works, so I’ll leave it alone.

Here’s the config in AMP. I got this working through the raw config files but wanted to figure it out in AMP. If you’re going to use A@H and AMP it’s best to get it working through AMP. AMP has a nice habit of writing over certain files because it know’s it correct! Anyway, here’s the config for the SIP trunk:

Outbound caller-id: Set to your PSTN number (although I don’t think it matters)
Max Channels: Set to 2 but I think it should probably be 1
Dial Rules: Whatever’s appropriate for you situation
Outgoing Settings: trunk name should be something meaningful
allow=ulaw
context=from-pstn
disallow=all
dtmfmode=rfc2833
host=192.168.x.x
insecure=very
ipaddr=192.168.x.x
type=peer

Replace x.x with the address of the router. Make sure to add the insecure=very! I can’t tell you how important that is. I went round and round before stumbling across that. The partial tutorials on the intarweb don’t specify that. From what I can understand you need this because there’s no means of authenticating the SIP session with the router, aside from the source IP address.

Leave everything else blank. Don’t forget to add your outbound routing dial patterns.

That’s it. If someone has a comment please email me or leave it in the comments here.

Categories: VoIP Tags:
  1. Jim
    February 7th, 2011 at 11:32 | #1

    Hy all, I have made the interconnection wint 1760 and Asterisk, and everything is OK (For about 15 Minutes). After that I get in the CLI:
    ===============================
    set_destination: Parsing for address/port to send to
    set_destination: set destination to 192.168.0.56, port 5060
    Audio is at 172.16.12.59 port 18248
    Adding codec 0×8 (alaw) to SDP
    Adding non-codec 0×1 (telephone-event) to SDP
    Reliably Transmitting (NAT) to 192.168.0.56:55350:
    INVITE sip:2310688184@192.168.0.56:5060 SIP/2.0
    Via: SIP/2.0/UDP 172.16.12.59:5060;branch=z9hG4bK69033545;rport
    Max-Forwards: 70
    From: ;tag=as1fc2060e
    To: ;tag=E8764B79-16C6
    Contact:
    Call-ID: FF2BA038-319711E0-9C32BD05-1C07ED8A@192.168.0.56
    CSeq: 102 INVITE
    User-Agent: FPBX-2.8.1(1.6.2.13)
    Require: timer
    Session-Expires: 1800;refresher=uas
    Min-SE: 90
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
    Supported: replaces, timer
    X-asterisk-Info: SIP re-invite (Session-Timers)
    Content-Type: application/sdp
    Content-Length: 237

    v=0
    o=root 1270771100 1270771100 IN IP4 172.16.12.59
    s=Asterisk PBX 1.6.2.13
    c=IN IP4 172.16.12.59
    t=0 0
    m=audio 18248 RTP/AVP 8 101
    a=rtpmap:8 PCMA/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    a=sendrecv

    SIP/2.0 420 Bad Extension
    Via: SIP/2.0/UDP 172.16.12.59:5060;branch=z9hG4bK69033545;rport
    From: ;tag=as1fc2060e
    To: ;tag=E8764B79-16C6
    Call-ID: FF2BA038-319711E0-9C32BD05-1C07ED8A@192.168.0.56
    CSeq: 102 INVITE
    Unsupported: timer
    Content-Length: 0

    — (8 headers 0 lines) —
    — Got SIP response 420 “Bad Extension” back from 192.168.0.56
    set_destination: Parsing for address/port to send to
    set_destination: set destination to 192.168.0.56, port 5060
    Transmitting (NAT) to 192.168.0.56:5060:
    ACK sip:2310688184@192.168.0.56:5060 SIP/2.0
    Via: SIP/2.0/UDP 172.16.12.59:5060;branch=z9hG4bK69033545;rport
    Max-Forwards: 70
    From: ;tag=as1fc2060e
    To: ;tag=E8764B79-16C6
    Contact:
    Call-ID: FF2BA038-319711E0-9C32BD05-1C07ED8A@192.168.0.56
    CSeq: 102 ACK
    User-Agent: FPBX-2.8.1(1.6.2.13)
    Content-Length: 0


    — Executing [h@macro-dial:1] Macro(“SIP/Cisco-0000009f”, “hangupcall”) in new stack
    — Executing [s@macro-hangupcall:1] GotoIf(“SIP/Cisco-0000009f”, “1?skiprg”) in new stack
    — Goto (macro-hangupcall,s,4)
    — Executing [s@macro-hangupcall:4] GotoIf(“SIP/Cisco-0000009f”, “0?skipblkvm”) in new stack
    — Executing [s@macro-hangupcall:5] NoOp(“SIP/Cisco-0000009f”, “Cleaning Up Block VM Flag: BLKVM/600/SIP/Cisco-0000009f”) in new stack
    — Executing [s@macro-hangupcall:6] NoOp(“SIP/Cisco-0000009f”, “Deleting: BLKVM/600/SIP/Cisco-0000009f “) in new stack
    — Executing [s@macro-hangupcall:7] GotoIf(“SIP/Cisco-0000009f”, “1?theend”) in new stack
    — Goto (macro-hangupcall,s,9)
    — Executing [s@macro-hangupcall:9] Hangup(“SIP/Cisco-0000009f”, “”) in new stack
    == Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/Cisco-0000009f’ in macro ‘hangupcall’
    == Spawn extension (macro-dial, s, 7) exited non-zero on ‘SIP/Cisco-0000009f’ in macro ‘dial’
    == Spawn extension (ext-group, 600, 14) exited non-zero on ‘SIP/Cisco-0000009f’
    == MixMonitor close filestream
    == End MixMonitor Recording SIP/Cisco-0000009f
    Elastix203*CLI>
    ===============================

    Have you ever met the same eroor anyone?

Comment pages
1 2 111
  1. No trackbacks yet.

The Cruft Of My Brain is Stephen Fry proof thanks to caching by WP Super Cache