VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
vids.cs at gmail.com Guest
|
Posted: Sat Sep 06, 2008 1:44 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Hi All,
How to use scheduled hangup from within a java script.
Here is the flow.
User dials 1212 from softphone call goes to default dialplan and calls test.js
in test.js i am doing like this
====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44 (911234567890@11.22.33.44)";
// now originate a new session
new_session = new Session();
new_session.setCallerData("caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
Now i want to hangup new_session after lets say 2 minutes.
I can not use scheduled hangup in dialplan as this hangup time may vary and will come from database.
Any help will be appreciated.
--
Thanks and Regards
Vidhya Sagar Dixit |
|
Back to top |
|
|
vids.cs at gmail.com Guest
|
Posted: Mon Sep 08, 2008 4:02 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
can any one please answer my question ...?
--
Thanks and Regards
Vidhya Sagar Dixit
On Sat, Sep 6, 2008 at 12:12 PM, vidhya sagar dixit <vids.cs@gmail.com (vids.cs@gmail.com)> wrote:
Quote: | Hi All,
How to use scheduled hangup from within a java script.
Here is the flow.
User dials 1212 from softphone call goes to default dialplan and calls test.js
in test.js i am doing like this
====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44 (911234567890@11.22.33.44)";
// now originate a new session
new_session = new Session();
new_session.setCallerData("caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
Now i want to hangup new_session after lets say 2 minutes.
I can not use scheduled hangup in dialplan as this hangup time may vary and will come from database.
Any help will be appreciated.
--
Thanks and Regards
Vidhya Sagar Dixit
|
|
|
Back to top |
|
|
brian at freeswitch.org Guest
|
|
Back to top |
|
|
vids.cs at gmail.com Guest
|
Posted: Tue Sep 09, 2008 2:04 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Dear Brian,
Thanks for the suggestion .
I have already tried like this but this does not work.Please see the sample code below.
Please tell me where i am doing wrong.
====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44 (911234567890@11.22.33.44)";
var calllength = "60";
// now originate a new session
new_session = new Session();
new_session.setCallerData("caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
new_session.execute("sched_hangup",+calllength+"alloted_timeout"); // for scheduled hangup.
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
On Mon, Sep 8, 2008 at 6:46 PM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
--
Thanks and Regards
Vidhya Sagar Dixit |
|
Back to top |
|
|
brian at freeswitch.org Guest
|
Posted: Tue Sep 09, 2008 2:16 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
The way you're doing this doesn't seem right. Can you provide me the
exact call flow?
I would also recommend putting a space between the " and the words
alloted_timeout" so that the args are passed to sched_hangup
correctly. Press F8 and see if it complains about it.
new_session.execute("sched_hangup",+"+"+calllength+" alloted_timeout");
/b
On Sep 9, 2008, at 2:01 AM, vidhya sagar dixit wrote:
Quote: | ====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44";
var calllength = "60";
// now originate a new session
new_session = new Session();
new_session.setCallerData("
caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
new_session.execute("sched_hangup",+calllength
+"alloted_timeout"); // for scheduled hangup.
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
|
Brian West
sip:brian@freeswitch.org
_______________________________________________
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 |
|
Back to top |
|
|
vids.cs at gmail.com Guest
|
Posted: Tue Sep 09, 2008 2:31 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Ok let me try this .. will let you know shortly.
On Tue, Sep 9, 2008 at 12:44 PM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote: | The way you're doing this doesn't seem right. Can you provide me the
exact call flow?
I would also recommend putting a space between the " and the words
alloted_timeout" so that the args are passed to sched_hangup
correctly. Press F8 and see if it complains about it.
new_session.execute("sched_hangup",+"+"+calllength+" alloted_timeout");
/b
On Sep 9, 2008, at 2:01 AM, vidhya sagar dixit wrote:
Quote: | ====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44 (911234567890@11.22.33.44)";
var calllength = "60";
// now originate a new session
new_session = new Session();
new_session.setCallerData("
caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
new_session.execute("sched_hangup",+calllength
+"alloted_timeout"); // for scheduled hangup.
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
|
Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
--
Thanks and Regards
Vidhya Sagar Dixit |
|
Back to top |
|
|
vids.cs at gmail.com Guest
|
Posted: Tue Sep 09, 2008 2:49 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
when i used your suggested code call hanged up as soon as i answered . in log i got this ..
2008-09-09 13:12:33 [WARNING] switch_scheduler.c:114 task_thread_loop() Task was executed late by 1220946153 seconds 2 switch_ivr_schedule_hangup (17c471d2-0e6b-4b61-89f9-59f56997c94c)
the call flow is as folllowing ..
1.user dials 1212 from softphone
2. call sent to test.js
3. answered the call on the first line of test.js
4.play a welcome note.
5. Now originate an outgoing PSTN call (new_session.)
6.call should be disconnected after given time(scheduled hangup).
On Tue, Sep 9, 2008 at 12:59 PM, vidhya sagar dixit <vids.cs@gmail.com (vids.cs@gmail.com)> wrote:
Quote: | Ok let me try this .. will let you know shortly.
On Tue, Sep 9, 2008 at 12:44 PM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote: | The way you're doing this doesn't seem right. Can you provide me the
exact call flow?
I would also recommend putting a space between the " and the words
alloted_timeout" so that the args are passed to sched_hangup
correctly. Press F8 and see if it complains about it.
new_session.execute("sched_hangup",+"+"+calllength+" alloted_timeout");
/b
On Sep 9, 2008, at 2:01 AM, vidhya sagar dixit wrote:
Quote: | ====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44 (911234567890@11.22.33.44)";
var calllength = "60";
// now originate a new session
new_session = new Session();
new_session.setCallerData("
caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
new_session.execute("sched_hangup",+calllength
+"alloted_timeout"); // for scheduled hangup.
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
|
Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
--
Thanks and Regards
Vidhya Sagar Dixit
|
--
Thanks and Regards
Vidhya Sagar Dixit |
|
Back to top |
|
|
brian at freeswitch.org Guest
|
Posted: Tue Sep 09, 2008 9:10 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Please join #freeswitch on irc.freenode.net as many nice folks there can provide help to solve your problem.
/b
On Sep 9, 2008, at 2:48 AM, vidhya sagar dixit wrote:
Quote: | when i used your suggested code call hanged up as soon as i answered . in log i got this ..
2008-09-09 13:12:33 [WARNING] switch_scheduler.c:114 task_thread_loop() Task was executed late by 1220946153 seconds 2 switch_ivr_schedule_hangup (17c471d2-0e6b-4b61-89f9-59f56997c94c)
the call flow is as folllowing ..
1.user dials 1212 from softphone
2. call sent to test.js
3. answered the call on the first line of test.js
4.play a welcome note.
5. Now originate an outgoing PSTN call (new_session.)
6.call should be disconnected after given time(scheduled hangup).
On Tue, Sep 9, 2008 at 12:59 PM, vidhya sagar dixit <vids.cs@gmail.com (vids.cs@gmail.com)> wrote:
Quote: | Ok let me try this .. will let you know shortly.
On Tue, Sep 9, 2008 at 12:44 PM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
Quote: | The way you're doing this doesn't seem right. Can you provide me the
exact call flow?
I would also recommend putting a space between the " and the words
alloted_timeout" so that the args are passed to sched_hangup
correctly. Press F8 and see if it complains about it.
new_session.execute("sched_hangup",+"+"+calllength+" alloted_timeout");
/b
On Sep 9, 2008, at 2:01 AM, vidhya sagar dixit wrote:
Quote: | ====================
session.answer();
//.......
//Do some stuff like ivr play etc .......
//......
var dialstr = "sofia/external/911234567890@11.22.33.44 (911234567890@11.22.33.44)";
var calllength = "60";
// now originate a new session
new_session = new Session();
new_session.setCallerData("
caller_id_name", "Vidhya");
new_session.setCallerData("caller_id_number", "911140500000");
new_session.originate(session, dialstr,60);
new_session.execute("sched_hangup",+calllength
+"alloted_timeout"); // for scheduled hangup.
bridge(session, new_session);
new_session.hangup();
session.hangup();
===================
|
Brian West
sip:brian@freeswitch.org ([email]sip%3Abrian@freeswitch.org[/email])
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
--
Thanks and Regards
Vidhya Sagar Dixit
|
--
Thanks and Regards
Vidhya Sagar Dixit
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
Brian West
[url=sip:brian@freeswitch.org]sip:brian@freeswitch.org[/url] |
|
Back to top |
|
|
brian at freeswitch.org Guest
|
Posted: Tue Sep 09, 2008 1:29 pm Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Show me the debug log.. you have to do the +60 otherwise its gonna
execute late since without the plus is in epoch time. By my
calculations that task executed 38.7 years late.
On Sep 9, 2008, at 2:48 AM, vidhya sagar dixit wrote:
Quote: | 2008-09-09 13:12:33 [WARNING] switch_scheduler.c:114
task_thread_loop() Task was executed late by 1220946153 seconds 2
switch_ivr_schedule_hangup (17c471d2-0e6b-4b61-89f9-59f56997c94c)
|
Brian West
sip:brian@freeswitch.org
_______________________________________________
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 |
|
Back to top |
|
|
vids.cs at gmail.com Guest
|
Posted: Wed Sep 10, 2008 12:10 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Hi Brian ,
I got it working by removing a leading + sign.The correct syntax is
new_session.execute("sched_hangup", "+"+calllength+" alloted_timeout");
Thanks a lot for your help.
--
Thanks and Regards
Vidhya Sagar Dixit
On Tue, Sep 9, 2008 at 11:57 PM, Brian West <brian@freeswitch.org (brian@freeswitch.org)> wrote:
|
|
Back to top |
|
|
brian at freeswitch.org Guest
|
Posted: Wed Sep 10, 2008 9:14 am Post subject: [Freeswitch-users] Scheduled hangup from javascript |
|
|
Please take the time to document or update the wiki to ensure others
don't run into the same problem.
/b
On Sep 10, 2008, at 12:09 AM, vidhya sagar dixit wrote:
Quote: |
Hi Brian ,
I got it working by removing a leading + sign.The correct syntax is
new_session.execute("sched_hangup", "+"+calllength+"
alloted_timeout");
Thanks a lot for your help.
|
Brian West
sip:brian@freeswitch.org
_______________________________________________
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 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|