【发布时间】:2016-08-15 18:19:49
【问题描述】:
我正在开发一个基于 Skype for buisienss 和 UCMA 5.0 的自定义 IVR 系统
在我的应用程序中,我使用begintransfer 方法将呼叫转移给用户。
当我从 Skype 客户端内部呼叫时,一切正常,呼叫路由正确。
来自 pstn 网关呼叫的入站呼叫得到应答并无异常执行 begintransfer,但呼叫不会路由到分机。
这是我的代码: call.BeginTransfer()
我不能使用转接(而不是转接),因为转接在呼叫尚未建立时起作用。我需要播放录音并选择没有 IVR 时不转接的来电。
我想我在“_toneController_ToneReceived”事件中遗漏了一些东西
我做错了什么?
public class IVR
{
private static void _toneController_ToneReceived(object sender, ToneControllerEventArgs e)
{
number += getToneString(tone);
if (number.Length == 3)
{
try
{
CallTransferOptions unattendedTransferOptions = new CallTransferOptions(CallTransferType.Unattended);
// currentCall.BeginTransfer(number, unattendedTransferOptions, TransferCallBack, null);
//currentCall.BeginTransfer(number , null,null);//, EndEndpointEstablish, new object());
currentCall.BeginTransfer(
number,
new CallTransferOptions(CallTransferType.Attended),
result =>
{
try
{
currentCall.EndTransfer(result);
}
catch (OperationFailureException ofe)
{
Logger_Call.log(string.Format("The recipient declined or did not answer the call:{0}",
ofe));
}
catch (RealTimeException rte)
{
Logger_Call.log(string.Format("Error transferring call:{0}", rte));
}
}, null);
Logger_Call.log(currentCall.OriginalDestinationUri + " ==> " + number);
}
catch (Exception ex)
{
Logger_Call.log(currentCall.OriginalDestinationUri + " ==ex==> " + ex.Message);
}
}
}
private void InitializeCallReceive(string applicationUri, string serverName, int serverPort, NetworkCredential credential)
{
try
{
Debugger.Launch();
ClientPlatformSettings clientPlatformSettings;
clientPlatformSettings = new ClientPlatformSettings("IVR.Server", SipTransportType.Tls);
collaborationPlatform = new CollaborationPlatform(clientPlatformSettings);
collaborationPlatform.EndStartup(collaborationPlatform.BeginStartup(null, null));
UserEndpointSettings endpointSettings;
endpointSettings = new UserEndpointSettings(applicationUri, serverName, serverPort);
endpoint = new UserEndpoint(collaborationPlatform, endpointSettings);
endpoint.Credential = credential;
endpoint.RegisterForIncomingCall<AudioVideoCall>(AudioVideoCallReceived);
endpoint.EndEstablish(endpoint.BeginEstablish(null, endpoint));
}
catch (Exception ex)
{
}
}
private void AudioVideoCallReceived(object sender, CallReceivedEventArgs<AudioVideoCall> e)
{
currentCall = e.Call;
currentCall.AudioVideoFlowConfigurationRequested += new EventHandler<AudioVideoFlowConfigurationRequestedEventArgs>(Call_AudioVideoFlowConfigurationRequested);
currentCall.EndAccept(currentCall.BeginAccept(null, null));
}
private void Call_AudioVideoFlowConfigurationRequested(object sender, AudioVideoFlowConfigurationRequestedEventArgs e)
{
currentCall.Flow.StateChanged += new EventHandler<MediaFlowStateChangedEventArgs>(Flow_StateChanged);
}
private void Flow_StateChanged(object sender, MediaFlowStateChangedEventArgs e)
{
_flow = (AudioVideoFlow)sender;
if (e.State == MediaFlowState.Active)
{
try
{
ToneController _toneController = new ToneController();
_toneController.ToneReceived += _toneController_ToneReceived;
_toneController.AttachFlow(_flow);
MediaSource source = new WmaFileSource("rec.wma");
source.EndPrepareSource(source.BeginPrepareSource(MediaSourceOpenMode.Buffered, null, null));
Player _player = new Player();
_player.SetSource(source);
_player.AttachFlow(_flow);
_player.SetMode(PlayerMode.Automatic);
_player.Start();
}
catch (Exception)
{
}
}
}
}
【问题讨论】:
-
请将您的代码编辑到您的问题中,而不是使用代码图像
-
@KevinL 代码已添加。
标签: c# lync ivr ucma skype-for-business