<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <tt>Hi Calvin,<br>
      <br>
      I'm afraid there is not much you can do, especially if (via script
      and modules) you will need access to the "fixed" FROM  - the msg
      changes you do via script are not applied on the spot, but only
      when the msg is sent out -> so you do not see your own changes.<br>
      <br>
      But if you do not need to access the FROM hdr, you can do a brutal
      replacement with remove_hf() and append_hf(), but not sure if you
      will be able to extract any other parts of the FROM (if you want o
      preserve them).<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 2021 online
  <a class="moz-txt-link-freetext" href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a></pre>
    <div class="moz-cite-prefix">On 4/15/21 8:47 PM, Calvin Ellison
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAL+QDG8bQrctCd2waLDMQkKr1sBb0XnNOn5fmUx0us3SrfUFKg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">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?
        <div><br>
        </div>
        <div>Most often the misbehavior is a space in the user part:</div>
        <div><br>
        </div>
        <div><<a class="moz-txt-link-freetext" href="sip:redacter">sip:redacter</a> Coredact@<br>
        </div>
        <div><<a class="moz-txt-link-freetext" href="sip:redact0330">sip:redact0330</a> @<br>
        </div>
        <div><br clear="all">
          <div>
            <div dir="ltr" data-smartmail="gmail_signature">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div>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.</div>
                      <div><br>
                      </div>
                      <div>opensips 3.1.1 (x86_64/linux) with commit to
                        remove unnecessary regex limitation<br>
                      </div>
                      <div><a
href="https://github.com/OpenSIPS/opensips/commit/a8f8aabc245ca86bd40a9eddf9befcd74a087be1"
                          moz-do-not-send="true">https://github.com/OpenSIPS/opensips/commit/a8f8aabc245ca86bd40a9eddf9befcd74a087be1</a><br>
                      </div>
                      <div><br>
                      </div>
                      <div>Here's the error followed by xlog $mb</div>
                      <div><br>
                      </div>
                      <div>Apr 15 15:26:24  /usr/sbin/opensips[13864]:
                        ERROR:core:parse_from_header: bad from header<br>
                        Apr 15 15:26:24  /usr/sbin/opensips[13864]:
                        ERROR:core:pv_get_from_attr: cannot parse From
                        header<br>
                        Apr 15 15:26:24  /usr/sbin/opensips[13864]:
                        INVITE <a class="moz-txt-link-freetext" href="sip:redact@redact:5060">sip:redact@redact:5060</a>
                        SIP/2.0#015#012Via: SIP/2.0/UDP
                        redact:5060;branch=z9hG4bK1sansay2313795380rdb15209#015#012Record-Route:
<a class="moz-txt-link-rfc2396E" href="sip:sansay2313795380rdb15209@redact:5060;lr;transport=udp"><sip:sansay2313795380rdb15209@redact:5060;lr;transport=udp></a>#015#012To:
                        <a class="moz-txt-link-rfc2396E" href="sip:redact@redact"><sip:redact@redact></a>#015#012From:
                        <a class="moz-txt-link-rfc2396E" href="sip:redact0330@redact;otg=redact;qtype=ers"><sip:redact0330
@redact;otg=redact;qtype=ers></a>;tag=sansay2313795380rdb15209#015#012Call-ID:
                        ers-1718949283-0-660497714@redact#015#012CSeq: 1
                        INVITE#015#012Contact: <a class="moz-txt-link-rfc2396E" href="sip:redact0330@redact:5060"><sip:redact0330
                        @redact:5060></a>#015#012P-Asserted-Identity:
                        <a class="moz-txt-link-rfc2396E" href="sip:redact0330%20@redact;user=phone"><sip:redact0330%20@redact;user=phone></a>#015#012Remote-Party-ID:
<a class="moz-txt-link-rfc2396E" href="sip:redact0330%20@redact"><sip:redact0330%20@redact></a>;privacy=off;screen=yes#015#012Max-Forwards:
                        63#015#012Content-Length: 0#015#012#015#012<br>
                      </div>
                      <div><br>
                      </div>
                      <div dir="ltr"><br>
                      </div>
                      <div dir="ltr">Regards,
                        <div><br>
                        </div>
                        <div>
                          <p
style="font-family:helvetica,arial,sans-serif;font-size:12px;margin:0px;padding:0px
                            0px 20px;color:rgb(0,0,0)"><strong>Calvin
                              Ellison</strong><br>
                            Systems Architect<br>
                            <a href="mailto:calvin.ellison@voxox.com"
                              style="text-decoration:none;color:rgb(14,123,174)"
                              target="_blank" moz-do-not-send="true">calvin.ellison@voxox.com</a><br>
                            +1 (213) 285-0555<br>
                            <br>
-----------------------------------------------<br>
                            <strong><a href="http://www.voxox.com/"
                                style="text-decoration:none;color:rgb(14,123,174)"
                                target="_blank" moz-do-not-send="true">voxox.com</a> </strong><br>
                            5825 Oberlin Drive, Suite 5<br>
                            San Diego, CA 92121<br>
                          </p>
                          <img
                            src="http://cdn.voxox.com/img/voxox-logo.png"
                            alt="Voxox"
                            style="color:rgb(0,0,0);font-family:"Times
                            New Roman";font-size:medium"
                            moz-do-not-send="true"><br>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>