I think that I need to register the actual DID phone number, but not quite sure where and how to register that. Localnet calls work fine.
failed attempt to dial out:
mordor*CLI>
== Using SIP RTP CoS mark 5
[Jul 1 06:22:06] NOTICE[2280][C-00000012]: chan_sip.c:25545 handle_request_invite: Call from 'hawat' (192.168.1.6:5060) to extension '18002506510' rejected because extension not found in context 'myphones'.
mordor*CLI>
mordor*CLI>
[Jul 1 06:23:25] NOTICE[2280]: chan_sip.c:27554 handle_request_subscribe: Received SIP subscribe for peer without mailbox: hawat
[Jul 1 06:24:32] NOTICE[2280]: chan_sip.c:27554 handle_request_subscribe: Received SIP subscribe for peer without mailbox: hawat
-- Unregistered SIP 'hawat'
mordor*CLI>
what works:
mordor*CLI>
mordor*CLI> sip show channels
Peer User/ANR Call ID Format Hold Last Message Expiry Peer
192.168.1.5 (None) 7654d6af-1a4567 (nothing) No Rx: NOTIFY <guest>
1 active SIP dialog
mordor*CLI>
mordor*CLI> sip show peers
Name/username Host Dyn Forcerport Comedia ACL Port Status Description
12345678GW1/12345678 63.247.69.226 Yes Yes 5060 OK (82 ms)
12345678GW2/12345678 205.251.137.154 Yes Yes 5060 OK (71 ms)
demo_alice (Unspecified) D Yes Yes 0 UNKNOWN
demo_bob (Unspecified) D Yes Yes 0 UNKNOWN
hawat/hawat 192.168.1.6 D Yes Yes 5060 OK (813 ms)
thufir/thufir 192.168.1.5 D Yes Yes 5062 OK (44 ms)
6 sip peers [Monitored: 4 online, 2 offline Unmonitored: 0 online, 0 offline]
mordor*CLI>
[Jul 1 06:18:25] NOTICE[2280]: chan_sip.c:27554 handle_request_subscribe: Received SIP subscribe for peer without mailbox: hawat
mordor*CLI>
mordor*CLI>
== Using SIP RTP CoS mark 5
-- Executing [6003@myphones:1] Dial("SIP/hawat-00000017", "SIP/thufir,20") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/thufir
-- SIP/thufir-00000018 is ringing
-- SIP/thufir-00000018 answered SIP/hawat-00000017
-- Channel SIP/hawat-00000017 joined 'simple_bridge' basic-bridge <a8ac969d-5194-4bb7-ba05-a7f3c2a886b6>
-- Channel SIP/thufir-00000018 joined 'simple_bridge' basic-bridge <a8ac969d-5194-4bb7-ba05-a7f3c2a886b6>
-- Channel SIP/thufir-00000018 left 'native_rtp' basic-bridge <a8ac969d-5194-4bb7-ba05-a7f3c2a886b6>
-- Channel SIP/hawat-00000017 left 'native_rtp' basic-bridge <a8ac969d-5194-4bb7-ba05-a7f3c2a886b6>
== Spawn extension (myphones, 6003, 1) exited non-zero on 'SIP/hawat-00000017'
mordor*CLI>
the sip.conf and extensions.conf files:
root@mordor:/etc/asterisk#
root@mordor:/etc/asterisk# cat sip.conf
[general]
externip = 123.456.789.012
localnet=192.168.1.0/255.255.255.0
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
directmedia=yes
nat=force_rport,comedia
session-timers=refuse
localnet=192.168.1.0/255.255.255.0
qualify=yes
register => 12345678:nvgfdslhfhs@gw1.siptrunk.com
[12345678GW1]
type=peer
insecure=port,invite
host=gw1.siptrunk.com
port=5060
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
qualify=yes
qualifyfreq=30
nat=force_rport,comedia
trustrpid=yes
fromdomain=gwX.siptrunk.com
username=12345678
secret=gfjklsjklfhds
context=from-trunk
rfc2833compensate=yes
session-timers=refuse
[12345678GW2]
type=peer
insecure=port,invite
host=gw2.siptrunk.com
port=5060
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
qualify=yes
qualifyfreq=30
nat=force_rport,comedia
trustrpid=yes
fromdomain=gw2.siptrunk.com
username=12345678
secret=jfdklhgflsdlkf
context=from-trunk
rfc2833compensate=yes
session-timers=refuse
[demo_alice]
type=friend
host=dynamic
secret=123
context=myphones
qualify=yes
[demo_bob]
type=friend
host=dynamic
secret=123
context=myphones
qualify=yes
[thufir]
type=friend
host=dynamic
secret=123
context=myphones
qualify=yes
[hawat]
type=friend
host=dynamic
secret=123
context=myphones
qualify=yes
root@mordor:/etc/asterisk#
root@mordor:/etc/asterisk# cat 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/6003)
exten => s,n,Hangup()
[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 => 555,1,Playback(hello-world)
exten => 555,n,Playback(echo-test)
exten => 555,n,Echo
exten => 555,n,Playback(demo-echodone)
exten=>4000,1,Playback(tt-monkeys)
exten=>5000,1,Playback(tt-monkeysintro)
exten=>6001,1,Dial(SIP/demo_alice,20)
exten=>6002,1,Dial(SIP/demo_bob,20)
exten=>6003,1,Dial(SIP/thufir,20)
exten=>6004,1,Dial(SIP/hawat,20)
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()
; 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()
root@mordor:/etc/asterisk#
I think I just need a pointer on how to input the DID as, I think, a register string?