Hello,

Try something like this :

        if ($rU=~"^0[0-9]+")
        {
                strip(1);
                prefix("87019");
                rewritehostport("10.9.6.3:5060");
                # $oU is a reference to the initial R-URI username
                uac_replace_to("sip:$oU@10.9.6.3:5060");
                route(1);
                exit;
        }

Regards,

Vlad Paiu
OpenSIPS Developer


On 12/09/2011 07:14 PM, spady wrote:
Hi all, I need to rewrite a To header, after send INVITE.
Here is my part of script:

if (avp_db_load("$fu/username","$avp(ARS-OFS)"))
          {
         if (avp_check("$avp(ARS-OFS)","eq/lw-re/i"))
                 {
                 if ($rU=~"^0[0-9]+")
                         {
                         strip(1);
                         prefix("87019");
                         rewritehostport("10.9.6.3:5060");
                         uac_replace_to("sip:$ru");
                         route(1);
                         exit;
                         }
                  }
                   else
                       {
                          if (avp_check("$avp(ARS-OFS)","eq/lw-mo/i"))
                          {
                            if ($rU=~"^0[0-9]+")
                              {
                                strip(1);
                                prefix("87070");
                            uac_replace_to("sip:$ru");
                                route(1);
                                exit;
                              }
                           }
                 }
         }

If I do like above, the result is:

INVITE sip:8701902700502403@10.9.6.3:5060;user=phone SIP/2.0.
Record-Route:
<sip:10.9.101.166;lr;ftag=F542B897A1EA;vst=AAAAAENZQg0IBwUBCwQCBHABBR4LGgEDcR8BGA8UAx4FCjUwNjA7dXNlcj1waG9uZQ-->.
Via: SIP/2.0/UDP 10.9.101.166;branch=z9hG4bK8ec5.cec86122.0.
Via: SIP/2.0/UDP 172.16.52.7:5061.
From: Fax Alcatel<sip:+390522375507@172.16.52.7:5061>;tag=F542B897A1EA.
*To: sip:sip:8701902700502403@10.9.6.3:5060;user=phone.*
Call-ID: 13c1f9de-2f37-4856-b73b-634090ec4190@172.16.52.7.
CSeq: 101 INVITE.
Max-Forwards: 69.
Contact:<sip:+390522375507@172.16.52.7:5061;user=phone>.
User-Agent: Alcatel-Lucent OmniTouch Fax Server Application/6.5.6.28.
P-Alcatel-CSBU: charging=sip:2542@ucalcatel.sedoc.locale.
Content-Type: application/sdp.
Content-Length: 164.

But what I am trying to achive is something like this:

*To: sip:002700502403@10.9.6.3:5060*


How can I do that?
Best regards.



--
View this message in context: 
http://opensips-open-sip-server.1449251.n2.nabble.com/Help-with-uac-replace-to-tp7078985p7078985.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to