January 25, 2007

268 words 2 mins read

Dial-Peers on Cisco 3600

When I setup the Cisco 3600 in the office to work with asterisk as our FXO ports, I needed incoming and outgoing capabilities. In was easy enough, but out was more tricky because you need to setup specific dial-peer plans. Well for the longest time I had 3 different sets of rules per port (911, Local & Longdistance). Luckily I only had 4 ports, for a total of 12 rules. I thought that was stupid, but never got to fixing it. Recently I have. I found the regex for destination-pattern. Here’s what why new rule’s look like:

_dial-peer voice 100 pots

destination-pattern …%

port 0/0/0

forward-digits all

!_

The above will take all calls that are 3 digits or longer and dial them exactly. (Note: periods are wild cards, and % are 0 or more of the preceding character). The key is to have asterisk send exactly the digits to call and no more. If your like my office, you have an external access number (in my case it is 8). Using ${EXTEN:1} you can drop that in asterisk before it calls out to the cisco. Below is an example of my asterisk’s extensions.conf (Note: 10.10.10.10 is the example IP for the cisco)

_[outgoing-calls]

ignorepat => 8

exten => _8011.,1,Dial(SIP/${EXTEN:1}@10.10.10.10)

exten => _81XXXNXXXXXX,1,Dial(SIP/${EXTEN:1}@10.10.10.10)

exten => _8NXXXXXX,1,Dial(SIP/${EXTEN:1}@10.10.10.10)

exten => _8911,1,Dial(SIP/${EXTEN:1}@10.10.10.10)

exten => _8611,1,Dial(SIP/${EXTEN:1}@10.10.10.10)

exten => _8411,1,Dial(SIP/${EXTEN:1}@10.10.10.10)

_

I could have setup a wild card for 911,611,411 and others, but I’d rather have specific control over what number people can call. Of the same is true with the international calling, but for now I don’t have to worry about that.