[Users] prefix routing for one account

Daniel-Constantin Mierla daniel at voice-system.ro
Thu Feb 16 18:10:42 CET 2006


Hello,

ok, I hope I got the proper picture right now. Correct me if I am wrong.

You want to preserve the initial username after the user location 
lookup. If someone calls 12340001 which is associated to user foo001  
then you want to do user location lookup for foo001 and send to it the 
R-URI in form of:  "sip:12340001 at foo001_ip:foo001_port"

Am I right?

In this case, the solution is to backup the username from intial r-uri 
in an avp and restore it after user location lookup.

Concerning the way how to get the username, if you are using the 
development CVS version, you can play with avp_db_query() to get it from 
database.

For example, you keep in a table (prefix, username) pairs. The you can 
do something like:

avp_db_query("select username from prefix_username_table where '$rU' 
LIKE prefix order by prefix desc limit 1", "$avp(s:username)");

Note that this query is valid for MySQL (I do not know if applies for 
other database types) and you have to store the prefixes ended by '%' to 
work with 'LIKE' operator (e.g.: (prefix, username) => ("1234000%", 
"foo001"))

Once you get the username in avp, push it to user part of r-uri, do the 
user location lookup and then restore initial username. Hope it works 
... I didn't tested ... :-)

Cheers,
Daniel


On 02/16/06 12:42, Peter Hudec wrote:
> Hello,
>
> Daniel-Constantin Mierla wrote:
>   
>> Hello,
>>
>> On 02/15/06 12:58, Peter Hudec wrote:
>>
>>     
>>> hi all,
>>>
>>> I need to route prefix to te one subscriber.
>>> It's something between PDT and ALIAS.
>>>
>>> ALIAS
>>> The R-URI shoult not be replaced by one in the alias table
>>> PDT
>>> The voip domain is rewrited, but I need to leave the old one.
>>>   
>>>       
>> maybe setting the target domain in pdt to be the same as original one is
>> one solution.
>>     
> The cutomer has the same VoIP domain as our company (he is our customer).
> For example. Each OPENSER is asociated eitch some prefixes eg ...
> 1234XXXX for ser1. On the ser1 there is a subsciber named foo001 and he has
> prefix 1234000X. So I need to route these adreses to thissubcliber (location,
> which is saved thne the location table, after successfully REGISTER request from foo001).
> I need to replace R-URI as ALIAS, but the user part leave untouched.
>
>   
>> Otherwise, if you know the length of prefix and dialed number then you
>> can strip the tail of dialed number so you get the prefix in username of
>> r-uri. You associate the prefix with the user in aliases table, do the
>> lookup and then the usual processing. To strip the tail use:
>> http://openser.org/dokuwiki/doku.php?id=openser_core_cookbook#strip_tail_int
>>     
> There can be more such users with various lenght of prefixes and I really dont
> want to touch routing part of the configuration if there will anything change.
> In the loadbalanced network it means to reconfigure more devices ....
>
>
> In the * PBX it's very easy, but I don't want to use * for this purpose
> exten => 1234000X,1,Dial(SIP/foo001/${EXTEN})
> exten => 1234000X,n,Hangup
>
>
> solutions are
> 1)
> I can write small script and call exec for each INVITE to do this.
> 2)
> I can write new module for OPENSER.
> 3)
> ask our friends (this mailing list) for working solutions
>
>   
>> Cheers,
>> Daniel
>>
>>     
>>> WHY ???
>>> I want to connect some SIP PBX (asterisk) to our VoIP network
>>> and give them more numbers / prefix. I dont want to put
>>> it into routing logic eq (if sip:0123XX at domain; then).
>>>
>>> The best case is to call some function as PREFIX, which will lookup
>>> into PREFIX, SUBCRIBER and LOCATION table and just call t_relay function.
>>>
>>> Is there any other solution ???
>>>
>>>     best regards
>>>         Peter Hudec
>>>
>>>   
>>>       
>>     
>
>
>   




More information about the sr-users mailing list