private void OnCallMedia(object sender, TapiCallMediaEventArgs e) { try { if (activeCall != null && e.Event == CALL_MEDIA_EVENT.CME_STREAM_ACTIVE && e.Terminal.Direction == TERMINAL_DIRECTION.TD_CAPTURE && playbackTerminal != null) { playbackTerminal.Start(); SetStatusMessage("File Playback Terminal started "); } } catch (TapiException ex) { MessageBox.Show(ex.Message); activeCall.Disconnect(DISCONNECT_CODE.DC_NORMAL); } }
private void tapi_TE_CALLSTATE(object sender, TapiCallStateEventArgs e) { if (e.State == CALL_STATE.CS_CONNECTED && playbackTerminal != null) { // Start the playback message.. playbackTerminal.Start(); } else if (e.State == CALL_STATE.CS_DISCONNECTED) { // Stop recording when the call terminates. if (recordTerminal != null) { recordTerminal.Stop(); } recordTerminal = null; playbackTerminal = null; } }
private void OnMediaEvent(object sender, TapiCallMediaEventArgs e) { // When the video rendering stream activates, popup the video window if it's available. if (e.Event == CALL_MEDIA_EVENT.CME_STREAM_ACTIVE) { TStream stm = e.Stream; if (stm.Direction == TERMINAL_DIRECTION.TD_RENDER && stm.MediaType == TAPIMEDIATYPES.VIDEO) { TTerminal t = stm.FindTerminal(stm.MediaType, stm.Direction); if (t != null) { IVideoWindow vw = t.QueryInterface(typeof(IVideoWindow)) as IVideoWindow; if (vw != null) { // Position to the right vw.SetWindowPosition(this.Left + this.Width + 2, this.Top, vw.Width, vw.Height); vw.Visible = 1; } } } else if (currCall != null && stm.Direction == TERMINAL_DIRECTION.TD_CAPTURE && stm.MediaType == TAPIMEDIATYPES.AUDIO && playbackTerminal != null) { try { playbackTerminal.Start(); toolStripStatusLabel1.Text = "File Playback Terminal started "; } catch (TapiException ex) { MessageBox.Show(ex.Message); } } } }