[OpenSIPS-Users] call forwarding with replace from uri

Jesse Cloutier jesse at cronomagic.com
Tue Feb 1 17:09:46 CET 2011


Hi list,

I having trouble with my script when trying to call forward by reseting 
the $ru and doing a route(1)

My problem seems to be coming from the fact that I am changing my $fu 
with uac_replace_from. When I xlog the $fu right before the route() It 
shows the correct value (the original $fu before it was changed by 
uac_replace_from). But on the request to the forwarded number it tries 
to authenticate the user using the new value (the value that 
uac_replace_from put in)

If I don't replace the $fu everything works fine.

Thanks A lot for any help!!

here is the relavant parts of my script:

Replacing the uri in the original request:

  if (is_avp_set("$avp(s:uri)")) {
                         if (is_avp_set("$avp(s:fromname)")) {
                                 xlog("L_INFO","Fromname set to 
$avp(s:fromname) and URI set to $avp(s:uri)");
                                 
uac_replace_from("$avp(s:fromname)","$avp(s:uri)");
                         } else {
                                 uac_replace_from("","$avp(s:uri)");
                                 xlog("L_INFO","Only Fromname Set");
                         }
                 }


The fowrwarding:

  if(avp_db_load("$ru","$avp(s:unavailcallfwd)")) {
                                           #xlog("call forward is set 
to: $avp(s:unavailcallfwd)");
                                           
avp_pushto("$ru","$avp(s:unavailcallfwd)");
                                           xlog("call forward is set to: 
$ru from $fu");

                                           route(1);

                                           exit;
}


And the proxy authorize


         xlog("Checking if we should attempt authentication on $fu");
         if (!(method=="REGISTER"))
         {
                 #Do not authenticate calls from the gateways
                 xlog("Checking if its from a gateway");
                 if(!is_from_gw()) # This check is from the drouting module
                 {
                         xlog("Checking if it is an IP Authed IP");
                         if(!check_source_address("0", "$avp(i:9)")) 
#This check looks in the address table
                         {
                                 xlog("Checking if it is a subscriber");

                                 xlog("from is $fu");

                                 if (!proxy_authorize("", "subscriber")) {
                                         proxy_challenge("", "0");
                                         xlog("Sent proxy challange to 
$fu");
                                         exit;
                                 }
                                 if (!db_check_from()) {
                                         sl_send_reply("403","Forbidden 
auth ID");
                                         exit;
                                 }

                         }
             }
         }


-- 
Jesse Cloutier
Network Administrator
Cronomagic Canada
5143411579 x210
jesse at cronomagic.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110201/dca961e5/attachment.htm>


More information about the Users mailing list