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

Jason Moran jmoran at secureachsystems.com
Mon Oct 3 18:40:18 MSD 2011


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20111003/4f2ce53c/attachment.html 


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