[Serusers] How to check the username if it is registered or not

Michal Matyska michal at iptel.org
Thu Sep 13 14:58:54 CEST 2007


I'm sorry typing faster than thinking.... registered checks whether AVP
with name UID exists for TO user, if not lookups based on request uri.
The workaround is to put the uid of the FROM user to get the correct
result.

to know whether FROM user is registered you should use following code
(SER 2.0 and higher):

lookup_user("$fu", at from.uri);
$tu.uid=$f.uid;
if (registered("location")) {
  ...
  del_attr("$tu.uid");
}
del_attr("$tu.uid");

Michal


On Thu, 2007-09-13 at 12:23 +0700, Tung Tran wrote:
> Hi,
>  
> I got this in iptel doc:
>  
> registered(domain) 
> The function returns true if the AOR in the Request-URI is registered,
> false otherwise. The function does not modify the message being
> process, it neither rewrites the Request-URI if a contact is found not
> append branches. 
>  
> But I want to check the from user if it is registered or not, any
> command can do this?
>  
> Thank you
> Tung
>  
> 
> 
> 
> > if (registered("location")) {
> > ..
> > }
> >
> > M.
> >
> > On Thu, 2007-09-13 at 00:12 +0700, Tung Tran wrote:
> >> Hi all,
> >>
> >> Should anyone please help how to check the from user in INVITE
> >> request is already registered?
> >>
> >> Thanks you very much.
> >>
> >> Tung




More information about the sr-users mailing list