[Serusers] Truncate username ?

Michal Matyska michal at iptel.org
Tue Jan 16 11:16:37 CET 2007


Hi,

in Ottendorf version it should be possible to do it this way:

$my_prefix=@to.username;
attr_subst("$my_prefix","/^([0-9]{6}).*$/\1/");
xlset_attr("$my_user","sip:%$my_prefix@%@to.host");
xlog("L_E","Loading attrs for %$my_user\n");
load_attrs("$tr","$my_user");

The subst RE match/replace might need some tuning... so take it as
challenge. If you succeed please post the code snippet, if anybody else
will need it sometime ;-)

The attributes will be loaded from the URI_ATTRS table, based on the
constructed AVP.

Michal



On Tue, 2007-01-16 at 09:49 +0100, inge wrote:
> Hi all,
> 
> Is it possible to truncate username in avp_db_load(), or with an other
> way ?
> In fact, I want to do a usr_preferences table like, but I don't want to
> add all my number. Just the first 6 digits. Something like 012345xxxx.
> 
> So I don't have to add in the table each number between 012345000 to
> 0123459999.
> 
> I think we can't do that directly in avp_db_load, but maybe it's
> possible to do something like that : 
> 
> truncate with an avp_check using regular expression and put the result
> into a variable, then use this variable like the source parameter in
> avp_db_load(). 
> 
> Someone have an idea ?
> 
> Thanks for your support.
> 
> _______________________________________________
> Serusers mailing list
> Serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers




More information about the sr-users mailing list