[Home]

Summary:ASTERISK-29165: res_pjsip: malformed header Accept-Encoding in OPTIONS response
Reporter:Alexander Greiner-Baer (algbaer)Labels:
Date Opened:2020-11-15 10:35:53.000-0600Date Closed:2020-11-19 13:40:14.000-0600
Priority:TrivialRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip
Versions:18.0.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:When establishing a SIP Trunk between Asterisk PJSIP and Alcatel OmniPCX,
the Alcatel periodically logs this:
{noformat}
Warning alarm [sip_acceptIncorrectHeader] Header Accept-Encoding is malformed => unknown header
{noformat}

Logging SIP packets in Asterisk shows, that the Accept-Encoding Header
is set to "text/plain":
{noformat}
<--- Received SIP request (455 bytes) from UDP:X.X.X.X:5060 --->
OPTIONS sip:Y.Y.Y.Y SIP/2.0
Route: <sip:Y.Y.Y.Y;lr>
Accept: application/sdp
User-Agent: OmniPCX Enterprise R12.3.1 m4.501.15
To: sip:Y.Y.Y.Y
From: sip:X.X.X.X;tag=c8743b616cc43ff1aa259447ed513231
Contact: <sip:alcatel;transport=UDP>
Call-ID: d5207489e2a0e69e8a31ac261d9500f2@X.X.X.X
CSeq: 1384889626 OPTIONS
Via: SIP/2.0/UDP X.X.X.X;branch=z9hG4bKb4a6eabaa38a16a64588e74aef74d88b
Max-Forwards: 70
Content-Length: 0


<--- Transmitting SIP response (856 bytes) to UDP: X.X.X.X:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP X.X.X.X;rport=5060;received= X.X.X.X;branch=z9hG4bKb4a6eabaa38a16a64588e74aef74d88b
Call-ID: d5207489e2a0e69e8a31ac261d9500f2@ X.X.X.X
From: <sip: X.X.X.X >;tag=c8743b616cc43ff1aa259447ed513231
To: <sip:Y.Y.Y.Y>;tag=z9hG4bKb4a6eabaa38a16a64588e74aef74d88b
CSeq: 1384889626 OPTIONS
Accept: application/dialog-info+xml, application/pidf+xml, application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: text/plain
Accept-Language: en
Server: Asterisk
Content-Length:  0
{noformat}

RFC 3261 says that Accept-Encoding SHOULD be present in an options
response. So setting it is fine, but the value "text/plain" seems
wrong here. Permitted values according to RFC 2616 are only compression
algorithms like gzip or the default identity encoding.

I have patched my installation with the following and the log messages
on the Alcatel gone away.
Patch (Asterisk 16.2.1, Debian 10):
{noformat}
-- a/res/res_pjsip_dlg_options.c
+++ b/res/res_pjsip_dlg_options.c
@@ -33,7 +33,7 @@
#include "asterisk/res_pjsip_session.h"

#define DEFAULT_LANGUAGE "en"
-#define DEFAULT_ENCODING "text/plain"
+#define DEFAULT_ENCODING "identity"

static int options_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
{
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -94,7 +94,7 @@
 */

#define DEFAULT_LANGUAGE "en"
-#define DEFAULT_ENCODING "text/plain"
+#define DEFAULT_ENCODING "identity"

/*! \brief These are the number of buckets to store AORs in */
#ifdef LOW_MEMORY

{noformat}
Comments:By: Asterisk Team (asteriskteam) 2020-11-15 10:35:54.864-0600

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: George Joseph (gjoseph) 2020-11-16 07:36:59.101-0600



You're right!  Will you be submitting a patch to correct this?  If so, you'll need to sign a license agreement (see link at top of page) and follow the guidelines below.


{panel:title=Patch Submission Guidelines}
If you'd like your contribution to be included faster, you should submit your patch for code review by the Asterisk Developer Community. To do so, please follow the Code Review ^1^ instructions on the wiki. Be sure to:
* Verify that your patch conforms to the Coding Guidelines ^2^
* Review the Code Review Checklist ^3^ for common items reviewers will look for
* If necessary, provide tests for the Asterisk Test Suite that verify the correctness of your patch ^4^

When ready, submit your patch and any tests to Gerrit ^5^ for code review.

Thanks!

^1^ https://wiki.asterisk.org/wiki/display/AST/Code+Review
^2^ https://wiki.asterisk.org/wiki/display/AST/Coding+Guidelines
^3^ https://wiki.asterisk.org/wiki/display/AST/Code+Review+Checklist
^4^ https://wiki.asterisk.org/wiki/display/AST/Asterisk+Test+Suite+Documentation
^5^ https://wiki.asterisk.org/wiki/display/AST/Gerrit+Usage
{panel}

By: Alexander Greiner-Baer (algbaer) 2020-11-16 12:08:41.352-0600

Ok, I will try to submit a patch. Much to read and to do, but it seems feasible.

By: George Joseph (gjoseph) 2020-11-16 12:43:19.792-0600

Great!  If you run into any trouble or have questions about the process, post in the freenode #asterisk-dev channel ^1^ or on the asterisk-dev mailing list ^2^.

^1^ https://webchat.freenode.net/?channels=#asterisk-dev
^2^ http://lists.digium.com/mailman/listinfo/asterisk-dev


By: Friendly Automation (friendly-automation) 2020-11-19 13:40:15.300-0600

Change 15177 merged by Friendly Automation:
res_pjsip: set Accept-Encoding to identity in OPTIONS response

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

By: Friendly Automation (friendly-automation) 2020-11-19 16:16:04.375-0600

Change 15184 merged by Kevin Harwell:
res_pjsip: set Accept-Encoding to identity in OPTIONS response

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

By: Friendly Automation (friendly-automation) 2020-11-19 16:16:23.438-0600

Change 15185 merged by Kevin Harwell:
res_pjsip: set Accept-Encoding to identity in OPTIONS response

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