Telnyx SIP Error

When making outbound calls, i am getting this error.

[Feb 21 10:34:43] WARNING[29257][C-000002aa]: chan_sip.c:24325 handle_response_invite: Received response: “Forbidden” from ‘sip:user@sip.telnyx.com;tag=as577876b3’

Reliably Transmitting (NAT) to 192.76.120.10:5060:
OPTIONS sip:sip.telnyx.com SIP/2.0
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK64bbcba0;rport
Max-Forwards: 70
From: "asterisk" <sip:sample@54.202.91.241>;tag=as1073c5ff
To: <sip:sip.telnyx.com>
Contact: <sip:sample@54.202.91.241:5060>
Call-ID: 779061bd30479a251d90998c498fb38b@54.202.91.241:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 16.8.0
Date: Fri, 21 Feb 2020 10:34:40 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

---
<--- SIP read from UDP:192.76.120.10:5060 --->
SIP/2.0 200 Keepalive
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK64bbcba0;rport=5060;received=54.202.91.241
From: "asterisk" <sip:sample@54.202.91.241>;tag=as1073c5ff
To: <sip:sip.telnyx.com>;tag=dfb4940bfc7117e4d7fa62ed6ef36d37.c982
Call-ID: 779061bd30479a251d90998c498fb38b@54.202.91.241:5060
CSeq: 102 OPTIONS
Server: kamailio (5.0.8 (x86_64/linux))
Content-Length: 0
<------------->
--- (8 headers 0 lines) ---
Really destroying SIP dialog '779061bd30479a251d90998c498fb38b@54.202.91.241:5060' Method: OPTIONS
== Using SIP RTP CoS mark 5
> 0x5613543572f0 -- Strict RTP learning after remote address set to: 203.128.18.250:36372
-- Executing [+923022473611@default:1] NoOp("SIP/21000-00000137", "+923022473611") in new stack
-- Executing [+923022473611@default:2] Goto("SIP/21000-00000137", "outgoing,+923022473611,1") in new stack
-- Goto (outgoing,+923022473611,1)
-- Executing [+923022473611@outgoing:1] Set("SIP/21000-00000137", "CALLERID(num)=17182809547") in new stack
-- Executing [+923022473611@outgoing:2] NoOp("SIP/21000-00000137", "17182809547") in new stack
-- Executing [+923022473611@outgoing:3] Dial("SIP/21000-00000137", "SIP/provider/923022473611") in new stack
== Using SIP RTP CoS mark 5
Audio is at 17116
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 192.76.120.10:5060:
INVITE sip:923022473611@sip.telnyx.com SIP/2.0
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK13392088;rport
Max-Forwards: 70
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>
Contact: <sip:sample@54.202.91.241:5060>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 102 INVITE
User-Agent: Asterisk PBX 16.8.0
Date: Fri, 21 Feb 2020 10:34:42 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 275
v=0
o=root 445984597 445984597 IN IP4 54.202.91.241
s=Asterisk PBX 16.8.0
c=IN IP4 54.202.91.241
t=0 0
m=audio 17116 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=maxptime:150
a=sendrecv
---
-- Called SIP/provider/923022473611
Retransmitting #1 (NAT) to 192.76.120.10:5060:
INVITE sip:923022473611@sip.telnyx.com SIP/2.0
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK13392088;rport
Max-Forwards: 70
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>
Contact: <sip:sample@54.202.91.241:5060>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 102 INVITE
User-Agent: Asterisk PBX 16.8.0
Date: Fri, 21 Feb 2020 10:34:42 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 275
v=0
o=root 445984597 445984597 IN IP4 54.202.91.241
s=Asterisk PBX 16.8.0
c=IN IP4 54.202.91.241
t=0 0
m=audio 17116 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=maxptime:150
a=sendrecv
---
<--- SIP read from UDP:192.76.120.10:5060 --->
SIP/2.0 100 Telnyx trying
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK13392088;rport=5060;received=54.202.91.241
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 102 INVITE
Server: kamailio (5.0.8 (x86_64/linux))
Content-Length: 0
<------------->
--- (8 headers 0 lines) ---
<--- SIP read from UDP:192.76.120.10:5060 --->
SIP/2.0 100 Telnyx trying
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK13392088;rport=5060;received=54.202.91.241
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 102 INVITE
Server: kamailio (5.0.8 (x86_64/linux))
Content-Length: 0
<------------->
--- (8 headers 0 lines) ---
<--- SIP read from UDP:192.76.120.10:5060 --->
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 54.202.91.241:5060;received=54.202.91.241;branch=z9hG4bK13392088;rport=5060
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>;tag=1321BSFQaayre
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 102 INVITE
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY
Supported: path, replaces
Allow-Events: talk, hold, conference, refer
Proxy-Authenticate: Digest realm="sip.telnyx.com", nonce="c274d05b-988a-48be-b027-932bfaea77df", algorithm=MD5, qop="auth", opaque="dcef8db9-f3c4-489b-9dd4-fe08b291f0d6/10.15.132.4"
Content-Length: 0
<------------->
--- (12 headers 0 lines) ---
Transmitting (NAT) to 192.76.120.10:5060:
ACK sip:923022473611@sip.telnyx.com SIP/2.0
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK13392088;rport
Max-Forwards: 70
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>;tag=1321BSFQaayre
Contact: <sip:sample@54.202.91.241:5060>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 102 ACK
User-Agent: Asterisk PBX 16.8.0
Content-Length: 0

---
Audio is at 17116
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 192.76.120.10:5060:
INVITE sip:923022473611@sip.telnyx.com SIP/2.0
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK3ce60184;rport
Max-Forwards: 70
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>
Contact: <sip:sample@54.202.91.241:5060>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 103 INVITE
User-Agent: Asterisk PBX 16.8.0
Proxy-Authorization: Digest username="sample", realm="sip.telnyx.com", algorithm=MD5, uri="sip:923022473611@sip.telnyx.com", nonce="c274d05b-988a-48be-b027-932bfaea77df", response="1444abbc5f75a4d55a93ac963fc6b349", opaque="dcef8db9-f3c4-489b-9dd4-fe08b291f0d6/10.15.132.4", qop=auth, cnonce="7d64d7e6", nc=00000001
Date: Fri, 21 Feb 2020 10:34:42 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 275
v=0
o=root 445984597 445984598 IN IP4 54.202.91.241
s=Asterisk PBX 16.8.0
c=IN IP4 54.202.91.241
t=0 0
m=audio 17116 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=maxptime:150
a=sendrecv
---
<--- SIP read from UDP:192.76.120.10:5060 --->
SIP/2.0 100 Telnyx trying
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK3ce60184;rport=5060;received=54.202.91.241
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 103 INVITE
Server: kamailio (5.0.8 (x86_64/linux))
Content-Length: 0
<------------->
--- (8 headers 0 lines) ---
<--- SIP read from UDP:192.76.120.10:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 54.202.91.241:5060;received=54.202.91.241;branch=z9hG4bK3ce60184;rport=5060
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>;tag=2cvtDm0t7jmBa
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 103 INVITE
Accept: application/sdp
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY
Supported: path, replaces
Allow-Events: talk, hold, conference, refer
Content-Length: 0
<------------->
--- (11 headers 0 lines) ---
Transmitting (NAT) to 192.76.120.10:5060:
ACK sip:923022473611@sip.telnyx.com SIP/2.0
Via: SIP/2.0/UDP 54.202.91.241:5060;branch=z9hG4bK3ce60184;rport
Max-Forwards: 70
From: <sip:sample@sip.telnyx.com>;tag=as577876b3
To: <sip:923022473611@sip.telnyx.com>;tag=2cvtDm0t7jmBa
Contact: <sip:sample@54.202.91.241:5060>
Call-ID: 77eb5ce03c7d1dc323b7eb7f49b1adc3@sip.telnyx.com
CSeq: 103 ACK
User-Agent: Asterisk PBX 16.8.0
Content-Length: 0

---
[Feb 21 10:34:43] WARNING[29257][C-000002aa]: chan_sip.c:24325 handle_response_invite: Received response: "Forbidden" from '<sip:sample@sip.telnyx.com>;tag=as577876b3'

Your call was rejected due to authentication failure. You’d need to double check configuration and credentials.

I contacted telnyx sip provider. They said to remove trunk name from caller id header. Is this possible?

Call-ID: 6d052f6756dc25f144a67bf238ee8b94@sip.telnyx.com

My trunk is registered. If i type “sip show registry”, it shows trunk

That is not the caller ID header. That is call ID which is used to uniquely identify the call. They may mean the From header which has both the “fromuser” and “fromdomain” options to control what is placed in it.

This is the header that need to be replaced, if you re using chan_sip fromuser will do it

No. They specifically mentioned this one. They said they only require the first part

Should i remove fromuser?

This is my current configuration in sip.conf

[provider]
type=peer
context=provider
host=sip.telnyx.com
insecure=invite,port
fromdomain=sip.telnyx.com
fromuser=sample
defaultuser=sample

remove fromuser=sample

I removed it but same result.

Did you reload Asterisk, also they have a configuration guide for PJSIP

https://support.telnyx.com/en/articles/1130628-how-to-configure-an-asterisk-pbx-ip-trunk

The “fromuser” should be set to the username present in the Telnyx Portal site for the Connection.

yes.it is set to that one

Yes i reload asterisk. Telnyx uses pjsip.conf file but i dont want to use that one. I want sip.conf file because that one we are using

Thankyou. I resolved issue by adding secret key to provider section in sip.conf

secret = xxxxx

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