[OpenSER-Users] Preserving original number when using alias_db_lookup

Stagg Shelton stagg at sheltonjohns.com
Mon Jun 30 03:16:30 CEST 2008


Also,  the other reason why I want to do this is because I have many  
hundreds of DIDs that are assigned to many asterisk PBX's.  I am  
thinking that having asterisk register to OpenSER and then have the  
DIDs as aliases to the registration credentials would be easy because  
it's all contained in the database.

I'm so new with OpenSER that I don't know what the best way is, and I  
don't want to bombard the list with all of my newbie questions. I'm  
just trying to learn how to make it work, and then will come around  
and refine what i've learned along the way.

Thanks


On Jun 29, 2008, at 6:08 PM, Iñaki Baz Castillo wrote:

> 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 at domain.com => 201 at domain.com
>
> - 201 at domain.com is not registered in OpenSer.
>
> - Your code:
>
>   => RURI = boby at domain.com
>
>   alias_db_lookup("dbaliases");
>   => RURI = 201 at domain.com
>
>   if (!lookup("location")) {
>   => User not registered so RURI still is 201 at domain.com and this  
> block
>         is not executed
>       ....
>  }
>  else {
>       avp_pushto("$ru/username", "$oU");
>       => Now RURI =  boby at domain.com
>  }
>
>
> 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 at lists.openser.org
> http://lists.openser.org/cgi-bin/mailman/listinfo/users





More information about the Users mailing list