[OpenSIPS-Users] msteams outgoing calls fail

Pasan Meemaduma pasan_5 at yahoo.com
Tue Mar 31 05:39:10 EST 2020


HI Guys,
I'm trying the following setup and outgoing call from msteams drop after answered due ms SBC not sending the ACK. Is there anything wrong in my script ?, Is this something ms should investigate ?

msteams -> opensips -> asterisk ->  linphone

                     opensips -V
version: opensips 2.4.4 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
main.c compiled on  with gcc 6.3.0



opensips.cfg
####### Global Parameters #########

log_level=5
log_stderror=yes
log_facility=LOG_LOCAL0

#udp_workers=1
#tcp_workers=1
tcp_connect_timeout=900


/* comment the next line to enable the auto discovery of local aliases
   based on reverse DNS on IPs */
auto_aliases=no
alias=tls:msteamsbctest.voippabx.com.au:5061
alias=udp:172.31.36.39:5060

listen=tls:172.31.36.39:5061
listen=udp:172.31.36.39:5060   # CUSTOMIZE ME
advertised_address=52.65.18.59


####### Modules Section ########

#set module path
mpath="/usr/lib/x86_64-linux-gnu/opensips/modules/"

loadmodule "tls_mgm.so"
loadmodule "proto_tls.so"
#loadmodule "proto_hep.so"
loadmodule "uri.so"
loadmodule "drouting.so"
loadmodule "db_mysql.so"
#### SIGNALING module
loadmodule "signaling.so"
loadmodule "textops.so"
#### StateLess module
loadmodule "sl.so"

#### Transaction Module
loadmodule "tm.so"
modparam("tm", "fr_timeout", 30)
modparam("tm", "fr_inv_timeout", 60)
modparam("tm", "restart_fr_on_each_reply", 0)
modparam("tm", "onreply_avp_mode", 1)
modparam("tm", "via1_matching", 0)
modparam("tm", "ruri_matching", 0)
modparam("tm", "T1_timer", 1000)

#### Record Route Module
loadmodule "rr.so"
#modparam("rr", "append_fromtag", 1)
#### MAX ForWarD module
loadmodule "maxfwd.so"

loadmodule "nathelper.so"

#### SIP MSG OPerationS module
loadmodule "sipmsgops.so"

#### FIFO Management Interface
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("mi_fifo", "fifo_mode", 0666)

loadmodule "permissions.so"
modparam("permissions", "db_url","mysql://opensips:xxx@localhost/opensips")

loadmodule "proto_udp.so"
#loadmodule "proto_tcp.so"
modparam("tls_mgm", "certificate", "/etc/opensips/tls/default.crt")
modparam("tls_mgm", "private_key","/etc/opensips/tls/default.key")
modparam("tls_mgm", "ca_list", "/etc/opensips/tls/ca-default.crt")
modparam("tls_mgm", "ca_dir", "/etc/ssl/certs/")
modparam("tls_mgm","verify_cert", "1")
modparam("tls_mgm","require_cert", "1")

modparam("tls_mgm", "server_domain", "dom1=172.31.36.39:5061")
#modparam("tls_mgm", "match_ip_address", "[dom1]172.31.36.39:5061")
#modparam("tls_mgm", "match_sip_domain", "[dom1]msteamsbctest.voippabx.com.au")
modparam("tls_mgm","verify_cert", "[dom1]1")
modparam("tls_mgm","require_cert", "[dom1]1")
modparam("tls_mgm","tls_method", "[dom1]TLSv1_2")
modparam("tls_mgm","certificate", "[dom1]/etc/tls/voippabx.com.au/voippabx.com.au.crt")
modparam("tls_mgm","private_key", "[dom1]/etc/tls/voippabx.com.au/voippabx.com.au.key")
modparam("tls_mgm", "ca_list", "[dom1]/etc/tls/voippabx.com.au/voippabx.com.au-ca.crt")
modparam("tls_mgm", "ca_dir", "[dom1]/etc/ssl/certs/")
modparam("tls_mgm", "tls_handshake_timeout", 900)
modparam("proto_tls", "tls_max_msg_chunks", 1024)


modparam("drouting", "db_url","mysql://opensips:xxxx@localhost/opensips")
modparam("drouting", "probing_from", "sip:pinger at 52.65.18.59")

####### Routing Logic ########

# main request routing logic

route{
    force_rport();
    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");
          sl_send_reply("200", "OK");
          exit;
    }

    # absorb retransmissions, but do not create transaction
    t_check_trans();
    if (has_totag()) {

        # sequential request within a dialog should
        # take the path determined by record-routing

        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).
        route(relay);
        exit;
    }

    # CANCEL processing
    if (is_method("CANCEL")) {
        if (t_check_trans())
            t_relay();
        exit;
    }

        # record routing

    if (is_method("INVITE") && ! has_totag() && ! check_source_address("0")) {
        xlog("Incoming call to MS: RURI=$ruri, SI=$si, M=$rm\n");
        strip(1);
        do_routing("1");
        prefix("+");
        route(relay);            
    } else if (is_method("INVITE") && ! has_totag()) {
        xlog("Incoming call from MS: RURI=$ruri, SI=$si, M=$rm\n");
        rewritehostport("supporttest.voippabx.com.au:5061");
        route(relay);
    }

    if (!is_myself("$rd")) {
        append_hf("P-hint: outbound\r\n"); 
        
        route(relay);
    }

    # requests for my domain
    
    if (is_method("PUBLISH|SUBSCRIBE")) {
        sl_send_reply("503", "Service Unavailable");
        exit;
    }

    if ($rU==NULL) {
        # request with no Username in RURI
        sl_send_reply("484", "Address Incomplete");
        exit;
    }

    # when routing via usrloc, log the missed calls also
    #route(relay);
}


route[relay] {
    # for INVITEs enable some additional helper routes
    if (is_method("INVITE") && !has_totag() ) {
        t_newtran();
        t_on_reply("handle_nat");
        record_route_preset("msteamsbctest.voippabx.com.au:5061;transport=tls", "172.31.36.39:5060");
        add_rr_param(";r2=on");
    }
    xlog("Method=$rm, RURI=$ruri, SI=$si ,DU=$du\n");
    if (!t_relay()) {
        sl_send_reply("500", "Internal Error");
    }
    exit;
}




branch_route[per_branch_ops] {
    xlog("new branch at $ru\n");
}


onreply_route[handle_nat] {
    xlog("incoming reply: RR=$rr, RS=$rs, SI=$si\n");
}



local_route {
  $var(dst) = "pstnhub.microsoft.com";
  if (is_method("OPTIONS") && ($(ru{s.index, $var(dst)}) != NULL))
    append_hf("Contact: <sip:msteamsbctest.voippabx.com.au:5061;transport=tls>\r\n");
}


  below is the message trace I got from logs
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:build_res_buf_from_sip_res: copied size: orig:125, new: 1248, rest: 1232 msg=
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: SIP/2.0 200 OK
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Via: SIP/2.0/TLS 52.114.14.70:5061;rport=3072;received=52.114.14.70;branch=z9hG4bKfabd2525
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Record-Route: <sip:msteamsbctest.voippabx.com.au:5061;transport=tls;ftag=127ce3aaa0c2420cad2c0183b7bbfadf;lr;r2=on>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Record-Route: <sip:172.31.36.39:5060;ftag=127ce3aaa0c2420cad2c0183b7bbfadf;lr;r2=on>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Record-Route: <sip:sip-du-a-as.pstnhub.microsoft.com:5061;transport=tls;lr>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: From: Pasan Meemaduma<sip:+61291391380 at sip.pstnhub.microsoft.com:5061;user=phone>;tag=127ce3aaa0c2420cad2c0183b7bbfadf
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: To: <sip:+61385783273 at msteamsbctest.voippabx.com.au:5061;user=phone>;tag=as43b48489
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Call-ID: 71bc7d7ddef8520e953472f28ca8ae46
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: CSeq: 1 INVITE
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Server: Asterisk PBX 16.9.0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Supported: replaces
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Contact: <sip:+61385783273 at 119.17.41.176:5061;transport=tls>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Content-Type: application/sdp
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Content-Length: 338
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: #015
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: v=0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: o=root 1590470023 1590470023 IN IP4 119.17.41.176
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: s=Asterisk PBX 16.9.0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: c=IN IP4 119.17.41.176
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: t=0 0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: m=audio 19240 RTP/SAVP 8 101
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:gG06kfD/N+jLNvmmDsmrFOWqWkKrrBI5O5eAQMnv
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=rtpmap:8 PCMA/8000
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=rtpmap:101 telephone-event/8000
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=fmtp:101 0-16
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=ptime:20
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=maxptime:150
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=sendrecv
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:tm:insert_timer_unsafe: [2]: 0x7f50d523d760 (47)
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:tcp_conn_get: con found in state 0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:tcp_conn_get: tcp connection found (0x7f50d51c2d58), acquiring fd
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:tcp_conn_get: c= 0x7f50d51c2d58, n=16, Usock=66
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2176] DBG:core:handle_worker: read response= 7f50d51c2d58, 1, fd -1 from 12 (2167)
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:tcp_conn_get: after receive_fd: c= 0x7f50d51c2d58 n=8 fd=69
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:proto_tls:proto_tls_send: sending via fd 69...
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:proto_tls:tls_update_fd: New fd is 69
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:proto_tls:tls_write: write was successful (1248 bytes)
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:proto_tls:proto_tls_send: after write: c= 0x7f50d51c2d58 n=1248 fd=69
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:proto_tls:proto_tls_send: buf=
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: SIP/2.0 200 OK
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Via: SIP/2.0/TLS 52.114.14.70:5061;rport=3072;received=52.114.14.70;branch=z9hG4bKfabd2525
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Record-Route: <sip:msteamsbctest.voippabx.com.au:5061;transport=tls;ftag=127ce3aaa0c2420cad2c0183b7bbfadf;lr;r2=on>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Record-Route: <sip:172.31.36.39:5060;ftag=127ce3aaa0c2420cad2c0183b7bbfadf;lr;r2=on>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Record-Route: <sip:sip-du-a-as.pstnhub.microsoft.com:5061;transport=tls;lr>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: From: Pasan Meemaduma<sip:+61291391380 at sip.pstnhub.microsoft.com:5061;user=phone>;tag=127ce3aaa0c2420cad2c0183b7bbfadf
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: To: <sip:+61385783273 at msteamsbctest.voippabx.com.au:5061;user=phone>;tag=as43b48489
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Call-ID: 71bc7d7ddef8520e953472f28ca8ae46
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: CSeq: 1 INVITE
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Server: Asterisk PBX 16.9.0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Supported: replaces
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Contact: <sip:+61385783273 at 119.17.41.176:5061;transport=tls>
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Content-Type: application/sdp
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Content-Length: 338
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: #015
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: v=0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: o=root 1590470023 1590470023 IN IP4 119.17.41.176
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: s=Asterisk PBX 16.9.0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: c=IN IP4 119.17.41.176
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: t=0 0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: m=audio 19240 RTP/SAVP 8 101
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:gG06kfD/N+jLNvmmDsmrFOWqWkKrrBI5O5eAQMnv
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=rtpmap:8 PCMA/8000
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=rtpmap:101 telephone-event/8000
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=fmtp:101 0-16
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=ptime:20
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=maxptime:150
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: a=sendrecv
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:tm:relay_reply: sent buf=0x7f50dd2ba1e0: SIP/2.0 2..., shmem=0x7f50d51c9388: SIP/2.0 2
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:tm:cleanup_uac_timers: RETR/FR timers reset
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:tm:t_unref: UNREF_UNSAFE: [0x7f50d523d6e0] after is 0
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:destroy_avp_list: destroying list (nil)
Mar 31 05:25:27 ip-172-31-36-39 opensips[2150]: Mar 31 05:25:27 [2167] DBG:core:receive_msg: cleaning up


  Thank youRegards,Pasan
       Distinguishing What && How !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200331/dae9ef4f/attachment-0001.html>


More information about the Users mailing list