Thanks for the answer, I was not very clear in my first email though,
sorry for that. Basically when caller A initiates a call, his $fu may
be pulled from the db and replaced with a uac_replace_from. Then if the
call progresses and is redirected to a new destination the call fails
to authenticate because the new FROM URI is not in the DB. I have tried
to restore his original FROM URI using uac_restore_from, but this
doesnt seem to do it and if I store the original uri and call
uac_replace_from a second time I get something like
"sip:[email protected]:[email protected]"
Multumesc!
On Wed 02 Feb 2011 07:28:28 AM EST, Bogdan-Andrei Iancu wrote:
Hi Jesse,
Lost me a bit between those pieces of script.
Anyhow, as far I understood from your problem, you want to change the
FROM URI in order to use the new value later in the script (in the auth
part). Well, this does not work - in opensips, the changes you do over
the message are not visible until the message is sent out. So you cannot
use your own changes later in script.
To avoid this issue, you can use a variable to store the "correct" value
of the FROM URI ($fu directly or the value from DB) - later in script,
use for auth (or other purposes) this variable in order to deal with the
FROM URI value (the right one).
Regards,
Bogdan
Jesse Cloutier wrote:
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
[email protected]
------------------------------------------------------------------------
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users