[Devel] Re: Methods filtering

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu Dec 8 19:02:52 CET 2005


in openser, module functions may return more than true or false - there 
is the return code variable "$?" or "$retcode" which may be tested. 
usrloc may return -1 for not found at all and -2 for found but not 
matching method:
    ....
    lookup(location);
    switch($?) {
       case -1:
          sl_send_reply(404);
          break;
       case -2:
          sl_send_reply(405);
          break;
    }
    t_relay();
    .....

regards,
bogdan

Juha Heinanen wrote:

>Bogdan-Andrei Iancu writes:
>
> > now that we have supported methods support into usrloc, I'm wondering 
> > what will be the mechanism to use this info. You mention something about 
> > a external apps inspecting the DB (for c2d, for ex.)...
>
>that was just one application before we can also use method information
>for contact selection.
>
> > I'm looking for a way to make it usable from script: what about making 
> > lookup() to do filtering of contacts based of supported methods:
> >    if I do lookup for a MESSAGE and this method is not supported by a 
> > registered contact, this contact should not be returned by the
> > lookup().
>
>yes, but there are some complications.  if i do lookup for a particular
>method and that method is not supported by any contact, but contact(s)
>supporting other methods do exist, then script should return 405 instead
>of 480.  this means that binary result from lookup (0 or -1) is not
>anymore enough.
>
> > this behaviour may be control via module param (turned on or off) or via 
> > a second param to lookup().
>
>yes.
>
>-- juha
>  
>




More information about the Devel mailing list