O'Reilly logo

Building Telephony Systems with OpenSIPS 1.6 by Flavio E. Goncalves

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling the responses

The "200 OK" message returned from the UAC will also need to be manipulated. Thus a NAT handling code must be included in the section on_reply_route[].

onreply_route[2] {
if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-
9])"){
force_rtp_proxy();
append_hf("P-hint: onreply_route|force_rtp_proxy \r\n");
}
#---- If the CALLEE is behind NAT, fix the CONTACT HF ----#
if (isbflagset(6)) {
#-- Insert nat=yes at the end of the Contact header --#
#-- This helps with REINVITEs, --#
#- nat=yes will be included in the R-URI for seq.requests-#
search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
append_hf("P-hint: Onreply-route - fixcontact \r\n");
fix_nated_contact();
}
exit;
}

If the flag 5 or 6 is set, in other ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required