[Freeswitch-users] problem with transferring calls when using ivr

bogusmaster at o2.pl bogusmaster at o2.pl
Fri Apr 29 12:31:18 MSD 2011


Hi all !

I'm a freeswitch newbie taking care of installation that I've recently
taken over from a colleague who left our company.
Currently I'm having a problem with transferring calls that went thru ivr
menu.

The call scenario looks like this: external number A calls our external
number E. Then, in ivr menu it selects some option. After that A is
connected with internal number I.
When internal number I tries to transfer call from A to another internal
number I2, call hangs up.

If I turn the ivr off, as it is commented in the excerpt from
/conf/dialplan/public/01_freephone_inbound.xml below, transferring calls
works fine.

     <extension name="general_inbound">
       <condition field="destination_number"
expression="^(freephone_XXXX_in)$">
         <action application="info"/>
         <action application="transfer" data="100 XML default"/>
         <!--action application="javascript" data="simpleivr.js"/-->
       </condition>
     </extension>

Below is my ivr script:

//====================================================================================
// Function :: Debug output
//====================================================================================
function Debug(text)
{
    var uuid_last5 = session.uuid.substr(-5)
    console_log("info", "["+uuid_last5+"] "+text+"\n");
}

//====================================================================================
// Function :: Callback handlers for collectInput
//             Returning false from these handlers causes the digit  
collection
//             to "unblock".  Depending on what behavior you want to  
achieve
//             you might want to unblock on any input or on a specific  
digit.
//====================================================================================
function Get_DTMF_Stop_On_Any(session, type, data, arg)
{
    Debug("DTMF: "+data.digit+"");
    arg.digits += data.digit;
    return false;
}


//=====================================================================================================================
//=====================================================================================================================
//=====================================================================================================================
//=====================================================================================================================


//====================================================================================
// Main Section
//====================================================================================
var dtmf_digits = new Object();

session.answer();
Debug("Playing welcome message...");
session.streamFile("/opt/freeswitch/sounds/mlife/ivr/welcome.wav");

dtmf_digits.digits = "";
var repeat = 0;
while (session.ready() && dtmf_digits.digits == "" && repeat < 3) {
      //------------------------------------------------------
      // Flush digits, ask for menu selection
      //------------------------------------------------------
      dtmf_digits.digits = "";
      session.flushDigits();

      Debug("Playing announcement...");
      session.streamFile("/opt/freeswitch/sounds/mlife/ivr/ann.wav",  
Get_DTMF_Stop_On_Any, dtmf_digits);
      if(dtmf_digits.digits == "") {
         session.collectInput(Get_DTMF_Stop_On_Any, dtmf_digits, 3000);
      }
      Debug("Menu Choice Selected = [" + dtmf_digits.digits + "]");

      if (dtmf_digits.digits == "") {
         repeat++;
         if (repeat > 2) {
             Debug("Max tries reached");
         	break;
         }
      } else {
      	if (dtmf_digits.digits == "1") {
      		session.execute("execute_extension", "100 XML default");
      	} else if (dtmf_digits.digits == "2") {
      		session.execute("execute_extension", "200 XML default");
      	} else if (dtmf_digits.digits == "3") {
			session.execute("execute_extension", "401 XML default");
      	} else if (dtmf_digits.digits == "4") {
			//session.execute("transfer", "ivr-support");
			Debug("Playing warning message about recording...");
			session.streamFile("/opt/freeswitch/sounds/mlife/ivr/support.wav");
			session.execute("execute_extension", "tech-support XML default");
      	}
      }
}

// User exceeded the ivr prompt limit, say bye-bye
// session.streamFile("conference/mlife/8000/conf-goodbye.wav");
session.hangup();

Any hints would be greatly appreciated.

Regards,
Bart

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/



More information about the FreeSWITCH-users mailing list