Why are chan_sip and res_pjsip with the same access data results in an error message

The following problem in the PBX I have noticed and it is the res_pjsip which outputs a error in the case of incoming calls with the following configuration

[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.1.0/16
local_net=127.0.0.1/32
external_media_address=ipv4
external_signaling_address=ipv4

[sip_reg]
type=registration
transport=transport-udp-nat
outbound_auth=sip_auth
server_uri=sip:sip.alice-voip.de
client_uri=sip:id@sip.alice-voip.de
contact_user=id
retry_interval=60

[sip_auth]
type=auth
auth_type=userpass
password=secret
username=id
realm=sip:sip.alice-voip.de

[sip_end]
type=endpoint
transport=transport-udp-nat
context=Rufannahme
disallow=all
allow=ulaw
outbound_auth=sip_auth
aors=sip_aor
direct_media=no
from_domain=sip.alice-voip.de

[sip_aor]
type=aor
contact=sip:sip.alice-voip.de

[sip_ident]
type=identify
endpoint=sip_end
match=sip:sip.alice-voip.de

— Transmitting SIP response (961 bytes) to UDP:62.52.28.195:5060 —>
SIP/2.0 416 Unsupported URI Scheme
Via: SIP/2.0/UDP 62.52.28.195:5060;rport=5060;received=62.52.28.195;branch=z9hG4bKmavodi-0-264-dfc-5-1000000-de160000-5b6c902dd9471-16a5-ffffffffffffffff-1c31-433f0000-5b6c902d8e457-3916737164-4744;oc-algo=“loss”;oc

Record-Route: sip:mavodi-0-266-70c-5-ffffffff-583b0000-5b6c902dd9199-16a5-ffffffffffffffff-mavsipodi-0-26c-1c31-5-433f0000-5b6c902d8e457-16a5@62.52.28.195:5060;lr;mavsipodi-0-26c-1c31-5-433f0000-5b6c902d8e457-16a5

Call-ID: FA163EADFF7F-1578-fa53f700-5bd276-60128a79-74975
From: “remote_id” sip:remote_id@telefonica.de;user=phone;tag=mavodi-__v~vuurtuxrtww__0-10d-58-5-ffffffff-1795-_000000000000-1578-fa53f700-3ebfb-60128a79-74b4d

why do I have a tel and no sip here?

To: tel:local_id;phone-context=ims.mnc003.mcc262.3gppnetwork.org;tag=z9hG4bKmavodi-0-264-dfc-5-1000000-de160000-5b6c902dd9471-16a5-ffffffffffffffff-1c31-433f0000-5b6c902d8e457-3916737164-4744

CSeq: 1 INVITE
Server: Yealink/SIP-T465S
Content-Length: 0

Because your provider or something uses the tel URI there?

Support for tel: URIs isn’t a requirement for a conforming SIP implementation and PJSIP doesn’t support them.

Also, I’d want to see the incoming request,as I suspect that rejection only happens for bad request IDs, in which case the provider would be broken, as they would not be returning the contact URI as provided.

Also, if you have provided a single response from Asterisk, the Server line indicates that you have overridden the user agent name in a strange way. If not, then the source of the logging is unclear.

You should mark all logs and configurations as pre-formatted text, one benefit of which is that the forum won’t mark up URIs, so won’t count them towards the limit of URIs in a newbie post.

1 Like
<--- Received SIP request (2109 bytes) from UDP:remote_server:5060 --->
INVITE sip:local_id SIP/2.0
Via: SIP/2.0/UDP remote_server:5060;oc-algo="loss";oc;rport;branch=z9hG4bKmavodi-0-264-fbf-2-1000000-b6120000-5b6c8f99a9955-1660-ffffffffffffffff-967-2e920000-5b6c8f98e437f-448961928-4848
Max-Forwards: 68
From: "remote_id" <sip:remote_id@remote_server;user=phone>;tag=mavodi-__v~vuurtuxrtww__0-10d-cd-1-ffffffff-1789-_000000000000-1564-57362700-3f7ad-6012af42-93db1
To: <tel:local_id;phone-context=ims.mnc003.mcc262.3gppnetwork.org>
Call-ID: FA163E6266D6-1564-57362700-5bea83-6012af42-93cb1
CSeq: 1 INVITE
Min-SE: 90
Session-Expires: 1800
Contact: <sip:mavodi-0-266-2d-2-fffffff1-cce10000-5b6c8f99a957c-1660-ffffffffffffffff-@62.52.28.195:5060>;+g.3gpp.ps2cs-srvcc-orig-pre-alerting;+g.3gpp.mid-call;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";+g.3gpp.accesstype="cellular"
Supported: timer,path,replaces,100rel
Allow: REGISTER,REFER,NOTIFY,SUBSCRIBE,INFO,PRACK,UPDATE,INVITE,ACK,OPTIONS,CANCEL,BYE
Record-Route: <sip:mavodi-0-266-2d-2-ffffffff-cce10000-5b6c8f99a957c-1660-ffffffffffffffff-mavsipodi-0-26c-967-2-2e920000-5b6c8f98e437f-1660@remote_server:5060;lr;mavsipodi-0-26c-967-2-2e920000-5b6c8f98e437f-1660>
P-Asserted-Identity: "remote_id" <sip:remote_id@remote_server>,"remote_id" <tel:remote_id>
P-Visited-Network-ID: remote_server
Content-Type: application/sdp
Content-Length: 702

v=0
o=ccs-0-615-2 06122944038740 1040934827 IN IP4  remote_server
s=-
c=IN IP4  remote_server
t=0 0
a=sendrecv
m=audio 57152 RTP/AVP 104 110 102 108 9 8 0 100 105
a=ptime:20
a=maxptime:40
a=sendrecv
a=rtpmap:104 AMR-WB/16000
a=fmtp:104 mode-change-capability=2;max-red=220
a=rtpmap:110 AMR-WB/16000
a=fmtp:110 octet-align=1;mode-change-capability=2;max-red=220
a=rtpmap:102 AMR/8000
a=fmtp:102 mode-change-capability=2;max-red=220
a=rtpmap:108 AMR/8000
a=fmtp:108 octet-align=1;mode-change-capability=2;max-red=220
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=rtpmap:105 telephone-event/16000
a=fmtp:105 0-15

With SIP the call building works.

-- Executing [remote_id@Rufannahme:1] Dial("SIP/remote_id-0000000a", "SIP/client_id") in new stack
  == Using SIP RTP CoS mark 5

-------------------------------------------------------------------------------------------->Audio is at 8002 

Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to client_address:5060:
INVITE sip:client_id@client_address;transport=udp SIP/2.0
Via: SIP/2.0/UDP local_server:5060;branch=z9hG4bK2a5c76e2
Max-Forwards: 70
From: "remote_id" <sip:remote_id@local_server>;tag=as7cb2c5b5
To: <sip:client_id@client_address;transport=udp>
Contact: <sip:remote_id@local_server:5060>
Call-ID: 53db8a816104010a28e517a3371b39c8@local_server:5060
CSeq: 102 INVITE
User-Agent: 
Date: Sat, 23 Jan 2021 09:18:32 GMT
Session-Expires: 2200
Min-SE: 2000
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 251

v=0
o=root 542508244 542508244 IN IP4 local_server
s=Asterisk PBX 16
c=IN IP4 local_server
t=0 0
m=audio 8002 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

---
    -- Called SIP/client_id

<--- SIP read from UDP:client_address:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP local_server:5060;branch=z9hG4bK2a5c76e2
To: <sip:client_id@client_address;transport=udp>
From: "remote_id" <sip:remote_id@local_server>;tag=as7cb2c5b5
Call-ID: 53db8a816104010a28e517a3371b39c8@local_server:5060
CSeq: 102 INVITE
Server: 
Content-Length: 0

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

<--- SIP read from UDP:client_address:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP local_server:5060;branch=z9hG4bK2a5c76e2
To: <sip:client_id@client_address;transport=udp>;tag=jfkaa
From: "remote_id" <sip:remote_id@local_server>;tag=as7cb2c5b5
Call-ID: 53db8a816104010a28e517a3371b39c8@local_server:5060
CSeq: 102 INVITE
Contact: <sip:client_id@client_address;transport=udp>
Server: 
Content-Length: 0

Given that you establish that local_id has the form of a telephone number, elsewhere, the provider is at fault. The syntax of SIP URIs is:

SIP-URI          =  "sip:" [ userinfo ] hostport
                    uri-parameters [ headers ]
SIPS-URI         =  "sips:" [ userinfo ] hostport
                    uri-parameters [ headers ]
userinfo         =  ( user / telephone-subscriber ) [ ":" password ] "@"

which means that any URI that doesn’t contain an “@” must be the domain part, containing either a domain name or an IP address literal. I’m not sure how chan_sip would cope with this. I can only suspect that it was treating it as a hostport, but not checking that it was a possible one, and sending it to extension “s”.

Normally, if registration is involved, the request URI should match the client ID in your configuration.

If my assumption that local_id looks like a phone number is wrong, your redaction has destroyed relevant information.

2 Likes

excuse I have the log mischaracterized look again please here

`<--- Received SIP request (2109 bytes) from UDP:ISP_IPv4_address:5060 --->
INVITE sip:ID_from_ISP_for_SIP@public_local_server_IPv4_address:5060 SIP/2.0
Via: SIP/2.0/UDP ISP_IPv4_address:5060;oc-algo="loss";oc;rport;branch=z9hG4bKmavodi-0-264-fbf-2-1000000-b6120000-5b6c8f99a9955-1660-ffffffffffffffff-967-2e920000-5b6c8f98e437f-448961928-4848
Max-Forwards: 68
From: "SIP_ID_incoming_call" <sip:SIP_ID_incoming_call@ISP_IPv4_domain_name;user=phone>;tag=mavodi-__v~vuurtuxrtww__0-10d-cd-1-ffffffff-1789-_000000000000-1564-57362700-3f7ad-6012af42-93db1
To: <tel:the_phone_number_of_the_SIP_connection_similar_that_SIP_ID;phone-context=ims.mnc003.mcc262.3gppnetwork.org>
Call-ID: FA163E6266D6-1564-57362700-5bea83-6012af42-93cb1
CSeq: 1 INVITE
Min-SE: 90
Session-Expires: 1800
Contact: <sip:mavodi-0-266-2d-2-fffffff1-cce10000-5b6c8f99a957c-1660-ffffffffffffffff-@ISP_IPv4_address:5060>;+g.3gpp.ps2cs-srvcc-orig-pre-alerting;+g.3gpp.mid-call;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel";+g.3gpp.accesstype="cellular"
Supported: timer,path,replaces,100rel
Allow: REGISTER,REFER,NOTIFY,SUBSCRIBE,INFO,PRACK,UPDATE,INVITE,ACK,OPTIONS,CANCEL,BYE
Record-Route: <sip:mavodi-0-266-2d-2-ffffffff-cce10000-5b6c8f99a957c-1660-ffffffffffffffff-mavsipodi-0-26c-967-2-2e920000-5b6c8f98e437f-1660@ISP_IPv4_address:5060;lr;mavsipodi-0-26c-967-2-2e920000-5b6c8f98e437f-1660>
P-Asserted-Identity: "the_phone_number_of_the_caller" <sip:SIP_ID_incoming_call@ISP_IPv4_domain_name>,"the_phone_number_of_the_caller" <tel:the_phone_number_of_the_caller>
P-Visited-Network-ID: ims.ISP_IPv4_domain_name
Content-Type: application/sdp
Content-Length: 702
`

But nevertheless, is my ISP most likely to blame that it doesn’t work properly?

If the request line is of this format, then Asterisk is at fault, as 416 only applies to request URIs, not to To or From headers, and the request URI scheme is valid. Also, the syntax for To and From headers allows any absolute URI, and a tel: URI seems to meet that definition, even though you can’t expect it to do anything with it, especially as Asterisk is a back to back user agent, so can’t simply pass unrecognised input through.

The chan_pjsip module doesn’t support tel URIs anywhere, including To and From. 416 was the best response code we found, if I recall, to send back even though the request URI wasn’t the source of the issue.

1 Like

I would suggest 403, because it is a policy decision to refuse a well formed request, with Error-Info, because 403 will result in lots of “why did I get this?” questions.

The specification doesn’t allow general URIs on REGISTER, so we are basically talking about INVITE, where the only actually required behaviour is to reflect the value received, opaquely, in future responses and requests.

I think even with an Error-Info people would still gloss over it and think they had an authentication issue and go down that path.

The reason currently why tel URIs aren’t supported in PJSIP is that it requires a full audit of everything and everywhere. This is because URIs in PJSIP aren’t opaque, and are used - for example for caller id, for determining endpoint. You have to write things explicitly with a “if this is SIP or SIPs do this, if this is Tel do this”. Noone has done that as of yet. If you don’t do it properly or miss, then a tel URI can crash Asterisk.

1 Like

I just looked at my pjsip.conf again and had to find out that I had commented out the realm the whole time because of the error message.

I set the realm in the trunk auth to sip: sip.alice-voip.de and now I get the following error message

[Jan 29 17:48:47] WARNING[2936]: res_pjsip_outbound_authenticator_digest.c:178 digest_create_request_with_auth: Host: '62.52.28.195:5060': Unable to create request with auth. No auth credentials for realm(s) 'ims.telefonica.de' in challenge.
[Jan 29 17:48:47] WARNING[2936]: res_pjsip_outbound_registration.c:933 handle_registration_response: Failed to create authenticated REGISTER request to server 'sip:sip.alice-voip.de' from client 'sip:sip_id@sip.alice-voip.de'
[Jan 29 17:48:47] WARNING[2936]: res_pjsip_outbound_registration.c:1006 handle_registration_response: Fatal response '401' received from 'sip:sip.alice-voip.de' on registration attempt to 'sip:sip_id@sip.alice-voip.de', stopping outbound registration

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