[Home]

Summary:ASTERISK-30006: res_pjsip: UDP transport does not work when async_operations is greater than 1
Reporter:Ross Beer (rossbeer)Labels:
Date Opened:2022-04-02 08:55:12Date Closed:2022-04-19 12:00:02
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:GIT 18.11.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOSAttachments:( 0) Ast_No_Reply.PNG
Description:After pulling the latest GIT version for 16/18 after restarting UDP endpoints can no longer register, however TLS/TCP can.

When rolling back the patch https://gerrit.asterisk.org/c/asterisk/+/18075 everything then works again as expected.

There do not appear to be any errors in the logs when loading, only that qualified peers are unreachable.

All UDP endpoints are affected, those that register or those that have a fixed AOR or are identified by IP.

It looks like the UDP transport isn't listening any longer. This transport is defined as below:

{noformat}
[transport-udp]
type = transport
protocol = udp
bind=0.0.0.0
tos=cs3
async_operations=500
symmetric_transport=yes
{noformat}

The transport is showing as configured:

{noformat}
pjsip show transports

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  transport-tcp             tcp      0     96  0.0.0.0:5060
Transport:  transport-tls             tls      0     96  0.0.0.0:5061
Transport:  transport-udp             udp      0     96  0.0.0.0:5060
{noformat}

If the following line is removed, the transport appears to work correctly:

{noformat}
async_operations=500
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2022-04-02 08:55:13.582-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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Joshua C. Colp (jcolp) 2022-04-02 09:11:52.697-0500

I am not able to reproduce this using the Asterisk 18 branch with PJSIP 2.12. You're going to need to provide more of a complete configuration that actually reproduces the issue. As it is I have a transport exactly as you've provided, I force the pjsip.conf to be reloaded using "touch /etc/asterisk/pjsip.conf" and after reload I still have endpoints successfully qualifying on UDP and traffic flowing as expected.

By: Joshua C. Colp (jcolp) 2022-04-02 09:12:07.993-0500

Can you also confirm that the transport is no longer listening using "netstat -a"?

By: Ross Beer (rossbeer) 2022-04-02 09:43:59.921-0500

The transport does appear to be listingin:

{noformat}
udp   444672      0 0.0.0.0:sip             0.0.0.0:*
{noformat}

As soon as I uncomment 'async_operations=500' it just stops processing any packets.

By: Ross Beer (rossbeer) 2022-04-02 09:44:48.899-0500

No reply from UDP transport

By: Joshua C. Colp (jcolp) 2022-04-02 10:23:54.677-0500

I did the same thing and it still continued to work as expected. Please give SPECIFIC instructions. Did you start Asterisk with async_operations commented out on the UDP transport, changed the config to uncomment it, and then reload?

By: Joshua C. Colp (jcolp) 2022-04-02 10:25:11.310-0500

And the transport 100% does not have allow_reload set?

By: Ross Beer (rossbeer) 2022-04-02 11:24:09.284-0500

I started asterisk with the config above with 'async_operations=500' which does not appear to process packets, I then commented out 'async_operations=500' and did a 'core restart now'. After the restart asterisk started processing packets.

The config above is exactly how the transport is configured without any other options. There are other transports for TCP and TLS configured using the same options:

{noformat}
[transport-tcp]
type = transport
protocol = tcp
bind=0.0.0.0
tos=cs3
async_operations=50
symmetric_transport=yes

[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:5061
tos=cs3
cert_file=/etc/asterisk/keys/asterisk.pem
priv_key_file=/etc/asterisk/keys/asterisk.key
ca_list_file=/etc/asterisk/keys/ca.crt
symmetric_transport=yes
async_operations=50
method=tlsv1_2
cipher=AES256-GCM-SHA384,AES256-SHA256,AES128-GCM-SHA256,AES128-SHA256,AES128-SHA
{noformat}

If I set 'async_operations=1' on the UDP transport, it processes SIP traffic correctly.

The TCP/TLS transports continue to process traffic with this option enabled, all be it the default value.

Asterisk shows the default to be 1 for async_operations without the value set:

{noformat}
hpbx05*CLI> pjsip show transport transport-udp

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  transport-udp             udp      0     96  0.0.0.0:5060

ParameterName              : ParameterValue
===========================================
allow_reload               : false
async_operations           : 1
bind                       : 0.0.0.0:5060
ca_list_file               :
ca_list_path               :
cert_file                  :
cipher                     :
cos                        : 0
domain                     :
external_media_address     :
external_signaling_address :
external_signaling_port    : 0
local_net                  :
method                     : unspecified
password                   :
priv_key_file              :
protocol                   : udp
require_client_cert        : No
symmetric_transport        : true
tos                        : 96
verify_client              : No
verify_server              : No
websocket_write_timeout    : 100
{noformat}

Asterisk is showing the correct value when it is set in the config:

{noformat}
pjsip show transport transport-udp

Transport:  <TransportId........>  <Type>  <cos>  <tos>  <BindAddress....................>
==========================================================================================

Transport:  transport-udp             udp      0     96  0.0.0.0:5060

ParameterName              : ParameterValue
===========================================
allow_reload               : false
async_operations           : 500
bind                       : 0.0.0.0:5060
ca_list_file               :
ca_list_path               :
cert_file                  :
cipher                     :
cos                        : 0
domain                     :
external_media_address     :
external_signaling_address :
external_signaling_port    : 0
local_net                  :
method                     : unspecified
password                   :
priv_key_file              :
protocol                   : udp
require_client_cert        : No
symmetric_transport        : true
tos                        : 96
verify_client              : No
verify_server              : No
websocket_write_timeout    : 100
{noformat}

By: Joshua C. Colp (jcolp) 2022-04-02 13:04:23.573-0500

Okay, let's try to clear up further confusion here. In your initial description you said "after reloading". Did you actually mean "after restarting"? Those are two vastly different things.

If so: Are you stating that upon starting Asterisk with PJSIP 2.12 with async_operations set to "500" UDP traffic is not processed, but setting it to the default of "1" works?

In your latest configuration you've provided it's "50". Does it work with "50"?

By: Ross Beer (rossbeer) 2022-04-02 14:40:22.052-0500

After restarting with 'core restart now'

SIP is only processed when setting 'async_operations=1' or not set at all.

By: Joshua C. Colp (jcolp) 2022-04-02 14:50:11.789-0500

In the future please try not to use "reload" when you mean "restart". It sent me on a wild goose chase in completely the wrong area and direction, and the testing I did of reloads was not applicable at all.

By: Ross Beer (rossbeer) 2022-04-02 14:54:56.169-0500

Understood and sorry :)

By: Joshua C. Colp (jcolp) 2022-04-04 10:03:03.822-0500

I'm continuing to investigate this, but from my initial research I don't think setting the option to greater than 1 actually ever did anything in Asterisk. It's used if you have multiple threads polling/waiting on things, but we only ever have 1 thread.

By: Joshua C. Colp (jcolp) 2022-04-04 12:31:01.204-0500

At least one other person has not been able to reproduce this. Are you running any patches? Can you provide a standalone set of configs that reproduce it?

By: Asterisk Team (asteriskteam) 2022-04-19 12:00:02.137-0500

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines

By: Friendly Automation (friendly-automation) 2022-04-26 11:08:14.297-0500

Change 18424 merged by Friendly Automation:
res_pjsip: Always set async_operations to 1.

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

By: Friendly Automation (friendly-automation) 2022-04-26 11:08:45.147-0500

Change 18425 merged by Friendly Automation:
res_pjsip: Always set async_operations to 1.

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

By: Friendly Automation (friendly-automation) 2022-04-26 11:10:31.320-0500

Change 18365 merged by Friendly Automation:
res_pjsip: Always set async_operations to 1.

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

By: Friendly Automation (friendly-automation) 2022-04-26 11:31:36.660-0500

Change 18423 merged by Joshua Colp:
res_pjsip: Always set async_operations to 1.

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