<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,</div><div dir="ltr"><br></div><div>Config is more or less like the standard one:</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">route[WITHINDLG] {</div><div dir="ltr">  if (!has_totag()) return;</div><div><div>if (loose_route()) {</div><div>    route(RURIALIAS);</div><div>    if ( is_method("ACK") ) {</div><div>      xlogl("L_INFO", "[$cfg(route)] ACK is forwarded statelessy\n");</div><div>      route(NATMANAGE);</div><div>    } else if (is_method("NOTIFY") ) {</div><div><span style="white-space:pre">                 </span># Add Record-Route for in-dialog NOTIFY as per RFC 6665.</div><div><span style="white-space:pre">                      </span>route(RECORD_ROUTE);</div><div><span style="white-space:pre">          </span>}</div><div>    xlogl("L_INFO", "[$cfg(route)] In Dialog loose_route, Relaying\n");</div><div><span style="white-space:pre">                 </span>route(RELAY);</div><div>      exit;</div><div>    };</div><div><br></div><div>    if (is_method("SUBSCRIBE") && uri == myself) {</div><div>      xlogl("L_INFO", "[$cfg(route)] in-dialog subscribe requests, Checking Dialog.\n");</div><div>      route(PRESENCE);</div><div>      exit;</div><div>    }</div><div><br></div><div>    if ( is_method("ACK") ) {</div><div>      if ( t_check_trans() ) {</div><div>        xlogl("L_INFO", "[$cfg(route)] ACK in transaction. Relaying\n");</div><div>        route(RELAY);</div><div>        exit;</div><div>        } else {</div><div>          xlogl("L_WARN", "[$cfg(route)] ACK without matching transaction ... ignore and discard\n");</div><div>          sl_send_reply("606", "Not Acceptable");</div><div>          exit;</div><div>        }</div><div>      }</div><div><br></div><div>      xlogl("L_WARN", "[$cfg(route)] Unknown Dialog\n");</div><div>      sl_send_reply("404","Not Found");</div><div>      exit;</div><div>}</div></div><div><br></div><div><div>route[RURIALIAS] {</div><div>    if(isdsturiset() || ($du != "")) {</div><div>        xlogl("L_INFO", "[$cfg(route)]: Destination URI is set, no un-aliasing is needed\n");</div><div>        return;</div><div>    }</div><div><br></div><div>    xlogl("L_INFO", "[$cfg(route)] --Start Route--\n");</div><div>    xlogl("L_INFO", "[$cfg(route)]: Route using R-URI, any alias on R-URI ('$ru')?\n");</div><div><br></div><div>    handle_ruri_alias();</div><div>    switch ($rc) {</div><div>    case -1:</div><div>        xlogl("L_WARN", "[$cfg(route)]: Failed to handle alias of R-URI $ru\n");</div><div>        send_reply("400","Bad Request");</div><div>        exit;</div><div>    case 1:</div><div>        xlogl("L_INFO", "[$cfg(route)]: Alias parsed, routing $rm from $fu to $du\n");</div><div>        break;<br></div><div>    case 2:</div><div>        xlogl("L_INFO", "[$cfg(route)]: Alias not found, routing $rm from $fu to $ru\n");</div><div>        break;</div><div>    };</div><div><br></div><div>    return;</div><div>}</div></div><div><br></div><div>route[NATMANAGE] {<br></div><div><div>if(has_body("application/sdp")) {</div><div>      route(RTPMANAGE);<br></div><div>    }</div><div><br></div><div>    # Set FLB_NATB? Only in within-dialog request with nat=yes on Route header initiated by AS</div><div>    if (is_request() && has_totag() && check_route_param("nat=yes") && isflagset(FLS_FROM_ASTERISK)) {</div><div>       setbflag(FLB_NATB);<br></div><div>    }</div><div><br></div><div>    # Return unless FLT_NATS or FLB_NATB are set</div><div>    if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB))) {</div><div>        xlogl("L_INFO", "[$cfg(route)] No endpoint is behind NAT, return\n");</div><div>        if(nat_uac_test("1")) {<br></div><div>          xlogl("L_INFO", "[$cfg(route)] Contact is behind NAT, Fixing\n");</div><div>          fix_nated_contact();</div><div>        }</div><div>        return;<br></div><div>    } else {</div><div>        xlogl("L_INFO", "[$cfg(route)] One or both endpoints are behind NAT, continue!\n");</div><div>    }</div><div><br></div><div>    # Add nat=yes in record-route? Only in initial requests when called from branch_route</div><div>    if (is_request() && !has_totag() && t_is_branch_route()) {</div><div>        xlogl("L_INFO", "[$cfg(route)] Add nat=yes to record-route (reason: initial request called from branch route)\n");</div><div>        add_rr_param(";nat=yes");</div><div>    }</div></div><div><br></div><div><div>  if (is_reply()) {</div><div>      if(isbflagset(FLB_NATB)) {</div><div>      fix_nated_contact();</div><div>      }</div><div>    }</div></div><div>}</div><div><br></div><div>route[RELAY] {<br></div><div>route(SETUP_BY_TRANSPORT);<br></div><div><br></div><div><div>if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {</div><div><span style="white-space:pre">          </span>if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");</div><div><span style="white-space:pre">       </span>}</div><div><span style="white-space:pre">     </span>if (is_method("INVITE|SUBSCRIBE|UPDATE")) {</div><div><span style="white-space:pre">         </span>if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");</div><div><span style="white-space:pre">        </span>}</div><div><span style="white-space:pre">     </span>if (is_method("INVITE")) {</div><div><span style="white-space:pre">          </span>if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");</div><div><span style="white-space:pre">    </span>}</div></div><div><br></div><div><div>if (!t_relay()) {</div><div><span style="white-space:pre">             </span>sl_reply_error();</div><div><span style="white-space:pre">     </span>}</div><div><span style="white-space:pre">     </span>exit;</div><div>}</div></div><div><br></div><div>}</div><div><br></div><div><div>route[SETUP_BY_TRANSPORT] {</div><div><br></div><div> if ($ru =~ "transport=ws") {</div><div>  xlogl("L_INFO","[$cfg(route)] Request going to WS");</div><div><span style="white-space:pre">    </span>if(sdp_with_transport("RTP/SAVPF")) {</div><div>          xlogl("L_INFO","[$cfg(route)] Request going from WS to WS");</div><div>          rtpengine_manage("force trust-address replace-origin replace-session-connection ICE=force");</div><div>          t_on_reply("REPLY_WS_TO_WS");</div><div>          return;</div><div>        }</div><div>  xlogl("L_INFO","[$cfg(route)] Request going to WS from AS");</div><div><span style="white-space:pre">     </span>rtpengine_manage("rtcp-mux-offer generate-mid DTLS=passive SDES-off ICE=force RTP/SAVPF");<br></div><div>  force_send_socket(tls:MY_EXTERNAL_IP_ADDR:10443);</div><div><span style="white-space:pre">     </span>t_on_reply("REPLY_FROM_WS");</div><div><span style="white-space:pre">        </span>}</div><div><span style="white-space:pre">     </span>else if ($proto =~ "ws") {</div><div><span style="white-space:pre">          </span>xlog("L_INFO", "Request coming from WS");</div><div><span style="white-space:pre">         </span>rtpengine_manage("rtcp-mux-demux DTLS=off SDES-off ICE=remove RTP/AVP");<br></div><div><span style="white-space:pre">          </span>t_on_reply("REPLY_TO_WS");</div><div><span style="white-space:pre">  </span>}</div><div><span style="white-space:pre">     </span>else {</div><div><span style="white-space:pre">                </span>xlog("L_INFO", "This is a classic phone call");</div><div><span style="white-space:pre">           </span>rtpengine_manage("replace-origin replace-session-connection");</div><div><span style="white-space:pre">              </span>t_on_reply("MANAGE_CLASSIC_REPLY");</div><div><span style="white-space:pre"> </span>}</div><div>}</div></div><div><br></div><div><div>onreply_route[REPLY_TO_WS] {</div><div><br></div><div><span style="white-space:pre"> </span>xlog("L_INFO", "Reply from softphone: $rs");</div><div><br></div><div><span style="white-space:pre">     </span>if (t_check_status("183")) {</div><div><span style="white-space:pre">                </span>change_reply_status("180", "Ringing");</div><div><span style="white-space:pre">            </span>remove_body();</div><div><span style="white-space:pre">                </span>exit;</div><div><span style="white-space:pre"> </span>}</div><div><br></div><div><span style="white-space:pre">    </span>if(!(status=~"[12][0-9][0-9]"))</div><div><span style="white-space:pre">             </span>return;</div><div><br></div><div>#<span style="white-space:pre">     </span>rtpengine_manage("froc+SP");</div><div><span style="white-space:pre">        </span>xlogl("L_INFO","Fixing ICE/SAVPF Parameters");</div><div><span style="white-space:pre">    </span>rtpengine_manage("rtcp-mux-offer generate-mid DTLS=passive SDES-off ICE=force RTP/SAVPF");</div><div><br></div><div>}</div><div><br></div><div>onreply_route[REPLY_FROM_WS] {</div><div><br></div><div><span style="white-space:pre">  </span>xlog("L_INFO", "Reply from webrtc client: $rs");</div><div><br></div><div><span style="white-space:pre"> </span>if(status=~"[12][0-9][0-9]") {</div><div><span style="white-space:pre">              </span>rtpengine_manage("force trust-address replace-origin replace-session-connection ICE=remove RTP/AVP");</div><div>#<span style="white-space:pre">              </span>rtpengine_manage("froc-sp");</div><div><span style="white-space:pre">                </span>route(NATMANAGE);</div><div><span style="white-space:pre">     </span>}</div><div>}</div><div><br></div><div>onreply_route[MANAGE_CLASSIC_REPLY] {</div><div><span style="white-space:pre">        </span>xlog("L_INFO", "Boring reply from softphone: $rs");</div><div><br></div><div><span style="white-space:pre">      </span>if(status=~"[12][0-9][0-9]") {</div><div><span style="white-space:pre">              </span>rtpengine_manage("replace-origin replace-session-connection");</div><div>#<span style="white-space:pre">             </span>rtpengine_manage("co");</div><div><span style="white-space:pre">             </span>route(NATMANAGE);</div><div><span style="white-space:pre">     </span>}</div><div>}</div><div><br></div><div>onreply_route[REPLY_WS_TO_WS] {</div><div>        xlog("L_INFO", "WS to WS");</div><div>        if(status=~"[12][0-9][0-9]") {</div><div>        <span style="white-space:pre">     </span>rtpengine_manage("force trust-address replace-origin replace-session-connection ICE=force");</div><div>                route(NATMANAGE);</div><div>        }</div><div>}</div></div><div><br></div><div>Thank you.</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>