[OpenSER-Users] Preserving original number when using alias_db_lookup
Stagg Shelton
stagg at sheltonjohns.com
Mon Jun 30 02:31:49 CEST 2008
I will re-read the lookup function documentation.
The reason why I am having to do this is because in my particular case
I have many asterisk PBX's registering to OpenSER. When asterisk
registers to OpenSER it has a contact id in the REGISTER message of s at w.x.y.z
. After using alias_db_lookup OpenSER is using the contact id in the
To: field. When the message gets to asterisk, I cannot route it to
the correct extension, IVR, Queue because the message is being sent to s at w.x.y.z
instead of 5551212 at w.x.y.z
Thanks
Stagg
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