<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi,<br>
      <br>
      you should get the body of the header, remove the header, do a
      subst (to change the username) and insert the hdr back:<br>
      <br>
      $var(body) = $hdr(Authorization);<br>
      $var(new_body) = $(var(body){re.subst,reg_exp}) ; // see
      <a class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-Tran-2-1#toc75">http://www.opensips.org/Documentation/Script-Tran-2-1#toc75</a><br>
      remove_hf("</tt><tt><tt>Authorization</tt>");<br>
      append_hf("</tt><tt><tt>Authorization: </tt>$</tt><tt><tt>var(new_body)\r\n</tt>");<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="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 27.05.2015 05:42, nirali soni wrote:<br>
    </div>
    <blockquote
cite="mid:CANtjt0knCQoqukci06z+9BgHdmgWaJB9-1aASVwwbwyg74d-wg@mail.gmail.com"
      type="cite">
      <p dir="ltr">Thank for reply<br>
        But how could I do this with using regexp?</p>
      <br>
      <div class="gmail_quote">On Tue, 26 May 2015 21:56 Bogdan-Andrei
        Iancu &lt;<a moz-do-not-send="true"
          href="mailto:bogdan@opensips.org">bogdan@opensips.org</a>&gt;
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div text="#000000" bgcolor="#FFFFFF"> <tt>Hi N</tt><tt>irali,</tt><tt><br>
              <br>
              You could try to do it with some regexp and
              transformations, but your authentication will fail as the
              "response" will not match the username - the response is
              computed based in username, password, etc. <br>
            </tt><tt><br>
            </tt><tt>Regards,</tt><br>
            <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
          </div>
          <div text="#000000" bgcolor="#FFFFFF">
            <div>On 26.05.2015 14:57, nirali soni wrote:<br>
            </div>
          </div>
          <div text="#000000" bgcolor="#FFFFFF">
            <blockquote type="cite">
              <div dir="ltr">
                <div>Hi,</div>
                <div><br>
                </div>
                <div>I want to change Digest username in Register
                  request.My use in opensips Subscribe table as 1001 and
                  in asterisk  sip.conf its lilke <b>1001_cname. </b>when
                  I try to register to asterisk it sends 403 Forbidden.
                  with user name mismatch.</div>
                <div><br>
                </div>
                <div>
                  <div>REGISTER sip:192.168.50.123:5060;transport=UDP
                    SIP/2.0</div>
                  <div>Via: SIP/2.0/UDP
                    192.168.50.43:5060;branch=z9hG4bKfa0a.ff2f5601.0</div>
                  <div>Via: SIP/2.0/UDP
192.168.50.30:50413;received=192.168.50.30;branch=z9hG4bK-524287-1---8343a748155f5d1c;rport=50413</div>
                  <div>Max-Forwards: 69</div>
                  <div>Contact:
                    <a moz-do-not-send="true"
href="mailto:sip:1006@192.168.50.30:50413;rinstance=bf3ed7694430b17a;transport=UDP"
                      target="_blank">&lt;sip:1006@192.168.50.30:50413;rinstance=bf3ed7694430b17a;transport=UDP&gt;</a></div>
                  <div>To: &lt;<a moz-do-not-send="true"
                      href="mailto:sip%3A1006_cname@192.168.50.123"
                      target="_blank">sip:1006_cname@192.168.50.123</a>&gt;</div>
                  <div>From: &lt;<a moz-do-not-send="true"
                      href="mailto:sip%3A1006_cname@192.168.50.123"
                      target="_blank">sip:1006_cname@192.168.50.123</a>&gt;;tag=b223565f</div>
                  <div>Call-ID: eODd20Lykxt_5QhbM49_hg..</div>
                  <div>CSeq: 2 REGISTER</div>
                  <div>Expires: 60</div>
                  <div>Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER,
                    MESSAGE, OPTIONS, INFO, SUBSCRIBE</div>
                  <div>Supported: replaces, norefersub, extended-refer,
                    timer, outbound, path, X-cisco-serviceuri</div>
                  <div>User-Agent: Zoiper r30798</div>
                  <div><b>Authorization: Digest username="<font
                        color="#ff0000">1006</font>",realm="asterisk",nonce="50742ec9",uri="sip:192.168.50.123:5060;transport=UDP",response="c0409f4c7a960df17b24994aff6a9fa2",algorithm=MD5</b></div>
                  <div>Allow-Events: presence, kpml</div>
                  <div>Content-Length: 0</div>
                </div>
                <div>==========</div>
                <div>I want Digest username= 1006_cname ..</div>
                <div>How can I do this?</div>
                <div><br>
                </div>
                <div><br>
                </div>
                <br clear="all">
                <div>
                  <div>
                    <div dir="ltr">Thanks and Regards,
                      <div> </div>
                    </div>
                  </div>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <br>
            </blockquote>
          </div>
          <div text="#000000" bgcolor="#FFFFFF">
            <blockquote type="cite">
              <pre>_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>