[Devel] avp_db_load regress the source data

Daniel-Constantin Mierla daniel at voice-system.ro
Tue Sep 6 12:07:21 CEST 2005


Hello Raymond,

you can use avp_printf() and avp_pushto():

avp_printf("s:newusername", "$avp(s:prefix)$rU");
avp_pushto("$ruri/username", "s:newusername");

I assumed that the prefix is stored in an AVP having the name 'prefix'.

Daniel


On 09/06/05 05:06, Raymond Chen wrote:

>Hi Daniel,
>
>We are trying to change the dialing pattern in openser, because some of the
>gateways don't support such feature.   In the database we have  abc000001
>account which assigned to some area's customer, We need to translate that
>customer's dialing pattern to add or strip prefix to make it as country code
>+ area code + destination.
>
>So we just strip the incoming FROM to a fix length as abc (according to your
>solution earlier), then load the database abc's prefix and add to the URI as
>prefix.  We are currently stuck on how to add the avp_db_load  abc's prefix
>to the URI.
>
>Thanks
>
>Ray
>
>-----Original Message-----
>From: Daniel-Constantin Mierla [mailto:daniel at voice-system.ro] 
>Sent: Tuesday, September 06, 2005 12:05 AM
>To: Raymond Chen
>Cc: 'Bogdan-Andrei Iancu'; devel at openser.org
>Subject: Re: [Devel] avp_db_load regress the source data
>
>Could you give an example of what you have in database and what you want 
>to achieve? I am not sure I understand what you exactly want. Take a 
>look at avp_printf() function, maybe that is what you need and my help 
>is not more necessary.
>
>http://www.voice-system.ro/docs/avpops/ar01s06.html#avp_printf
>
>Daniel
>
>
>On 09/05/05 16:58, Raymond Chen wrote:
>
>  
>
>>Hi Daniel,
>>
>>Thanks for your help.  But I am stuck on how to add the avp_db_loaded value
>>to the uri as a prefix.  Any idea?
>>
>>Thanks
>>
>>Ray
>>
>>-----Original Message-----
>>From: Daniel-Constantin Mierla [mailto:daniel at voice-system.ro] 
>>Sent: Monday, August 29, 2005 5:36 PM
>>To: Raymond Chen
>>Cc: Bogdan-Andrei Iancu; devel at openser.org
>>Subject: Re: [Devel] avp_db_load regress the source data
>>
>>Hello Ray,
>>
>>if you have some well defined patterns regarding how many digits you 
>>have to match you can use a set o avpops functions to achieve your goal.
>>
>>For example, if all usernames in rpid tables have three digits and '%', 
>>then remove the '%' character and you can use:
>>
>>modparam("avpops", "avp_aliases", "tmpuri=i:20");
>>avp_write("$from", "$tmpuri");
>>avp_subst("$tmpuri","/([0-9]{3})[0-9]+@(.*)/sip:\1@\2/d");
>>avp_load("$tmpuri/uri", "s:username/rpid")
>>
>>Daniel
>>
>>
>>On 08/29/05 12:22, Bogdan-Andrei Iancu wrote:
>>
>> 
>>
>>    
>>
>>>Hi Ray,
>>>
>>>no, I'm afraid it's not possible. avp_db_load support only "equal" 
>>>matching.
>>>
>>>regards,
>>>bogdan
>>>
>>>Raymond Chen wrote:
>>>
>>>   
>>>
>>>      
>>>
>>>>Dear all,
>>>>
>>>>can avpops regres the source data like avp_db_load("$from/uri", 
>>>>"s:username/rpid") and uri = 123123132 username in rpid talbe is 123%.
>>>>
>>>>Regards
>>>>
>>>>Ray
>>>>
>>>>------------------------------------------------------------------------
>>>>
>>>>_______________________________________________
>>>>Devel mailing list
>>>>Devel at openser.org
>>>>http://openser.org/cgi-bin/mailman/listinfo/devel
>>>>
>>>>
>>>>     
>>>>
>>>>        
>>>>
>>>_______________________________________________
>>>Devel mailing list
>>>Devel at openser.org
>>>http://openser.org/cgi-bin/mailman/listinfo/devel
>>>
>>>   
>>>
>>>      
>>>
>>
>>
>> 
>>
>>    
>>
>
>
>
>
>  
>



More information about the Devel mailing list