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