Пример #1
0
 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);
     }
 }
Пример #2
0
 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);
             }
         }
     }
 }
Пример #3
0
        private void OnMediaChange(object sender, TapiCallMediaEventArgs e)
        {
            if (e.Call.Privilege != CALL_PRIVILEGE.CP_OWNER)
            {
                return;
            }

            // Find out if this stream has a video render terminal. If not,
            // we don't need to do anything with this stream. Also note
            // if this is the video capture stream or the video render stream.
            if (e.Event == CALL_MEDIA_EVENT.CME_STREAM_ACTIVE)
            {
                TStream stm = e.Stream;
                if (stm != null && stm.MediaType == TAPIMEDIATYPES.VIDEO)
                {
                    if (stm.Direction == TERMINAL_DIRECTION.TD_RENDER ||
                        stm.Direction == TERMINAL_DIRECTION.TD_CAPTURE)
                    {
                        DisplayVideoWindow(stm, stm.MediaType, stm.Direction);
                    }
                }
            }
        }
Пример #4
0
        private void tapi_TE_CALLMEDIA(object sender, TapiCallMediaEventArgs e)
        {
            if (e.Event == CALL_MEDIA_EVENT.CME_STREAM_ACTIVE)
            {
                TStream stm = e.Stream;
                /*if (stm.Direction == TERMINAL_DIRECTION.TD_RENDER &&
                    stm.MediaType == TAPIMEDIATYPES.VIDEO)
                {

                }
                else */if (e.Call != null &&
                    stm.Direction == TERMINAL_DIRECTION.TD_CAPTURE &&
                    stm.MediaType == TAPIMEDIATYPES.AUDIO &&
                    e.Terminal != null)
                {
                    try
                    {
                        //e.Terminal.Start();
                        //voz.Voice = (SpObjectToken)voces[cbVoces.SelectedIndex];
                        //voz.AudioOutput = (SpObjectToken)audioOuts[cbAudioOuts.SelectedIndex];
                        voz.Speak(tbTexto.Text, SpeechVoiceSpeakFlags.SVSFDefault);
                        //e.Terminal.Stop();
                        e.Call.Disconnect(DISCONNECT_CODE.DC_NORMAL);
                        this.tapi.Addresses[address].Close();
                        //toolStripStatusLabel1.Text = "File Playback Terminal started ";
                    }
                    catch (TapiException ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                }
            }
        }