[Freeswitch-users] Interaction between event handler and streamfile (avmd specifically)

Anthony Minessale anthony.minessale at gmail.com
Tue Oct 4 02:01:38 MSD 2011


whatever you return from the callback besides null undefined blank
string etc will be returned from streamfile so you want to just return
something like "replay" vs "stop" vs nothing if you want it to keep
playing.  then you can decide from there.


On Mon, Oct 3, 2011 at 9:40 AM, Jason Moran <jmoran at secureachsystems.com> wrote:
> In short, I’m looking to stream a message twice unless a voicemail beeps. If
> the voicemail beeps, then start over immediately and only play the message
> once.
>
>
>
> Pseudo-code:
>
>
>
> session.execute("avmd", "start");
>
> session.streamFile(playbackFileName); //1st play
>
> session.streamFile(playbackFileName); //2nd play
>
> session.execute("hangup","ORIGINATOR_CANCEL");
>
>
>
> function onDTMF(s, type, obj, arg)
>
> {
>
>   if(type == "event" && session.getVariable("avmd_detect") == "TRUE")
>
>  {
>
>   session.execute("avmd", "stop");
>
>   session.streamFile(playbackFileName);
>
>   return false;
>
>  }
>
>  return true;
> }
>
>
>
> My question is what the effect and timing is of returning false or true from
> the onDTMF function? Does the original streamFile continue playing? Pause?
> end immediately? Do I have to set a variable, return false to stop the
> original from playing, then do my streamfile logic OUTSIDE of the onDTMF for
> proper flow? What happens if I never return true or false, what does it do
> then?
>
>
>
> Thanks,
> Jason
>
> 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/
Twitter: http://twitter.com/FreeSWITCH_wire

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

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list