I have the following code in openser.cfg
if (client_nat_test("3")) { #IP address in contact is private IP #Via is different to address client has contacted us from #If so then setflag7 to indicate that sender is behind NAT xlog("client nat test 3 returned true for r-uri <$ru> in route 3 so will setflag7"); setflag(7); xlog("contact before update <$ct>"); xlog("via before update <$hdr(via)>"); force_rport(); #Rewrite Contact: header to contain Sip client's public IP:port fix_nated_contact(); xlog("contact is now <$ct>"); xlog("via is now <$hdr(via)>"); };
However the value returned by $ct is the same before and after fix_nated_contact(). Is that because I'm doing something wrong, or because I've misunderstood fix_nated_contact or because the $ct variable doesn't get updated by fix_nated_contact? If the latter, how can I find out the result of fix_nated_contact? The same applies to force_rport and the via details.
Any advice appreciated.
Regards
Cameron
Hi Cameron,
that's a side effect of how openser deals with changes on the sip messages. instead of keep re-generating the message buffer after each change, openser keeps the original received buffer and the changes are stored as lumps - they will be applied only when the message is to be sent out.
all parsing functions (including ones used by pseudo-variables) use the original buffer, so the changes are not visible.
regards, bogdan
kjcsb wrote:
I have the following code in openser.cfg
if (client_nat_test("3")) { #IP address in contact is private IP #Via is different to address client has contacted us from #If so then setflag7 to indicate that sender is behind NAT xlog("client nat test 3 returned true for r-uri <$ru> in
route 3 so will setflag7"); setflag(7); xlog("contact before update <$ct>"); xlog("via before update <$hdr(via)>"); force_rport(); #Rewrite Contact: header to contain Sip client's public IP:port fix_nated_contact(); xlog("contact is now <$ct>"); xlog("via is now <$hdr(via)>"); };
However the value returned by $ct is the same before and after fix_nated_contact(). Is that because I'm doing something wrong, or because I've misunderstood fix_nated_contact or because the $ct variable doesn't get updated by fix_nated_contact? If the latter, how can I find out the result of fix_nated_contact? The same applies to force_rport and the via details.
Any advice appreciated.
Regards
Cameron
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users