UCMA 如何在遇忙信号和终止信号之前检测呼叫响铃持续时间并转移呼叫?
Posted
技术标签:
【中文标题】UCMA 如何在遇忙信号和终止信号之前检测呼叫响铃持续时间并转移呼叫?【英文标题】:UCMA How to detect call ring duration and transfer call before busy signal and terminate? 【发布时间】:2019-02-04 13:44:46 【问题描述】:我有一个自助转接的 b2b 电话。如果无人接听或座席忙,无法接听电话,我想转接到另一个空闲座席。我订阅了拨出呼叫段的临时响应接收,也订阅了 StateChanged。所以我可以看到呼叫何时响铃以及何时从响铃过渡到终止。如何在呼叫进入终止状态之前将此呼叫转移/转发到另一个座席。有没有办法计算响铃持续时间?或者在我可以进一步转移之前设置响铃限制?
// Create the outbound call between UCMA and the agent.
_outboundAVCall = new AudioVideoCall(_outboundConversation);
// Register for notification of the StateChanged event on the outbound call.
_outboundAVCall.StateChanged += new EventHandler<CallStateChangedEventArgs>(outboundAVCall_StateChanged);
_outboundAVCall.ProvisionalResponseReceived += new EventHandler<CallProvisionalResponseReceivedEventArgs>(OnOutProvisionalResponseReceived);
//_outboundAVCall.
InitiateBackToBackCall(incomingCall, _outboundAVCall);
_outboundCallLeg = new BackToBackCallSettings(outboundCall, _destinationSipUrit);
incomingCall.StateChanged += new EventHandler<CallStateChangedEventArgs>(inboundAVCall_StateChanged);
incomingCall.ProvisionalResponseReceived += new EventHandler<CallProvisionalResponseReceivedEventArgs>(OnInProvisionalResponseReceived);
// incomingCallLeg.StateChanged += OnCallStateChanged;
// Create a new conversation for the incoming call leg.
_inboundConversation = new Conversation(incomingCall.Conversation.Endpoint);
_inboundCallLeg = new BackToBackCallSettings(incomingCall);
LogHelper.Log(LogTarget.FileEvent, "Status of incomming call:" + incomingCall.State.ToString());
LogHelper.Log(LogTarget.FileEvent, "Status of incommoutgoing call:" + outboundCall.State.ToString());
// Create the back-to-back call instance.
// Note that you need a Destination URI for the outgoing call leg, but not for the incoming call leg.
_b2bCall = new BackToBackCall(_inboundCallLeg, _outboundCallLeg);
// Begin the back-to-back session; provide a destination.
try
IAsyncResult result = _b2bCall.BeginEstablish(BeginEstablishCB, _b2bCall);
/* IAsyncResult result = _b2bCall.BeginEstablish(
delegate(IAsyncResult ar)
_b2bCall.EndEstablish(ar);
_waitForB2BCallToEstablish.Set();
, _b2bCall);*/
catch (InvalidOperationException ioe)
LogHelper.Log(LogTarget.FileEvent, "_b2bCall must be in the Idle state." + ioe.Message.ToString(),1);
_waitForB2BCallToEstablish.WaitOne();
【问题讨论】:
我发现我必须接听未接听或忙的接听电话并尝试重新接听电话。我试过以下代码:`` 【参考方案1】:我必须添加代码来处理将发生的异常
private void SelfTransferCompleted(IAsyncResult asyncResult)
Exception exceptionCaught = null;
// bool exceptionEncountered = true;
try
_flow.Call.EndTransfer(asyncResult);
//Self Transfer has completed. successfully.
exceptionEncountered = false;
LogHelper.Log(LogTarget.FileEvent, "IVR Menu Ended self tranfer for call>" +_flow.Call.CallId);
// cleaning up atten
string sqlstring = "update astsxqueue set uniqueid ='" + _server.b2bCallDelId + "' where uniqueid='" + _flow.Call.CallId + "';";
LogHelper.Log(LogTarget.FileEvent, sqlstring);
_server.mconnector.mysqlqueryruner(sqlstring);
catch (OperationTimeoutException orte)
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Operation Timeout Exception: " + orte.ToString(), 2);
exceptionCaught = orte;
exceptionEncountered = true;
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Trying to transfer to other agent...", 2);
RetrieveCallAfterTransferFailure();
//_flow.Call.BeginTransfer("tel:+123456", null/*transferOptions*/, this.SelfTransferCompleted, _flow.Call);
// _inboundAVCall.Flow.Call.BeginTransfer("tel:+123456", _server.EndTransferCall, _inboundAVCall.Flow.Call);
//_flow.Call.BeginTransfer("tel:+123456", _server.EndTransferCall, _flow.Call);
// Wait for the call to complete the transfer.
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Waiting for transfer to complete...");
_server._waitForTransferComplete.WaitOne();
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Transfer completed.");
catch (FailureResponseException frte)
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Failure Exception = 0" + frte.ToString(), 2);
exceptionCaught = frte;
exceptionEncountered = true;
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Trying to transfer to other agent...", 2);
//_flow.Call.BeginTransfer("tel:+123456", null/*transferOptions*/, this.SelfTransferCompleted, _flow.Call);
// _inboundAVCall.Flow.Call.BeginTransfer("tel:+123456", _server.EndTransferCall, _inboundAVCall.Flow.Call);
//_flow.Call.BeginTransfer("tel:+123456", _server.EndTransferCall, _flow.Call);
// Wait for the call to complete the transfer.
RetrieveCallAfterTransferFailure();
LogHelper.Log(LogTarget.FileEvent, "Waiting for transfer to complete...");
_server._waitForTransferComplete.WaitOne();
LogHelper.Log(LogTarget.FileEvent, "Transfer completed.");
catch (RealTimeException rte)
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Realtime Exception = 0" + rte.ToString(),2);
exceptionCaught = rte;
exceptionEncountered = true;
LogHelper.Log(LogTarget.FileEvent, "IVR SelfTransferCompleted Trying to transfer to other agent...", 2);
RetrieveCallAfterTransferFailure();
LogHelper.Log(LogTarget.FileEvent, "IVR Call is retreived waiting a bit...", 2);
// Thread.Sleep(2000);
LogHelper.Log(LogTarget.FileEvent, "IVR Call is retreived time passed...", 2);
// _flow.EndHold(null);
// _speechSynthesizer.Speak("We did not get to a green agent. Please retry your option!"); //TEXT TO SPEEECH!
// SpeakMenuOptions();
// toneController.ToneReceived += toneController_ToneReceived;
// Wait for the call to complete the transfer.
LogHelper.Log(LogTarget.FileEvent, "Waiting for transfer to complete...");
//_server._waitForTransferComplete.Set();
LogHelper.Log(LogTarget.FileEvent, "Transfer completed.");
private void RetrieveCallAfterTransferFailure()
// Take the call off of hold after a transfer fails.
LogHelper.Log(LogTarget.FileEvent, "IVR Trying to retrive from Self transfer ...", 2);
try
_flow.BeginRetrieve(retrieveResult =>
try
LogHelper.Log(LogTarget.FileEvent, "IVR Trying to retrive from Self transfer ...", 2);
Thread.Sleep(1000);
_flow.EndRetrieve(retrieveResult);
LogHelper.Log(LogTarget.FileEvent, "IVR Successfully retrieved call. Waiting a bit");
LogHelper.Log(LogTarget.FileEvent, "IVR Call is retreived time passed...", 1);
//_flow.EndHold(retrieveResult);
Thread.Sleep(2000);
// _flow.EndRetrieve(retrieveResult);
// _speechSynthesizer.Speak("A green agent is busy. Please retry your option!"); //TEXT TO SPEEECH!
// SpeakMenuOptions();
// toneController.ToneReceived += toneController_ToneReceived;
catch (RealTimeException rtex)
LogHelper.Log(LogTarget.FileEvent, "IVR Failed retrieving call." + rtex);
,
null);
catch (InvalidOperationException ioex)
LogHelper.Log(LogTarget.FileEvent, "IVR Failed retrieving call."+ ioex);
添加上述代码后,我可以正常工作了。
谢谢。
【讨论】:
以上是关于UCMA 如何在遇忙信号和终止信号之前检测呼叫响铃持续时间并转移呼叫?的主要内容,如果未能解决你的问题,请参考以下文章