Now you can change all parts of message before b2b_init_request call and in b2b_request/b2b_reply routes.
It useful for add additional headers before b2b_init_request to pass through b2b (don't forget custom_headers param) and also for NAT processing in b2b_request/b2b_reply routes.
Instead of patch #3515749. Please, ignore/remove old patch.
Added actual v3 patch.
Added v4 patch.
Fixed:
- b2b_request_route called before tm transaction created. Now we can use force_rport() and change contact header in b2b_request_route. We use it to process NAT on b2b.
The way we use this patch in our production environment to process NAT via b2b:
route {
force_rport();
# Here are some checks, deny non-invite requests.
# Fix NATed contact and SDP in client requests
if (nat_uac_test("19")) fix_nated_contact();
if ( (has_body("application/sdp")) && (nat_uac_test("8")) ) fix_nated_sdp("10");
b2b_init_request("top hiding");
exit;
}
route[B2B_REQUEST] {
force_rport();
# Fix NATed contact and SDP in client requests
if (nat_uac_test("19")) fix_nated_contact();
if ( (has_body("application/sdp")) && (nat_uac_test("8")) ) fix_nated_sdp("10");
# Also we can add this our custom headers
}
route[B2B_REPLY] {
# Here we can also add our custom headers
}
onreply_route {
# Fix NATed contact and SDP in client replies
if (nat_uac_test("97")) fix_nated_contact();
if ( (has_body("application/sdp")) && (nat_uac_test("8")) ) fix_nated_sdp("10");
}