[Freeswitch-users] Problem using originate

B Karthik carthick84 at gmail.com
Mon Aug 18 11:02:59 PDT 2008


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 at 10.1.1.202','user/1002 at 10.1.1.202
','user/1004 at 10.1.1.202','user/1005 at 10.1.1.202');
var i = 0;
while(!done) {
  result = newSession.originate(session, extensions[i] + ",user/
9999 at 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 at lists.freeswitch.org> wrote:

> Send Freeswitch-users mailing list submissions to
>        freeswitch-users at 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 at lists.freeswitch.org
>
> You can reach the person managing the list at
>        freeswitch-users-owner at 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 at gmail.com>
> To: freeswitch-users at 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 at 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 at 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 at freeswitch.org <sip%3Abrian at freeswitch.org>
>>
>>
>>
>>
>> _______________________________________________
>> Freeswitch-users mailing list
>> Freeswitch-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>
>
>
> --
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
> pstn:213-799-1400
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080818/9194ac05/attachment-0002.html 


More information about the FreeSWITCH-users mailing list