Problem with nat and sip


#1

I am unable to get both incoming and outgoing calls to work with the same configuration. I can get both to work but I have to change my config and reload asterisk…

here is what I have:

port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
nat=yes
externip=69.141.187.60
localnet=192.168.1.0/24
localmask=255.255.255.0

[vonage-in]
username=1XXXXXXXXXX
type=friend
secret=XXXXXX
port=5061
nat=yes
insecure=very
host=sphone.vopr.vonage.net
fromuser=1XXXXXXXXXX
fromdomain=sphone.vopr.vonage.net
dtmfmode=rfc2833
context=from-pstn
canreinvite=no
auth=md5

[vonage-out]
username=1XXXXXXXXXX
type=friend
secret=XXXXXX
port=5061
nat=yes
host=sphone.vopr.vonage.net
fromuser=1XXXXXXXXXX
fromdomain=sphone.vopr.vonage.net
dtmfmode=rfc2833
auth=md5

With this config I can receive incoming calls.

if I change nat to nat=no in [General] then I can make out going calls.

This makes no sense to me, but I’ve been fighting with it for two weeks and I cannot make it work!

I am using vonage (obviously) and I have paid for a softphone. I am also actually using AAH so most of my configurations are done through amp (except for the [general] section). I am also obviously behind a NAT.

I thought it might be a problem with my router but when I download vonage’s softphone it works fine…

Please help me! :smile:

Thanks
–Andrew


#2

Try changing type to peer

rgds


#3

[quote=“middletn”]Try changing type to peer

rgds[/quote]

Tried this, results are identical, to type=friend…


#4

Read this, maybe it should give you some clues about what to do:
forums.digium.com/viewtopic.php? … highlight=


#5

I was unabled to find anything usefull in that thread, other then try putting the nat=yes or nat=no in the sip.conf file which I had already tried (and tried again after reading it). I finally gave up an moved my asterisk box to be the nat box in my house so it could talk directly to vonage (without using nat). Oddly enough I have the exact same problem. if I set nat=yes in general I can have incoming calls if I set nat=no in gereral I can make outgoing calls. Here is what I get in my debug logs with nat=no during an incoming call:

sip debug
SIP Debugging enabled
REGISTER 12 headers, 0 lines
Reliably Transmitting (no NAT) to 216.115.20.41:5061:
REGISTER sip:sphone.vopr.vonage.net SIP/2.0
Via: SIP/2.0/UDP 69.248.18.169:5060;branch=z9hG4bK55a09be8;rport
From: sip:17323913925@sphone.vopr.vonage.net;tag=as5fe50693
To: sip:17323913925@sphone.vopr.vonage.net
Call-ID: 3e84c8e9284bcbf82383f57959ecadea@127.0.0.1
CSeq: 103 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact: sip:s@69.248.18.169
Event: registration
Content-Length: 0

–terisk1CLI>
asterisk1
CLI>
<-- SIP read from 216.115.20.41:5061:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 69.248.18.169:5060;branch=z9hG4bK55a09be8;rport
From: sip:17323913925@sphone.vopr.vonage.net;tag=as5fe50693
To: sip:17323913925@sphone.vopr.vonage.net
Call-ID: 3e84c8e9284bcbf82383f57959ecadea@127.0.0.1
CSeq: 103 REGISTER
Contact: sip:s@69.248.18.169;expires=20
Content-Length: 0

— (8 headers 0 lines)—
Scheduling destruction of call ‘3e84c8e9284bcbf82383f57959ecadea@127.0.0.1’ in 32000 ms
asterisk1*CLI>
<-- SIP read from 216.115.20.41:5061:
INVITE sip:17323913925@69.248.18.169:5060;suppress-features=- SIP/2.0
Via: SIP/2.0/UDP 216.115.20.41:5061
Via: SIP/2.0/UDP 216.115.30.25:5060
Via: SIP/2.0/UDP 216.115.23.16:5060;branch=z9hG4bK189E
Record-Route: sip:17323913925@216.115.20.41:5061
Record-Route: sip:17323913925@216.115.30.25:5060
From: “WIRELESS CALLER” sip:19172097341@216.115.23.16;tag=999537527
To: sip:17323913925@inbound2.vonage.net
Call-ID: 713F99B6-895611DA-866BA29A-195C0439@216.115.23.16
CSeq: 101 INVITE
Contact: sip:19172097341@216.115.23.16:5060;rtpupdated=-
Max-Forwards: 13
Content-Type: application/sdp
Content-Length: 361

v=0
o=CiscoSystemsSIP-GW-UserAgent 5049 8072 IN IP4 216.115.23.16
s=SIP Call
c=IN IP4 216.115.23.16
t=0 0
m=audio 18592 RTP/AVP 0 18 2 100 101
c=IN IP4 216.115.23.16
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:2 G726-32/8000
a=rtpmap:100 X-NSE/8000
a=fmtp:100 192-194
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

— (14 headers 15 lines)—
Using INVITE request as basis request - 713F99B6-895611DA-866BA29A-195C0439@216.115.23.16
Sending to 216.115.20.41 : 5061 (non-NAT)
Found peer 'vonage-out’
Reliably Transmitting (NAT) to 216.115.20.41:5061:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 216.115.20.41:5061;received=216.115.20.41
Via: SIP/2.0/UDP 216.115.30.25:5060
Via: SIP/2.0/UDP 216.115.23.16:5060;branch=z9hG4bK189E
From: “WIRELESS CALLER” sip:19172097341@216.115.23.16;tag=999537527
To: sip:17323913925@inbound2.vonage.net;tag=as1d4ff982
Call-ID: 713F99B6-895611DA-866BA29A-195C0439@216.115.23.16
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Max-Forwards: 70
Contact: sip:17323913925@69.248.18.169
Proxy-Authenticate: Digest realm=“asterisk”, nonce="2106d708"
Content-Length: 0


Scheduling destruction of call ‘713F99B6-895611DA-866BA29A-195C0439@216.115.23.16’ in 15000 ms
asterisk1*CLI>
<-- SIP read from 216.115.20.41:5061:
ACK sip:17323913925@inbound2.vonage.net SIP/2.0
Via: SIP/2.0/UDP 216.115.20.41:5061
From: “WIRELESS CALLER” sip:19172097341@216.115.23.16;tag=999537527
To: sip:17323913925@inbound2.vonage.net;tag=as1d4ff982
Call-ID: 713F99B6-895611DA-866BA29A-195C0439@216.115.23.16
CSeq: 101 ACK
Content-Length: 0

— (7 headers 0 lines)—
Destroying call '3e84c8e9284bcbf82383f57959ecadea@127.0.0.1’
REGISTER 12 headers, 0 lines
Reliably Transmitting (no NAT) to 216.115.20.41:5061:
REGISTER sip:sphone.vopr.vonage.net SIP/2.0
Via: SIP/2.0/UDP 69.248.18.169:5060;branch=z9hG4bK5bba2455;rport
From: sip:17323913925@sphone.vopr.vonage.net;tag=as335203e9
To: sip:17323913925@sphone.vopr.vonage.net
Call-ID: 3e84c8e9284bcbf82383f57959ecadea@127.0.0.1
CSeq: 104 REGISTER
User-Agent: Asterisk PBX
Max-Forwards: 70
Expires: 120
Contact: sip:s@69.248.18.169
Event: registration
Content-Length: 0

–terisk1CLI>
asterisk1
CLI>
<-- SIP read from 216.115.20.41:5061:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 69.248.18.169:5060;branch=z9hG4bK5bba2455;rport
From: sip:17323913925@sphone.vopr.vonage.net;tag=as335203e9
To: sip:17323913925@sphone.vopr.vonage.net
Call-ID: 3e84c8e9284bcbf82383f57959ecadea@127.0.0.1
CSeq: 104 REGISTER
Contact: sip:s@69.248.18.169;expires=20
Content-Length: 0

— (8 headers 0 lines)—
Scheduling destruction of call ‘3e84c8e9284bcbf82383f57959ecadea@127.0.0.1’ in 32000 ms
Destroying call ‘713F99B6-895611DA-866BA29A-195C0439@216.115.23.16’

Hopefully this helps.