SIP Trunk to Teliax: chan_sip works, PJSIP outbound fails

So, I am setting up a new server, and connecting it to Teliax. I figured that I would use PJSIP for all extensions and trunks on this machine, as that’s the way of the future, but I am running in to an issue with making a SIP trunk work. Incoming calls work fine, but outbound calls are rejected with a “403 Forbidden” message. If I disable the PJSIP trunk and add a chan_sip trunk, everything works just fine.

Working chan_sip trunk:

Peer Details:
username=myuser
type=friend
secret=supersecretpw
qualify=yes
insecure=invite
host=hostname.domain.dom
fromdomain=hostname.domain.dom
dtmfmode=rfc2833
disallow=all
context=from-trunk
allow=ulaw

Register String: myuser:[email protected]

As for the PJSIP trunk, I have set up the trunk name to be the same as the username (I think this could be avoided if I manually configured the AOR setting?). I also configured the settings in the UI:

General Tab:
Username: myuser
Secret:••••••••••••••••••••
Authentication: Outbound
Registration: Send
SIP Server: hostname.domain.dom
SIP Server Port:5060
Context: from-pstn
Transport: 0.0.0.0-udp

Advanced Tab:
From Domain: [My IP Address]

I have tried various combinations of different options in the advanced tab, such as Client URI, From User, etc, but I’m just throwing stuff at the wall and hoping something will stick. This is a (badly) obfuscated version of what I got from pjsip set logger on:

XXX.XXX.XXX.XXX is Teliax’s IP
YYY.YYY.YYY.YYY is my IP
2125551212 is the dialed number
6175551212 is my callerID

<--- Transmitting SIP request (960 bytes) to UDP:XXX.XXX.XXX.XXX:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport;branch=z9hG4bKPjd6cfdef4-877c-4e3d-a6d0-297f359276db
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31053 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-14.0.13.4(13.27.1)
Content-Type: application/sdp
Content-Length:   263

v=0
o=- 1932683777 1932683777 IN IP4 YYY.YYY.YYY.YYY
s=Asterisk
c=IN IP4 YYY.YYY.YYY.YYY
t=0 0
m=audio 16466 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (379 bytes) from UDP:XXX.XXX.XXX.XXX:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport=5060;branch=z9hG4bKPjd6cfdef4-877c-4e3d-a6d0-297f359276db
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31053 INVITE
User-Agent: Teliax Bonsai 3.0.0 Alpha
Content-Length: 0


<--- Received SIP response (883 bytes) from UDP:XXX.XXX.XXX.XXX:5060 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport=5060;branch=z9hG4bKPjd6cfdef4-877c-4e3d-a6d0-297f359276db
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>;tag=UQpgFp2D25yUp
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31053 INVITE
User-Agent: Teliax Bonsai 3.0.0 Alpha
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Proxy-Authenticate: Digest realm="YYY.YYY.YYY.YYY", nonce="41cea0f4-58f7-4a50-95ac-c0aff4573d38", algorithm=MD5, qop="auth"
Content-Length: 0


<--- Transmitting SIP request (437 bytes) to UDP:XXX.XXX.XXX.XXX:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport;branch=z9hG4bKPjd6cfdef4-877c-4e3d-a6d0-297f359276db
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>;tag=UQpgFp2D25yUp
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31053 ACK
Max-Forwards: 70
User-Agent: FPBX-14.0.13.4(13.27.1)
Content-Length:  0


<--- Transmitting SIP request (1254 bytes) to UDP:XXX.XXX.XXX.XXX:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport;branch=z9hG4bKPja3630247-6beb-4f8c-b075-0558a3704bc5
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31054 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-14.0.13.4(13.27.1)
Proxy-Authorization: Digest username="myuser", realm="YYY.YYY.YYY.YYY", nonce="41cea0f4-58f7-4a50-95ac-c0aff4573d38", uri="sip:[email protected]:5060", response="053a8af21e70d09b79512f48b43cd55c", algorithm=MD5, cnonce="ef089734-dc86-49a5-98cd-9aeba9efdcd7", qop=auth, nc=00000001
Content-Type: application/sdp
Content-Length:   263

v=0
o=- 1932683777 1932683777 IN IP4 YYY.YYY.YYY.YYY
s=Asterisk
c=IN IP4 YYY.YYY.YYY.YYY
t=0 0
m=audio 16466 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (379 bytes) from UDP:XXX.XXX.XXX.XXX:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport=5060;branch=z9hG4bKPja3630247-6beb-4f8c-b075-0558a3704bc5
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31054 INVITE
User-Agent: Teliax Bonsai 3.0.0 Alpha
Content-Length: 0


<--- Received SIP response (740 bytes) from UDP:XXX.XXX.XXX.XXX:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport=5060;branch=z9hG4bKPja3630247-6beb-4f8c-b075-0558a3704bc5
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>;tag=v0F9gHKHZeNej
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31054 INVITE
User-Agent: Teliax Bonsai 3.0.0 Alpha
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0


<--- Transmitting SIP request (437 bytes) to UDP:XXX.XXX.XXX.XXX:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport;branch=z9hG4bKPja3630247-6beb-4f8c-b075-0558a3704bc5
From: "myuser" <sip:[email protected]>;tag=6cac78a4-924b-42d3-9fe0-0bf8367df8aa
To: <sip:[email protected]>;tag=v0F9gHKHZeNej
Call-ID: e316f001-1cc6-4c2a-ba86-a37b41ab44ad
CSeq: 31054 ACK
Max-Forwards: 70
User-Agent: FPBX-14.0.13.4(13.27.1)
Content-Length:  0


<--- Transmitting SIP request (457 bytes) to UDP:XXX.XXX.XXX.XXX:5060 --->
OPTIONS sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport;branch=z9hG4bKPjf41437eb-38f6-4295-a9a5-069424482212
From: <sip:[email protected]>;tag=04e7f35b-b809-47e9-97cd-a3b770afcf57
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: 27f52335-c4f2-4928-b17f-1c6fb86aed88
CSeq: 51734 OPTIONS
Max-Forwards: 70
User-Agent: FPBX-14.0.13.4(13.27.1)
Content-Length:  0


<--- Received SIP response (751 bytes) from UDP:XXX.XXX.XXX.XXX:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP YYY.YYY.YYY.YYY:5060;rport=5060;branch=z9hG4bKPjf41437eb-38f6-4295-a9a5-069424482212
From: <sip:[email protected]>;tag=04e7f35b-b809-47e9-97cd-a3b770afcf57
To: <sip:[email protected]>;tag=1De5Sr72gU4Bc
Call-ID: 27f52335-c4f2-4928-b17f-1c6fb86aed88
CSeq: 51734 OPTIONS
Contact: <sip:XXX.XXX.XXX.XXX>
User-Agent: Teliax Bonsai 3.0.0 Alpha
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Length: 0

I could just fall back on the working chan_sip configuration, but that’ll eventually need to go away, so I really don’t want to do that, especially because this is a new install. I’m sure that there is some simple thing that I am missing, but I don’t know what it is. Any insight that someone might be able to provide would be much appreciated.

Tom

If you are using this as the From Domain in Chan_SIP why are you using this in PJSIP?

It’s the same setting for both of them. You need to have the proper From Domain in your PJSIP trunk not just your IP.

1 Like

@BlazeStudios: Thank you! It’s super obvious, and I know that I tried it that way before, because I compared all of the settings side by side, and I swear that it didn’t work. Of course, now that I have embarrased myself by posting this thread, the PBX gods have made it work.

Once again, thank you!

It was just Schrodinger’s Route.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.