Home

Setting up a freeswitch conference server

Updated:
Created:
thehub

I had problems running asterisk in an openvz setup, so I thought freeswitch might be an alternative.

cd /usr/share
ln -s automake-1.10/ automake-1.9
<include>
  <gateway name="sipgate.de">-
  <!--/// account username *required* ///-->
  <param name="username" value="myuser"/>
  <!--/// account password *required* ///-->
  <param name="password" value="pass"/>
  </gateway>
</include>
> sofia status profile outbound
>...

stops the server

    <extension name="conferencing">
      <condition field="destination_number" expression=".*">
        <action application="conference" data="test" />
      </condition>        
    </extension>

 

vzctl set $VE --privvmpages 65536:69632 

Now, restarting again, calling in, flamenco to be heard. Great!

 

----------------------------

 

Problem is that it has not multiple conferences.

So, to change that, conf/dialplan/public.xml gets a different action:

 

   <extension name="conferencing">
      <condition field="destination_number" expression=".*">
        <!--<action application="conference" data="test" /> -->
        <action application="javascript" data="/home/jhb/confroom.js"/>
      </condition>
    </extension>

with /home/jhb/confroom.js being:

/** 
confroom.js - Simple iIVR Menu using a database.
http://wiki.freeswitch.org/wiki/Examples_confcall_js
by Ken Rice (SwK @ #freeswitch) and Joerg Baach (jhb)

**/

var astsounds = '/var/lib/asterisk/sounds/en/'

var line = "====================================\n";

var dtmf = new Object();
dtmf.digits = "";
var replay = 1;
var lastdigit = "";

function mycb (session, type, data, arg) {

        lastdigit = data.digit;
        dtmf.digits += lastdigit;
        console_log("notice","got: " + lastdigit + "\n");
        return(false);
}

session.answer();

while(session.ready()) {
    console_log("notice","Collecting digits\n"); 
    console_log("notice", line);
    session.streamFile(astsounds + "conf-getconfno.wav", mycb); 
    
    while (lastdigit != "#" && session.ready()) {
        session.collectInput(mycb, dtmf, 5000);
    } 
     
    var confroom = dtmf.digits + "@default";
    
    console_log("notice", "ConfRoom: [" + confroom  +"]\n");
    console_log("notice", line);
    
    session.flushDigits();
    session.execute("conference", confroom);
    
    session.flushDigits();
    lastdigit = "";
    dtmf.digits = ""; 

}