Пример #1
0
        void On_InstantMessagingCall_Received(object sender, CallReceivedEventArgs <InstantMessagingCall> e)
        {
            //Type checking was done by the platform; no risk of this being any
            // type other than the type expected.
            _instantMessagingCall = e.Call;

            // Call: StateChanged: Only hooked up for logging, to show the call
            // state transitions.
            _instantMessagingCall.StateChanged += new
                                                  EventHandler <CallStateChangedEventArgs>(_instantMessagingCall_StateChanged);

            // Remote Participant URI represents the far end (caller) in this
            // conversation. Toast is the message set by the caller as the 'greet'
            // message for this call. In Microsoft Lync, the toast will
            // show up in the lower-right of the screen.
            Console.WriteLine("Call Received! From: " + e.RemoteParticipant.Uri + " Toast is: " +
                              e.ToastMessage.Message);

            // Now, decline the call. CallDeclineOptions can be used to supply a
            // response code, here, 486 (Busy Here). Decline is asynchronous, as
            // no reply will be received from the far end.
            _instantMessagingCall.Decline(new CallDeclineOptions(486));

            _autoResetEvent.Set();
        }