[OpenSIPS-Users] B2BUA on OpenWRT router

Andrew Radke andrew.radke at yuruga.com.au
Fri Jan 13 00:02:07 CET 2012


It looks like opensips will do exactly what we need and I have a working config below with a few caveats:
If the called party hangs up there is no SIP BYE packet sent from our ITSP to us. I assume there is still something that I need to change in the forwarded packets. Does anyone have any pointers? If the caller hangs up it is fine.
I've tried removing the g711 codecs but this results in a different packet size and the Content-Length isn't recalculated automatically. Is there an easy way to do this? And is it a problem leaving a blank line in it's place?
Probably other issues that I don't even know about due to my very very rusty knowledge of SIP.

At this stage I have only tried outbound calls via our ITSP.
For reference opensips is only listening on the routers internal IP (192.168.52.1).

All comments welcome, including if there is a better way of doing this.


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","auto")



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

# main request routing logic

route{
	t_on_failure("1");
	if ( is_method("INVITE") ) {
		xlog("Calling: $oU\n");
	}

	if ( has_body("application/sdp") ) {
		# the following will not cause the Content-Length to be recaulculated
		#replace_all("a=rtpmap:. PCM.\/.*", "");
	}
	
	if ( uri=~"sip:.+ at 192.168.52.1" ) {
		rewritehost("sip.pennytel.com");
		#remove_credentials();
		remove_hf("Proxy-Authorization");
		uac_replace_from("Yuruga","sip:0740933826 at sip.pennytel.com");
		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

On 12/01/2012, at 2:24 PM, Ovidiu Sas wrote:

> The default config file is a good way to start playing with opensips.
> There are also some config examples in the source tree.
> Because the config file is a script, it needs to be adjusted according
> to your needs.
> Understanding SIP is essential in configuring opensips and that's the
> first step.  After that, everything else will come pretty easy.
> Take a look also at milkfish: http://www2.milkfish.org.sipwerk.com
> Good luck with the opensips installation.
> 
> Regards,
> Ovidiu Sas
> 
> On Wed, Jan 11, 2012 at 6:25 PM, Andrew Radke
> <andrew.radke at yuruga.com.au> wrote:
>> Thanks Ovidiu.
>> 
>> Our router is a Ubuquiti Routerstation Pro so it has plenty of power to run
>> a task like this.
>> 
>> Also, would you mind giving me a starting point to achieve what I'm aiming
>> for? I'm sorry, I've been looking at so many options for this, that while I
>> have found the opensips documentation very good, it would be nice not to
>> have to learn every SIP proxy/switch/thingy before I get to the solution. I
>> don't need everything, just something to get me started. :-) In this case I
>> do think that opensips probably will be the right way to achieve what I'm
>> looking for (otherwise I wouldn't even ask).
>> 
>> I will be fully documenting any solution I arrive at and I will be more than
>> happy to add it to the opensips.org documentation pages.
>> 
>> Regards,
>> Andrew Radke
>> 
>> On 12/01/2012, at 5:30 AM, Ovidiu Sas wrote:
>> 
>> Hello Andrew,
>> 
>> You don't need the b2b modules to achieve what are you looking for.
>> Actually, if you really want to use the b2b module, you will need to
>> run a separate instance of opensips to deal with rtp and control the
>> SDP.
>> 
>> Anyway, one option for you would be to setup opensips on your internal
>> LAN and enable port forwarding on your router.  The config will be a
>> little more complex, but you don't need to setup opensips on openwrt.
>> Another option (for installing opensips on the router) would be to get
>> the latest opensips from the optware feeds (you will need to check for
>> the right feed for your particular router).  More info here:
>> http://en.wikipedia.org/wiki/Optware
>> http://www.nslu2-linux.org/
>> 
>> 
>> Regards,
>> Ovidiu Sas
>> 
>> --
>> VoIP Embedded, Inc.
>> http://www.voipembedded.com
>> 
>> 
>> On Tue, Jan 10, 2012 at 8:11 PM, Andrew Radke
>> <andrew.radke at yuruga.com.au> wrote:
>> 
>> Hi all,
>> 
>> I would like to setup a B2BUA SBC on our OpenWRT based router to work with
>> our sipX PBX. Very simple requirements:
>> authenticate outgoing calls for our ITSP
>> preferably enforce negotiation of G729 due to limited bandwidth
>> no need to relay RTP, just let it get passed through from the phones to the
>> ITSP directly
>> possibly register with our ITSP for inbound calls which would be sent to the
>> PBX (unlikely to be used, but nice as an option)
>> 
>> An advantage would also be that it can be started and stopped, etc in line
>> with the state of the Internet connection rather than waiting for a timeout
>> if the Internet is down. The PBX would then automatically route calls via
>> the PSTN SBC.
>> 
>> I've looked at the B2BUA documentation but it uses two modules that don't
>> appear to be available in OpenWRT: b2b_entities and b2b_logic.
>> 
>> Is it possible to get opensips to act as a B2BUA with the available modules
>> listed below, possibly with an external script. The version is given
>> as 1.5.3-1 if that affects anything.
>> 
>> 
>> Regards,
>> Andrew Radke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20120113/47252352/attachment.htm>


More information about the Users mailing list