<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Did you load the module?<br /><br />On Thursday, January 3, 2019 5:27:12 PM EST Andrew Chen wrote:<br /></p>
<p style=" margin-top:12px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">Hey it's me again.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">So I'm following the instructions in the Kamailio 5.1.x wiki module page for websocket configuration and it specifically mention to set this block:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">onreply_route[WS_REPLY] {</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">        xlog("L_INFO", "[CSeq $cs] Is in WS_REPLY.");</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">        xlog("L_INFO", "[CSeq $cs] Sending $rs $rr to $sel(via[2].host) via $sel(via[2].transport) len: $ml");</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">        xlog("L_INFO", "[CSeq $cs] \n$mb \n");</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">        if(nat_uac_test("64")) {</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">                # Do NAT traversal stuff for replies to a WebSocket connection</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">                # - even if it is not behind a NAT!</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">                # This won't be needed in the future if Kamailio and the</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">                # WebSocket client support Outbound and Path.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">                add_contact_alias();</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">        }</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">}</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">When I did this and started up Kamailio, it gave me an error:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">Jan  3 22:19:43 sjomainkama55 kamailio: ERROR: <core> [core/cfg.y:3309]: yyparse(): cfg. parser: failed to find command nat_uac_test (params 1)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">I moved that if statement to a route block and I was able to start it up.</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">The wiki page for nathelper module specify this function can be run in onreply_route as well:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /></p>
<p style=" margin-top:24px; margin-bottom:18px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px; line-height:28px;"><span style=" font-family:'Scada,Helvetica,sans-serif'; font-size:large; font-weight:600; font-style:italic; color:#6b5344;">5.5.  </span><span style=" font-family:'Hack'; font-size:large; font-weight:600; font-style:italic; color:#6b5344;">nat_uac_test(flags)</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;">Tries to guess if client's request originated behind a nat. The parameter determines what heuristics is used.</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;">Meaning of the flags is as follows:</span></p>
<ul style="margin-top: 0px; margin-bottom: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">1</span><span style=" font-size:15px;"> - The “Contact” header field is searched for occurrence of RFC1918 or RFC6598 addresses.</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">2</span><span style=" font-size:15px;"> - the "received" test is used: address in the “Via” header is compared against source IP address of signaling</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">4</span><span style=" font-size:15px;"> - The Top Most “Via” is searched for occurrence of RFC1918 or RFC6598 addresses</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">8</span><span style=" font-size:15px;"> - The SDP is searched for occurrence of RFC1918 or RFC6598 addresses</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">16</span><span style=" font-size:15px;"> - Test if the source port is different from the port in the “Via” header</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">32</span><span style=" font-size:15px;"> - Test if the source IP address of signaling is a RFC1918 or RFC6598 address</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">64</span><span style=" font-size:15px;"> - Test if the source connection of signaling is a WebSocket</span></li>
<li style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;" style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:15px; font-style:italic;">128</span><span style=" font-size:15px;"> - Test if the “Contact” header URI port differs from the source port of the request (Warning: this is might be legal or even intended combination in non NATted scenarios)</span></li></ul>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;">All flags can be bitwise combined, the test returns true if any of the tests identified a NAT.</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;">This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;"><br /></span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;">is this some known bug in 5.1.x?</span></p>
<p style=" margin-top:12px; margin-bottom:12px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Helvetica,Arial,sans-serif'; font-size:15px; color:#000000;">Thanks</span></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br />-- <br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;">Andy Chen</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><a href="mailto:achen@thinkingphones.com"><span style=" text-decoration: underline; color:#2980b9;">achen@</span></a><a href="http://fuze.com"><span style=" text-decoration: underline; color:#2980b9;">fuze.com</span></a><br /></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:40px; margin-right:40px; -qt-block-indent:0; text-indent:0px;"><br /><br /><br /><span style=" font-family:'Arial,sans-serif'; font-size:14px; color:#333333; background-color:#ffffff;">*Confidentiality Notice: The information contained in this e-mail and any<br />attachments may be confidential. If you are not an intended recipient, you<br />are hereby notified that any dissemination, distribution or copying of this<br />e-mail is strictly prohibited. If you have received this e-mail in error,<br />please notify the sender and permanently delete the e-mail and any<br />attachments immediately. You should not retain, copy or use this e-mail or<br />any attachment for any purpose, nor disclose all or any part of the<br />contents to any other person. Thank you.*</span> </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /><br /></p></body></html>