[OpenSIPS-Users] Can you drop a 487 Request Terminated?

discodog62 at aol.com discodog62 at aol.com
Thu Mar 1 07:33:41 CET 2012


When I setup a call then cancel the call I am getting a 487 from my gateway that is relayed to the client.
I don't wish to show the 487 to the client.  Is it possible to drop the reply for the 487?


I am hoping someone could let me know if this is possible.


I am running opensips 1.7  Here is a copy of my config as well.



debug=4
log_stderror=no
log_facility=LOG_LOCAL0


fork=yes
children=4
disable_tcp=yes
auto_aliases=yes
sip_warning=yes


listen=udp:10.8.1.139:5060


group=nobody
user=nobody


server_header="ZZZ"
server_signature = off
user_agent_header="User-Agent: ZZZ"


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


#set module path
mpath="/usr/local/lib64/opensips/modules/"
loadmodule "db_text.so"
loadmodule "signaling.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "uri.so"
loadmodule "domain.so"
loadmodule "permissions.so"
loadmodule "userblacklist.so"
loadmodule "dialog.so"


modparam("domain|userblacklist|dialog|permissions", "db_url","text:///zxa/server/opensipsDNC")
modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
modparam("rr", "append_fromtag", 0)
modparam("uri", "use_uri_table", 0)
modparam("domain", "db_mode", 1)   # Use caching


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


# main request routing logic


route{


	xlog("=== TOP ===");
    xlog("%%%% tu= $tu | fu= $fu | od= $od | ReceivedINT: $Ri | SourceIP: $si %%%");
    
    if ( $si == "10.8.1.139") && ( $Ri == "10.8.1.139")
    {
        exit;
    }
	 
    if (!check_address("1","$si","$sp","$proto"))
    {


		xlog("=== ACCESS FAILED ===");
		xlog("=== $si| $sp | $proto ===");
        sl_send_reply("403","Forbidden");
        exit;


    }


    if (!mf_process_maxfwd_header("10"))
    {
	    xlog("=== TOO MANY HOPS ===");
        sl_send_reply("483","Too Many Hops");
        exit;
    }


	#CANCEL processing
    if (is_method("CANCEL"))
    {
	    xlog("=== CANCEL 76 ===");
        if (t_check_trans())
            t_relay();
        exit;
    }
	
	if (is_method("PUBLISH"))
    {
        sl_send_reply("503", "Service Unavailable");
        exit;
    }
    
    
    if (has_totag())
    {
        xlog("=== HAS TO TAG ===");


        if (loose_route()) 
		{
        
            
            xlog("=== HAS LOOSE ===");
            if (is_method("BYE"))
            {
                 xlog("=== LOOSE BYE ===");
                 route(3);
                 exit;
            } else if (is_method("INVITE")) {
                
                xlog("=== RE-INVITE LOOSE ===");
                record_route();
            } 
            
            xlog("In loouse going to Route 1");
            route(1);
        
        } else {
            
            if ( is_method("ACK") )
            {
                xlog("=== LOOSE ELSE ACK ===");   
                if ( t_check_trans() )
                {
                    t_relay();
                    exit;
                } else {
                    xlog("=== LOOSE Discard ACK ===");
                    exit;
                }
            }


                sl_send_reply("404","Not here");
        }
		
        exit;
    }


    t_check_trans();


	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
    if (!is_method("REGISTER|MESSAGE"))
	{
        record_route();
    }


    if (!is_uri_host_local())
    {
        xlog("Not local so lets just see what happens $rd");
        route(1);
    }


    if ($rU==NULL)
    {
        # request with no Username in RURI
        sl_send_reply("484","Address Incomplete");
        exit;
    }
    	
    if (is_method("INVITE") && (!has_totag()) )
    {   
        xlog("||||||  NEW CALL ||||||");
    }
    
    
    route(2);
    


    send_reply("420", "Invalid Extension");
    exit;
}




route[1] {
    #---- RTP Proxy handling ---#
    xlog("=== ROUTE 1 ===");
    rewritehostport("10.8.1.44:5060");
    
    if (is_method("INVITE")) {
        
        t_on_reply("1");
        t_on_failure("1");
    }
    
    
    if (!t_relay())
    {
        sl_reply_error();
    }
    
    exit;
    
}


route[2] {
    xlog("=== ROUTE 2 ===");
    if (!check_blacklist("userblacklist"))
    {
        xlog('~~~  BLACKLISTED DID Forbidden ~~~');
        sl_send_reply("403", "DID Forbidden");
        exit;
    }
    
    route(1);


}


route[3] {
  xlog("=== ROUTE 3 ===");
  t_on_reply("1");
  t_on_failure("1");
  t_relay("udp:10.8.1.44:5060");


}


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




onreply_route[1] {
    
    xlog("=== ON REPLY ROUTE 2  rs= $rs | fu= $fu | si= $si | Ri= $Ri ===");
    
    if (t_check_status("487")) 
    {
        xlog("487 at reply route");
        t_cancel_branch();
        
        drop;
    }


}




failure_route[1] {
	xlog("=== FAIL ROUTE ===");  
  xlog("=== FAIL ROUTE 2  fu= $fu | od= $od | si= $si | Ri= $Ri ===");
    
	if (t_was_cancelled())
    {
        exit;
    }


}





Here is a call flow that I have a question about.  Sorry if this is over kill.



| 10.6.3.87         |10.8.1.139         | 10.8.1.44                             |
|                   |                   |                   
|         Request: INVITE sip           |                   |SIP/SDP: Request: INVITE 
|(5068)   ------------------>  (5060)   |                   |
|         Status: 100 Giving            |                   |SIP: Status: 100 Giving a try
|(5068)   <------------------  (5060)   |                   |
|                   |         Request: INVITE sip           |SIP/SDP: Request: INVITE 
|                   |(5060)   ------------------>  (5060)   |
|                   |         Status: 100 Trying            |SIP: Status: 100 Trying
|                   |(5060)   <------------------  (5060)   |
|                   |         Status: 180 Ringing           |SIP: Status: 180 Ringing
|                   |(5060)   <------------------  (5060)   |
|         Status: 180 Ringing           |                   |SIP: Status: 180 Ringing
|(5068)   <------------------  (5060)   |                   |
|         Request: CANCEL sip           |                   |SIP: Request: CANCEL 
|(5068)   ------------------>  (5060)   |                   |
|         Status: 200 canceli           |                   |SIP: Status: 200 canceling
|(5068)   <------------------  (5060)   |                   |
|                   |         Request: CANCEL sip           |SIP: Request: CANCEL 
|                   |(5060)   ------------------>  (5060)   |
|         Request: ACK sip:18           |                   |SIP: Request: ACK 
|(5068)   ------------------>  (5060)   |                   |
|         Request: BYE sip:18           |                   |SIP: Request: BYE 
|(5068)   ------------------>  (5060)   |                   |
|                   |         Request: BYE sip:10           |SIP: Request: BYE 
|                   |(5060)   ------------------>  (5060)   |
|                   |         Status: 200 OK                |SIP: Status: 200 OK
|                   |(5060)   <------------------  (5060)   |
|                   |         Status: 487 Request           |SIP: Status: 487 Request Terminated
|                   |(5060)   <------------------  (5060)   |
|                   |         Request: ACK sip:18           |SIP: Request: ACK 
|                   |(5060)   ------------------>  (5060)   |
|         Status: 487 Request           |                   |SIP: Status: 487 Request Terminated
|(5068)   <------------------  (5060)   |                   |
|         Request: ACK sip:18           |                   |SIP: Request: ACK 
|(5068)   ------------------>  (5060)   |                   |
|                   |         Status: 200 OK                |SIP: Status: 200 OK
|                   |(5060)   <------------------  (5060)   |
|         Status: 200 OK                |                   |SIP: Status: 200 OK
|(5068)   <------------------  (5060)   |                   |





Thanks,


James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120301/2e4b18ad/attachment-0001.htm>


More information about the Users mailing list