Hi to all,
I need to edit our ser installation (OLD ser-2.0.0-rc1) implementing a check to rewrite the INVITE URI address in case a flag on a DB is set or not. I'm not proof on this and as always the solution is to find out on the production system without the possibility (for now) to upgrade to most recent version. In fact I would load the flag with the db_ops module. The scenario should be the follow: 1. a call is coming from sip or from pstn to an internal sip account 2. the ser should check if a given flag for the called account is set (db_ops) 3. if it's set it should take the destination URI (taken from location db table) and rewrite the number to another known number. i.e. from sip:123456789@IP;uniqu=... to sip:new987654321@IP;uniq=... My first issue is to identify WHERE ser execute the INVITE to the sip account and how rewrite the URI.
Could someone point me to the right place and give me some suggestion?
The ser.cfg used could be read from a previous post of me:
http://www.mail-archive.com/sr-users@lists.sip-router.org/msg04900.html
Thank's a lot!
Simon
Simone,
At a first glance, make Your magic on the route[INBOUD], just after ALIAS lookup.
Didn't see further, but you should make the same some point before use of some forward function (t_relay,p.ex.)
Edson.
P.S.: Your configuration file is a mess to read, since you are asking us to read, understand and provide solutions to _your_ problems, could you, at least, provide some indentation and clean all unused and commented command lines??? It would help....
Em 17/06/2011 06:50, Simone Felici escreveu:
Hi to all,
I need to edit our ser installation (OLD ser-2.0.0-rc1) implementing a check to rewrite the INVITE URI address in case a flag on a DB is set or not. I'm not proof on this and as always the solution is to find out on the production system without the possibility (for now) to upgrade to most recent version. In fact I would load the flag with the db_ops module. The scenario should be the follow:
- a call is coming from sip or from pstn to an internal sip account
- the ser should check if a given flag for the called account is set
(db_ops) 3. if it's set it should take the destination URI (taken from location db table) and rewrite the number to another known number. i.e. from sip:123456789@IP;uniqu=... to sip:new987654321@IP;uniq=... My first issue is to identify WHERE ser execute the INVITE to the sip account and how rewrite the URI.
Could someone point me to the right place and give me some suggestion?
The ser.cfg used could be read from a previous post of me:
http://www.mail-archive.com/sr-users@lists.sip-router.org/msg04900.html
Thank's a lot!
Simon
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
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
Il 17/06/2011 15:40, Edson - Lists ha scritto:
Simone,
At a first glance, make Your magic on the route[INBOUD], just after ALIAS lookup.
Didn't see further, but you should make the same some point before use of some forward function (t_relay,p.ex.)
Edson.
P.S.: Your configuration file is a mess to read, since you are asking us to read, understand and provide solutions to _your_ problems, could you, at least, provide some indentation and clean all unused and commented command lines??? It would help....
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
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@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users