コード例 #1
0
        static void Main()
        {
            Console.WriteLine("C# Plantronics COM API Sample");
            bool quit = false;

            _hubSDK                      = new HubSDKConnector();
            _hubSDK.SDKError            += _hubSDK_SDKError;
            _hubSDK.SDKInfo             += _hubSDK_SDKInfo;
            _hubSDK.CallStateChanged    += _hubSDK_CallStateChanged;
            _hubSDK.HeadsetStateChanged += _hubSDK_HeadsetStateChanged;

            while (!quit)
            {
                ShowMenu();
                string cmd = Console.ReadLine();
                switch (cmd)
                {
                case "1":
                    _callid++;
                    // inform Plantronics my app has an incoming (ringing) call
                    Console.WriteLine("Performing incoming call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.IncomingCall, _callid, "Bob%20Smith"));
                    break;

                case "2":
                    _callid++;
                    // inform Plantronics my app has an outgoing call
                    Console.WriteLine("Performing outgoing call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.OutgoingCall, _callid, "Bob%20Smith"));
                    break;

                case "3":
                    // inform Plantronics my app has now answered an incoming (ringing) call
                    Console.WriteLine("Answering call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.AnswerCall, _callid));
                    break;

                case "4":
                    // place call on hold
                    Console.WriteLine("Holding call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.HoldCall, _callid));
                    break;

                case "5":
                    // resume the call
                    Console.WriteLine("Resuming call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.ResumeCall, _callid));
                    break;

                case "6":
                    // mute the headset (note for wireless products, audio link must be active)
                    Console.WriteLine("Setting headset mute = true");
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.SetMute, true));
                    break;

                case "7":
                    // unmute the headset (note for wireless products, audio link must be active)
                    Console.WriteLine("Setting headset mute = false");
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.SetMute, false));
                    break;

                case "8":
                    // inform Plantronics my app has now terminated the call
                    Console.WriteLine("Terminating call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.TerminateCall, _callid));
                    break;

                case "0":
                    quit = true;
                    break;

                default:
                    Console.WriteLine("Unrecognised menu choice.");
                    break;
                }
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: vhnatiuk/pdc
        static void Main()
        {
            Console.WriteLine("C# Plantronics COM API Sample");
            bool quit = false;

            _hubSDK                      = new HubSDKConnector();
            _hubSDK.SDKError            += _hubSDK_SDKError;
            _hubSDK.SDKInfo             += _hubSDK_SDKInfo;
            _hubSDK.CallStateChanged    += _hubSDK_CallStateChanged;
            _hubSDK.HeadsetStateChanged += _hubSDK_HeadsetStateChanged;

            while (!quit)
            {
                ShowMenu();
                string cmd = Console.ReadLine();
                switch (cmd)
                {
                case "1":
                    _callid++;
                    // inform Plantronics my app has an incoming (ringing) call
                    Console.WriteLine("Performing incoming call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.IncomingCall, _callid, "Bob%20Smith"));
                    break;

                case "2":
                    _callid++;
                    // inform Plantronics my app has an outgoing call
                    Console.WriteLine("Performing outgoing call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.OutgoingCall, _callid, "Bob%20Smith"));
                    break;

                case "3":
                    // inform Plantronics my app has now answered an incoming (ringing) call
                    Console.WriteLine("Answering call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.AnswerCall, _callid));
                    break;

                case "4":
                    // place call on hold
                    Console.WriteLine("Holding call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.HoldCall, _callid));
                    break;

                case "5":
                    // resume the call
                    Console.WriteLine("Resuming call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.ResumeCall, _callid));
                    break;

                case "6":
                    // mute the headset (note for wireless products, audio link must be active)
                    Console.WriteLine("Setting headset mute = true");
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.SetMute, true));
                    break;

                case "7":
                    // unmute the headset (note for wireless products, audio link must be active)
                    Console.WriteLine("Setting headset mute = false");
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.SetMute, false));
                    break;

                case "8":
                    // inform Plantronics my app has now terminated the call
                    Console.WriteLine("Terminating call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.TerminateCall, _callid));
                    break;

                case "0":
                    quit = true;
                    break;

                // ADVANCED OPTIONS
                case "9":
                    // dial outbound call using Hub SDK
                    Console.Write("Enter phone number >");
                    string num = Console.ReadLine();
                    Console.WriteLine("Dialling outbound call to " + num + " with Hub default softphone...");
                    if (num.Length > 0)
                    {
                        _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.DialOutbound, 0, num));
                    }
                    else
                    {
                        Console.WriteLine("You must enter a contact number or name to dial. Please invoke operation again to retry.");
                    }
                    break;

                case "10":
                    _callid++;
                    // inform Plantronics my app has an already ongoing call, for instance in auto-answer scenario
                    Console.WriteLine("Performing insert call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.InsertCall, _callid, "Bob%20Smith"));
                    Console.WriteLine("Resuming call, id = " + _callid);
                    _hubSDK.DoHubSDKAction(new HubSDKAction(HubSDKActionType.ResumeCall, _callid));
                    break;

                default:
                    Console.WriteLine("Unrecognised menu choice.");
                    break;
                }
            }
        }