[Freeswitch-users] Remove scheduled broadcast in javascript
Matt Broad
matt at inveroak.com
Mon Jul 29 17:11:13 MSD 2013
Hi Anthony,
just an update to say that the change you made works perfectly!
Just to outline, Using javascript I first set a scheduled broadcast for
x seconds time (which in this case will also end the call). If
something occurs before this broadcast, the broadcast should be canceled.
To do this I used the following javascript:
//set the broadcast to play and then end the call
session.execute("sched_broadcast", "+60
playback!normal_clearing::/sounds/callending.mp3 both");
//I now need to get the task ID for this broadcast
var endCallBroadcastTaskID = session.getVariable("last_sched_id");
//now check for something. if something happend then cancel the
broadcast using the taskid collected previously
if (somethingHappened == true)
{
session.execute("sched_cancel",endCallBroadcastTaskID);
}
I will happily add to the wiki to include this change/addition, but will
need a few pointers in doing so. Is there a page on the wiki explaining
how to do this?
thanks
Matt
On 29/07/2013 08:28, Matt Broad wrote:
> Perfect, Thanks Anthony.
> I will update my version to the latest and give it a go.
>
> Michael, I am more than happy to update the wiki. Is there is a "how
> to" page detailing to add/amend pages?
>
>
> thanks
> Matt
>
>
> On 26/07/2013 21:13, Michael Collins wrote:
>> Please report back your results. If it works then you can help us out
>> by paying the wiki tax. I'll be happy to assist if you need a hand
>> with getting up and running with the wiki.
>>
>> -MC
>>
>>
>> On Fri, Jul 26, 2013 at 12:30 PM, Anthony Minessale
>> <anthony.minessale at gmail.com <mailto:anthony.minessale at gmail.com>> wrote:
>>
>> try latest and last_sched_id var
>>
>>
>>
>> On Fri, Jul 26, 2013 at 9:09 AM, Matt Broad <matt at inveroak.com
>> <mailto:matt at inveroak.com>> wrote:
>>
>> is there a way of getting the individual task id when setting
>> the broadcast?
>>
>> again thanks for the help :)
>>
>> thanks
>> Matt
>>
>>
>>
>> On 26/07/2013 14:51, Anthony Minessale wrote:
>>> The group id is always the uuid of the session. You can
>>> only delete the whole group or the individual tasks.
>>>
>>>
>>>
>>> On Fri, Jul 26, 2013 at 2:17 AM, Matt Broad
>>> <matt at inveroak.com <mailto:matt at inveroak.com>> wrote:
>>>
>>> Hi Anthony,
>>>
>>> thanks for the reply :)
>>>
>>> That's great, that explains why it would delete all
>>> tasks associated to the session. Do you know of a way
>>> of getting/setting the group id when calling
>>> schedule_broadcast?
>>>
>>> I can't see that it expects a variable when being called
>>> to be able to give it a groupid, and the session execute
>>> just returns true or false (which I guess it should).
>>>
>>> Any suggestions would be appreciated
>>>
>>> thanks
>>> Matt
>>>
>>>
>>>
>>> On 25/07/2013 20:54, Anthony Minessale wrote:
>>>> you can pass an optional group id to sched_cancel. When
>>>> you don't provide it, it defaults to the session uuid.
>>>> I noticed in the code that it did not pull out task ids
>>>> but I changed the code so it will next time you update.
>>>>
>>>> meanwhile, you can still use sched_del as a variable
>>>> execute the eval app with the args ${sched_del 1234} or
>>>> whatever the task id is.
>>>>
>>>>
>>>> On Thu, Jul 25, 2013 at 2:47 AM, Matt Broad
>>>> <matt at inveroak.com <mailto:matt at inveroak.com>> wrote:
>>>>
>>>> Hi Michael,
>>>>
>>>> thanks for taking the time to reply.
>>>> You're right, I hadn't realised that sched_del was
>>>> api only :)
>>>>
>>>> I have tested sched_cancel and it works, but it
>>>> removes all scheduled broadcasts that have been set.
>>>> This is visible by calling "show tasks" from the
>>>> fs_cli before and after the sched_cancel is called.
>>>>
>>>> Do you think there is a way of passing a task id to
>>>> the application to cancel a specific broadcast?
>>>>
>>>> I can work around the issue by re-adding the other
>>>> broadcasts, by calculating the duration of the call
>>>> and subtracting that from the time passed to the
>>>> sched_broadcast, but would be nicer to be able to
>>>> cancel the one schedule :)
>>>>
>>>> I will be happy to update the wiki, though I may
>>>> need a little guidance in doing so as I've not done
>>>> so before.
>>>>
>>>> Again thanks for your time :)
>>>>
>>>> thanks
>>>> Matt
>>>>
>>>>
>>>> On 24/07/2013 23:35, Michael Collins wrote:
>>>>> Hi Matt,
>>>>>
>>>>> I hope you're willing to try a few things and
>>>>> report back. You're using session.execute to
>>>>> execute a dialplan application (sched_boradcast).
>>>>> However, sched_del is actually an API, not a
>>>>> dialplan application (i.e. you type sched_api blah
>>>>> blah at fs_cli). It just so happens that there are
>>>>> some dialplan apps that perform the same function
>>>>> as their API counterparts:
>>>>> sched_broadcast
>>>>> sched_hangup
>>>>> sched_transfer
>>>>>
>>>>> However, there are some that are different:
>>>>> sched_del (API) vs. sched_cancel (dialplan app).
>>>>> If you're confused don't worry - it happens to
>>>>> everyone until they firmly grasp the difference
>>>>> between an API command and a dialplan application.
>>>>>
>>>>> To remove the scheduled broadcast try this:
>>>>> session.execute("sched_cancel")
>>>>>
>>>>> If it works then you can maybe add sched_cancel to
>>>>> the dptools wiki page
>>>>> <https://wiki.freeswitch.org/wiki/Mod_dptools#S>. :)
>>>>>
>>>>> Let us know how it goes,
>>>>> Michael
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Jul 24, 2013 at 6:50 AM, Matt Broad
>>>>> <matt at inveroak.com <mailto:matt at inveroak.com>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> is it possible to remove a sheduled broadcast
>>>>> within javascript?
>>>>>
>>>>> I have:
>>>>> session.execute("sched_broadcast", "+60
>>>>> /tmp/test.mp3 both");
>>>>>
>>>>> But if for some reason I no longer need the
>>>>> broadcast to occur I need to
>>>>> delete it. Looking on the Wiki I have found
>>>>> "sched_del" but cannot see
>>>>> how to get the task id for the broadcast to
>>>>> implement it.
>>>>>
>>>>> Any help would be appreciated.
>>>>>
>>>>> thanks
>>>>> Matt
>>>>>
>>>>>
>>>>> _________________________________________________________________________
>>>>> Professional FreeSWITCH Consulting Services:
>>>>> consulting at freeswitch.org
>>>>> <mailto:consulting at freeswitch.org>
>>>>> http://www.freeswitchsolutions.com
>>>>>
>>>>> FreeSWITCH-powered IP PBX: The CudaTel
>>>>> Communication Server
>>>>>
>>>>>
>>>>> Official FreeSWITCH Sites
>>>>> http://www.freeswitch.org
>>>>> http://wiki.freeswitch.org
>>>>> http://www.cluecon.com
>>>>>
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>> <mailto: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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Michael S Collins
>>>>> Twitter: @mercutioviz
>>>>> http://www.FreeSWITCH.org
>>>>> http://www.ClueCon.com
>>>>> http://www.OSTAG.org
>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________________
>>>>> Professional FreeSWITCH Consulting Services:
>>>>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>>>>> http://www.freeswitchsolutions.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Official FreeSWITCH Sites
>>>>> http://www.freeswitch.org
>>>>> http://wiki.freeswitch.org
>>>>> http://www.cluecon.com
>>>>>
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org <mailto: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
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> <mailto:consulting at freeswitch.org>
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> FreeSWITCH-powered IP PBX: The CudaTel
>>>> Communication Server
>>>>
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> <mailto: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/
>>>> Twitter: http://twitter.com/FreeSWITCH_wire
>>>>
>>>> AIM: anthm
>>>> MSN:anthony_minessale at hotmail.com
>>>> <mailto:MSN%3Aanthony_minessale at hotmail.com>
>>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>>>> <mailto:PAYPAL%3Aanthony.minessale at gmail.com>
>>>> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
>>>>
>>>> FreeSWITCH Developer Conference
>>>> sip:888 at conference.freeswitch.org
>>>> <mailto:sip%3A888 at conference.freeswitch.org>
>>>> googletalk:conf+888 at conference.freeswitch.org
>>>> <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
>>>> pstn:+19193869900 <tel:%2B19193869900>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>>>> http://www.freeswitchsolutions.com
>>>>
>>>>
>>>>
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org <mailto: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
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>>> http://www.freeswitchsolutions.com
>>>
>>>
>>>
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> <mailto: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/
>>> Twitter: http://twitter.com/FreeSWITCH_wire
>>>
>>> AIM: anthm
>>> MSN:anthony_minessale at hotmail.com
>>> <mailto:MSN%3Aanthony_minessale at hotmail.com>
>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>>> <mailto:PAYPAL%3Aanthony.minessale at gmail.com>
>>> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
>>>
>>> FreeSWITCH Developer Conference
>>> sip:888 at conference.freeswitch.org
>>> <mailto:sip%3A888 at conference.freeswitch.org>
>>> googletalk:conf+888 at conference.freeswitch.org
>>> <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
>>> pstn:+19193869900 <tel:%2B19193869900>
>>>
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>>> http://www.freeswitchsolutions.com
>>>
>>>
>>>
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org <mailto: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
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> <mailto: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/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> <mailto:MSN%3Aanthony_minessale at hotmail.com>
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> <mailto:PAYPAL%3Aanthony.minessale at gmail.com>
>> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> <mailto:sip%3A888 at conference.freeswitch.org>
>> googletalk:conf+888 at conference.freeswitch.org
>> <mailto:googletalk%3Aconf%2B888 at conference.freeswitch.org>
>> pstn:+19193869900 <tel:%2B19193869900>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> <mailto: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
>>
>>
>>
>>
>> --
>> Michael S Collins
>> Twitter: @mercutioviz
>> http://www.FreeSWITCH.org
>> http://www.ClueCon.com
>> http://www.OSTAG.org
>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> 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/20130729/60f3a528/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list