Basically this solution gives me exactly what I need at the moment.<div><br><div>If there is a still special reason to use OpenSIPS, maybe we should expect opinion of some better FS experts then me :-)</div><div><br></div>
<div>vIT<br><br><div class="gmail_quote">2010/3/16 Alfredo Quiroga-Villamil <span dir="ltr"><<a href="mailto:lawwton@gmail.com">lawwton@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Vit:<br>
<br>
Nice email, very informative; curious to find out the reasons why you<br>
decided to go with FS instead of OpenSip. We soon have to make a<br>
similar decision and would like to find out the rationale behind it.<br>
<br>
Thanks,<br>
<br>
Alfredo<br>
<div class="im"><br>
On Tue, Mar 16, 2010 at 8:04 AM, Vitalii Colosov <<a href="mailto:vetali100@gmail.com">vetali100@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="h5">> Hi dear FS community,<br>
> After a brief analysis of 2 solutions using OpenSIPS<br>
> and Kamailio (<a href="http://www.opensips.org/html/docs/modules/devel/load_balancer.html#id226109" target="_blank">http://www.opensips.org/html/docs/modules/devel/load_balancer.html#id226109</a><br>
> ) and (<a href="http://wiki.freeswitch.org/wiki/SBC_Setup" target="_blank">http://wiki.freeswitch.org/wiki/SBC_Setup</a>) I decided to implement my<br>
> own solution using ONLY FreeSWITCH and ONLY 1 table of any database server<br>
> (we use MySQL).<br>
> It works on few of our servers right now without any issues.<br>
> Feel free to reuse / improve it or provide your comments if you see<br>
> something wrong with it.<br>
><br>
> We have one routing server (RS) and several Media Servers (MS).<br>
> FreeSWITCH is installed on each server in default configuration.<br>
> --> MS_1<br>
> RS --> MS_2<br>
> --> MS_N<br>
><br>
> (Failover can be implemented by adding one more routing server, but this is<br>
> out of scope of current description).<br>
> Routing server routes calls to media servers based on logic that you can<br>
> easily define.<br>
> (Generally speaking, Routing server can route part of the calls onto itself,<br>
> but to simplify let's say that it will route only to Media Servers).<br>
><br>
> Routing server is used to register subscribers (it will have directory files<br>
> ./freeswitch/conf/directory/default/10001whatever.xml-99999whatever.xml).<br>
> Media servers do NOT contain files with users (security issue? probably<br>
> should be managed on dialplan stage of media servers by comparing ip<br>
> addresses of requests).<br>
><br>
> The whole routing can be presented by the following chain:<br>
> Call arrives into Default context-->RS default dialplan-->Lua script-->PHP<br>
> script to get destination MEDIA SERVER IP-->back to Lua script-->Bridge<br>
> "sofia/external/" to determined MS IP address-->[Bridge to fail over media<br>
> server, optionally]-->End<br>
> Let's say we need to route all international calls based on less loaded<br>
> server (other logic can be easily implemented in PHP script as well).<br>
> 1. RS Dialplan: default.xml<br>
> <include><br>
> <extension name="route"><br>
> <condition field="destination_number"<br>
> expression="^(00)(\d+)"><br>
> <action application="lua" data="route.lua $2"/><br>
> </condition><br>
> </extension><br>
> </include><br>
><br>
> 2. RS Lua script: route.lua<br>
> called_number = argv[1]; //without "00"<br>
> api = freeswitch.API();<br>
> server_ip_address = api:executeString("curl<br>
> <a href="http://localhost/get_server_ip.php" target="_blank">http://localhost/get_server_ip.php</a>);<br>
> forwarding_session_string =<br>
> "sofia/external/"..called_number.."@"..server_ip_address;<br>
> session:setVariable("bypass_media", "true"); //described below!!!<br>
> session:execute("bridge",forwarding_session_string);<br>
> 3. PHP script: get_server_ip.php<br>
> <<< ANY PHP CODE THAT WILL QUERY COMMON DATABASE AND WILL DETERMINE LESS<br>
> LOADED AT THE MOMENT SERVER>>><br>
> die($less_loaded_server_ip);<br>
><br>
> All Media Servers should provide information about their current load into<br>
> one common database (dedicated server or routing server can be used for<br>
> database).<br>
> If you use scripts you can update this table on starting a call and after<br>
> call finished.<br>
> Or you can create a job that will query FreeSWITCH and will update the<br>
> database every, say, 10 seconds.<br>
><br>
> Basically that's all (really!)<br>
> I beleive it can be used for most general purpose scenarios without need of<br>
> third-party tools.<br>
> P.S.<br>
> The only problem we had from the beginning was that RTP media traffic was<br>
> passing thru both servers: RS and Media Server.<br>
> But after we added the following command to the routing script, RTP media<br>
> traffic started to pass only thru Media server, making RS almost free.<br>
> session:setVariable("bypass_media", "true");<br>
><br>
><br>
> Best regards,<br>
> vIT<br>
><br>
</div></div>> _______________________________________________<br>
> FreeSWITCH-users mailing list<br>
> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
><br>
><br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br></div></div>