[Serusers] how can I look up the username in the location table?

Klaus Darilion klaus.mailinglists at pernau.at
Fri Mar 11 09:00:36 CET 2005


Hi!

Lookup takes the request URI und looks up the location table. In 
REGISTER messages, the address-of-record is in the To: header. 
Therefore, lookup() will fail always.

Maybe you can overcome this by copying the To: URI into an AVP and then 
copying this AVP into the request URI. (avpops module).

Btw: Why do you need this feature?

regards,
klaus

Dana Olson wrote:
> I want to look up the username in the location table during the
> method==register if block.
> 
> The reason I wish to do this is to see if there is another location
> currently registered in the database for this particular username. How
> can I do this? Do I have to use exec_msg() or exec_dset(), or does
> lookup() work?
> 
> I've tried lookup("location") but it failed to work, it seems.
> 
> Can anyone help me out? Here is the block of code that I'm trying to use:
> 
>         if (method=="REGISTER") {
>                 if (!search("^Expires: 0")) {
>                         if (lookup("location")) {
>                                 sl_send_reply("200","Another registration.");
>                         } else {
>                                 sl_send_reply("200", "First registration.");
>                         }
>                 } else {
>                         sl_send_reply("200", "Unregistration.");
>                 }
>                 save_noreply("location");
>                 break;
>         }
> 
> Note that it is sending the proper replies for "First registrations"
> and "Unregistrations," but not for "Another registrations."
> 
> Thanks in advance,
> 
> Dana
> 
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
> 
> 




More information about the sr-users mailing list