Heya,
I have a bit of a problem with forward vs rewrite. Basically, my Asterisk box is providing voicemail and such behind SER. I use SIPDOMAIN in Asterisk to put incoming calls into the right context. This works using SER for non-NATed clients as I use forward() to forward the packets to the Asterisk platform. However for NATed clients it seems I need to use rewriteuri otherwise the remote port doesn't get fixed up correctly before the forward() happens, and I end up sending packets to the real port of the client not the firewall NAT port (although the IP is correct). When I use rewritehost/port and then t_relay() to forward the packets to Asterisk, then all works okay (except I've now obliterated the URI, breaking SIPDOMAIN).
I can in theory use the To: header of the SIP packet to extract the correct SIPDOMAIN in Asterisk, however this requires some regexp, etc, and doesn't feel right to me. Is this the right way to go and use rewrite, or is there a way I can get the forward to work with force_rport?
Cheers, Chris.