I am trying a simple configuration setting up sip.conf and extensions.conf. I have a media gateway that will translate sip calls to PSTN calls and I want to forward all my SIP calls to the gateway.
Here is my sip.conf:
[general]
;context=incoming
allow=ulaw
allow=alaw
allow=gsm
; Register and get calls from Foo Provider, to our number 1-555-455-1337
register => yile:@10.254.1.101
[fooprovider]
type=friend
host=10.254.1.101
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
insecure=port,invite
context=incoming
[outbound_provider]
type=friend
host=10.254.1.101
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
insecure=port,invite
context=outbound
; ------------------------------------
[1000]
type=friend
secret=ku
dtmfmode=rfc2833
callerid=“First Phone” <1000>
; Our phones will register to Asterisk.
; Otherwise we would define the IP address or FQDN of the phone on the following line.
host=dynamic
canreinvite=no
; Deny registration from anywhere first
deny=0.0.0.0/0.0.0.0
; Replace the IP address and mask below with the actual IP address and mask
; of the computer running the softphone, or the address of the hardware phone,
; either a host address and full mask, or a network address and correct mask,
; registering will be allowed from that host/network.
permit=192.168.1.0/255.255.255.0
context=outbound
Here is my extensions.conf:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
; Global variables goes here
[incoming]
exten => s,1,Log(NOTICE, Incoming call from ${CALLERID(all)})
exten => s,n,Dial(SIP/1000)
exten => s,n,Hangup()
; End of the “incoming” context
[myphones]
; When we dial something from the phones we just added in
; sip.conf, Asterisk will look for a matching extension here,
; in this context.
; First Phone, extension 1000. If 1000 is called, here is
; where we land, and the device registered with the
; name 1000, is dialed, after that Asterisk hangs up.
exten => 1000,1,Dial(SIP/1000)
exten => 1000,n,Hangup()
; The same goes for Second Phone, extension 1001
exten => 1001,1,Dial(SIP/1001)
exten => 1001,n,Hangup()
; Testing extension, prepare to be insulted like a
; Monthy Python knight
exten => 201,1,Answer()
exten => 201,n,Playback(tt-monty-knights)
exten => 201,n,Hangup()
; Echo-test, it is good to test if we have sound in both directions.
; The call is answered
exten => 202,1,Answer()
; Welcome message is played
exten => 202,n,Playback(welcome)
; Play information about the echo test
exten => 202,n,Playback(demo-echotest)
; Do the echo test, end with the # key
exten => 202,n,Echo()
; Plays information that the echo test is done
exten => 202,n,Playback(demo-echodone)
; Goodbye message is played
exten => 202,n,Playback(vm-goodbye)
; Hangup() ends the call, hangs up the line
exten => 202,n,Hangup()
[outbound]
; Call POTS numbers through Foo Provider (any number longer than 5 digits starting with 9)
exten => _9XXXX.,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN:1} through Foo Provider)
exten => _9XXXX.,n,Dial(SIP/fooprovider/${EXTEN:1},60)
exten => _9XXXX.,n,Playtones(congestion)
exten => _9XXXX.,n,Hangup()
I have a SIP phone that I try and dial 9-3096 (3096 is a valid extension on the media gateway) but I get the error:
[Feb 25 09:05:04] NOTICE[3331][C-00000001] chan_sip.c: Call from ‘’ (192.168.3.6:53288) to extension ‘93096’ rejected because extension not found in context ‘default’.
For now I just want all outbound (from my SIP phone to the PSTN) calls to work by going through the media gateway.
Thanks for any help in advance,
Y-