El Domingo, 29 de Junio de 2008, Stagg Shelton escribió:
Thank you Iñaki. Not only did I find that my syntax
made no sense, I
also found that openser would not start because of it.
I believe that I have found my solution with your help. The below
syntax appears to be working with the results I intended.
alias_db_lookup("dbaliases");
if (!lookup("location")) {
...
}
}
else
{
avp_pushto("$ru/username", "$oU");
}
What the above does for me is that OpenSER can receive an invite from
one of my SIP providers. I can determine if the call is intended for
one of the PBX's that are registered to OpenSER and appropriately
route the call to the PBX that serves the number.
Hi, first this complex syntax is not needed anymore:
avp_pushto("$ru/username", "$oU");
because you can just do:
$rU = $oU;
But anyway I can't understand why you do it. In your case, please re-read the
doc of "lookup" function. When you do:
if (!lookup("location")) {
that will change the RURI ****just**** in the case the original RURI is an AoR
existing in the "location" table, this is: that user is registered in
OpenSer.
But in the case it's not registered then the RURI ***won't*** be changed so
you don't need, at all, to restore the RURI.
Well, imagine an example with your code:
- There is an alias:
boby(a)domain.com => 201(a)domain.com
- 201(a)domain.com is not registered in OpenSer.
- Your code:
=> RURI = boby(a)domain.com
alias_db_lookup("dbaliases");
=> RURI = 201(a)domain.com
if (!lookup("location")) {
=> User not registered so RURI still is 201(a)domain.com and this block
is not executed
....
}
else {
avp_pushto("$ru/username", "$oU");
=> Now RURI = boby(a)domain.com
}
The question is: why do you need RURI being the original? it makes no sense
(IMHO).
Regards.
--
Iñaki Baz Castillo