Cannot call "myself" via SIP-Provider

Hello

I have asterisk set up behind a router/firewall using NAT. My SIP-Provider has given me 2 accounts I have to login to (2 different phone-numbers).

All calls work very well except if I call one of “my own” numbers. This means that a call goes like this
phone -> Asterisk -> VOIP-Provider -> Asterisk -> phone. In that scenario, the destination phone rings and I can answer the call, but there is no audio in either direction. Also, there are no RTP-packages dropped or lost (I don’t get the usual retransmission timeouts). The call doesn’t drop as long as no party hangs up, but there is absolutely no audio going through.

First I thought that this might be a problem with the provider’s routes, but it seems it’s not. If I log in to one account with a sip-phone directly (not asterisk) and make a call from asterisk to that number, audio works fine.

Another thing I’ve noticed is that independant of which number is dialled, asterisk always thinks that the account which is listed in the first register statement in sip.conf is receiving the call. The call still ends up at the right extension because I have all inbound calls in the same context, but it appears to come via the “wrong” account. That’s no big deal to me as everything works correctly, however, maybe it has something to do with things.

as for my config, my firewall forwads ports 5060 and 10000-20000 (this matches rtp.conf) udp to the box asterisk is running on.
this is my sip.conf:

[code][general]
language=en
context=unauthenticated
allowguest=no
srvlookup=yes
udpbindaddr=0.0.0.0
tcpenable=no
alwaysauthreject=yes
localnet=192.168.0.0/255.255.255.0
externhost=externhost.dyndns.org
externrefresh=180
directmedia=no
canreinvite=no
nat=yes

register => account1:password@guest2.voipgateway.org/account1
register => account2:password@guest2.voipgateway.org/account2

;
; Templates
;

codecs
disallow=all
allow=alaw
allow=ulaw

local-phone
nat=no
type=peer
host=dynamic
dtmfmode=auto
insecure=invite,port
deny=0.0.0.0/0.0.0.0
permit=192.168.0.0/255.255.254.0
subscribecontext=subscribe
busylevel=1
callcounter=yes
secret=secret
context=internal

guest-voip
type=friend
host=guest2.voipgateway.org
insecure=invite
dtmfmode=auto
context=external
deny=0.0.0.0
permit=212.117.203.0/255.255.255.0
nat=yes

;
; Phones.
;

phone1
phone2
;
; guest-voip clients
;

account1
defaultuser=account1
secret=password
account2
defaultuser=account2
secret=password[/code]

and my extensions.conf

[code][internal]
exten => 30,1,Dial(SIP/phone1)
exten => 31,1,Dial(SIP/phone2)
exten => _XXX!,1,Dial(SIP/${EXTEN}@account1)

[external]
exten => account1,1,Dial(SIP/phone1)
exten => account2,1,Dial(SIP/phone2)[/code]

Thanks for any help in advance!

RTP is never retransmitted. If you have SIP retransmissions you have network problems that need addressing.

You have a significant security problem: insecure=invite should never be used on accounts capable of making toll calls. Chances are that you don’t need port either. For the external account, remotesecret is a better solution.

Most ITSPs send caller-ID in SP From user, so type=friend is no help, but reduces security and can cause other problems.

Given the above, the only way that Asterisk can distinguish between remote accounts is by IP address and port number. If both are the same, it will use the first match. It is better to have one trunk account, rather than two single line accounts.

nat probably doesn’t do what you think it does; externhost does that.

Having said that, I can’t see why there is no RTP, so you will need to provide a SIP trace, including the SDP exchange.

Hi david,

Thanks for your answer. Regarding the “retransmission”, I don’t experience that. I just wanted to state that I (most likely) don’t have a NAT issue.

regarding the security issue: I reckon that type=friend is not necessary (I thought it was, but it’s still working with type=peer and insecure=invite). However, I think I need insecure=invite as my voip-provider is not registering itsself with me when it dispatches an incoming call to me.

However, I’ve locked the guest-voip accounts in the context [external] from which it is not possible to make a toll call. Additionally, I’ve limited the IPs allowed to connect to my to my voip-provider’s subnet (both with deny / permit and on a firewall level). I thought that’s pretty much all I can do - am I wrong?

I wish I had a single SIP-trunk, but this would cost me an additional $20 per months, which I’m not willing to spare - everything works at that end, though I probably have a little unnecessary traffic on my wan connection.

Also thanks for your input regarding nat=. I’ve removed nat= completely from my sip.conf - localnet and externhost do all the magic.

Finally, about that sip trace: here it is. The sip trace shows a call from phone 1 to the external number, which then rings on phone2 and is answered. There is no audio going trough. Then the call is ended.

SIP Debugging enabled

<--- SIP read from UDP:192.168.0.233:54974 --->
INVITE sip:0123465789@nas.weily.lan SIP/2.0
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 2658 INVITE
From: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
To: <sip:0123465789@nas.weily.lan>
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bKb9c17f3598fa47bc5ee5ce971264bda7373033;rport
Max-Forwards: 70
Contact: "phone1" <sip:phone1@192.168.0.233:54974;transport=udp>
Content-Type: application/sdp
Content-Length: 299

v=0
o=- 1371933378566 1371933378568 IN IP4 192.168.0.233
s=-
c=IN IP4 192.168.0.233
t=0 0
m=audio 39384 RTP/AVP 96 97 3 0 8 127
a=rtpmap:96 GSM-EFR/8000
a=rtpmap:97 AMR/8000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:127 telephone-event/8000
a=fmtp:127 0-15
<------------->
--- (10 headers 13 lines) ---
Sending to 192.168.0.233:54974 (NAT)
Using INVITE request as basis request - 9f42d2a53406e625509057427a28d5aa@192.168.0.233
Found peer 'phone1' for 'phone1' from 192.168.0.233:54974
  == Using SIP RTP CoS mark 5
Found RTP audio format 96
Found RTP audio format 97
Found RTP audio format 3
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 127
Found unknown media description format GSM-EFR for ID 96
Found unknown media description format AMR for ID 97
Found audio description format GSM for ID 3
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 127
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0xe (gsm|ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.0.233:39384
Looking for 0123465789 in internal (domain nas.weily.lan)
list_route: hop: <sip:phone1@192.168.0.233:54974;transport=udp>

<--- Transmitting (NAT) to 192.168.0.233:54974 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bKb9c17f3598fa47bc5ee5ce971264bda7373033;received=192.168.0.233;rport=54974
From: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
To: <sip:0123465789@nas.weily.lan>
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 2658 INVITE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:0123465789@192.168.0.3:5060>
Content-Length: 0


<------------>
    -- Executing [0123465789@internal:1] Dial("SIP/phone1-0000001e", "SIP/0123465789@0123465789") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 13414
Adding codec 0x8 (alaw) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 212.117.203.47:5060:
INVITE sip:0123465789@guest2.voipgateway.org SIP/2.0
Via: SIP/2.0/UDP 80.219.136.161:5060;branch=z9hG4bK0a8b87b9;rport
Max-Forwards: 70
From: "Phone 1" <sip:0123465789@80.219.136.161>;tag=as74b9a0bd
To: <sip:0123465789@guest2.voipgateway.org>
Contact: <sip:0123465789@80.219.136.161:5060>
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
Date: Sat, 22 Jun 2013 20:36:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 272

v=0
o=root 1222134708 1222134708 IN IP4 80.219.136.161
s=Asterisk PBX 1.8.13.1~dfsg-3
c=IN IP4 80.219.136.161
t=0 0
m=audio 13414 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
    -- Called SIP/0123465789@0123465789

<--- SIP read from UDP:212.117.203.47:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK0a8b87b9;rport=5060
To: <sip:0123465789@guest2.voipgateway.org>
From: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:212.117.203.47:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK0a8b87b9;rport=5060
Record-Route: <sip:212.117.203.47;lr>
To: <sip:0123465789@guest2.voipgateway.org>
From: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 102 INVITE
Server: Sippy
WWW-Authenticate: Digest realm="guest2.voipgateway.org",nonce="3cce6f0854c7e80a57ec911beaf9d8b2c80d"
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
set_destination: Parsing <sip:0123465789@guest2.voipgateway.org> for address/port to send to
set_destination: set destination to 212.117.203.47:5060
Transmitting (NAT) to 212.117.203.47:5060:
ACK sip:0123465789@guest2.voipgateway.org SIP/2.0
Via: SIP/2.0/UDP 80.219.136.161:5060;branch=z9hG4bK0a8b87b9;rport
Max-Forwards: 70
From: "Phone 1" <sip:0123465789@80.219.136.161>;tag=as74b9a0bd
To: <sip:0123465789@guest2.voipgateway.org>
Contact: <sip:0123465789@80.219.136.161:5060>
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
Content-Length: 0


---
Audio is at 13414
Adding codec 0x8 (alaw) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 212.117.203.47:5060:
INVITE sip:0123465789@guest2.voipgateway.org SIP/2.0
Via: SIP/2.0/UDP 80.219.136.161:5060;branch=z9hG4bK0e8e95ec;rport
Max-Forwards: 70
From: "Phone 1" <sip:0123465789@80.219.136.161>;tag=as74b9a0bd
To: <sip:0123465789@guest2.voipgateway.org>
Contact: <sip:0123465789@80.219.136.161:5060>
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 103 INVITE
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
Authorization: Digest username="0123465789", realm="guest2.voipgateway.org", algorithm=MD5, uri="sip:0123465789@guest2.voipgateway.org", nonce="3cce6f0854c7e80a57ec911beaf9d8b2c80d", response="6954cf880fdddf589e3178689dcbd127"
Date: Sat, 22 Jun 2013 20:36:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 272

v=0
o=root 1222134708 1222134709 IN IP4 80.219.136.161
s=Asterisk PBX 1.8.13.1~dfsg-3
c=IN IP4 80.219.136.161
t=0 0
m=audio 13414 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---

<--- SIP read from UDP:212.117.203.47:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK0e8e95ec;rport=5060
To: <sip:0123465789@guest2.voipgateway.org>
From: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 103 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---


<--- SIP read from UDP:212.117.203.47:5060 --->
INVITE sip:0123465789@192.168.0.3:5060 SIP/2.0
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-ce32f95014328a74-1---d8754z-;rport
Via: SIP/2.0/UDP 212.117.203.47:5061;branch=z9hG4bK-egcpsxgheepjccle;rport=5061
Max-Forwards: 69
Record-Route: <sip:212.117.203.47;lr>
Contact: "Anonymous"<sip:212.117.203.47:5061>
To: <sip:0123465789@212.117.203.47>
From: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 579 INVITE
Expires: 300
Content-Disposition: session
Content-Type: application/sdp
User-Agent: Sippy
h323-conf-id: 3509096997-3091581407-1494187459-2897649152
cisco-GUID: 3509096997-3091581407-1494187459-2897649152
Content-Length: 251

v=0
o=Sippy 738974032 0 IN IP4 80.219.136.161
s=Asterisk PBX 1.8.13.1~dfsg-3
t=0 0
m=audio 13414 RTP/AVP 8 0 101
c=IN IP4 80.219.136.161
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
<------------->
--- (17 headers 11 lines) ---
Sending to 212.117.203.47:5060 (NAT)
Using INVITE request as basis request - 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
Found peer '0123465789' for '0123465789' from 212.117.203.47:5060
  == Using SIP RTP CoS mark 5
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0xc (ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 80.219.136.161:13414
Looking for 0123465789 in external (domain 192.168.0.3)
list_route: hop: <sip:212.117.203.47;lr>

<--- Transmitting (NAT) to 212.117.203.47:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-ce32f95014328a74-1---d8754z-;received=212.117.203.47;rport=5060
Via: SIP/2.0/UDP 212.117.203.47:5061;branch=z9hG4bK-egcpsxgheepjccle;rport=5061
Record-Route: <sip:212.117.203.47;lr>
From: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
To: <sip:0123465789@212.117.203.47>
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 579 INVITE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:0123465789@80.219.136.161:5060>
Content-Length: 0


<------------>
    -- Executing [0123465789@external:1] Dial("SIP/0123465789-00000020", "SIP/phone2") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 17650
Adding codec 0x8 (alaw) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 192.168.0.107:5060:
INVITE sip:phone2@192.168.0.107:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK31f9ac2e;rport
Max-Forwards: 70
From: "Phone 1" <sip:0123465789@192.168.0.3>;tag=as1eb64ae6
To: <sip:phone2@192.168.0.107:5060;transport=udp>
Contact: <sip:0123465789@192.168.0.3:5060>
Call-ID: 76397d3a4927da5c7a9420376b208397@192.168.0.3:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
Date: Sat, 22 Jun 2013 20:36:20 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 266

v=0
o=root 1628457472 1628457472 IN IP4 192.168.0.3
s=Asterisk PBX 1.8.13.1~dfsg-3
c=IN IP4 192.168.0.3
t=0 0
m=audio 17650 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
    -- Called SIP/phone2

<--- SIP read from UDP:192.168.0.107:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK31f9ac2e;rport=5060;received=192.168.0.3
From: "Phone 1" <sip:0123465789@192.168.0.3>;tag=as1eb64ae6
To: <sip:phone2@192.168.0.107:5060;transport=udp>;tag=2512611503
Call-ID: 76397d3a4927da5c7a9420376b208397@192.168.0.3:5060
CSeq: 102 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
Allow-Events: talk, hold, conference, LocalModeStatus
Contact: "Phone2" <sip:phone2@192.168.0.107:5060;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-1000-8000-00085D1A2812>"
Server: Aastra 55i/3.2.2.3077
Supported: path
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---
list_route: hop: <sip:phone2@192.168.0.107:5060;transport=udp>
    -- SIP/phone2-00000021 is ringing

<--- Transmitting (NAT) to 212.117.203.47:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-ce32f95014328a74-1---d8754z-;received=212.117.203.47;rport=5060
Via: SIP/2.0/UDP 212.117.203.47:5061;branch=z9hG4bK-egcpsxgheepjccle;rport=5061
Record-Route: <sip:212.117.203.47;lr>
From: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
To: <sip:0123465789@212.117.203.47>;tag=as3a9cd917
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 579 INVITE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:0123465789@80.219.136.161:5060>
Content-Length: 0


<------------>

<--- SIP read from UDP:212.117.203.47:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK0e8e95ec;rport=5060
Record-Route: <sip:212.117.203.47;lr>
To: <sip:0123465789@guest2.voipgateway.org>;tag=oyefjjxy5eqerzze.i
From: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 103 INVITE
Server: Sippy
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
list_route: hop: <sip:212.117.203.47;lr>
    -- SIP/0123465789-0000001f is ringing

<--- Transmitting (NAT) to 192.168.0.233:54974 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bKb9c17f3598fa47bc5ee5ce971264bda7373033;received=192.168.0.233;rport=54974
From: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
To: <sip:0123465789@nas.weily.lan>;tag=as30a62f26
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 2658 INVITE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:0123465789@192.168.0.3:5060>
Content-Length: 0


<------------>

<--- SIP read from UDP:192.168.0.107:5060 --->
SUBSCRIBE sip:192.168.0.3:5060 SIP/2.0
Accept: application/dialog-info+xml
Via: SIP/2.0/UDP 192.168.0.107;branch=z9hG4bKea12bc7c0fe47fd26
Max-Forwards: 70
From: "Phone 2" <sip:phone2@192.168.0.3:5060>;tag=ab5a85c7f2
To: <sip:192.168.0.3:5060>
Call-ID: 3cfc4c0de2aecf1f
CSeq: 168 SUBSCRIBE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
Allow-Events: talk, hold, conference, LocalModeStatus
Contact: "Phone 2" <sip:phone2@192.168.0.107:5060;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-1000-8000-00085D1A2812>"
Event: dialog
Expires: 593
Supported: path
User-Agent: Aastra 55i/3.2.2.3077
Content-Length: 0

<------------->
--- (16 headers 0 lines) ---
Creating new subscription
Sending to 192.168.0.107:5060 (NAT)
list_route: hop: <sip:phone2@192.168.0.107:5060;transport=udp>
Found peer 'phone2' for 'phone2' from 192.168.0.107:5060
Looking for s in subscribe (domain 192.168.0.3)

<--- Transmitting (NAT) to 192.168.0.107:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.0.107;branch=z9hG4bKea12bc7c0fe47fd26;received=192.168.0.107;rport=5060
From: "Phone 2" <sip:phone2@192.168.0.3:5060>;tag=ab5a85c7f2
To: <sip:192.168.0.3:5060>;tag=as78a83697
Call-ID: 3cfc4c0de2aecf1f
CSeq: 168 SUBSCRIBE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


------------>
Really destroying SIP dialog '3cfc4c0de2aecf1f' Method: SUBSCRIBE

<--- SIP read from UDP:192.168.0.107:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK31f9ac2e;rport=5060;received=192.168.0.3
From: "Phone 1" <sip:0123465789@192.168.0.3>;tag=as1eb64ae6
To: <sip:phone2@192.168.0.107:5060;transport=udp>;tag=2512611503
Call-ID: 76397d3a4927da5c7a9420376b208397@192.168.0.3:5060
CSeq: 102 INVITE
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, OPTIONS, UPDATE, PRACK, SUBSCRIBE, INFO
Allow-Events: talk, hold, conference, LocalModeStatus
Contact: "Phone 2" <sip:phone2@192.168.0.107:5060;transport=udp>;+sip.instance="<urn:uuid:00000000-0000-1000-8000-00085D1A2812>"
Server: Aastra 55i/3.2.2.3077
Supported: path, replaces
Content-Type: application/sdp
Content-Length: 259

v=0
o=MxSIP 0 1 IN IP4 192.168.0.107
s=SIP Call
c=IN IP4 192.168.0.107
t=0 0
m=audio 3000 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=fmtp:101 0-15
a=ptime:20
a=sendrecv
<------------->
--- (13 headers 13 lines) ---
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0xc (ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 192.168.0.107:3000
list_route: hop: <sip:phone2@192.168.0.107:5060;transport=udp>
set_destination: Parsing <sip:phone2@192.168.0.107:5060;transport=udp> for address/port to send to
set_destination: set destination to 192.168.0.107:5060
Transmitting (NAT) to 192.168.0.107:5060:
ACK sip:phone2@192.168.0.107:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK44138b25;rport
Max-Forwards: 70
From: "Phone 1" <sip:0123465789@192.168.0.3>;tag=as1eb64ae6
To: <sip:phone2@192.168.0.107:5060;transport=udp>;tag=2512611503
Contact: <sip:0123465789@192.168.0.3:5060>
Call-ID: 76397d3a4927da5c7a9420376b208397@192.168.0.3:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
Content-Length: 0


---
    -- SIP/phone2-00000021 answered SIP/0123465789-00000020
Audio is at 13444
Adding codec 0x8 (alaw) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (NAT) to 212.117.203.47:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-ce32f95014328a74-1---d8754z-;received=212.117.203.47;rport=5060
Via: SIP/2.0/UDP 212.117.203.47:5061;branch=z9hG4bK-egcpsxgheepjccle;rport=5061
Record-Route: <sip:212.117.203.47;lr>
From: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
To: <sip:0123465789@212.117.203.47>;tag=as3a9cd917
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 579 INVITE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:0123465789@80.219.136.161:5060>
Content-Type: application/sdp
Content-Length: 272

v=0
o=root 1569894218 1569894218 IN IP4 80.219.136.161
s=Asterisk PBX 1.8.13.1~dfsg-3
c=IN IP4 80.219.136.161
t=0 0
m=audio 13444 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

<------------>
    -- Locally bridging SIP/0123465789-00000020 and SIP/phone2-00000021

<--- SIP read from UDP:212.117.203.47:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK0e8e95ec;rport=5060
Record-Route: <sip:212.117.203.47;lr>
Contact: "Anonymous"<sip:212.117.203.47:5061>
To: <sip:0123465789@guest2.voipgateway.org>;tag=oyefjjxy5eqerzze.i
From: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 103 INVITE
Content-Type: application/sdp
Server: Sippy
Content-Length: 250

v=0
o=Sippy 21596856 2 IN IP4 80.219.136.161
s=Asterisk PBX 1.8.13.1~dfsg-3
t=0 0
m=audio 13444 RTP/AVP 8 0 101
c=IN IP4 80.219.136.161
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=sendrecv
<------------->
--- (11 headers 11 lines) ---
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format telephone-event for ID 101
Capabilities: us - 0xc (ulaw|alaw), peer - audio=0xc (ulaw|alaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0xc (ulaw|alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 80.219.136.161:13444
list_route: hop: <sip:212.117.203.47;lr>
set_destination: Parsing <sip:212.117.203.47;lr> for address/port to send to
set_destination: set destination to 212.117.203.47:5060
Transmitting (NAT) to 212.117.203.47:5060:
ACK sip:212.117.203.47:5061 SIP/2.0
Via: SIP/2.0/UDP 80.219.136.161:5060;branch=z9hG4bK759c81fb;rport
Route: <sip:212.117.203.47;lr>
Max-Forwards: 70
From: "Phone 1" <sip:0123465789@80.219.136.161>;tag=as74b9a0bd
To: <sip:0123465789@guest2.voipgateway.org>;tag=oyefjjxy5eqerzze.i
Contact: <sip:0123465789@80.219.136.161:5060>
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 103 ACK
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
Content-Length: 0


---
    -- SIP/0123465789-0000001f answered SIP/phone1-0000001e
Audio is at 10242
Adding codec 0x8 (alaw) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP

<--- Reliably Transmitting (NAT) to 192.168.0.233:54974 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bKb9c17f3598fa47bc5ee5ce971264bda7373033;received=192.168.0.233;rport=54974
From: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
To: <sip:0123465789@nas.weily.lan>;tag=as30a62f26
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 2658 INVITE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:0123465789@192.168.0.3:5060>
Content-Type: application/sdp
Content-Length: 264

v=0
o=root 362708731 362708731 IN IP4 192.168.0.3
s=Asterisk PBX 1.8.13.1~dfsg-3
c=IN IP4 192.168.0.3
t=0 0
m=audio 10242 RTP/AVP 8 0 127
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:127 telephone-event/8000
a=fmtp:127 0-16
a=ptime:20
a=sendrecv

<------------>
    -- Locally bridging SIP/phone1-0000001e and SIP/0123465789-0000001f

<--- SIP read from UDP:212.117.203.47:5060 --->
ACK sip:0123465789@192.168.0.3:5060 SIP/2.0
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-50556d5e44897152-1---d8754z-;rport
Via: SIP/2.0/UDP 212.117.203.47:5061;rport=5061;branch=z9hG4bK-z5w52vfrek2tjdpa
Max-Forwards: 69
To: <sip:0123465789@212.117.203.47>;tag=as3a9cd917
From: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 579 ACK
User-Agent: Sippy
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---

<--- SIP read from UDP:192.168.0.233:54974 --->
ACK sip:0123465789@192.168.0.3:5060 SIP/2.0
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 2658 ACK
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bK52d087a35bf086d47b980841c0055a7e373033
From: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
To: <sip:0123465789@nas.weily.lan>;tag=as30a62f26
Max-Forwards: 70
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---

<--- SIP read from UDP:192.168.0.233:54974 --->
OPTIONS sip:0123465789@nas.weily.lan SIP/2.0
Call-ID: 7f600b6f5dd49f3191485b2221770e6e@192.168.0.233
CSeq: 3370 OPTIONS
From: "phone1" <sip:phone1@nas.weily.lan>;tag=486596409
To: <sip:0123465789@nas.weily.lan>
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bK247566f945c8d4f4475e75d2b55ae09d373033;rport
Max-Forwards: 70
Contact: "phone1" <sip:phone1@192.168.0.233:54974;transport=udp>
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Looking for 0123465789 in unauthenticated (domain nas.weily.lan)

<--- Transmitting (NAT) to 192.168.0.233:54974 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.0.233:54974;branch=z9hG4bK247566f945c8d4f4475e75d2b55ae09d373033;received=192.168.0.233;rport=54974
From: "phone1" <sip:phone1@nas.weily.lan>;tag=486596409
To: <sip:0123465789@nas.weily.lan>;tag=as7ef73b98
Call-ID: 7f600b6f5dd49f3191485b2221770e6e@192.168.0.233
CSeq: 3370 OPTIONS
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '7f600b6f5dd49f3191485b2221770e6e@192.168.0.233' in 32000 ms (Method: OPTIONS)

<--- SIP read from UDP:192.168.0.107:5060 --->
BYE sip:0123465789@192.168.0.3:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.107;branch=z9hG4bKee9b7f770c9b3cea2
Max-Forwards: 70
From: <sip:phone2@192.168.0.107:5060;transport=udp>;tag=2512611503
To: "Phone 1" <sip:0123465789@192.168.0.3>;tag=as1eb64ae6
Call-ID: 76397d3a4927da5c7a9420376b208397@192.168.0.3:5060
CSeq: 11673 BYE
User-Agent: Aastra 55i/3.2.2.3077
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Sending to 192.168.0.107:5060 (NAT)
Scheduling destruction of SIP dialog '76397d3a4927da5c7a9420376b208397@192.168.0.3:5060' in 32000 ms (Method: BYE)

<--- Transmitting (NAT) to 192.168.0.107:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.107;branch=z9hG4bKee9b7f770c9b3cea2;received=192.168.0.107;rport=5060
From: <sip:phone2@192.168.0.107:5060;transport=udp>;tag=2512611503
To: "Phone 1" <sip:0123465789@192.168.0.3>;tag=as1eb64ae6
Call-ID: 76397d3a4927da5c7a9420376b208397@192.168.0.3:5060
CSeq: 11673 BYE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
  == Spawn extension (external, 0123465789, 1) exited non-zero on 'SIP/0123465789-00000020'
Scheduling destruction of SIP dialog '1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o' in 32000 ms (Method: ACK)
set_destination: Parsing <sip:212.117.203.47;lr> for address/port to send to
set_destination: set destination to 212.117.203.47:5060
Reliably Transmitting (NAT) to 212.117.203.47:5060:
BYE sip:212.117.203.47:5061 SIP/2.0
Via: SIP/2.0/UDP 80.219.136.161:5060;branch=z9hG4bK636b87d4;rport
Route: <sip:212.117.203.47;lr>
Max-Forwards: 70
From: <sip:0123465789@212.117.203.47>;tag=as3a9cd917
To: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 102 BYE
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---

<--- SIP read from UDP:212.117.203.47:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK636b87d4;rport=5060
To: "Phone 1"<sip:0123465789@212.117.203.47>;tag=pe7dwc57mtiy3xyo.o
From: <sip:0123465789@212.117.203.47>;tag=as3a9cd917
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o
CSeq: 102 BYE
Server: Sippy
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---
SIP Response message for INCOMING dialog BYE arrived
Really destroying SIP dialog '1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060~2o' Method: ACK

<--- SIP read from UDP:212.117.203.47:5060 --->
BYE sip:0123465789@192.168.0.3:5060 SIP/2.0
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-f6f7ec3310257d69-1---d8754z-;rport
Via: SIP/2.0/UDP 212.117.203.47:5061;branch=z9hG4bK-xlewl3mpp7bncjxt;rport=5061
Max-Forwards: 69
Contact: "Anonymous"<sip:212.117.203.47:5061>
To: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
From: <sip:0123465789@guest2.voipgateway.org>;tag=oyefjjxy5eqerzze.i
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 428 BYE
User-Agent: Sippy
h323-conf-id: 692572566-3680965090-2692252715-735722158
cisco-GUID: 692572566-3680965090-2692252715-735722158
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Sending to 212.117.203.47:5060 (NAT)
Scheduling destruction of SIP dialog '1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060' in 32000 ms (Method: BYE)

<--- Transmitting (NAT) to 212.117.203.47:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 212.117.203.47:5060;branch=z9hG4bK-d8754z-f6f7ec3310257d69-1---d8754z-;received=212.117.203.47;rport=5060
Via: SIP/2.0/UDP 212.117.203.47:5061;branch=z9hG4bK-xlewl3mpp7bncjxt;rport=5061
From: <sip:0123465789@guest2.voipgateway.org>;tag=oyefjjxy5eqerzze.i
To: "Phone 1"<sip:0123465789@192.168.0.3:5060>;tag=as74b9a0bd
Call-ID: 1158ce590452a15e0a5291aa425f4658@80.219.136.161:5060
CSeq: 428 BYE
Server: Asterisk PBX 1.8.13.1~dfsg-3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


<------------>
  == Spawn extension (internal, 0123465789, 2) exited non-zero on 'SIP/phone1-0000001e'
Scheduling destruction of SIP dialog '9f42d2a53406e625509057427a28d5aa@192.168.0.233' in 32000 ms (Method: ACK)
set_destination: Parsing <sip:phone1@192.168.0.233:54974;transport=udp> for address/port to send to
set_destination: set destination to 192.168.0.233:54974
Reliably Transmitting (NAT) to 192.168.0.233:54974:
BYE sip:phone1@192.168.0.233:54974;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK074f501c;rport
Max-Forwards: 70
From: <sip:0123465789@nas.weily.lan>;tag=as30a62f26
To: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 102 BYE
User-Agent: Asterisk PBX 1.8.13.1~dfsg-3
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---

<--- SIP read from UDP:192.168.0.233:54974 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.3:5060;branch=z9hG4bK074f501c;rport=5060;received=192.168.0.3
From: <sip:0123465789@nas.weily.lan>;tag=as30a62f26
To: "phone1" <sip:phone1@nas.weily.lan>;tag=1104846907
Call-ID: 9f42d2a53406e625509057427a28d5aa@192.168.0.233
CSeq: 102 BYE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---
SIP Response message for INCOMING dialog BYE arrived
Really destroying SIP dialog '9f42d2a53406e625509057427a28d5aa@192.168.0.233' Method: ACK

The security problem relates to local-phone having insecure=invite.

The ITSP has done the equivalent of directmedia to you, so your RTP is being looped back at your NAT router. I suspect it isn’t clever enough to cope with that, or you have only enabled port forwarding form the ITSP’s address.

Which lines tell you that? Not that I don’t believe you (your suggestion makes perfectly sense), I just have spent quite some time analysing that trace myself and haven’t seen it :smile:

thanks

INVITE sip:0123465789@192.168.0.3:5060 SIP/2.0

m=audio 13414 RTP/AVP 8 0 101
c=IN IP4 80.219.136.161

And the equivalent lines from their subsequent OK to the original outbound request.

Note the URI on that INVITE is somewhat broken, but Aterisk ignores the domain.

Of course, the best solution is to configure your dialplan to recognize such loop-backed calls and route them internally.