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:
    [EMAIL PROTECTED] => [EMAIL PROTECTED]

- [EMAIL PROTECTED] is not registered in OpenSer.

- Your code:

   => RURI = [EMAIL PROTECTED]

   alias_db_lookup("dbaliases");
   => RURI = [EMAIL PROTECTED]

   if (!lookup("location")) {
   => User not registered so RURI still is [EMAIL PROTECTED] and this block
         is not executed
       ....
  }
  else {
       avp_pushto("$ru/username", "$oU");
       => Now RURI =  [EMAIL PROTECTED]
  }


The question is: why do you need RURI being the original? it makes no sense 
(IMHO).


Regards.


-- 
Iñaki Baz Castillo

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

Reply via email to