无法使用 ucma 5.0 从 pstn 转入呼入电话

Posted

技术标签:

【中文标题】无法使用 ucma 5.0 从 pstn 转入呼入电话【英文标题】:cannot transfer calls in inbound call from pstn with ucma 5.0 【发布时间】: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 代码已添加。 【参考方案1】:

代码是正确的。 我在 Skype 服务器中设置错误。 要进行传输,refer suport 必须在中继配置中启用。

检查此链接: https://support.microsoft.com/en-us/kb/2506083

重要提示:

Lync Server 全局、站点或池中继配置策略启用了启用引用支持选项

本地部署的 IP 网关或 Internet 服务提供商 (ISP) 的 SIP 中继服务部署的 IP 网关不支持使用 SIP REFER 方法

image of trunk configuration

【讨论】:

以上是关于无法使用 ucma 5.0 从 pstn 转入呼入电话的主要内容,如果未能解决你的问题,请参考以下文章

思科CME9.0搭建企业VOIP电话

使用 UCMA 的 Lync 客户端实施

Skype for business server 2015和PSTN集成后,无法完成呼叫

在 UCMA 中取消转移

从 UCMA 应用程序中的电话号码检索 Lync 联系人

适用于 Lync 的 UCC API 到 UCMA 3.0