Hi, Olaf!
Pls ignore the previous mail and refer to this as there's a typo error.
Oops, I accidentally deleted the semi-colon(;) at the closing of the IF statement. I know that the SIP messages are routed according to the URI and that's the reason why I need to change the URI (of the TO header). But I just failed to change the uri at the TO header. Therefore, it couldn't route to another SIP server.
Current FROM/TO uri that I get, From : sip:12345@mySER.net:5060 To : sip:88888888@mySER.net:5060
The actual FROM/TO uri that I WANT will be, From : sip:12345@mySER.net:5060 To : sip:88888888@anotherSIP.net:5060
I've checked on the regular expression, and it's fine with that. Am I using the correct function - rewritehostport()?
Thanks.
Best regards, Roa Yu
-----Original Message----- From: Olaf Bergmann [mailto:Olaf.Bergmann@freenet-ag.de] Sent: Tuesday, July 03, 2007 3:07 PM To: roayu Cc: serusers@lists.iptel.org Subject: Re: [Serusers] How SER communicate to other SIP server
roayu wrote:
Hi, Olaf!
I've used 'rewritehostport("sipB.net:5060")' under the INVITE message handler.
The following are my configuration, pls correct me if I'm wrong. if(uri =~ "^sip:[0-9{8}@.*") { if(!proxy_authorise("","subscriber")){ proxy_challenge("","0"); break;
}else if(!check_from()) { sl_send_reply("403","Use From ID"); break; };
consume_credentials(); rewritehostport("sipB.net:5060"); setflag(1); route(1); break; }
When I dialed 8-digit of the number, it will pass to another SIP server(sipB.net). But on the TO header, I still found that the TO address still under the sipSER.net. You may refer to the following. From : sip:12345@sipSER.net:5060 To : sip:88888888@sipSER.net:5060 Does that means that it's still looping inside sipSER.net instead of
routing
to sipB.net? If yes, how do I change the TO header or make it route to sipB.net?
No, SIP messages are routed according to their request URI. I am not sure if the regular expression in your if-clause was corrupted by the E-Mail service (if not, at least a closing bracket is missing). I suggest, you start with a simplified version of this regexp to be sure that the then-part is evaluated at all. Use xlog() to add a couple of debug messages to find out which routing blocks are evaluated.
Regards, Olaf _______________________________________________ Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
roayu wrote:
that's the reason why I need to change the URI (of the TO header).
No, it is not. At least if your user agent and other servers implement the same RFC 3261 as most of the other SIP servers in the world do.
just failed to change the uri at the TO header. Therefore, it couldn't route to another SIP server.
Current FROM/TO uri that I get, From : sip:12345@mySER.net:5060 To : sip:88888888@mySER.net:5060
The actual FROM/TO uri that I WANT will be, From : sip:12345@mySER.net:5060 To : sip:88888888@anotherSIP.net:5060
I've checked on the regular expression, and it's fine with that. Am I using the correct function - rewritehostport()?
Well, rewritehostport() changes the request URI, not the URI part of the To header field. This is fine for most applications, but if you really want to change the contents of the To header, you will have to use something like replace_hf(). But it is not recommended to do that. Really. SIP is designed to work without replacing the To. In fact, applications are more likely to break if it is changed.
Regards, Olaf