How to set up a DTMF callback in C or C#?
Hi there, If I want to set up a DTMF callBack to a function (in either C or C#) when a caller presses a key, what function should I use to set it up? Thanks, Frankie
protected string DtmfReceived(Char Digit, TimeSpan DurationMilliseconds) //t is the duration of the tone -TimeSpan.FromMilliseconds(dtmf.duration)); { SaveDigit(Digit.ToString()); BaseLog.WriteLine(BaseLogLevel.Info, CallID, sv_uuid, CurrentAction, Termination.Reason, "DtmfReceived {0} Duration:{1}", Digit.ToString(), DurationMilliseconds.ToString()); // if (Termination.TerminatorDigits.IndexOf(Digit) >= 0 || Termination.TerminatorDigits.IndexOf('@') >= 0) //@ means any digit return "break"; //returning anything breaks play if (Termination.MaximumDigits > 0) //break the play return "break"; //returning anything but SWITCH_STATUS_SUCCESS breaks play return String.Empty;// play continues } void SetDTMFFunction(bool set) { if (Session != null && Session.Ready()) { if (set) Session.DtmfReceivedFunction = DtmfReceived;// public Func<Char, TimeSpan, string> else Session.DtmfReceivedFunction = null; } } ----- Original Message ----- From: "Frankie Yiu" <yky1628@yahoo.com> To: <freeswitch-users@lists.freeswitch.org> Sent: Friday, February 11, 2011 12:13 PM Subject: [Freeswitch-users] How to set up a DTMF callback in C or C#? Hi there, If I want to set up a DTMF callBack to a function (in either C or C#) when a caller presses a key, what function should I use to set it up? Thanks, Frankie
The code sample with the source also has a complete example for this. src\mod\languages\mod_managed\managed\demo.csx When this type of file is copied to managed in your runtime location fs will dynamically compile it - watch the cli. Look at the dialplan and example section on the mod_managed Wiki http://wiki.freeswitch.org/wiki/Mod_managed replace <action application="managed" data="AppDemo"/> -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/How-to-set-up-a-DTMF-callback-... Sent from the freeswitch-users mailing list archive at Nabble.com.
participants (3)
-
Frankie Yiu
-
Jeff Lenk
-
Kris