[SR-Users] Help find out where to modify request uri

Simone Felici s.felici at mclink.eu
Mon Jun 20 15:36:09 CEST 2011


Sorry again!

I've found how to change it but I'm missing something maybe stupid.
Having the new number to call into a variable $alias_number I can print it out as follow:

xlog("L_ERR", "MATCH USERNAME - %$alias_number - %$user_number");

I've tried to rewrite it into the if-statement using both examples:

rewriteuser("$alias_number");
OR
subst_uri('/^sip:(.*)@(.*)$/sip:$alias_number@\2/');

But the URI will rewritten with the WORD "$alias_number" instead of it's value. (tried with 
$alias_number as well as %$alias_number).

Where I'm wrong?

Thank's!

Simon




Il 20/06/2011 14:50, Simone Felici ha scritto:
>
> Hi again,
>
> I've found where I can collect all infromations i need in the "INBOUND" route (called username and
> alias). I've saved them into two variables that I've printed out to log to confirm. Into NAT_MANGLE
> route I can match the uri that I should change, based on a username:
>
> if (uri=~"^sip:MYUSERNAME@") {
> xlog("L_ERR", "LXLOG MATCH!!!! - %$alias_number - %$user_number");
> }
>
> It works. But I've no idea how now change the uri to use the new alias instead the old one.
> I.ex from original:
>
> <sip:<MYUSERNAME>@<IP>:1032;uniq=7600673C6E68DF3228C4E238ABB24>
>
> to
>
> <sip:<NEWUSERNAME>@<IP>:1032;uniq=7600673C6E68DF3228C4E238ABB24>
>
> When I'll able to edit it statically, I'll then try db_ops to change values based on some MySQL
> entries. For now it would great if I could simple edit the uri on a static example.
>
> It's not so clear how to use the t_relay or whatever I could use to rewrite my new destination based
> on the above needs.
>
> Any help?
>
> Thank's a lot!
>
> Simon
>
>
>
>
>
>
> Il 17/06/2011 16:49, Simone Felici ha scritto:
>>
>> Thank you for your answer.
>> You've absolutely right on the linked ser.cfg. I send a cleaned up and indented version.
>> It's attached.
>> Meanwhile I'll try out a little your solution.
>>
>> Thank's
>>
>> Simon
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


-- 
Simone Felici
Divisione Tecnica: Progettazione e Sviluppo

tel. +39 0461.030.111
fax. +39 0461 030.112
Via Fersina, 23 - 38123 Trento

-------------
MC-link S.p.A.
Sede Direzionale e Amministrativa
Via Carlo Perrier, 9/a - 00157 Roma
Sede Legale
Via Fersina, 23 - 38123 Trento

http://www.mclink.it

Save a tree. Don't print this e-mail unless it's really necessary

Informativa ai sensi del Codice della proprietà industriale e del Codice dei dati personali.
Le informazioni contenute in questa e-mail e negli eventuali allegati, possono contenere 
informazioni confidenziali e coperte da segreto commerciale/industriale. Esse vengono comunicate nei 
limiti giuridici dei rapporti in essere fra le parti e pertanto nessun ulteriore diritto di 
proprietà intellettuale o industriale  può essere rivendicato dal ricevente.
Le informazioni contenute in questa e-mail e negli eventuali allegati sono indirizzate 
esclusivamente a coloro che figurano come destinatari.
Se avete ricevuto per errore questa e-mail siete pregati di informarci (rispedendola al mittente) e 
di provvedere alla sua rimozione, a non farne utilizzo e a non conservarne alcuna copia.



More information about the sr-users mailing list