[SOLVED] Asterisk Box-SIP Client-->Internet<--SIP Clie

So I’ve got an *@h setup at my headquarters. Everything is working quite well. I decided to setup an extension/phone for my home office so that I could use 3 digit dial to reach my office bound colleagues and bypass the pstn. The IP phone at home (xt 201, Polycom IP300) registers with the * server (filled in phone icon) gets dial tone etc. However when I place a call to a, local to the * box, SIP extension (xt 185) I get:

Connected to Asterisk 1.0.9 currently running on asterisk1 (pid = 3395)
Verbosity is at least 3
    -- Executing Macro("SIP/201-5451", "exten-vm|185@default|185") in new stack
    -- Executing SetVar("SIP/201-5451", "FROMCONTEXT=exten-vm") in new stack
    -- Executing Macro("SIP/201-5451", "record-enable|185|IN") in new stack
    -- Executing GotoIf("SIP/201-5451", "0 > 0?2:4") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing GotoIf("SIP/201-5451", "0?5:8") in new stack
    -- Goto (macro-record-enable,s,8)
    -- Executing GotoIf("SIP/201-5451", "0?9:12") in new stack
    -- Goto (macro-record-enable,s,12)
    -- Executing DBget("SIP/201-5451", "RecEnable=RECORD-IN/185") in new stack
    -- DBget: varname=RecEnable, family=RECORD-IN, key=185
    -- DBget: Value not found in database.
    -- Executing SetVar("SIP/201-5451", "CALLFILENAME=20051129-110810-1133291290.400") in new stack
    -- Executing GotoIf("SIP/201-5451", "0?15:99") in new stack
    -- Goto (macro-record-enable,s,99)
    -- Executing NoOp("SIP/201-5451", "NO RECORDING NEEDED") in new stack
    -- Executing Macro("SIP/201-5451", "dial|15|tr|185") in new stack
    -- Executing GotoIf("SIP/201-5451", "0?4:2") in new stack
    -- Goto (macro-dial,s,2)
    -- Executing GotoIf("SIP/201-5451", "0?4:3") in new stack
    -- Goto (macro-dial,s,3)
    -- Executing SetCIDName("SIP/201-5451", "Dana Morris") in new stack
    -- Executing AGI("SIP/201-5451", "dialparties.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
    --  dialparties.agi: request = dialparties.agi
    --  dialparties.agi: priority = 4
    --  dialparties.agi: extension = s
    --  dialparties.agi: language = en
    --  dialparties.agi: accountcode = 
    --  dialparties.agi: uniqueid = 1133291290.400
    --  dialparties.agi: channel = SIP/201-5451
  dialparties.agi: callerid = Dana
    --  dialparties.agi: context = macro-dial
    --  dialparties.agi: type = SIP
    --  dialparties.agi: rdnis = unknown
    --  dialparties.agi: enhanced = 0.0
    --  dialparties.agi: dnid = 185
  dialparties.agi: Caller ID name is 'Dana Morris' number is '201'
    --  dialparties.agi: Added extension 185 to extension map
    --  dialparties.agi: Extension 185 cf is disabled
    --  dialparties.agi: Extension 185 do not disturb is disabled
  == Parsing '/etc/asterisk/manager.conf': Found
  == Parsing '/etc/asterisk/manager_custom.conf': Found
  == Manager 'admin' logged on from 127.0.0.1
  == Manager 'admin' logged off from 127.0.0.1
  dialparties.agi: Extension 185 has call waiting disabled
    --  dialparties.agi: DbSet CALLTRACE/185 to 201
  dialparties.agi: Dial string is SIP/185|15|tr
    -- AGI Script dialparties.agi completed, returning 0
    -- Executing Dial("SIP/201-5451", "SIP/185|15|tr") in new stack
    -- Called 185
    -- SIP/185-d099 is ringing
    -- Nobody picked up in 15000 ms
    -- Executing GotoIf("SIP/201-5451", "0?s-NOANSWER|1") in new stack
    -- Executing GotoIf("SIP/201-5451", "0?s-NOANSWER|1") in new stack
    -- Executing NoOp("SIP/201-5451", "Sending to Voicemail box 185@default") in new stack
    -- Executing Macro("SIP/201-5451", "vm|185@default|NOANSWER") in new stack
    -- Executing Goto("SIP/201-5451", "s-NOANSWER|1") in new stack
    -- Goto (macro-vm,s-NOANSWER,1)
    -- Executing VoiceMail("SIP/201-5451", "u185@default") in new stack
    -- Playing 'voicemail/default/185/unavail' (language 'en')
    -- Playing 'vm-intro' (language 'en')
    -- Playing 'beep' (language 'en')
    -- Recording the message
    -- x=0, open writing:  /var/spool/asterisk/voicemail/default/185/INBOX/msg0001 format: wav49, 0x9086e90
    -- x=1, open writing:  /var/spool/asterisk/voicemail/default/185/INBOX/msg0001 format: wav, 0x90a62b0
    -- User hung up
  == Spawn extension (macro-vm, s-NOANSWER, 1) exited non-zero on 'SIP/201-5451' in macro 'vm'
  == Spawn extension (macro-exten-vm, s, 7) exited non-zero on 'SIP/201-5451' in macro 'exten-vm'
  == Spawn extension (from-internal, 185, 1) exited non-zero on 'SIP/201-5451'
    -- Executing Macro("SIP/201-5451", "hangupcall") in new stack
    -- Executing ResetCDR("SIP/201-5451", "w") in new stack
    -- Executing NoCDR("SIP/201-5451", "") in new stack
    -- Executing Wait("SIP/201-5451", "5") in new stack
    -- Executing Hangup("SIP/201-5451", "") in new stack
  == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/201-5451' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/201-5451'

This causes the called extension to ring, and regardless of the line being picked up, or being moved to VM there is no audio on the calling end.

If someone at the office dials my soho extension, my soho phone rings, but the caller gets an “unavailable” message directly after placing the call, no ringing at all. Below is the output of that scenario:

 -- Executing Macro("SIP/199-a7ab", "exten-vm|201@default|201") in new stack
    -- Executing SetVar("SIP/199-a7ab", "FROMCONTEXT=exten-vm") in new stack
    -- Executing Macro("SIP/199-a7ab", "record-enable|201|IN") in new stack
    -- Executing GotoIf("SIP/199-a7ab", "0 > 0?2:4") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing GotoIf("SIP/199-a7ab", "0?5:8") in new stack
    -- Goto (macro-record-enable,s,8)
    -- Executing GotoIf("SIP/199-a7ab", "0?9:12") in new stack
    -- Goto (macro-record-enable,s,12)
    -- Executing DBget("SIP/199-a7ab", "RecEnable=RECORD-IN/201") in new stack
    -- DBget: varname=RecEnable, family=RECORD-IN, key=201
    -- DBget: Value not found in database.
    -- Executing SetVar("SIP/199-a7ab", "CALLFILENAME=20051129-111439-1133291679.410") in new stack
    -- Executing GotoIf("SIP/199-a7ab", "0?15:99") in new stack
    -- Goto (macro-record-enable,s,99)
    -- Executing NoOp("SIP/199-a7ab", "NO RECORDING NEEDED") in new stack
    -- Executing Macro("SIP/199-a7ab", "dial|15|tr|201") in new stack
    -- Executing GotoIf("SIP/199-a7ab", "0?4:2") in new stack
    -- Goto (macro-dial,s,2)
    -- Executing GotoIf("SIP/199-a7ab", "0?4:3") in new stack
    -- Goto (macro-dial,s,3)
    -- Executing SetCIDName("SIP/199-a7ab", "Mila Hiles") in new stack
    -- Executing AGI("SIP/199-a7ab", "dialparties.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
    --  dialparties.agi: request = dialparties.agi
    --  dialparties.agi: priority = 4
    --  dialparties.agi: extension = s
    --  dialparties.agi: language = en
    --  dialparties.agi: accountcode = 
    --  dialparties.agi: uniqueid = 1133291679.410
    --  dialparties.agi: channel = SIP/199-a7ab
  dialparties.agi: callerid = Mila
    --  dialparties.agi: context = macro-dial
    --  dialparties.agi: type = SIP
    --  dialparties.agi: rdnis = unknown
    --  dialparties.agi: enhanced = 0.0
    --  dialparties.agi: dnid = 201
  dialparties.agi: Caller ID name is 'Mila Hiles' number is '199'
    --  dialparties.agi: Added extension 201 to extension map
    --  dialparties.agi: Extension 201 cf is disabled
    --  dialparties.agi: Extension 201 do not disturb is disabled
  == Parsing '/etc/asterisk/manager.conf': Found
  == Parsing '/etc/asterisk/manager_custom.conf': Found
  == Manager 'admin' logged on from 127.0.0.1
  == Manager 'admin' logged off from 127.0.0.1
  dialparties.agi: Extension 201 has call waiting disabled
    --  dialparties.agi: DbSet CALLTRACE/201 to 199
  dialparties.agi: Dial string is SIP/201|15|tr
    -- AGI Script dialparties.agi completed, returning 0
    -- Executing Dial("SIP/199-a7ab", "SIP/201|15|tr") in new stack
    -- Called 201
  == No one is available to answer at this time
    -- Executing GotoIf("SIP/199-a7ab", "0?s-NOANSWER|1") in new stack
    -- Executing GotoIf("SIP/199-a7ab", "0?s-NOANSWER|1") in new stack
    -- Executing NoOp("SIP/199-a7ab", "Sending to Voicemail box 201@default") in new stack
    -- Executing Macro("SIP/199-a7ab", "vm|201@default|NOANSWER") in new stack
    -- Executing Goto("SIP/199-a7ab", "s-NOANSWER|1") in new stack
    -- Goto (macro-vm,s-NOANSWER,1)
    -- Executing VoiceMail("SIP/199-a7ab", "u201@default") in new stack
    -- Playing 'vm-theperson' (language 'en')
    -- Playing 'digits/2' (language 'en')
    -- Playing 'digits/0' (language 'en')
    -- Playing 'digits/1' (language 'en')
    -- Playing 'vm-isunavail' (language 'en')
    -- Playing 'vm-intro' (language 'en')
    -- Playing 'beep' (language 'en')
    -- Recording the message
    -- x=0, open writing:  /var/spool/asterisk/voicemail/default/201/INBOX/msg0001 format: wav49, 0x90a0438
    -- x=1, open writing:  /var/spool/asterisk/voicemail/default/201/INBOX/msg0001 format: wav, 0x9084cc0
    -- User hung up
  == Spawn extension (macro-vm, s-NOANSWER, 1) exited non-zero on 'SIP/199-a7ab' in macro 'vm'
  == Spawn extension (macro-exten-vm, s, 7) exited non-zero on 'SIP/199-a7ab' in macro 'exten-vm'
  == Spawn extension (from-internal, 201, 1) exited non-zero on 'SIP/199-a7ab'
    -- Executing Macro("SIP/199-a7ab", "hangupcall") in new stack
    -- Executing ResetCDR("SIP/199-a7ab", "w") in new stack
    -- Executing NoCDR("SIP/199-a7ab", "") in new stack
    -- Executing Wait("SIP/199-a7ab", "5") in new stack
  == Spawn extension (macro-hangupcall, s, 3) exited non-zero on 'SIP/199-a7ab' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/199-a7ab'

If I dial a PSTN call (my cell phone) from the soho phone, it goes out through * box, rings my cell phone. If I answer my cell phone, I get no audio, and soho phone doesn’t get any audio either, but the call continues along as if audio was being transmitted to and fro.

Similarily, dialing into voicemail or any other IVR’s on the * box from the soho line, greeted with no audio of any kind.

I hope it’s just a config, and not an issue with bandwidth.
Asterisk Box = T1 1500/1500
Home = Cable 1500/4500

Thanks for any assistance.
day

Asterisk@home v1.5
Asterisk 1.0.9 behind router, w/ one to one NAT giving * box a public IP
SOHO public IP

do you have NAT anywhere in that setup? if so, that’s why. SIP ‘works’ behind NAT, or will appear to until you try to call, and then you get no audio.

To fix it, on the * server at the office (which presumably has a public IP) set nat=yes in the entries for the phones behind NAT. Then on the phones themselves, you need to either setup STUN or tell the phone what it’s external IP address is.
If you have Symmetric NAT, you will also have to forward ports to the phone. You need the SIP port (5060) and RTP ports (varies, can be anything). Also, setting canreinvite=no in the phones sip.conf entry can also help.

My asterisk machine is behind a router with it’s 192.x.x.165 address. On that router I have one to one NAT which associates a public IP address to the asterisk box, so that all requests to 65.x.x.165 (public) go to the 192.x.x.165 * box. I have several phones behind the same router sharing the 192.x.x.x address space that connect to and use the * box.

At soho, my ip phone has a public ip 69.x.x.3

[201]
type=peer
secret=201
callerid=Doogie Howser <201>
host=dynamic
defaultip=69.x.x.3
canreinvite=no
dtmfmode=rfc2833
mailbox=201
nat=yes
context=myown
disallow=all
allow=ulaw

With the above setup, and dialing to soho from local * network, I immediately get a “…person is on the phone” msg. Same with setting nat=no. If I set nat=never, I get a ring, but after that ring I get a “…person is unavailable” msg.

So the only thing behind the NAT is the * box, technically speaking. I can connect directly into the * box from outside its local network using its public ip 65.x.x.165

Thanks for your time,
d

you cannot solive this problem like that.

As I seen that you are using sip client connecting to the asterisk

go to the CLI> and run this command :

Sip Debug

you’ll have sip messages, read the sip messages and check the RTP settings which is shown before inviting other end.

Therefore, astersik cannot solive complicated nat cases such as if asterisk behind nat and your client behind nat also.

so if this is the case, you have two options :
check to connect and dial an extention with asterisk using iax client from your pc in your home , if things goes well, try to forward rtp ports manualy .

get back to the sip messages and grap it here .

Fahad

Fahad,
Only my Asterisk box is behind the NAT.
NOT the soho IP phone.

Please post the [general] parameters of SIP.conf here.

I already fix such nat cases many times before.

Well my wife is pissed off at me for doing it, but I got it working! Here are the general details of sip.conf .

[general]
port = 5062           ; Port to bind to (SIP is 5060) using 5062 because of iChat interference
bindaddr = 0.0.0.0    ; Address to bind to (all addresses on machine)
externip = 65.x.x.165 ; Asterisk boxes public IP
localnet = 192.168.1.0/255.255.255.0
disallow=all
allow=ulaw
allow=alaw
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown

[201]
type=friend
secret=201
callerid=Doogie Howser<201>
host=69.x.x.3 ; soho phone's public IP address
dtmfmode=rfc2833
canreinvite=no
mailbox=201
nat=never
context=my own
disallow=all
allow=ulaw

Thank you all for your suggestions, and any observations you might be able to make regarding my sip.conf file.
d