[OpenSIPS-Users] B2BUA on OpenWRT router

Andrew Radke andrew.radke at yuruga.com.au
Fri Jan 13 04:40:43 CET 2012


Hi all,

I think I have this all quite good now. I do have the issue though that when the remote party hangs up a call we aren't sent the BYE. I'm guessing this is something to do with either the Record-Route or a Via header.

I don't think it's the Via because the responses from our ITSP come back with something like this for the opensips line:
Via: SIP/2.0/UDP 192.168.52.1;branch=z9hG4bKcd53.5599c4a7.0;received=203.31.111.19;rport=5060
indicating that they are dealing with it. And I've tried changing the Via header for opensips with this code but I think it is created late in the process as it is never triggered:
        if ( search("Via: SIP/2\.0/UDP 192\.168\.52\.1;") ) {       
                xlog("Correcting router's Via header...\n");      
                replace_all("Via: SIP/2\.0/UDP 192\.168\.52\.1;", "Via: SIP/2.0/UDP 203.31.111.19;")
        }

If I try to use record_route() it breaks everything as then opensips seems to loose track of the session and doesn't even respond to the ACKs when the session is created and then our ITSP hangs up 30 seconds later.

So again, any pointers greatly appreciated. And here is our config file as it currently stands:

debug=3
log_stderror=no
log_facility=LOG_LOCAL0

fork=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
fork=no
log_stderror=yes

disable_tcp=yes

#disable_dns_blacklist=no
#dns_try_ipv6=yes
auto_aliases=no                                                                                 

port=5060
listen=udp:192.168.52.1:5060


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

#set module path
mpath="/usr/lib/opensips/modules/"

loadmodule "rr.so"
loadmodule "tm.so"
loadmodule "uac.so"
loadmodule "xlog.so"
loadmodule "textops.so"


# ----------------- setting module-specific parameters ---------------                           

# ----- uac params -----                                                                     
modparam("uac", "credential", "<userid>:sip.pennytel.com:<password>")
modparam("uac","from_restore_mode","none")



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

# main request routing logic

route{
	t_on_failure("1");
	if ( is_method("INVITE") ) {
		xlog("$fU ($fn) Calling $oU\n");
		#record_route();
	}
        if ( search("Via: SIP/2\.0/UDP 192\.168\.52\.1;") ) {       
                xlog("Correcting router's Via header...\n");      
                replace_all("Via: SIP/2\.0/UDP 192\.168\.52\.1;", "Via: SIP/2.0/UDP 203.31.111.19;")
        }                                                                                           

	if ( has_body("application/sdp") ) {
		if ( search_body("a=rtpmap:. PCM.\/.*\n") ) {
			xlog("Removing g711 codecs...\n");
			replace_body_all("a=rtpmap:. PCM.\/.*\n", "");
		}
		if ( search_body("192\.168\.52\..*") ) {
			xlog("Correcting RTP IP address...\n");
			replace_body_all("192\.168\.52\..*", "203.31.111.19");
		}
	}
	
	if ( uri=~"sip:.+ at 192.168.52.1" ) {
		rewritehost("sip.pennytel.com");
		#remove_credentials();
		remove_hf("Proxy-Authorization");
		remove_hf("User-Agent");

		uac_replace_from("Yuruga Nursery","sip:0740933826 at 203.31.111.19");
		t_relay("udp:sip.pennytel.com:5060");
	};

	route(1);
}


route[1] {
	exit;
}

failure_route[1] {
	if (t_check_status("40[17]")) {
		xlog("Authentication requested\n");
		if (uac_auth()) {
			xlog("Authentication successfull\n");
			t_relay("udp:sip.pennytel.com:5060");
		}
	}
}


Regards,
Andrew Radke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120113/1aa3830c/attachment-0001.htm>


More information about the Users mailing list