[OpenSIPS-Users] RTP Delay when changing RTP Source port

Trevor Steyn trevor at webon.co.za
Wed Jul 22 09:51:57 CEST 2015


Hi, All

Still quite new to opensips I have the following configuration running on

version: opensips 2.1.0 (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_lt, epoll_et, sigio_rt, select.
main.c compiled on 06:22:03 May  8 2015 with gcc 4.4.7


                                    (Topology Hiding)
UAC -------> Opensips(Internal)    Opensips(External) ----> UAS
                                   (RTP PROXY BRIDGE)



what i am experiencing is the following call is setup between UAC and
UAS through opensips UAS sets up RTP with a 183 Session Progress message
with SDP Shortly after we get a 180 ringing (i understand this is not
correct but cannot be changed), When a 200OK is eventually sent the
Source Port is different to what was in the SDP on the 183 message.

Media starts flowing from UAS to opensips External from the new source
port but for the first 7 seconds or so opensips/rtpproxy does not pass
on this media to UAC from Internal.

I run rtp proxy as follows

rtpproxy -l <Internal IP>/<External IP> -s udp:127.0.0.1:12221 -m 25000
-M 65000 -F -d DBUG:LOCAL1

route{
        #script_trace( 3, "$rm from $si, ruri=$ru", "me");
   
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483","Too Many Hops");
        exit;
    }

    if ( check_source_address("1","$avp(trunk_attrs)") ) {
        # request comes from trunks
        setflag(IS_TRUNK);
    } else if ( is_from_gw() ) {
        # request comes from GWs
    } else {
        send_reply("403","Forbidden");
        exit;
    }

    if (has_totag()) {
        # sequential request withing a dialog should
        # take the path determined by record-routing
        if(topology_hiding_match()) {
            # validate the sequential request against dialog
            if ( $DLG_status!=NULL && !validate_dialog() ) {
                xlog("In-Dialog $rm from $si (callid=$ci) is not valid
according to dialog\n");
                ## exit;
            }
           
            if (is_method("BYE")) {
                setflag(ACC_DO); # do accounting ...
                setflag(ACC_FAILED); # ... even if the transaction fails
            } else if (is_method("INVITE")) {
                # even if in most of the cases is useless, do RR for
                # re-INVITEs alos, as some buggy clients do change route set
                # during the dialog.
                record_route();
            }
            route(RELAY);
        } else {
            if ( is_method("ACK") ) {
                if ( t_check_trans() ) {
                    # non loose-route, but stateful ACK; must be an ACK
after
                    # a 487 or e.g. 404 from upstream server
                    t_relay();
                    exit;
                } else {
                    # ACK without matching transaction ->
                    # ignore and discard
                    exit;
                }
            }
            sl_send_reply("404","Not here");
        }
        exit;
    }

    #### INITIAL REQUESTS

    if ( !isflagset(IS_TRUNK) ) {
        ## accept new calls only from trunks
        send_reply("403","Not from trunk");
        exit;
    }

    # CANCEL processing
    if (is_method("CANCEL")) {
        if (t_check_trans())
            t_relay();
        exit;
    } else if (!is_method("INVITE")) {
        send_reply("405","Method Not Allowed");
        exit;
    }

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

    t_check_trans();

    # preloaded route checking
    if (loose_route()) {
        xlog("L_ERR",
        "Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
        if (!is_method("ACK"))
            sl_send_reply("403","Preload Route denied");
        exit;
    }

    # record routing
    record_route();

    setflag(ACC_DO); # do accounting

   
    # create dialog with timeout
    if ( !create_dialog("B") ) {
        send_reply("500","Internal Server Error");
        exit;
    }

   
    dp_translate("1","$rU/$rU");   

    # route calls based on prefix
    if ( !do_routing("1",,,,"$var(gw_attributes)") ) {
        send_reply("404","No Route found");
        exit;
    }
        if (is_method("INVITE")) {
                        force_send_socket(udp:<EXternal IP:5060);
                        rtpproxy_engage('ierz20');
                        #rtpproxy_engage();
                        topology_hiding();
        }


    t_on_failure("GW_FAILOVER");
    route(RELAY);
}


route[RELAY] {
    if (!t_relay()) {
        sl_reply_error();
    };
    exit;
}


failure_route[GW_FAILOVER] {
    if (t_was_cancelled()) {
        exit;
    }

    # detect failure and redirect to next available GW
    if (t_check_status("(408)|([56][0-9][0-9])")) {
        xlog("Failed GW $rd detected \n");

        if ( use_next_gw() ) {
            t_on_failure("GW_FAILOVER");
            t_relay();
            exit;
        }
       
        send_reply("500","All GW are down");
    }
}


local_route {
    if (is_method("BYE") && $DLG_dir=="UPSTREAM") {
       
        acc_log_request("200 Dialog Timeout");
       
    }
}


Below you can see the call flow

http://salamander.iburst.co.za:8000/personal/signalling.txt

I have tried a most of the options on rtpproxy_engage with no luck

Regards
Trevor Steyn




More information about the Users mailing list