[Users] manipulate $from under avops module

Daniel-Constantin Mierla daniel at voice-system.ro
Thu Oct 13 08:51:44 CEST 2005



On 10/13/05 02:59, Brandon Price wrote:
> Thank you. Can you give myself and rest of the community a working 
> example of how to use avp_subst() to strip the first character?
you have to use perl like regular expression, something like 
"/(\+)(.+)/\2/" -- I am not a perl master, if does not work, pleas check 
perl manual, you should find a lot online.
> It would be greatly appreciated. Also it seems inefficient I'm 
> basically taking the $to, storing it in a var, them manipulating that 
> var, and using that in my avp_db_load(). How taxing is that in 
> comparison to just directly manipulating the var somehow then using 
> that in the avp_db_load()? 
Will take more to manipulate that variable, because it is a reference 
into a buffer -- changing directly there will require to 
shift/alloc/free some memory and will break other pseudo-variables which 
must be re-referenced again, which costs a lot of time. Anyhow, this is 
not possible now in OpenSER and I do not think it will change soon, if 
ever, since will introduce big performance and architectural penalty to 
server's design.

Cheers,
Daniel

> Honest question.
>
> On Oct 12, 2005, at 7:27 PM, Daniel-Constantin Mierla wrote:
>
>> Hello,
>>
>> you have to write the From URI in an avp, then use the avp_subst() to 
>> strip the first char. Afterwards,you can use the result in 
>> avp_db_load(). All these are possible with the latest CVS version of 
>> openser.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 10/13/05 00:04, Brandon Price wrote:
>>
>>> I am having some trouble with avpops and the from variable. I am 
>>> doing something like
>>>
>>> avp_db_load("$to","$disabled");
>>>
>>> which produces a query like
>>> select value,attribute,type from usr_preferences where 
>>> username='+15183207486' AND attribute='50'
>>> the problem is I need a query like select value,attribute,type from 
>>> usr_preferences where username='15183207486' AND attribute='50' 
>>> ,without the "+"
>>> is there any way I can strip the 1st digit from the $from variable? 
>>> I have already tried using strip(1);
>>>
>>> As always any help greatly appreciated.
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at openser.org
>>> http://openser.org/cgi-bin/mailman/listinfo/users
>>>
>>
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>




More information about the sr-users mailing list