/// <summary> /// Method invoked when call is established /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void phone_Established(object sender, EstablishedEventArgs args) { DateTime connEstablishedTimeStamp = DateTime.Now; /** * When call is connected, create a new instance of calleeIterationInfo * and set the time stamp of the instant when call was connected. * Also set the caller ID */ calleeData = null; calleeData = new CalleeIterationInfo(); calleeData.callConnectTime = connEstablishedTimeStamp; calleeData.remotePartyExtension = args.CallingDevice; // Preserve the connection object conn = args.EstablishedConnection; ++currIter; // Increment the iteration number try { ll.Start(); } catch (Exception e) { display("Exception in phone_Established.Message = " + e.Message + " StackTrace = " + e.StackTrace, MessageType.WARNING); } try { if (recorder != null) { recorder.Filename = inputParam.resultDirName + "\\Callee_RecordedWav_" + currIter.ToString() + ".wav"; recorder.Start(); } } catch(Exception e2) { display("Exception in phone_Established.Message = " + e2.Message + " StackTrace = " + e2.StackTrace, MessageType.WARNING); } promptTimer.Enabled = true; setState(CurrentState.CONNECTED); missingHangupDetectionTimer.Enabled = true; }
/// <summary> /// Method invoked when call is established /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void phone_Established(object sender, EstablishedEventArgs args) { DateTime connEstablishedTimeStamp = DateTime.Now; /** * A new instance of callerIterationInfo (callerData) is created while calling placeCall method. * Initialize it with call connect time. */ callerData.callConnectTime = connEstablishedTimeStamp; // Preserve the connection object conn = args.EstablishedConnection; setState(CurrentState.CONNECTED); try { ll.Start(); } catch(Exception e1) { Console.WriteLine("Exception while starting listener. Message: " + e1.Message + " Stack Trace: " + e1.StackTrace); Trace.TraceError("Exception while starting listener. Message: " + e1.Message + " Stack Trace: " + e1.StackTrace + " Current Time = " + DateTime.Now); } try { if (recorder != null) { int temp; lock (this) { temp = numCallsPlaced; } recorder.Filename = inputParam.resultDirName + "\\Caller_RecordedWav_" + (temp).ToString() + ".wav"; display("Starting recording to file: " + recorder.Filename); recorder.Start(); } } catch (Exception e) { Console.WriteLine("Exception in starting recorder. Message : " + e.Message); Trace.TraceError("Exception in starting recorder. Message: " + e.Message + " Stack Trace: " + e.StackTrace + " Current time = " + DateTime.Now + "\r\nStack Trace : \r\n" + e.StackTrace, "Warning"); } }