<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi,</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Not sure how can I help you if you do not even provide the
      "</tt><tt>$var(reg_exp)" value you get there :(</tt><tt><br>
    </tt><tt><br>
    </tt><tt>Regards,</tt><br>
    <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 26.06.2015 14:33, nirali soni wrote:<br>
    </div>
    <blockquote
cite="mid:CANtjt0nw-vSsHBnT13DmsGbYpAr4-3Ep1nUye81fXL4gFy7NXw@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello, 
        <div><br>
        </div>
        <div>
          <div>I want to change contact header </div>
          <div>$var(from_user)= $avp(i:678) + $fU;</div>
          <div><span class="" style="white-space:pre"> </span>$var(body)
            = $hdr(Contact);</div>
          <div><span class="" style="white-space:pre"> </span>$var(reg_exp)
            = "/$avp(i:678)/$var(from_user)/g";</div>
          <div>                $var(new_body) =
            $(var(body){re.subst,$var(reg_exp)}) ;</div>
          <div><span class="" style="white-space:pre"> </span>remove_hf("Contact");</div>
          <div><span class="" style="white-space:pre"> </span>append_hf("Contact:
            $var(new_body)\r\n");</div>
          <div><br>
          </div>
          <div>But this is not working.The problen is in
            $var(reg_exp).Help me how could I solve this.</div>
        </div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature">
            <div dir="ltr">Thanks and Regards,
              <div>    Nirali Soni</div>
            </div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">On Wed, Jun 24, 2015 at 6:10 PM,
          Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:bogdan@opensips.org"
              target="_blank">bogdan@opensips.org</a>&gt;</span> 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>Of course you
                can do it. In a similar way as below: <br>
                    if ($rd=="<a moz-do-not-send="true"
                  href="http://abc.com" target="_blank">abc.com</a>")
                prefix("7777");<br>
                <br>
                Regards,<br>
              </tt><span class="">
                <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>
              </span>
              <div>
                <div class="h5">
                  <div>On 24.06.2015 08:36, nirali soni wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">Thank you Bogdan.
                      <div>But I still have query on how i could map
                        between prefix and domain.If domain is <a
                          moz-do-not-send="true" href="http://acb.com"
                          target="_blank">acb.com</a> then i apply
                        prefix 7777 to user and if xyz,com then prefix
                        would be 9999.So is there any way to store in db
                        and mapping of these both?
                        <div><br>
                        </div>
                      </div>
                      <div>so In asterisk it would like <a
                          moz-do-not-send="true"
                          href="mailto:77771001@abc.com" target="_blank">77771001@abc.com</a>
                        and <a moz-do-not-send="true"
                          href="mailto:99991001@xyz.com" target="_blank">99991001@xyz.com</a>.</div>
                    </div>
                    <div class="gmail_extra"><br clear="all">
                      <div>
                        <div>
                          <div dir="ltr">Thanks and Regards,
                            <div>    Nirali Soni</div>
                          </div>
                        </div>
                      </div>
                      <br>
                      <div class="gmail_quote">On Tue, Jun 23, 2015 at
                        10:34 PM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
                            moz-do-not-send="true"
                            href="mailto:bogdan@opensips.org"
                            target="_blank">bogdan@opensips.org</a>&gt;</span>
                        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,<br>
                              <br>
                              So what you want to do is basically to
                              convert from 1234ABC@..... into <a
                                moz-do-not-send="true"
                                href="mailto:ABC@domain1.com"
                                target="_blank">ABC@domain1.com</a> ?<br>
                              <br>
                              You can do simple scripting like:<br>
                                  if ($rU=~"^1234") { <br>
                                      strip(4);<br>
                                      $rd = "<a moz-do-not-send="true"
                                href="http://domain1.com"
                                target="_blank">domain1.com</a>";<br>
                                  }<br>
                              <br>
                              or you can use the dialplan module to do
                              in a scalable way, via DB.<br>
                              <br>
                                  dp_translate("1","$rU/$ru")<br>
                              <br>
                              and in dialplan use:<br>
                                  match_regexp : "^1234[0-9]+"<br>
                                  subst_exp: "</tt><tt><tt>^1234([0-9]+)</tt>"<br>
                                  repl_exp: <a moz-do-not-send="true"
                                href="mailto:sip:%5C1@domain1.com"
                                target="_blank">"sip:\1@domain1.com"</a><br>
                              <br>
                              See more <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/1.11.x/dialplan.html#id249304"
                                target="_blank">http://www.opensips.org/html/docs/modules/1.11.x/dialplan.html#id249304</a><br>
                              <br>
                              <br>
                              Regards,<br>
                            </tt><span>
                              <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>
                            </span>
                            <div>
                              <div>
                                <div>On 19.06.2015 12:01, nirali soni
                                  wrote:<br>
                                </div>
                                <blockquote type="cite">
                                  <div dir="ltr">Hello Bogdan,
                                    <div><br>
                                    </div>
                                    <div>I am having different accounts
                                      with unique account code in
                                      asterisk.In asterisk peer is
                                      defined as [account
                                      code+extension] like 1234 is
                                      account code and 101 is
                                      extension.its like <b>[1234101].</b>So

                                      we have different account code
                                      with same extensions. i want to
                                      use opensips to map account code
                                      with domain.like 1234 having
                                      domain <a moz-do-not-send="true"
                                        href="http://abc.com"
                                        target="_blank">abc.com</a> and
                                      3456 having <a
                                        moz-do-not-send="true"
                                        href="http://xyz.com.In"
                                        target="_blank">xyz.com.In</a>
                                      opensips subscriber table  I want
                                      to insert user as 101 with doman <a
                                        moz-do-not-send="true"
                                        href="http://abc.com"
                                        target="_blank">abc.com</a>. And
                                      its forwarded to asterisk with
                                      1234101.How could I do this?<br>
                                      <div><br>
                                      </div>
                                      <div><br>
                                      </div>
                                      <div><br>
                                      </div>
                                    </div>
                                  </div>
                                  <div class="gmail_extra"><br
                                      clear="all">
                                    <div>
                                      <div>
                                        <div dir="ltr">Thanks and
                                          Regards,
                                          <div>    Nirali Soni</div>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
                                    <div class="gmail_quote">On Thu, Jun
                                      4, 2015 at 4:08 PM, Bogdan-Andrei
                                      Iancu <span dir="ltr">&lt;<a
                                          moz-do-not-send="true"
                                          href="mailto:bogdan@opensips.org"
                                          target="_blank">bogdan@opensips.org</a>&gt;</span>
                                      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
                                            Nirali,<br>
                                            <br>
                                            Use the s.select
                                            transformation with the dot
                                            as separator:<br>
                                                <a
                                              moz-do-not-send="true"
                                              href="http://www.opensips.org/Documentation/Script-Tran-2-1#toc6"
                                              target="_blank">http://www.opensips.org/Documentation/Script-Tran-2-1#toc6</a><br>
                                            <br>
                                            Regards,<br>
                                          </tt><span>
                                            <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>
                                          </span>
                                          <div>
                                            <div>
                                              <div>On 04.06.2015 08:46,
                                                nirali soni wrote:<br>
                                              </div>
                                              <blockquote type="cite">
                                                <div dir="ltr">Hi,
                                                  <div><br>
                                                  </div>
                                                  <div>My domain is <b><a
moz-do-not-send="true" href="http://www.cname.com" target="_blank">www.cname.com</a></b>...I


                                                    want only <b>cname
                                                    </b> from that..How
                                                    can i do this?  </div>
                                                </div>
                                                <div class="gmail_extra"><br
                                                    clear="all">
                                                  <div>
                                                    <div>
                                                      <div dir="ltr">Thanks
                                                        and Regards,
                                                        <div>    Nirali
                                                          Soni</div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                  <br>
                                                  <div
                                                    class="gmail_quote">On
                                                    Wed, May 27, 2015 at
                                                    10:34 PM,
                                                    Bogdan-Andrei Iancu
                                                    <span dir="ltr">&lt;<a
moz-do-not-send="true" href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>&gt;</span>
                                                    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,<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
                                                          moz-do-not-send="true"
href="http://www.opensips.org/Documentation/Script-Tran-2-1#toc75"
                                                          target="_blank">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><span>
                                                          <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>
                                                        </span>
                                                        <div>
                                                          <div>
                                                          <div>On
                                                          27.05.2015
                                                          05:42, nirali
                                                          soni wrote:<br>
                                                          </div>
                                                          <blockquote
                                                          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" target="_blank">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>
                                                          </div>
                                                        </div>
                                                      </div>
                                                    </blockquote>
                                                  </div>
                                                  <br>
                                                </div>
                                              </blockquote>
                                              <br>
                                            </div>
                                          </div>
                                        </div>
                                      </blockquote>
                                    </div>
                                    <br>
                                  </div>
                                </blockquote>
                                <br>
                              </div>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>