/// <summary> /// Handles flow configuration changed event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">An AudioVideoFlowConfigurationChangedEventArgs that contains the event data.</param> private void HandleAudioVideoConfigurationChanged(object sender, AudioVideoFlowConfigurationChangedEventArgs e) { // If the call was put on hold before the activity has started executing, // then we would only get the call retrieved event. // In this case we safely call startspeakaync to replay the prompt. // However if the call was put on hold while the statement activity was // executing ( in our case in between a speakasync operation) then, // we should get a event for the call being put on hold, and in this case we need to cancel the speak async opeation. // later we will get a call retrieved event, in which case we start the speakasync operation. if (this.GetCallConfiguration(AudioVideoCall) == AvCallCommunicationEvents.Retrieved && m_callOnHold == true) { m_callOnHold = false; if (AudioVideoCall.State == CallState.Established) { StartSpeakAsync(); } } else if (this.GetCallConfiguration(AudioVideoCall) == AvCallCommunicationEvents.OnHold && m_callOnHold == false) { m_callOnHold = true; if (AudioVideoCall.State == CallState.Established) { m_speechSynthesizer.SpeakAsyncCancelAll(); } } }
// Callback that is called when the configuration of an AudioVideoFlow changes. private void audioVideoFlow_ConfigurationChanged(object sender, AudioVideoFlowConfigurationChangedEventArgs e) { // application can check AudioVideoFlow values to see the result of the negotiation. }