Hi, Olaf!
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@anotherSIP.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