本文整理汇总了C#中ICall.HangUp方法的典型用法代码示例。如果您正苦于以下问题:C# ICall.HangUp方法的具体用法?C# ICall.HangUp怎么用?C# ICall.HangUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICall
的用法示例。
在下文中一共展示了ICall.HangUp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallPressed
private void CallPressed(string phoneNumber)
{
Logger.Log("Calling " + phoneNumber);
WaveStreamPlayback waveStream = null;
initiatedCall = apiExt.CreateCall(UsedPhoneNumber, phoneNumber, phoneNumber);
if (initiatedCall == null)
return;
bool transferStarted = false;
initiatedCall.CallStateChanged += (sender, e) =>
{
try
{
if (e.Item == CallState.Answered)
{
if (transferStarted)
{
initiatedCall.DisconnectAudioSender(waveStream);
waveStream.Dispose();
var tts = new TextToSpeech();
tts.Stopped += (sender1, e1)=>{
tts.Dispose();
initiatedCall.HangUp();
};
initiatedCall.ConnectAudioSender(tts);
tts.AddAndStartText(string.Format("Calling {0} has failed. Please try again later.", phoneNumber));
return;
}
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("OPSCallAssistant.Resources.ringback.wav");
waveStream = new WaveStreamPlayback(stream, true, true);
initiatedCall.ConnectAudioSender(waveStream);
waveStream.StartStreaming();
transferStarted = true;
initiatedCall.BlindTransfer(phoneNumber);
}
if (e.Item.IsCallEnded())
{
if (waveStream != null)
waveStream.Dispose();
}
}
catch(Exception ex)
{
Logger.Log(ex.Message);
Logger.Log(ex.StackTrace);
}
var k = 65;
};
initiatedCall.Start();
}