[OpenSIPS-Users] B2BUA on OpenWRT router

Andrew Radke andrew.radke at yuruga.com.au
Thu Jan 12 08:27:16 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 Radke
Yuruga Nursery Pty Ltd
Clonal Solutions Australia Pty Ltd
PO Box 220
Walkamin Qld 4872
Phone: (07) 4093 3826
Fax: (07) 4093 3869
Email: andrew.radke at yuruga.com.au
Web: www.yuruga.com.au

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
>> Yuruga Nursery Pty Ltd
>> Clonal Solutions Australia Pty Ltd
>> PO Box 220
>> Walkamin Qld 4872
>> Phone: (07) 4093 3826
>> Fax: (07) 4093 3869
>> Email: andrew.radke at yuruga.com.au
>> Web: www.yuruga.com.au
>> 
>> 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
>> 
>> Yuruga Nursery Pty Ltd
>> 
>> Clonal Solutions Australia Pty Ltd
>> 
>> PO Box 220
>> 
>> Walkamin Qld 4872
>> 
>> Phone: (07) 4093 3826
>> 
>> Fax: (07) 4093 3869
>> 
>> Email: andrew.radke at yuruga.com.au
>> 
>> Web: www.yuruga.com.au
>> 
>> 
>> 
>> opensips
>> 
>> opensips-example
>> 
>> opensips-mod-acc
>> 
>> opensips-mod-alias-db
>> 
>> opensips-mod-auth
>> 
>> opensips-mod-auth-db
>> 
>> opensips-mod-auth-radius
>> 
>> opensips-mod-avp-radius
>> 
>> opensips-mod-avpops
>> 
>> opensips-mod-benchmark
>> 
>> opensips-mod-call-control
>> 
>> opensips-mod-cfgutils
>> 
>> opensips-mod-closeddial
>> 
>> opensips-mod-cpl-c
>> 
>> opensips-mod-db-flatstore
>> 
>> opensips-mod-db-mysql
>> 
>> opensips-mod-db-postgres
>> 
>> opensips-mod-db-text
>> 
>> opensips-mod-dialog
>> 
>> opensips-mod-dialplan
>> 
>> opensips-mod-dispatcher
>> 
>> opensips-mod-diversion
>> 
>> opensips-mod-domain
>> 
>> opensips-mod-domainpolicy
>> 
>> opensips-mod-drouting
>> 
>> opensips-mod-enum
>> 
>> opensips-mod-exec
>> 
>> opensips-mod-gflags
>> 
>> opensips-mod-group
>> 
>> opensips-mod-group-radius
>> 
>> opensips-mod-h350
>> 
>> opensips-mod-identity
>> 
>> opensips-mod-imc
>> 
>> opensips-mod-jabber
>> 
>> opensips-mod-lcr
>> 
>> opensips-mod-ldap
>> 
>> opensips-mod-load_balancer
>> 
>> opensips-mod-localcache
>> 
>> opensips-mod-mangler
>> 
>> opensips-mod-maxfwd
>> 
>> opensips-mod-mi-datagram
>> 
>> opensips-mod-mi-fifo
>> 
>> opensips-mod-msilo
>> 
>> opensips-mod-nat_traversal
>> 
>> opensips-mod-nathelper
>> 
>> opensips-mod-options
>> 
>> opensips-mod-path
>> 
>> opensips-mod-pdt
>> 
>> opensips-mod-peering
>> 
>> opensips-mod-permissions
>> 
>> opensips-mod-pike
>> 
>> opensips-mod-presence
>> 
>> opensips-mod-presence-dialoginfo
>> 
>> opensips-mod-presence-mwi
>> 
>> opensips-mod-presence-xcapdiff
>> 
>> opensips-mod-presence-xml
>> 
>> opensips-mod-pua
>> 
>> opensips-mod-pua-bla
>> 
>> opensips-mod-pua-dialoginfo
>> 
>> opensips-mod-pua-mi
>> 
>> opensips-mod-pua-usrloc
>> 
>> opensips-mod-pua-xmpp
>> 
>> opensips-mod-qos
>> 
>> opensips-mod-ratelimit
>> 
>> opensips-mod-regex
>> 
>> opensips-mod-registrar
>> 
>> opensips-mod-rls
>> 
>> opensips-mod-rr
>> 
>> opensips-mod-seas
>> 
>> opensips-mod-signaling
>> 
>> opensips-mod-siptrace
>> 
>> opensips-mod-sl
>> 
>> opensips-mod-sms
>> 
>> opensips-mod-speeddial
>> 
>> opensips-mod-sst
>> 
>> opensips-mod-statistics
>> 
>> opensips-mod-textops
>> 
>> opensips-mod-tlsops
>> 
>> opensips-mod-tm
>> 
>> opensips-mod-uac
>> 
>> opensips-mod-uac-redirect
>> 
>> opensips-mod-uri
>> 
>> opensips-mod-uri-db
>> 
>> opensips-mod-uri-radius
>> 
>> opensips-mod-userblacklist
>> 
>> opensips-mod-usrloc
>> 
>> opensips-mod-xcap-client
>> 
>> opensips-mod-xlog
>> 
>> opensips-mod-xmpp
>> 
>> opensips-tools
>> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 

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


More information about the Users mailing list