SIP trunk. No outbound calls

SIP trunk. No outbound calls

Hi,

I’m having a problem that is driving me nuts and my Google-fu is apparently limited. I have FreePBX 13.0.190.7 (The Distro) with Asterisk 13.13.1 and a bunch of Cisco SIP (chan-sip) and SCCP phones (and a Zoiper soft-phone configured using chan-pjsip). The pbx and all phones are sitting behind NAT and a dynamic IP adress. I have a SIP trunk from a local provider. I can make calls between all phones internally

FreePBX is registered with the provider and I can receive external calls to the DID. Audio is working correctly for all calls both internally and from the trunk. The problem is that I can’t call any external numbers. I have tried to narrow the problem down and a SIP debug shows that i get a “SIP/2.0 403 Forbidden” from the voip provider whenever I try to call out over the trunk. I initially used chan_pjsip for the trunk but switched over to chan_sip but the result is the same.

Here are the PEER Details on the outgoing tab of the trunk sip settings

host=95.143.207.218
port=9950
username=3976
secret=hunter2
type=peer
qualify=yes
nat=yes
insecure=port,invite

I realise that there must be something wrong with my configuration but I haven’t been able to nail it yet so I would really appreciate any help I can get with this.

Here is a sip debug trace from a connection attempt. What else can I provide to narrow down the issue?

SIP Debugging enabled
[2017-01-02 12:23:39] WARNING[7183]: res_pjsip_pubsub.c:3150 pubsub_on_rx_publish_request: No registered publish handler for event presence
[2017-01-02 12:23:39] WARNING[7183]: res_pjsip_pubsub.c:639 subscription_get_handler_from_rdata: No registered subscribe handler for event presence.winfo
[2017-01-02 12:23:39] WARNING[2055]: func_cdr.c:383 cdr_write_callback: CDR requires a value (CDR(variable)=value)
Audio is at 12034
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec g726 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 95.143.207.218:9950:
INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK322b0c61;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as29ca084e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Date: Mon, 02 Jan 2017 11:23:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 334

v=0
o=root 1978262473 1978262473 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 12034 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
Retransmitting #1 (NAT) to 95.143.207.218:9950:
INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK322b0c61;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as29ca084e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Date: Mon, 02 Jan 2017 11:23:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 334

v=0
o=root 1978262473 1978262473 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 12034 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK322b0c61;rport=5160
To: <sip:[email protected]:9950>
From: <sip:[email protected]:5160>;tag=as29ca084e
Call-ID: [email protected]
CSeq: 102 INVITE
Content-Length: 0

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

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK322b0c61;rport=5160
Proxy-Authenticate: Digest nonce="414d535c0e7ac93323:88273b0cbea406e86e0ccb0dc2de0a05",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=bc720b74
From: <sip:[email protected]:5160>;tag=as29ca084e
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to 95.143.207.218:9950:
ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK322b0c61;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as29ca084e
To: <sip:[email protected]:9950>;tag=bc720b74
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


---
Audio is at 12034
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec g726 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 95.143.207.218:9950:
INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK3cc9854d;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as29ca084e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Proxy-Authorization: Digest username="3976", realm="3CXPhoneSystem", algorithm=MD5, uri="sip:[email protected]:9950", nonce="414d535c0e7ac93323:88273b0cbea406e86e0ccb0dc2de0a05", response="a027db0748189532f8ac2dd211a3c44f"
Date: Mon, 02 Jan 2017 11:23:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 334

v=0
o=root 1978262473 1978262474 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 12034 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK322b0c61;rport=5160
Proxy-Authenticate: Digest nonce="414d535c0e7ac93323:88273b0cbea406e86e0ccb0dc2de0a05",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=bc720b74
From: <sip:[email protected]:5160>;tag=as29ca084e
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to 95.143.207.218:9950:
ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK3cc9854d;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as29ca084e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


---

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK3cc9854d;rport=5160
To: <sip:[email protected]:9950>;tag=237b1917
From: <sip:[email protected]:5160>;tag=as29ca084e
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Warning: 499 WIN-F6MOI2921OH "Caller is forbidden"
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to 95.143.207.218:9950:
ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK3cc9854d;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as29ca084e
To: <sip:[email protected]:9950>;tag=237b1917
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


---
[2017-01-02 12:23:39] WARNING[2405][C-00000003]: chan_sip.c:23861 handle_response_invite: Received response: "Forbidden" from '<sip:[email protected]:5160>;tag=as29ca084e'
Scheduling destruction of SIP dialog '[email protected]' in 7616 ms (Method: INVITE)
Reliably Transmitting (no NAT) to 192.168.0.120:5160:
OPTIONS sip:[email protected]:5160;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.0.38:5160;branch=z9hG4bK093cf21c
Max-Forwards: 70
From: "Unknown" <sip:[email protected]:5160>;tag=as66e16942
To: <sip:[email protected]:5160;transport=udp>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]:5160
CSeq: 102 OPTIONS
User-Agent: FPBX-13.0.190.7(13.13.1)
Date: Mon, 02 Jan 2017 11:23:39 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:192.168.0.120:51837 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.38:5160;branch=z9hG4bK093cf21c
From: "Unknown" <sip:[email protected]:5160>;tag=as66e16942
To: <sip:[email protected]:5160;transport=udp>;tag=0018187f3bf514043c773463-6a31ccd8
Call-ID: [email protected]:5160
Date: Mon, 02 Jan 2017 11:23:39 GMT
CSeq: 102 OPTIONS
Server: Cisco-CP7941G/9.4.2
Allow: ACK,BYE,CANCEL,INVITE,NOTIFY,OPTIONS,REFER,REGISTER,UPDATE
Allow-Events: kpml,dialog,refer
Accept: application/sdp,multipart/mixed,multipart/alternative
Accept-Encoding: identity
Accept-Language: en
Supported: replaces,join,sdp-anat,norefersub,resource-priority,extended-refer,X-cisco-callinfo,X-cisco-serviceuri,X-cisco-escapecodes,X-cisco-service-control,X-cisco-srtp-fallback,X-cisco-monrec,X-cisco-config,X-cisco-sis-6.0.0
Content-Length: 265
Content-Type: application/sdp
Content-Disposition: session;handling=optional

v=0
o=Cisco-SIPUA 6727 0 IN IP4 192.168.0.120
s=SIP Call
t=0 0
m=audio 0 RTP/AVP 0 8 18 102 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:102 L16/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
--- (17 headers 12 lines) ---

Try adding the settings:
fromdoamin=trunkdomain
fromuser=trunkuser

Reload sip and try again.

Hi!

I think you meant “fromdomain”…

Happy New Year!

Nick

Hi and thank you for the feedback! That some kind of difference, but the call is still not going thru.

My config now looks like this:

host=95.143.207.218
port=9950
username=3976
fromuser=3976
fromdomain=95.143.207.218 ; <- Should this really be the IP of the provider?
secret=hunter2
type=peer
qualify=yes
nat=yes
insecure=port,invite

The difference is that I get a different audio error message. The message went from “The number you have dialled is unavailable….” to “All circuits are busy right now….” but I still get a 403 from the provider:

SIP Debugging enabled
[2017-01-02 18:31:17] WARNING[11931]: res_pjsip_pubsub.c:3150 pubsub_on_rx_publish_request: No registered publish handler for event presence
[2017-01-02 18:31:17] WARNING[11931]: res_pjsip_pubsub.c:639 subscription_get_handler_from_rdata: No registered subscribe handler for event presence.winfo
[2017-01-02 18:31:17] WARNING[11581]: func_cdr.c:383 cdr_write_callback: CDR requires a value (CDR(variable)=value)
Audio is at 16032
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec g726 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 95.143.207.218:9950:
INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60946803;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as3975b51e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Date: Mon, 02 Jan 2017 17:31:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 332

v=0
o=root 923376205 923376205 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 16032 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60946803;rport=5160
Proxy-Authenticate: Digest nonce="414d535c0e7b1f5d77:bfa293c5dbd4e927dcbcd056ef140883",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=702a7443
From: <sip:[email protected]:5160>;tag=as3975b51e
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to 95.143.207.218:9950:
ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60946803;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as3975b51e
To: <sip:[email protected]:9950>;tag=702a7443
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


---
Audio is at 16032
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding codec g726 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 95.143.207.218:9950:
INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as3975b51e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Proxy-Authorization: Digest username="3976", realm="3CXPhoneSystem", algorithm=MD5, uri="sip:[email protected]:9950", nonce="414d535c0e7b1f5d77:bfa293c5dbd4e927dcbcd056ef140883", response="0446b61e49895d0e30f2c972c5ad07e3"
Date: Mon, 02 Jan 2017 17:31:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 332

v=0
o=root 923376205 923376206 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 16032 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
Retransmitting #1 (NAT) to 95.143.207.218:9950:
INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as3975b51e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Proxy-Authorization: Digest username="3976", realm="3CXPhoneSystem", algorithm=MD5, uri="sip:[email protected]:9950", nonce="414d535c0e7b1f5d77:bfa293c5dbd4e927dcbcd056ef140883", response="0446b61e49895d0e30f2c972c5ad07e3"
Date: Mon, 02 Jan 2017 17:31:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 332

v=0
o=root 923376205 923376206 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 16032 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport=5160
To: <sip:[email protected]:9950>
From: <sip:[email protected]:5160>;tag=as3975b51e
Call-ID: [email protected]
CSeq: 103 INVITE
Content-Length: 0

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

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport=5160
To: <sip:[email protected]:9950>;tag=8247ad36
From: <sip:[email protected]:5160>;tag=as3975b51e
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Warning: 499 WIN-F6MOI2921OH "Caller is forbidden"
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to 95.143.207.218:9950:
ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as3975b51e
To: <sip:[email protected]:9950>;tag=8247ad36
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


---
[2017-01-02 18:31:17] WARNING[11639][C-00000005]: chan_sip.c:23861 handle_response_invite: Received response: "Forbidden" from '<sip:[email protected]:5160>;tag=as3975b51e'
Scheduling destruction of SIP dialog '[email protected]' in 9344 ms (Method: INVITE)

<--- SIP read from UDP:95.143.207.218:9950 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport=5160
To: <sip:[email protected]:9950>;tag=8247ad36
From: <sip:[email protected]:5160>;tag=as3975b51e
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Warning: 499 WIN-F6MOI2921OH "Caller is forbidden"
Content-Length: 0

<------------->
--- (9 headers 0 lines) ---
Transmitting (NAT) to 95.143.207.218:9950:
ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK60dbe3c2;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as3975b51e
To: <sip:[email protected]:9950>;tag=8247ad36
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


---
[2017-01-02 18:31:20] WARNING[11595]: res_pjsip_pubsub.c:3150 pubsub_on_rx_publish_request: No registered publish handler for event presence
[2017-01-02 18:31:20] WARNING[11931]: res_pjsip_pubsub.c:639 subscription_get_handler_from_rdata: No registered subscribe handler for event presence.winfo
freepbx*CLI> sip set debug off

Do you have any more ideas?

Since this is Peer, the “fromdomain” should be the domain that matches your domain with whatever the ITSP is expecting. In other words, this fromdomain should be your domain name or address.

ThanksI tried setting fromdomain to my public IP and domain name too but the result is the same. I still get a 403 “Forbidden” from the provider :confused:

Fromdomain must be the domain of your ITSP not your host. Anyway that setting still does nothing to your INVITE.

Some questions:

1.- Which ITSP is your provider?
2.- Did you change the realm from FreePBX?(currently the invite is using “3CXPhoneSystem”)
3.- Your provider allow any User-Agent to send INVITES?
4.- What said your provider about this error?
5.- Does it send you special instructions to register or send calls?

Thanks for taking the time to help me.

  1. My ITSP is InternetPort AB (In Sweden)
  2. I have not changed any realm setting as far as I’m aware. I assume that the 3CXPhoneSystem string is coming from the ITSPs server in their response somehow (Their user agent says “3CXPhoneSystem 15.0.59950.0 (59299)”).
  3. I don’t know but I intend to ask them. What I know is that I have managed to register directly to the ITSP and make oubound calls using the “Media5-fone” softphone from a mobile device from my wifi behind the same firewall/nat server (pfsense) as the FreePBX server. I have assumed that that softphone uses a different user agent.
  4. I haven’t received a response from them yet. I was in contact with them last week. The problem at that point was that my internal ip adress leaked thru in the invite. I have changed to chan_sip since then because I realized that chan_pjsip probably isn’t ready for NAT yet.
  5. All I’ve received from the ITSP is a user name, password, registration server and port, and a DID. No other instructions are available.

Regarding Nat: I have set the following options:

Settings/Asterisk SIP Settings/General SIP Settings:
External Adress: My public IP
Local Networks: 192.168.0.0/24

Settings/Asterisk SIP Settings/Chan SIP SIP Settings:
NAT: yes
IP Configuration: Dynamic IP
Dynamic Host: My public domain name

Quick doubt: Your ITSP: “InternetPort AB” provide the “SIP trunk” right?(sometimes ITSP is not related with “trunk provider” and that generate a confusion so I want to double check, i want to know who is your “trunk provider”).

Interesting, You can do the same in your PC using Zoiper or another softphone then install wireshark and finally compare the INVITE sent by the softphone(which presumably will work) against the FreePBX INVITE.

No problem. I’m not 100% that I understand the distinction but InternetPort is providing both the telephony service and the trunk to me.

I will fire up a packet analyser on the firewall and try to capture a successful authentication that way and post it here. I haven’t been successful with connecting Zoiper on the Mac to the trunk yet. It doesn’t seem to register for some reason.

Thanks,
Stefan

Allright. Here is a packet capture from the firewall. It shows a successful call from a softphone on a mobile device directly to the trunk so FreePBX is not involved at all here. I will post a capture of an unsuccessful attempt from FreePBX next so we can compare them.

INVITE sip:[email protected]:9950 SIP/2.0
Accept: application/conference-info+xml, application/sdp, message/sipfrag, multipart/mixed
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bK779750a877a325b1c;rport
Max-Forwards: 70
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
To: <sip:[email protected]:9950>
Call-ID: a8077bc8401bd54e
CSeq: 1640554182 INVITE
Allow: ACK, BYE, CANCEL, INVITE, MESSAGE, NOTIFY, OPTIONS, REFER, SUBSCRIBE, UPDATE
Allow-Events: refer
Contact: <sip:[email protected]:5060>;audio
Supported: histinfo, replaces, sdp-anat, join
User-Agent: Media5-fone/4.23.5.11228 iOS/10.0.2
Content-Disposition: session
Content-Type: application/sdp
Content-Length: 302

v=0
o=- 2419651667404825277 2419651667404825278 IN IP4 192.168.0.52
s=m5
c=IN IP4 192.168.0.52
t=0 0
a=sendrecv
m=audio 10000 RTP/AVP 0 8 96 125
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 iLBC/8000
a=rtpmap:125 telephone-event/8000
a=fmtp:96 mode=30
a=fmtp:125 0-15
a=sendrecv



SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bK779750a877a325b1c;rport=39794;received=83.233.167.184
Proxy-Authenticate: Digest nonce="414d535c0e7b710456:4f872e520036f7946c6e48a1bf4bdc4b",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=f62cae6f
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
Call-ID: a8077bc8401bd54e
CSeq: 1640554182 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0



ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bK779750a877a325b1c;rport
Max-Forwards: 70
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
To: <sip:[email protected]:9950>;tag=f62cae6f
Call-ID: a8077bc8401bd54e
CSeq: 1640554182 ACK
User-Agent: Media5-fone/4.23.5.11228 iOS/10.0.2
Content-Length: 0



INVITE sip:[email protected]:9950 SIP/2.0
Accept: application/conference-info+xml, application/sdp, message/sipfrag, multipart/mixed
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bKd21d601fe79946267;rport
Proxy-Authorization: Digest username="3976",realm="3CXPhoneSystem",nonce="414d535c0e7b710456:4f872e520036f7946c6e48a1bf4bdc4b",uri="sip:[email protected]:9950",response="cfb091e5f2f887b6b939eceb788ad618",algorithm=MD5
Max-Forwards: 70
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
To: <sip:[email protected]:9950>
Call-ID: a8077bc8401bd54e
CSeq: 1640554183 INVITE
Allow: ACK, BYE, CANCEL, INVITE, MESSAGE, NOTIFY, OPTIONS, REFER, SUBSCRIBE, UPDATE
Allow-Events: refer
Contact: <sip:[email protected]:5060>;audio
Supported: histinfo, replaces, sdp-anat, join
User-Agent: Media5-fone/4.23.5.11228 iOS/10.0.2
Content-Disposition: session
Content-Type: application/sdp
Content-Length: 302

v=0
o=- 2419651667404825277 2419651667404825278 IN IP4 192.168.0.52
s=m5
c=IN IP4 192.168.0.52
t=0 0
a=sendrecv
m=audio 10000 RTP/AVP 0 8 96 125
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 iLBC/8000
a=rtpmap:125 telephone-event/8000
a=fmtp:96 mode=30
a=fmtp:125 0-15
a=sendrecv


SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bKd21d601fe79946267;rport=39794;received=83.233.167.184
To: <sip:[email protected]:9950>
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
Call-ID: a8077bc8401bd54e
CSeq: 1640554183 INVITE
Content-Length: 0



SIP/2.0 183 Session Progress
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bKd21d601fe79946267;rport=39794;received=83.233.167.184
Contact: <sip:[email protected]:9950>
To: <sip:[email protected]:9950>;tag=850c8c63
From: "3976"<sip:[email protected]:9950>;tag=b3a6c816ee
Call-ID: a8077bc8401bd54e
CSeq: 1640554183 INVITE
Content-Type: application/sdp
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 251

v=0
o=3cxPS 329185755136 18723373057 IN IP4 95.143.207.218
s=3cxPS Audio call
c=IN IP4 95.143.207.218
t=0 0
m=audio 9224 RTP/AVP 0 8 125
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:125 telephone-event/8000
a=fmtp:125 0-15
a=sendrecv

… And here is an unsuccessful attempt from a Zoiper softphone via FreePBX. I’m not that familiar with SIP so it is still hard for me to pinpoint where it goes

An obvious difference is the “From” header that looks like this in the successful attempt:
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee

INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK38565de1;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as1573709e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Date: Mon, 02 Jan 2017 23:43:25 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 334

v=0
o=root 1663583188 1663583188 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 19814 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv




SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK38565de1;rport=5160
Proxy-Authenticate: Digest nonce="414d535c0e7b769562:c550549d78eebbfe304d4a6a96ee970e",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=4b190643
From: <sip:[email protected]:5160>;tag=as1573709e
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0



ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK38565de1;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as1573709e
To: <sip:[email protected]:9950>;tag=4b190643
Contact: <sip:[email protected]:5160>
Call-ID: [email protected].167.184
CSeq: 102 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0


INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK55d4a80a;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as1573709e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: FPBX-13.0.190.7(13.13.1)
Proxy-Authorization: Digest username="3976", realm="3CXPhoneSystem", algorithm=MD5, uri="sip:[email protected]:9950", nonce="414d535c0e7b769562:c550549d78eebbfe304d4a6a96ee970e", response="7b1d427ffdac28ac9ff9a154435e6ccf"
Date: Mon, 02 Jan 2017 23:43:25 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 334

v=0
o=root 1663583188 1663583189 IN IP4 83.233.167.184
s=Asterisk PBX 13.13.1
c=IN IP4 83.233.167.184
t=0 0
m=audio 19814 RTP/AVP 0 8 3 111 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK55d4a80a;rport=5160
To: <sip:[email protected]:9950>;tag=2b58eb7f
From: <sip:[email protected]:5160>;tag=as1573709e
Call-ID: [email protected]
CSeq: 103 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Warning: 499 WIN-F6MOI2921OH "Caller is forbidden"
Content-Length: 0


ACK sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK55d4a80a;rport
Max-Forwards: 70
From: <sip:[email protected]:5160>;tag=as1573709e
To: <sip:[email protected]:9950>;tag=2b58eb7f
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]
CSeq: 103 ACK
User-Agent: FPBX-13.0.190.7(13.13.1)
Content-Length: 0

Ok in the sucessfull INVITE I can see this:

INVITE sip:[email protected]:9950 SIP/2.0
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5060>;audio
Supported: histinfo, replaces, sdp-anat, join
User-Agent: Media5-fone/4.23.5.11228 iOS/10.0.2


SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bK779750a877a325b1c;rport=39794;received=83.233.167.184
Proxy-Authenticate: Digest nonce="414d535c0e7b710456:4f872e520036f7946c6e48a1bf4bdc4b",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=f62cae6f
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
Call-ID: a8077bc8401bd54e
CSeq: 1640554182 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0


INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.52;branch=z9hG4bKd21d601fe79946267;rport
Proxy-Authorization: Digest username="3976",realm="3CXPhoneSystem",nonce="414d535c0e7b710456:4f872e520036f7946c6e48a1bf4bdc4b",uri="sip:[email protected]:9950",response="cfb091e5f2f887b6b939eceb788ad618",algorithm=MD5
From: "3976" <sip:[email protected]:9950>;tag=b3a6c816ee
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5060>;audio
User-Agent: Media5-fone/4.23.5.11228 iOS/10.0.2

meanwhile in the failed INVITE:

INVITE sip:[email protected]:9950 SIP/2.0
From: <sip:[email protected]:5160>;tag=as1573709e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
Supported: replaces, timer
User-Agent: FPBX-13.0.190.7(13.13.1)


SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK38565de1;rport=5160
Proxy-Authenticate: Digest nonce="414d535c0e7b769562:c550549d78eebbfe304d4a6a96ee970e",algorithm=MD5,realm="3CXPhoneSystem"
To: <sip:[email protected]:9950>;tag=4b190643
From: <sip:[email protected]:5160>;tag=as1573709e
Call-ID: [email protected]
CSeq: 102 INVITE
User-Agent: 3CXPhoneSystem 15.0.59950.0 (59299)
Content-Length: 0


INVITE sip:[email protected]:9950 SIP/2.0
Via: SIP/2.0/UDP 83.233.167.184:5160;branch=z9hG4bK55d4a80a;rport
Proxy-Authorization: Digest username="3976", realm="3CXPhoneSystem", algorithm=MD5, uri="sip:[email protected]:9950", nonce="414d535c0e7b769562:c550549d78eebbfe304d4a6a96ee970e", response="7b1d427ffdac28ac9ff9a154435e6ccf"
From: <sip:[email protected]:5160>;tag=as1573709e
To: <sip:[email protected]:9950>
Contact: <sip:[email protected]:5160>
User-Agent: FPBX-13.0.190.7(13.13.1)

The only difference that I can see is the FROM in the initial INVITE, FreePBX is not sending the username and the correct IP address of your ITSP, but later the Digest use the same SIP URI as the successfull INVITE :confused: And the UserAgent, in the past ITSPs blocked the “asterisk” UserAgent but I don’t think this is the case since the UA is from FreePBX.

So i would like to see again your sip settings for the trunk. You need to have at least:

defaultuser=3976
fromuser=3976
fromdomain=95.143.207.218
host=95.143.207.218
port=9950

I made a quick google search against the Proxy Auth & 403 almost all results says the same as me(here is one):

Another:
http://forums.asterisk.org/viewtopic.php?f=13&t=79896#p163520

I think that we need the deep insight of @david55 here.

Thanks guys. I really appreciate your help here. I tried setting the defaultuser option but the result was the same as before.

I received a response from the ITSP earlier today but it was nothing more than another SIP log and a suggestion to try a softphone instead. I realised then that I should probably try another provider. I signed up with another company and had a working trunk within five minutes. Same settings as before, just a different port, DID, username, password and IP adress.

Thanks again for your help. I did learn a lot along the way and I will certainly stay on FreePBX in the future.

Cheers!

what are you using for an outbound caller id? some providers will only allow you to pass a number they own.

I used the CID they provided.

In other words: “We don’t want you to connect a PBX to this line.”

If so, changing the User Agent maybe will work. @sco01 if you still have it give it a try by changing the UA in the sip settings for the same as the working softphone.

I will try that.