<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>It looks like opensips will do exactly what we need and I have a working config below with a few caveats:</div><div><ol class="MailOutline"><li>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.</li><li>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?</li><li>Probably other issues that I don't even know about due to my very very rusty knowledge of SIP.</li></ol></div><div><br></div><div>At this stage I have only tried outbound calls via our ITSP.</div><div>For reference opensips is only listening on the routers internal IP (192.168.52.1).</div><div><br></div><div>All comments welcome, including if there is a better way of doing this.</div><div><br></div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'">debug=3</font></div><div><font class="Apple-style-span" face="'Courier New'">log_stderror=no</font></div><div><font class="Apple-style-span" face="'Courier New'">log_facility=LOG_LOCAL0</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">fork=yes</font></div><div><font class="Apple-style-span" face="'Courier New'">children=4</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">/* uncomment the following lines to enable debugging */</font></div><div><font class="Apple-style-span" face="'Courier New'">#debug=6</font></div><div><font class="Apple-style-span" face="'Courier New'">fork=no</font></div><div><font class="Apple-style-span" face="'Courier New'">log_stderror=yes</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">disable_tcp=yes</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">#disable_dns_blacklist=no</font></div><div><font class="Apple-style-span" face="'Courier New'">#dns_try_ipv6=yes</font></div><div><span class="Apple-style-span" style="font-family: 'Courier New'; ">auto_aliases=no &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">port=5060</font></div><div><span class="Apple-style-span" style="font-family: 'Courier New'; ">listen=udp:192.168.52.1:5060</span></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">####### Modules Section ########</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">#set module path</font></div><div><font class="Apple-style-span" face="'Courier New'">mpath="/usr/lib/opensips/modules/"</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">loadmodule "rr.so"</font></div><div><font class="Apple-style-span" face="'Courier New'">loadmodule "tm.so"</font></div><div><font class="Apple-style-span" face="'Courier New'">loadmodule "uac.so"</font></div><div><font class="Apple-style-span" face="'Courier New'">loadmodule "xlog.so"</font></div><div><font class="Apple-style-span" face="'Courier New'">loadmodule "textops.so"</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># ----------------- setting module-specific parameters --------------- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># ----- uac params ----- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font></div><div><font class="Apple-style-span" face="'Courier New'">modparam("uac", "credential", "&lt;userid&gt;:sip.pennytel.com:&lt;password&gt;")</font></div><div><font class="Apple-style-span" face="'Courier New'">modparam("uac","from_restore_mode","auto")</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">####### Routing Logic ########</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"># main request routing logic</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">route{</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>t_on_failure("1");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>if ( is_method("INVITE") ) {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>xlog("Calling: $oU\n");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>}</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>if ( has_body("application/sdp") ) {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span># the following will not cause the Content-Length to be recaulculated</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>#replace_all("a=rtpmap:. PCM.\/.*", "");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>}</font></div><div><span class="Apple-tab-span" style="white-space: pre; "><font class="Apple-style-span" face="'Courier New'">        </font></span></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>if ( uri=~"<a href="sip:.+@192.168.52.1">sip:.+@192.168.52.1</a>" ) {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>rewritehost("<a href="http://sip.pennytel.com/">sip.pennytel.com</a>");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>#remove_credentials();</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>remove_hf("Proxy-Authorization");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>uac_replace_from("Yuruga","<a href="sip:0740933826@sip.pennytel.com">sip:0740933826@sip.pennytel.com</a>");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>t_relay("udp:sip.pennytel.com:5060");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>};</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>route(1);</font></div><div><font class="Apple-style-span" face="'Courier New'">}</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">route[1] {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>exit;</font></div><div><font class="Apple-style-span" face="'Courier New'">}</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">failure_route[1] {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>if (t_check_status("40[17]")) {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>xlog("Authentication requested\n");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>if (uac_auth()) {</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                        </span>xlog("Authentication successfull\n");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                        </span>t_relay("udp:sip.pennytel.com:5060");</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">                </span>}</font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-tab-span" style="white-space: pre; ">        </span>}</font></div><div><font class="Apple-style-span" face="'Courier New'">}</font></div></div><div><br></div><div><br></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><div>Regards,<div>Andrew<br></div></div></div></span>
</div>
<br><div><div>On 12/01/2012, at 2:24 PM, Ovidiu Sas wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>The default config file is a good way to start playing with opensips.<br>There are also some config examples in the source tree.<br>Because the config file is a script, it needs to be adjusted according<br>to your needs.<br>Understanding SIP is essential in configuring opensips and that's the<br>first step. &nbsp;After that, everything else will come pretty easy.<br>Take a look also at milkfish: <a href="http://www2.milkfish.org.sipwerk.com">http://www2.milkfish.org.sipwerk.com</a><br>Good luck with the opensips installation.<br><br>Regards,<br>Ovidiu Sas<br><br>On Wed, Jan 11, 2012 at 6:25 PM, Andrew Radke<br>&lt;<a href="mailto:andrew.radke@yuruga.com.au">andrew.radke@yuruga.com.au</a>&gt; wrote:<br><blockquote type="cite">Thanks Ovidiu.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Our router is a Ubuquiti Routerstation Pro so it has plenty of power to run<br></blockquote><blockquote type="cite">a task like this.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Also, would you mind giving me a starting point to achieve what I'm aiming<br></blockquote><blockquote type="cite">for? I'm sorry, I've been looking at so many options for this, that while I<br></blockquote><blockquote type="cite">have found the opensips documentation very good, it would be nice not to<br></blockquote><blockquote type="cite">have to learn every SIP proxy/switch/thingy before I get to the solution. I<br></blockquote><blockquote type="cite">don't need everything, just something to get me started. :-) In this case I<br></blockquote><blockquote type="cite">do think that opensips probably will be the right way to achieve what I'm<br></blockquote><blockquote type="cite">looking for (otherwise I wouldn't even ask).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I will be fully documenting any solution I arrive at and I will be more than<br></blockquote><blockquote type="cite">happy to add it to the <a href="http://opensips.org">opensips.org</a> documentation pages.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Regards,<br></blockquote><blockquote type="cite">Andrew Radke</blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 12/01/2012, at 5:30 AM, Ovidiu Sas wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hello Andrew,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">You don't need the b2b modules to achieve what are you looking for.<br></blockquote><blockquote type="cite">Actually, if you really want to use the b2b module, you will need to<br></blockquote><blockquote type="cite">run a separate instance of opensips to deal with rtp and control the<br></blockquote><blockquote type="cite">SDP.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Anyway, one option for you would be to setup opensips on your internal<br></blockquote><blockquote type="cite">LAN and enable port forwarding on your router. &nbsp;The config will be a<br></blockquote><blockquote type="cite">little more complex, but you don't need to setup opensips on openwrt.<br></blockquote><blockquote type="cite">Another option (for installing opensips on the router) would be to get<br></blockquote><blockquote type="cite">the latest opensips from the optware feeds (you will need to check for<br></blockquote><blockquote type="cite">the right feed for your particular router). &nbsp;More info here:<br></blockquote><blockquote type="cite"><a href="http://en.wikipedia.org/wiki/Optware">http://en.wikipedia.org/wiki/Optware</a><br></blockquote><blockquote type="cite"><a href="http://www.nslu2-linux.org/">http://www.nslu2-linux.org/</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Regards,<br></blockquote><blockquote type="cite">Ovidiu Sas<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--<br></blockquote><blockquote type="cite">VoIP Embedded, Inc.<br></blockquote><blockquote type="cite"><a href="http://www.voipembedded.com">http://www.voipembedded.com</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Tue, Jan 10, 2012 at 8:11 PM, Andrew Radke<br></blockquote><blockquote type="cite">&lt;<a href="mailto:andrew.radke@yuruga.com.au">andrew.radke@yuruga.com.au</a>&gt; wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi all,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I would like to setup a B2BUA SBC on our OpenWRT based router to work with</blockquote><blockquote type="cite">our sipX PBX. Very simple requirements:</blockquote><blockquote type="cite">authenticate outgoing calls for our ITSP</blockquote><blockquote type="cite">preferably enforce negotiation of G729 due to limited bandwidth</blockquote><blockquote type="cite">no need to relay RTP, just let it get passed through from the phones to the</blockquote><blockquote type="cite">ITSP directly</blockquote><blockquote type="cite">possibly register with our ITSP for inbound calls which would be sent to the</blockquote><blockquote type="cite">PBX (unlikely to be used, but nice as an option)</blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">An advantage would also be that it can be started and stopped, etc in line</blockquote><blockquote type="cite">with the state of the Internet connection rather than waiting for a timeout</blockquote><blockquote type="cite">if the Internet is down. The PBX would then automatically route calls via</blockquote><blockquote type="cite">the PSTN SBC.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I've looked at the B2BUA documentation but it uses two modules that don't</blockquote><blockquote type="cite">appear to be available in OpenWRT:&nbsp;b2b_entities&nbsp;and&nbsp;b2b_logic.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Is it possible to get opensips to act as a B2BUA with the available modules</blockquote><blockquote type="cite">listed below, possibly with an external script.&nbsp;The version is given</blockquote><blockquote type="cite">as&nbsp;1.5.3-1 if that affects anything.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Regards,</blockquote><blockquote type="cite">Andrew Radke</blockquote></div></blockquote></div></body></html>