} // Analyzer_DtmfToneStarted private void Analyzer_DtmfToneStopped(DtmfToneEnd obj) { try { // logging MethodBase myMethod = new StackTrace().GetFrame(0).GetMethod(); MethodBeginLogging(myMethod); string currentDTMFChar = GetDTMFShortHand(obj.DtmfTone.Key.ToString()); bool fallThrough = false; // GET FIRST CHARACTER // is this the beginning of a new command? if (string.IsNullOrEmpty(CurrentDTMFCommand)) { // is this character initiating a new command? (#) if (currentDTMFChar == @"#") { MyState = DTMFCommandStates.isCommand; CurrentDTMFCommand = currentDTMFChar; fallThrough = true; } // if else { ResetDTMFCommandState(); } // else } // if // GET SECOND CHARACTER // command has started, get 2nd char if (MyState == DTMFCommandStates.isCommand && fallThrough == false) { if (currentDTMFChar == @"*") { // 2nd position is *, command is #* MyState = DTMFCommandStates.isDisconnect; CurrentDTMFCommand += currentDTMFChar; FinalDTMFCommand = CurrentDTMFCommand; } // if // 2nd char is NOT *, so it MUST be 0-9 else if (IsNumeric(currentDTMFChar)) { MyState = DTMFCommandStates.isNotDisconnect; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // else if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if // GET THIRD CHARACTER // command has started and is not a disconnect, get 3rd char if (MyState == DTMFCommandStates.isNotDisconnect && fallThrough == false) { // if 3rd char is * this is a config change if (currentDTMFChar == @"*") { MyState = DTMFCommandStates.isLoadConfig; CurrentDTMFCommand += currentDTMFChar; FinalDTMFCommand = CurrentDTMFCommand; } // if // if 3rd char is 0-9, this is isAdminSettingORChannelChange else if (IsNumeric(currentDTMFChar)) { MyState = DTMFCommandStates.isAdminSettingORChannelChange; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // else if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if // GET FOURTH CHARACTER //command has started, and is either Admin Setting or Channel Change, get 4th char if (MyState == DTMFCommandStates.isAdminSettingORChannelChange && fallThrough == false) { // if 4th char is # this is an Admin Setting change if (currentDTMFChar == @"#") { MyState = DTMFCommandStates.isAdminSetting; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // if // if 4th char is 0-9, this is a channel change else if (IsNumeric(currentDTMFChar)) { MyState = DTMFCommandStates.isChangeChannel; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // else if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if // GET FIFTH CHARACTER //command has started, and is Admin Setting, get 5th char if (MyState == DTMFCommandStates.isAdminSetting && fallThrough == false) { // Admin Setting change, 5th char is 0-9 if (IsNumeric(currentDTMFChar)) { MyState = DTMFCommandStates.isAdminSettingNotFinal; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if //command has started, and is Channel Change, get 5th char if (MyState == DTMFCommandStates.isChangeChannel && fallThrough == false) { // Admin Setting change, 5th char is # if (currentDTMFChar == @"#") { MyState = DTMFCommandStates.isChannelChangeNoChannelNumber; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if //GET SIXTH CHARACTER // command has started, is Admin Setting, get 6th char if (MyState == DTMFCommandStates.isAdminSettingNotFinal && fallThrough == false) { // Admin Setting change, 6th char is * if (currentDTMFChar == @"*") { MyState = DTMFCommandStates.isAdminSettingFinal; CurrentDTMFCommand += currentDTMFChar; FinalDTMFCommand = CurrentDTMFCommand; fallThrough = true; } // if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if // command has started, is Channel Change, get 6th char if (MyState == DTMFCommandStates.isChannelChangeNoChannelNumber && fallThrough == false) { // Channel Change, 6th char is 0-9 if (IsNumeric(currentDTMFChar)) { MyState = DTMFCommandStates.isChannelChangeNotFinal; CurrentDTMFCommand += currentDTMFChar; fallThrough = true; } // if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if //GET SEVENTH CHARACTER if (MyState == DTMFCommandStates.isChannelChangeNotFinal && fallThrough == false) { // Channel Change, 7th char is * if (currentDTMFChar == @"*") { MyState = DTMFCommandStates.isChannelChangeFinal; CurrentDTMFCommand += currentDTMFChar; FinalDTMFCommand = CurrentDTMFCommand; fallThrough = true; } // if // illegal char passed, reset else { ResetDTMFCommandState(); } // else } // if ProcessDTMFCommand(FinalDTMFCommand, MyState); SetText(currentDTMFChar + "-" + CurrentDTMFCommand); // logging MethodEndLogging(myMethod); } // try catch (Exception ex) { UtilityMethods.ExceptionHandler(ex, TraceString); } // catch } // Analyzer_DtmfToneStopped
public EvaluatorEventArgs(DtmfToneStart toneStart, DtmfToneEnd toneEnd, DateTime timestamp) { ToneStart = toneStart; ToneEnd = toneEnd; Timestamp = timestamp; }