Thursday, December 30, 2010

Cisco 2811 and Asterisk/FreePBX

A few months ago I had to install an analog fax machine in one of our offices (could we forget about fax machines on a global scale, by the way?).
We use a FreePBX server and SIP-based Grandstream phones, and we don't have a phone line in that office, so I wanted to use our VOIP system. Luckily, we had an idle Cisco 2811 in that office with this config:

System image file is "flash:c2800nm-advipservicesk9-mz.124-9.T7.bin"
Cisco 2811 (revision 53.51) with 237568K/24576K bytes of memory.

Processor board ID XXXXXXXXXX
2 FastEthernet interfaces
1 Serial(sync/async) interface
3 ISDN Basic Rate interfaces
1 Virtual Private Network (VPN) Module
4 Voice FXS interfaces



Here's what the config looks like on the IOS side:

!
voice-port 1/1/0
input gain 10
output attenuation 10
no comfort-noise
cptone HU
!
dial-peer voice 399 voip
destination-pattern .T
session protocol sipv2
session target ipv4:192.168.13.248
session transport udp
dtmf-relay rtp-nte
codec g711ulaw
fax protocol t38 ls-redundancy 0 hs-redundancy 0 fallback pass-through g711ulaw
!
dial-peer voice 100 pots
destination-pattern 3399
port 1/1/0
authentication username 3399 password 01234567891234
!
sip-ua
retry invite 3
retry response 3
retry bye 3
retry cancel 3
timers trying 1000
mwi-server ipv4:192.168.13.248 expires 3600 port 5060 transport udp unsolicited
registrar ipv4:192.168.13.248 expires 300
sip-server ipv4:192.168.13.248
!



and on the Asterisk side:

[3399]
deny=0.0.0.0/0.0.0.0
secret=xxxxxxx
dtmfmode=rfc2833
canreinvite=no
context=from-internal
host=dynamic
type=friend
nat=yes
port=5060
qualify=yes
callgroup=
pickupgroup=
dial=SIP/3399
mailbox=3399@device
permit=0.0.0.0/0.0.0.0
callerid=device <3399>
call-limit=50


A few things the IOS is bitchy about:
  • you must have a SIP secret. Our standard phones login without one, but IOS needs a secret.
  • the SIP username must be at least 4 chars long. We use 3 char names by default, so I had to prepend an additional '3' character.
As for the config: 192.168.13.248 is the FreePBX server of course, and you might have to play around with the destination-pattern.