[OpenSIPS-Users] Gracefully handling bad from header

Calvin Ellison calvin.ellison at voxox.com
Thu Apr 15 17:47:24 EST 2021


I would like to more gracefully handle non-RFC compliant From headers. Is
it possible to fix them with regex or a string replacement so I can process
them?

Most often the misbehavior is a space in the user part:

<sip:redacter Coredact@
<sip:redact0330 @

Other times there's an unclosed double quote on the friendly-name part or
some kind of non-printing character in the friendly-name or user part. It's
garbage that will ultimately be rejected, but the failure to parse is
preventing me from logging the offending trunk ID in the 'otg=' parameter
of the From header.

opensips 3.1.1 (x86_64/linux) with commit to remove unnecessary regex
limitation
https://github.com/OpenSIPS/opensips/commit/a8f8aabc245ca86bd40a9eddf9befcd74a087be1

Here's the error followed by xlog $mb

Apr 15 15:26:24  /usr/sbin/opensips[13864]: ERROR:core:parse_from_header:
bad from header
Apr 15 15:26:24  /usr/sbin/opensips[13864]: ERROR:core:pv_get_from_attr:
cannot parse From header
Apr 15 15:26:24  /usr/sbin/opensips[13864]: INVITE sip:redact at redact:5060
SIP/2.0#015#012Via: SIP/2.0/UDP
redact:5060;branch=z9hG4bK1sansay2313795380rdb15209#015#012Record-Route:
<sip:sansay2313795380rdb15209 at redact:5060;lr;transport=udp>#015#012To:
<sip:redact at redact>#015#012From: <sip:redact0330
@redact;otg=redact;qtype=ers>;tag=sansay2313795380rdb15209#015#012Call-ID:
ers-1718949283-0-660497714 at redact#015#012CSeq: 1 INVITE#015#012Contact:
<sip:redact0330 @redact:5060>#015#012P-Asserted-Identity:
<sip:redact0330%20 at redact;user=phone>#015#012Remote-Party-ID:
<sip:redact0330%20 at redact>;privacy=off;screen=yes#015#012Max-Forwards:
63#015#012Content-Length: 0#015#012#015#012


Regards,

*Calvin Ellison*
Systems Architect
calvin.ellison at voxox.com
+1 (213) 285-0555

-----------------------------------------------
*voxox.com <http://www.voxox.com/> *
5825 Oberlin Drive, Suite 5
San Diego, CA 92121
[image: Voxox]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210415/6fa2b7ce/attachment.html>


More information about the Users mailing list