Hi,
I am wondering if someone can please help us? We are struggling to get the BYE
packet to go back to MS Teams when the call is initiated by Teams.
Our setup is as follows:
MS Teams < --- > SBC External 64.x.x.x < --- > SBC Internal 10.11.250.3 < --- >
FreePBX (internal only) 10.11.250.1 < --- > SIP Provider < --- > Mobile
(external number)
Now we are getting calls routed both ways with audio. The problem when the MS
Teams calls the Mobile and the Mobile ends the call, the BYE doesn't go back to
MS Teams and FreePBX looks like it tries to send the BYE to the external IP
address of the SBC, instead of via the internal then external.
This is what happens the mobile ends the call and the BYE packet is routed as
follows:
Mobile --- > SIP Provider --- > FreePBX 10.11.250.1 ---> SBC External 64.x.x.x
---> LOST
How do we get the BYE packet to route correctly back through the SBC and onto
MS?
Thanks
Chris
Here is our script if that helps:
/* comment the next line to enable the auto discovery of local aliases
based on reverse DNS on IPs */
auto_aliases=no
alias=tls:sbc01.froneri.com:5061
alias=udp:sbc01.froneri.com:5060
alias=tcp:sbc01.froneri.com:5060
#alias=tls:62.54.11.4:5061
listen=udp:10.11.250.3:5060 #as 62.54.11.41
listen=tcp:10.11.250.3:5060 #as 62.54.11.41
listen=tls:10.11.250.3:5061 #as 62.54.11.41
# listen=hep_tcp:10.11.250.3:9060
#advertised_address=62.54.11.4
advertised_address=sbc01.froneri.com
#### NAT module
loadmodule "nathelper.so"
modparam("nathelper", "natping_interval", 10)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "sipping_bflag", "SIP_PING_FLAG")
modparam("nathelper", "sipping_from", "sip:[email protected]") #CUSTOMIZE ME
modparam("nathelper", "received_avp", "$avp(received_nh)")
####### Routing Logic ########
# main request routing logic
route{
#sip_trace("tid");
force_rport();
if (nat_uac_test("23")) {
if (is_method("REGISTER")) {
fix_nated_register();
setbflag(NAT);
} else {
fix_nated_contact();
setflag(NAT);
}
}
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(is_method("OPTIONS")) {
# xlog("L_INFO", "[MS TEAMS] OPTIONS In\n");
set_advertised_address("62.54.11.41");
set_advertised_port("5061");
sl_send_reply("200", "OK");
exit;
}
# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
sip_trace("tid");
t_relay();
exit;
}
# absorb retransmissions, but do not create transaction
t_check_trans();
if (has_totag()) {
sip_trace("tid");
# handle hop-by-hop ACK (no routing required)
if ( is_method("ACK") && t_check_trans() ) {
xlog("[INFO] has totag & transaction id ACK pass
straight out RURI=$ruri, SI=$si, M=$rm\n");
t_relay();
exit;
}
# sequential request within a dialog should
# take the path determined by record-routing
if(is_method("INVITE") && !check_source_address("0")) {
xlog("[INFO] In dialog Method=$rm, RURI=$ruri, SI=$si ,DU=$du\n");
xlog("[ROUTE] t_relay Route SIP Message \n$mb\n");
t_relay();
}
if ( !loose_route() ) {
# we do record-routing for all our traffic, so we should not
# receive any sequential requests without Route hdr.
sl_send_reply("404", "Not here");
exit;
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
#xlog("[INFO] sequential requests Route SIP Message \n$mb\n");
xlog("[INFO] has totag RURI=$ruri, SI=$si, M=$rm\n");
route(relay);
exit;
}
# record routing
if (is_method("INVITE") && ! has_totag() && check_source_address("0")) {
xlog("[ROUTE] Incoming call from PBX to MS TEAMS: RURI=$ruri, SI=$si,
M=$rm\n");
sip_trace("tid");
strip(1);
do_routing("1");
#prefix("+49");
record_route_preset("sbc01.froneri.com:5061;transport=tls;r2=on",
"10.11.250.3:5060;r2=on");
#record_route_preset("sbc01.froneri.com:5061;transport=tls");
#add_rr_param(";r2=on");
route(relay);
} else
if (is_method("INVITE") && ! has_totag() &&
!check_source_address("0")) {
sip_trace("tid");
create_dialog();
t_on_reply("handle_nat");
#record_route_preset("10.11.250.3:5060;r2=on",
"sbc01.froneri.com:5061;transport=tls;r2=on");
record_route();
xlog("[ROUTE] Incoming call from MS TEAMS to PBX:
RURI=$ruri, SI=$si, M=$rm\n");
rewritehostport("10.11.250.1:5060");
force_send_socket(udp:10.11.250.3:5060);
route(relay);
}
if (check_route_param("nat=yes")){
setflag(NAT);
#route it out to whatever destination was set by loose_route()
#in $du (destination URI).
record_route();
route(relay);
}
record_route();
route(relay);
}
route[relay] {
if (isflagset(NAT)) {
add_rr_param(";nat=yes");
}
xlog("[ON ROUTE] route[relay]: Method=$rm, RURI=$ruri, SI=$si,
M=$rm\n");
if (is_method("INVITE") && ! has_totag() ) {
t_newtran();
t_on_reply("handle_nat");
t_on_failure("missed_call");
# if we have an application/sdp on our body, so
we execute
# the rtpproxy_offer
if(has_body("application/sdp")){
xlog("[RTPPROXY] route[relay] we have sdp on this
message\n$rm\n");
rtpproxy_offer("co", "62.54.11.4");
}
}
if(is_method("ACK") && has_body("application/sdp")){
xlog("[RTPPROXY] onreply_route[handle_nat] ACK
rtpproxy_answer\n");
rtpproxy_answer("co", "62.54.11.4");
}
xlog("[INFO] Method=$rm, RURI=$ruri, SI=$si ,DU=$du\n");
if (!t_relay()) {
send_reply("500","Internal Error");
}
exit;
}
branch_route[per_branch_ops] {
xlog("[INFO] New branch at $ru\n");
}
onreply_route[handle_nat] {
xlog("[INFO] onreply_route[handle_nat]: RR=$rr, RS=$rs,
SI=$si\n$mb\n");
# we receive a reply, we need to check about application/sdp
# on our body, if we have, we answer that
if(is_method("ACK") && has_body("application/sdp")){
xlog("[RTPPROXY] onreply_route[handle_nat] ACK
rtpproxy_answer\n");
rtpproxy_answer("co", "62.54.11.4");
}
if (nat_uac_test("1")){
xlog("[INFO] nat_uac_test=1: RR=$rr, RS=$rs, SI=$si\n$mb\n");
fix_nated_contact();
}
if ( isflagset(NAT) && has_body("application/sdp") ){
xlog("[INFO] isflagset[NAT] && has_body sdp RR=$rr, RS=$rs,
SI=$si\n$mb\n");
rtpproxy_answer("co", "62.54.11.4");
xlog("incoming reply\n");
}
}
failure_route[missed_call] {
if (t_was_cancelled()) {
exit;
}
}
local_route {
$var(dst) = "pstnhub.microsoft.com";
if (is_method("OPTIONS") && ($(ru{s.index, $var(dst)}) !=
NULL)){
set_advertised_address("62.54.11.41");
set_advertised_port("5061");
append_hf("Contact:
<sip:sbc01.froneri.com:5061;transport=tls>\r\n");
}
}
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users