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.
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@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Hi,
Ottendorf is really a nice version :) But I don't use it :/
I begin to try with subst_user, but he truncate the sip to whereas I want to truncate the $from/username.
I will lost my hair :)
Thanks for your support
Le mardi 16 janvier 2007 à 11:16 +0100, Michal Matyska a écrit :
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@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers