Sorry if this mail is sent twice. In my case, the session is not already created.

 My actual requirement is similar to a call center setup -

    1.Park calls coming to extension 800 in mod_fifo.
    2. Originate calls to a group of extensions simultanously
    3. After an extension answers, bridge that call with a call pulled out of mod_fifo.

For this, wrote some event_socket code to listen to fifo events and when a call is pushed into the queue, i do a jsrun command to originate calls to the number and bridge it with a call in fifo queue. Unfortunately for me, the code didn't work as expected. I am enclosing the code below -

Dial Plan:

<extension name="callcentre">
      <condition field="${destination_number}" expression="^800$">
        <action application="set" data="tts_engine=flite"/>     
                                                                                               
        <action application="set" data="tts_voice=kal"/>                                                                                                       
          <action application="fifo" data="callcentre_queue in nowait E:/othersounds/holdmusic.mp3 E:/othersounds/holdmusic.mp3" />
      </condition>
    </extension>

Event Socket (It uses Ray's event socket php code in contrib section) :

<?php
require_once('fs_sock.php');

$connectionInfo = array(
'host'=>'localhost',
'port'=>'8021',
'pass'=>'ClueCon',
'timeout'=>3,
'stream_timeout'=>0.5
);

$fsObj = new fs_sock($connectionInfo);

if ($fsObj -> auth != true) {
    die(printf("Unable to authenticate\r\n"));
}

if (!$fsObj -> subscribe_events('plain CUSTOM fifo::info')) {
    die(printf("Unable to subscribe to events"));
}

while(1) {
  $output = $fsObj -> wait_for_event();
  if($output != null && isset ($output['Body']['FIFO-Action']) &&
      $output['Body']['FIFO-Action'] == "push") {
    //Send the command to run the javascript.
    $fsObj->bgapi_command("jsrun CallConnect.js");
  }
}

$fsObj -> sock_close();

?>

JavaScript:

newSession = new Session();
done = false;

var extensions = new Array('user/1001@10.1.1.202','user/1002@10.1.1.202','user/1004@10.1.1.202','user/1005@10.1.1.202');
var i = 0;
while(!done) {
  result = newSession.originate(session, extensions[i] + ",user/9999@10.1.1.202",2); //It does not originate call to 9999 but timeout works
//  result = newSession.originate(session, extensions[i] ,2); //timeout does not work
  if(result) {
      newSession.answer();
      newSession.execute( "fifo", "callcentre_queue out wait undef undef" );
      done = true;
      break;
  }
  i = (i >= extensions.length) ?  0  : i+1;
}

My requirement is for the js to originate multiple calls simulatnously like how bridge does it. If that is not possible, i would ring each extension for a second until someone picks up.

Thanks.

B Karthik




On Mon, Aug 18, 2008 at 9:30 PM, <freeswitch-users-request@lists.freeswitch.org> wrote:
Send Freeswitch-users mailing list submissions to
       freeswitch-users@lists.freeswitch.org

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
or, via email, send a message with subject or body 'help' to
       freeswitch-users-request@lists.freeswitch.org

You can reach the person managing the list at
       freeswitch-users-owner@lists.freeswitch.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Freeswitch-users digest..."

Today's Topics:

  1. Re: Problem using originate (Anthony Minessale)


---------- Forwarded message ----------
From: "Anthony Minessale" <anthony.minessale@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Date: Mon, 18 Aug 2008 10:52:17 -0500
Subject: Re: [Freeswitch-users] Problem using originate
the originate method should only be called on a session that was created with no arguments to the constructor.

For an existing session you should use session.execute("bridge", "<originate string>");

the timeout can be set inside the originate string with the {} variables.

"{call_timeout=5}sofia/dest/user@host.com"

Everything inside the originate string is identical to anything that takes the originate arg, including the originate CLI FSAPI command, the bridge app and that originate method to embedded langs.





On Mon, Aug 18, 2008 at 9:00 AM, Brian West <brian@freeswitch.org> wrote:
Can you clarify what you're doing.  Create a small test case and post
that along with instructions on how you're create this scenario that
will help greatly on my part.

/b

On Aug 18, 2008, at 8:57 AM, B Karthik wrote:

> Can someone  help me on this please....
>
> Thanks.
>
> B Karthik

Brian West
sip:brian@freeswitch.org



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org