[Asterisk-Users] Cisco and Asterisk

Ben Miller ruiner at netslacking.net
Thu Mar 10 16:39:31 MST 2005


Hey all,

I'm pretty new to Asterisk and VoIP in general, so I'm hoping I can get 
a bit of help here.

First I'll explain my setup, and then my problem.

Right now I have a Cisco 3640 with a VIC2FXO card in it which has 2 FXO 
ports.  I have an analog phone line plugged into the first port 
(voice-port 1/0/0).  I've got it setup so that calls coming into that 
analog line are transferred to my Asterisk server via SIP.

In the second port on my FXO card, I have a phone cable plugged into a 
phone-system phone (the kind you have in the office plugged into your 
phone system, the extra port on it acts as an FXS so a normal phone can 
be plugged into it and can dial out by hitting 9,9 and then a number).

Incoming calls come into my * box fine, and I can hit digits on the 
phone and have different thing happen.  For example, I setup XLite on my 
work laptop and I've got an extension setup to dial my laptop.  What I'm 
trying to do, though, is setup an extension that will connect back to my 
router and let me make an outgoing call on the second voice port.  Every 
time I try to do this, I get SIP errors in the * CLI:

Got SIP response 400 "Bad Request - 'Malformed/Missing URL'" back from 
206.222.200.46.

206.222.200.46 is the IP of my router.  I'm pretty sure that I'm just 
missing some config in my router, but I've been googling the past few 
days and can't get anything that's helping.  Thus, I turn to you to help 
me out, if possible.

I work for an ISP and what we eventually want to do is setup VoIP for 
our broadband customers so they can do unlimited dialing to various 
cities where we have routers, and we'll just through some voice ports 
into those routers and get some lines hooked up.

Here is my relevant config:

sip.conf:

[general]
context=default
port=5060
bindaddr=0.0.0.0
srvlookup=yes
disallow=all
allow=ulaw
dtmfmode=inband
nat=never
promiscredir = yes      ; If yes, allows 302 or REDIR to non-local SIP 
address

[voice-gw]			; This is what I've setup for my Cisco
				; has the voice ports
context=demo
type=friend
host=206.222.200.46             ; IP address of Cisco gateway
dtmfmode=inband
disallow=all
allow=ulaw
nat=no
qualify=yes

[ben]				; my work laptop
context=demo
type=friend
username=ben
host=dynamic
disallow=all
allow=ulaw


extensions.conf:

[general]
static=yes
writeprotect=no

; You can include other config files, use the #include command (without 
the ';')
; Note that this is different from the "include" command that includes 
contexts within
; other contexts. The #include command works in all asterisk 
configuration files.
;#include "filename.conf"

; The "Globals" category contains global variables that can be referenced
; in the dialplan with ${VARIABLE} or ${ENV(VARIABLE)} for Environmental 
variable
; ${${VARIABLE}} or ${text${VARIABLE}} or any hybrid
;
[globals]
CONSOLE=Console/dsp                             ; Console interface for demo
;CONSOLE=Zap/1
;CONSOLE=Phone/phone0
IAXINFO=guest                                   ; IAXtel username/password
;IAXINFO=myuser:mypass
TRUNK=Zap/g2                                    ; Trunk interface
TRUNKMSD=1                                      ; MSD digits to strip 
(usually 1 or 0)
;TRUNK=IAX2/user:pass at provider

;
; Any category other than "General" and "Globals" represent
; extension contexts, which are collections of extensions.
;
; Extension names may be numbers, letters, or combinations
; thereof. If an extension name is prefixed by a '_'
; character, it is interpreted as a pattern rather than a
; literal.  In patterns, some characters have special meanings:
;
;   X - any digit from 0-9
;   Z - any digit from 1-9
;   N - any digit from 2-9
;   [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9)
;   . - wildcard, matches anything remaining (e.g. _9011. matches
;       anything starting with 9011 excluding 9011 itself)
;
; For example the extension _NXXXXXX would match normal 7 digit dialings,
; while _1NXXNXXXXXX would represent an area code plus phone number
; preceeded by a one.
;
; Each step of an extension is ordered by priority, which must
; always start with 1 to be considered a valid extension.
;
; Contexts contain several lines, one for each step of each
; extension, which can take one of two forms as listed below,
; with the first form being preferred.  One may include another
; context in the current one as well, optionally with a
; date and time.  Included contexts are included in the order
; they are listed.
;
;[context]
;exten => someexten,priority,application(arg1,arg2,...)
;exten => someexten,priority,application,arg1|arg2...
;
; Timing list for includes is
;
;   <time range>|<days of week>|<days of month>|<months>
;
;include => daytime|9:00-17:00|mon-fri|*|*
;
; ignorepat can be used to instruct drivers to not cancel dialtone upon
; receipt of a particular pattern.  The most commonly used example is
; of course '9' like this:
;
;ignorepat => 9
;
; so that dialtone remains even after dialing a 9.
;

;
; Here are the entries you need to participate in the IAXTEL
; call routing system.  Most IAXTEL numbers begin with 1-700, but
; there are exceptions.  For more information, and to sign
; up, please go to www.gnophone.com or www.iaxtel.com
;
[iaxtel700]
exten => _91700XXXXXXX,1,Dial(IAX2/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel)

;
; The SWITCH statement permits a server to share the dialplain with
; another server. Use with care: Reciprocal switch statements are not
; allowed (e.g. both A -> B and B -> A), and the switched server needs
; to be on-line or else dialing can be severly delayed.
;
[iaxprovider]
;switch => IAX2/user:[key]@myserver/mycontext

[trunkint]
;
; International long distance through trunk
;
exten => _9011.,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _9011.,2,Congestion

[trunkld]
;
; Long distance context accessed through trunk
;
exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _91NXXNXXXXXX,2,Congestion

[trunklocal]
;
; Local seven-digit dialing accessed through trunk interface
;
exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _9NXXXXXX,2,Congestion

[trunktollfree]
;
; Long distance context accessed through trunk interface
;
exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _91800NXXXXXX,2,Congestion
exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _91888NXXXXXX,2,Congestion
exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _91877NXXXXXX,2,Congestion
exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}})
exten => _91866NXXXXXX,2,Congestion

[international]
;
; Master context for international long distance
;
ignorepat => 9
include => longdistance
include => trunkint

[longdistance]
;
; Master context for long distance
;
ignorepat => 9
include => local
include => trunkld

[local]
;
; Master context for local, toll-free, and iaxtel calls only
;
ignorepat => 9
include => default
include => parkedcalls
include => trunklocal
include => iaxtel700
include => trunktollfree
include => iaxprovider
;
; You can use an alternative switch type as well, to resolve
; extensions that are not known here, for example with remote
; IAX switching you transparently get access to the remote
; Asterisk PBX
;
; switch => IAX2/user:password at bigserver/local

[macro-stdexten];
;
; Standard extension macro:
;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well
;   ${ARG2} - Device(s) to ring
;
exten => s,1,Dial(${ARG2},20)                                   ; Ring 
the interface, 20 seconds maximum
exten => s,2,Goto(s-${DIALSTATUS},1)                            ; Jump 
based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)

exten => s-NOANSWER,1,Voicemail(u${ARG1})               ; If 
unavailable, send to voicemail w/ unavail announce
exten => s-NOANSWER,2,Goto(default,s,1)                 ; If they press 
#, return to start

exten => s-BUSY,1,Voicemail(b${ARG1})                   ; If busy, send 
to voicemail w/ busy announce
exten => s-BUSY,2,Goto(default,s,1)                             ; If 
they press #, return to start

exten => _s-.,1,Goto(s-NOANSWER,1)                              ; Treat 
anything else as no answer

exten => a,1,VoicemailMain(${ARG1})                             ; If 
they press *, send the user into VoicemailMain

[demo]
;
; We start with what to do when a call first comes in.
;
exten => s,1,Wait,1                     ; Wait a second, just for fun
exten => s,2,Answer                     ; Answer the line
exten => s,3,DigitTimeout,5             ; Set Digit Timeout to 5 seconds
exten => s,4,ResponseTimeout,10         ; Set Response Timeout to 10 seconds
exten => s,5,BackGround(demo-congrats)  ; Play a congratulatory message
exten => s,6,BackGround(demo-instruct)  ; Play some instructions

exten => 2,1,BackGround(demo-moreinfo)  ; Give some more information.
exten => 2,2,Goto(s,6)

exten => 3,1,SetLanguage(fr)            ; Set language to french
exten => 3,2,Goto(s,5)                  ; Start with the congratulations

exten => 1001,1,Goto(default,s,1)
;
; We also create an example user, 1234, who is on the console and has
; voicemail, etc.
;
exten => 201,1,Playback(transfer,skip)          ; "Please hold while..."
exten => 1234,1,Playback(transfer,skip)         ; "Please hold while..."
;                                       ; (but skip if channel is not up)
exten => 1234,2,Macro(stdexten,1234,${CONSOLE})
;
exten => 1235,1,Voicemail(u1234)                ; Right to voicemail
;
exten => 1236,1,Dial(Console/dsp)               ; Ring forever
exten => 1236,2,Voicemail(u1234)                ; Unless busy

;
; # for when they're done with the demo
;
exten => #,1,Playback(demo-thanks)              ; "Thanks for trying the 
demo"
exten => #,2,Hangup                     ; Hang them up.

;
; A timeout and "invalid extension rule"
;
exten => t,1,Goto(#,1)                  ; If they take too long, give up
exten => i,1,Playback(invalid)          ; "That's not valid, try again"

;
; Create an extension, 500, for dialing the
; Asterisk demo.
;
exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
exten => 500,2,Dial(IAX2/guest at misery.digium.com/s at default)     ; Call 
the Asterisk demo
exten => 500,3,Playback(demo-nogo)      ; Couldn't connect to the demo site
exten => 500,4,Goto(s,6)                ; Return to the start over message.

;
; Create an extension, 600, for evaulating echo latency.
;
exten => 600,1,Playback(demo-echotest)  ; Let them know what's going on
exten => 600,2,Echo                     ; Do the echo test
exten => 600,3,Playback(demo-echodone)  ; Let them know it's over
exten => 600,4,Goto(s,6)                ; Start over


exten => 601,1,Dial(SIP/1 at voice-gw)
exten => 602,1,Dial(SIP/ben)


[default]
include => demo

Cisco 3640 config:

!
voice-port 1/0/0
  input gain 10
  output attenuation 11
  no comfort-noise
  connection plar 1001
!
voice-port 1/0/1
  input gain 10
  output attenuation 11
  no comfort-noise
  connection trunk 1
!
!
mgcp profile default
!
!
!
dial-peer cor custom
!
!
!
dial-peer voice 100 pots
  destination-pattern 9....
  port 1/0/0
  forward-digits 4
!
dial-peer voice 2 voip
  destination-pattern 1...
  session protocol sipv2
  session target ipv4:206.222.200.19:5060
  codec g711ulaw
  no vad
!
dial-peer voice 601 pots
  port 1/0/1
!

voice-gw#sh ver
Cisco Internetwork Operating System Software
IOS (tm) 3600 Software (C3640-P7-M), Version 12.2(15)T14, RELEASE 
SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Sat 28-Aug-04 10:54 by cmong
Image text-base: 0x60008950, data-base: 0x61802000

ROM: System Bootstrap, Version 11.1(19)AA, EARLY DEPLOYMENT RELEASE 
SOFTWARE (fc1)
ROM: 3600 Software (C3640-P7-M), Version 12.2(15)T14, RELEASE SOFTWARE (fc4)

voice-gw uptime is 1 day, 7 hours, 27 minutes
System returned to ROM by reload
System image file is "slot0:c3640-p7-mz.122-15.T14.bin"

cisco 3640 (R4700) processor (revision 0x00) with 126976K/4096K bytes of 
memory.
Processor board ID 09301319
R4700 CPU at 100Mhz, Implementation 33, Rev 1.0
X.25 software, Version 3.0.0.
Bridging software.
1 FastEthernet/IEEE 802.3 interface(s)
2 Voice FXO interface(s)
DRAM configuration is 64 bits wide with parity disabled.
125K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read/Write)
16384K bytes of processor board PCMCIA Slot0 flash (Read/Write)

%Error: No PCMCIA Slot1 flash chip information available

Configuration register is 0x2102


If anyone has any suggestions at all, they would be greatly appreciated. 
  Thanks in advance.

-Ben Miller
ruiner at netslacking.net




More information about the asterisk-users mailing list