[Home]

Summary:ASTERISK-28393: Multidomain support issue
Reporter:Andrea Sannucci (voztovoice)Labels:patch pjsip
Date Opened:2019-04-22 12:23:02Date Closed:2021-05-26 10:30:40
Priority:MajorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:13.26.0 16.3.0 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-26026 res_pjsip: Error on configuring PJSIP multi domain
Environment:Centos 7Attachments:( 0) 0001-res_pjsip-pjsip_configurator-Parse-user-field-embedd.patch
( 1) pjsip-debug.txt
Description:I'm Trying to configure PJSIP in a multi domain escenario. My Endpoint configuration is:

[1000@sip20.voztovoice.org]
type=endpoint
context=externas-pjsip
disallow=all
allow=ulaw,g722
accountcode=1000
language=es
mailboxes=1000@default
dtmf_mode=rfc4733
callerid=Fulano <1000>
direct_media=no
force_rport=yes
rtp_symmetric=yes
rewrite_contact=yes
call_group=1
pickup_group=1
transport=no-nat
auth=aut1000
aors=1000

[aut1000]
type=auth
auth_type=userpass
password=password
username=1000

[1000]
type=aor
max_contacts=1
remove_existing=yes
qualify_frequency=30

When I register a Softphone (XLITE) on the Asterisk console i can see:

-- Added contact 'sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5' to AOR '1000' with expiration of 600 seconds
[2019-04-22 12:20:29] ERROR[631]: res_pjsip.c:3874 create_out_of_dialog_request: Unable to create outbound NOTIFY request to endpoint 1000@sip20.voztovoice.org
[2019-04-22 12:20:29] WARNING[631]: res_pjsip_mwi.c:503 send_unsolicited_mwi_notify_to_contact: Unable to create unsolicited NOTIFY request to endpoint 1000@sip20.voztovoice.org URI sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5
[2019-04-22 12:20:29] ERROR[6447]: res_pjsip.c:3874 create_out_of_dialog_request: Unable to create outbound OPTIONS request to endpoint 1000@sip20.voztovoice.org
[2019-04-22 12:20:29] ERROR[6447]: res_pjsip/pjsip_options.c:877 sip_options_qualify_contact: Unable to create request to qualify contact sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5 on AOR 1000
   -- Removed contact 'sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5' from AOR '1000' due to request
 == Contact 1000/sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5 has been deleted
   -- Added contact 'sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5' to AOR '1000' with expiration of 600 seconds
[2019-04-22 12:20:29] ERROR[631]: res_pjsip.c:3874 create_out_of_dialog_request: Unable to create outbound NOTIFY request to endpoint 1000@sip20.voztovoice.org
[2019-04-22 12:20:29] WARNING[631]: res_pjsip_mwi.c:503 send_unsolicited_mwi_notify_to_contact: Unable to create unsolicited NOTIFY request to endpoint 1000@sip20.voztovoice.org URI sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5
[2019-04-22 12:20:29] ERROR[9751]: res_pjsip.c:3874 create_out_of_dialog_request: Unable to create outbound OPTIONS request to endpoint 1000@sip20.voztovoice.org
[2019-04-22 12:20:29] ERROR[9751]: res_pjsip/pjsip_options.c:877 sip_options_qualify_contact: Unable to create request to qualify contact sip:1000@93.41.37.15:64331;rinstance=9ef93b2b70945db5 on AOR 1000

Comments:By: Asterisk Team (asteriskteam) 2019-04-22 12:23:02.439-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Andrea Sannucci (voztovoice) 2019-04-22 12:27:45.310-0500

Registration DEBUG

By: Andrea Sannucci (voztovoice) 2019-04-22 12:29:29.507-0500

Without multidomain support, we have a security issue too because we can't register and send calls only using domain name.

By: Kevin Harwell (kharwell) 2019-04-23 12:07:23.664-0500

I was able to replicate this issue. It appears that when Asterisk is building the "from" address (_sip_dialog_create_from_ in _res_pjsip.c_):
{noformat}
from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
from->slen = pj_ansi_snprintf(from->ptr, PJSIP_MAX_URL_SIZE,
     "<sip:%s@%s%.*s%s:%d%s%s>",
     user,
     (type & PJSIP_TRANSPORT_IPV6) ? "[" : "",
     (int)local_addr.slen,
     local_addr.ptr,
     (type & PJSIP_TRANSPORT_IPV6) ? "]" : "",
     local_port,
     (type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? ";transport=" : "",
     (type != PJSIP_TRANSPORT_UDP && type != PJSIP_TRANSPORT_UDP6) ? pjsip_transport_get_type_name(type) : "");
{noformat}
the _user_ portion in this scenario is the endpoint name (1000@sip20.voztovoice.org), and the _local_addr_ is derived from the transport or system.

In any case the final result contains two '@' characters in the from header, which gets passed into _pjsip_endpt_create_request_. The underlying pjsip parsing algorithm then fails to parse the header due to it containing two '@' characters, thus failing to create the request.

By: Andrea Sannucci (voztovoice) 2019-06-16 14:06:18.352-0500

So, is there a estimated time to resolve the issue?
Thank you
Regards

By: Joshua C. Colp (jcolp) 2019-06-16 15:23:01.029-0500

This issue is not assigned to anyone, and there is no estimated time to resolution.

By: Dennis Haney (CineCine) 2021-04-07 03:40:58.756-0500

This issue was first reported in May 2016 (ASTERISK-26026), will it ever get fixed?
Someone even found the code causing the problem?

By: Dennis Haney (CineCine) 2021-04-13 23:29:22.879-0500

Based on the code, I found a workaround.
If the realtime lookup on a request for endpoint a@b.c returns id=a.b.c instead of id=a@b.c, registration and qualify works. AORs can keep using id=a@b.c.
However, it exposes another bug where the default context of the user is not respected no matter what the realtime returns.

By: Joseph Nadiv (yois) 2021-05-20 14:58:58.220-0500

I uploaded a patch to Gerrit for review to solve the issue here, but I was thinking that there may be a bigger issue to solve.

Since 'fromuser' and 'fromdomain' are referenced throughout the project, it's probably a better idea to parse the username
on PJSIP reloads and split the username from [x@y.com] so that fromuser=x and fromdomain=y.com.

I tried doing this but the code doesn't seem to be effective at all.  I may be applying this to the wrong function.
If anyone else has the desire to take a look I've attached it.

By: Friendly Automation (friendly-automation) 2021-05-26 10:30:41.493-0500

Change 15896 merged by Friendly Automation:
res_pjsip.c: Support endpoints with domain info in username

[https://gerrit.asterisk.org/c/asterisk/+/15896|https://gerrit.asterisk.org/c/asterisk/+/15896]

By: Friendly Automation (friendly-automation) 2021-05-26 10:37:01.998-0500

Change 15923 merged by George Joseph:
res_pjsip.c: Support endpoints with domain info in username

[https://gerrit.asterisk.org/c/asterisk/+/15923|https://gerrit.asterisk.org/c/asterisk/+/15923]

By: Friendly Automation (friendly-automation) 2021-05-26 10:38:37.958-0500

Change 15924 merged by George Joseph:
res_pjsip.c: Support endpoints with domain info in username

[https://gerrit.asterisk.org/c/asterisk/+/15924|https://gerrit.asterisk.org/c/asterisk/+/15924]