Sean’s Obsessions

Sean Walberg’s blog

Asterisk and an AS5350 SIP Peer

I’ve been playing with Asterisk lately, and needed to get out to the PSTN. Since I had a Cisco AS5350 with a PRI attached for incoming RAS, I figured I could use that. I also had some DIDs on the line that I could use to separate voice and data calls.

Googling around, I couldn’t find a good example of anyone who has done it, so I was on my own.

My goals here were simple:

  1. People dialing 555-1111 should be picked up by the AS5350’s internal modems
  2. People dialing 555-222X should be forwarded to my Asterisk box for handling
  3. The Asterisk box should be able to dial out using the PRI

Already the DIDs were assigned to this PRI, so that wasn’t a problem.

The configuration on the AS5350 is fairly straightforward once you get it working:

voice service voip
! Bind the SIP and RTP sessions to a known interface
bind control source-interface FastEthernet0/0
bind media source-interface FastEthernet0/0
! Normal T1-PRI configuration using all channels
controller T1 3/0
framing esf
linecode b8zs
cablelength short 133
pri-group timeslots 1-24
! Anything not picked up by a dial peer defaults to a modem call
interface Serial3/0:23
isdn incoming-voice modem
! Use a data dial-peer to answer anything to 555-1111 with a modem
dial-peer data 10 pots
incoming called-number 5551111
! Match inbound calls to the voice DIDs
dial-peer voice 100 pots
incoming called-number 555222.
! All digits are collected and sent along
forward-digits extra
! The IP leg of the call... send to the sip server defined below
dial-peer voice 200 voip
destination-pattern 555222.
session protocol sipv2
session target sip-server
! Any digits collected after the call has been answers get forwarded
dtmf-relay sip-notify rtp-nte
! I want g711 ulaw for a codec
codec g711ulaw
! Anything else gets sent out the PSTN
! Note you need the data dial-peer above to accept modem calls, otherwise
! this dial-peer will give dialtone to anyone who calls!
dial-peer voice 1000 pots
application session
destination-pattern .T
port 3/0:D
forward-digits all
! define your SIP server
authentication username USERNAME password PASSWORD
! represents the Asterisk box
registrar expires 3600

After that, it’s just a matter of configuring a sip peer in /etc/asterisk/sip.conf


I’m trying something new here. Talk to me on Twitter with the button above, please.