コード例 #1
0
ファイル: OutgoingForm.cs プロジェクト: oldfox94/itapi3
        private void OnFileTerminal(object sender, TapiFileTerminalEventArgs e)
        {
            // We are interested in TMS_IDLE because we will un-select playback and
            // select recording
            if (e.State == TERMINAL_MEDIA_STATE.TMS_IDLE)
            {
                if (e.Terminal.Direction == TERMINAL_DIRECTION.TD_RENDER &&
                    playbackTerminal != null)
                {
                    try
                    {
                        // Remove the playback terminal
                        currCall.UnselectTerminalOnCall(playbackTerminal);
                        playbackTerminal.Dispose();
                        playbackTerminal = null;

                        // Generate a custom tone on the call.
                        currCall.GenerateCustomTones(new TCustomTone[] { new TCustomTone(700, 500, 0, 0xFFFF) }, 500);

                        // Disconnect the call
                        currCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
                    }
                    catch (TapiException ex)
                    {
                        MessageBox.Show(ex.Message);
                        currCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
                    }
                }
            }
        }