<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <tt>Take a look at the append_to_reply() [1] function.<br>
      <br>
      [1]
<a class="moz-txt-link-freetext" href="https://opensips.org/docs/modules/3.1.x/sipmsgops.html#func_append_to_reply">https://opensips.org/docs/modules/3.1.x/sipmsgops.html#func_append_to_reply</a><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>

</pre>
    <div class="moz-cite-prefix">On 5/30/20 3:14 PM, Saint Michael
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAC9cSOBdN7fyRPJM2UZRNtBi_Y0Du8M1tFbN30HubqVF_s95ng@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">I need to add a new SIP header to the response
        below.<span class="gmail_default" style="font-size:small"></span><br>
        <br>
        <br>
        if ($rm=="INVITE") {<br>
            /* add the redirect destinations as branches */<br>
            $branch = "<a href="mailto:sip%3Abatman@gotham.com"
          moz-do-not-send="true">sip:batman@gotham.com</a>";<br>
            $branch = $avp(my_custom_uri);<br>
            /* sending a 3xx reply will automatically push all<br>
             * existing branches as Contact URIs */<br>
            send_reply("302","Moved Temporarily");<br>
            exit;<br>
        }
        <div>
          <div class="gmail_default" style="font-size:small">the final
            result should be:</div>
          <br>
        </div>
        <div>
          <div class="gmail_default" style="font-size:small">SIP/2.0 302
            Moved Temporarily</div>
          Via: SIP/2.0/UDP
172.16.7.254:52169;rport=52169;received=47.205.172.89;branch=z9hG4bK-524287-1---129f4244aaba9f04<br>
          Call-ID: 102650Mzg4NmFiNTQzOGY5NDJmNjM3OTYzNmE5MzNlZDIwZmI<br>
          From: "<span class="gmail_default" style="font-size:small">XXXXX</span>"
          <sip:<span class="gmail_default" style="font-size:small">XXX</span>4433019@<span
            class="gmail_default" style="font-size:small">XXX</span>.124.224.87>;tag=81a25c36<br>
          To: <<a class="moz-txt-link-freetext" href="sip:16317918378@">sip:16317918378@</a><span class="gmail_default"
            style="font-size:small">XXX</span>.124.224.87>;tag=9e198dc4-7ce8-433d-ae23-05b9bc14d55a</div>
        <div>
          <div class="gmail_default" style="font-size:small">Identity:eyJhbGciOiJFUzI1NiIsInR5cCI6InBhc3Nwb3J0IiwicHB0Ijoic2hha2VuIiwieDV1IjoiaHR0cHM6Ly9jZXJ0LmV4YW1wbGUub3JnL3Bhc3Nwb3J0LmNlciJ9.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyI2MzE3OTE4Mzc4Il19LCJpYXQiOjE1OTA4MTEyMzgsIm9yaWciOnsidG4iOiI3Mjc0NDMzMDE5In0sIm9yaWdpZCI6IjEyM2U0NTY3LWU4OWItMTJkMy1hNDU2LTQyNjY1NTQ0MDAwMCJ9.AKViDWA3uonP6tt5cKBh0FUPY5zBuJnwZLQNTrp9LCWJ-vLY1Xx5i3_oXGh1ERL4tnD-KK5wsP3FdByDa_cjGw;info=<<a
              href="https://cert.example.org/passport.cer"
              moz-do-not-send="true">https://cert.example.org/passport.cer</a>>;alg=ES256;ppt=shaken</div>
          CSeq: 1 INVITE<br>
          Server: Asterisk PBX 16.10.0<br>
          Contact: <a class="moz-txt-link-rfc2396E" href="sip:16317918378"><sip:16317918378></a><br>
          Reason: Q.850;cause=0<br>
          <div class="gmail_default" style="font-size:small">Content-Length:
             0</div>
          <br>
        </div>
        <div>
          <div class="gmail_default" style="font-size:small">also if I
            get that packet at my end, how do I extract the Identity
            header and apply it to the next INVITE?</div>
          <div class="gmail_default" style="font-size:small">Is this
            even doable?</div>
          <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </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>