[OpenSIPS-Users] Zombi sessions in Media-proxy

Alexandr Dranchuk dav at davion.kz
Mon Apr 19 15:02:05 CEST 2010


Here is my Media trace on this call:

CDRTool Media Trace
Media Session 1422612996 at 1.1.1.2
Media InformationCall duration	36
Media relay	PUBLIC_IP

Media Streams	Audio	Image
Status	closed	closed
Caller codec	G729	Unknown
Post dial delay	6.26536607742	
Callee codec	G729	Unknown
Start time	0	36
Caller bytes	93070	0
Callee bytes	98040	0
Caller packets	1552	0
End time	36	36
Callee remote	PUBLIC_GWIP:19034	Unknown
Caller remote	1.1.1.2:25728	Unknown
Media type	audio	image
Callee local	PUBLIC_IP:51042	PUBLIC_IP:51082
Timeout wait	0	0
Caller local	PUBLIC_IP:51040	PUBLIC_IP:51080
Callee packets	1690	0

Stream Succession
audio			36	


and for any case OPENSIPS.CFG:


# main request routing logic

route{

        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        }

        if (has_totag()) {
                # sequential request withing a dialog should
                # take the path determined by record-routing
                if (loose_route()) {
                        if (is_method("BYE")) {
                                setflag(1); # do accounting ...
                                $avp(s:can_uri) = $ru;
                                $avp(s:sip_proxy_ip) = "PUBLIC_IP";
                                setflag(2); # for missed calls accounting
also
                        } 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();
                                #we get over here for T38 re-INVITE!
                        }
                        # route it out to whatever destination was set by
loose_route()
                        # in $du (destination URI).
                        t_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                     #
######################################################

        # CANCEL processing
        if (is_method("CANCEL"))
        {
                if (t_check_trans())
                        t_relay();
                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 to stay on the path of sequential requests
        if (!is_method("REGISTER|MESSAGE")) {
                record_route();
        }

        # account only INVITEs
        if (is_method("INVITE")) {
                setflag(1); # do accounting
                setflag(2); # do accounting for missed call
                $avp(s:can_uri) = $ru; #radius require this
                $avp(s:sip_proxy_ip) = "PUBLIC_IP";
        }

#allowed numbers are 00XXXXXX

        if($rU=~"^00[2-7,9]{1}[0-9]{5}$") {
                #Check for Source IP
                if(!check_source_address("2","$avp(i:707)")) {
                        xlog("Call is rejected!!! si:$si, sp:$sp!\n");
                        send_reply("403","Forbidden");
                        exit;
                }
                $avp(s:billing_party)        = $avp(i:707);
                $avp(s:sip_application_type) = "audio";

                #remove leading 00:
                strip(2);

        ##Call limit:
                #have we done our checking on this call?
                if(!isflagset(31)) {
                        #get current calls for mygw
                        get_profile_size("callee","mygw","$var(calls)");
                        if($var(calls) > 25) {
                                sl_send_reply("503","Request Terminated:
Channel limit exceeded");
                                xlog("Call is rejected
CALL_LIMIT!!!$var(calls)!\n");
                                exit;
                        }

                        if(is_method("INVITE") && !has_totag()) {

                                trace_dialog();         #run sip trace
                                engage_media_proxy();   #run mediaproxy

                                if(create_dialog()) {
                                        setflag(5);     #activate bye on
timeout
                                        set_dlg_profile("callee","mygw");
                                }
                        }
                        setflag(31);
                }
                #redirect to GW:
                rewritehostport("192.168.1.203:5060");
                #mask CallerID:
                uac_replace_from("2225","sip:2225 at 192.168.1.200");
                #now simply forward the call:
                t_relay();
                exit;
        }
#all other calls are blocked:
        xlog("ERROR Call from $fu to $ru - 404 Not Found!\n");
        sl_send_reply("404", "Not Found");
        exit;

}





More information about the Users mailing list