public CancelNotRequiredCallLegs ( CallCancelCause cancelCause ) : void | ||
cancelCause | CallCancelCause | |
리턴 | void |
public void CancelNotRequiredCallLegs(CallCancelCause cancelCause)
{
try
{
m_commandCancelled = true;
FireProxyLogEvent(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "Cancelling all call legs for ForkCall app.", m_username));
// Cancel all forwarded call legs.
if (m_switchCalls.Count > 0)
{
ISIPClientUserAgent[] inProgressCalls = (from ua in m_switchCalls where !ua.IsUACAnswered select ua).ToArray();
for (int index = 0; index < inProgressCalls.Length; index++)
{
ISIPClientUserAgent uac = inProgressCalls[index];
uac.Cancel();
}
}
// Signal any delayed calls that they are no longer required.
foreach (SIPCallDescriptor callDescriptor in m_delayedCalls)
{
callDescriptor.DelayMRE.Set();
}
CallLegCompleted();
}
catch (Exception excp)
{
logger.Error("Exception ForkCall CancelAllCallLegs. " + excp);
}
}
private SIPDialogue Dial( ForkCall call, string data, int ringTimeout, int answeredCallLimit, SIPRequest clientRequest, List <string> customHeaders) { SIPDialogue answeredDialogue = null; ManualResetEvent waitForCallCompleted = new ManualResetEvent(false); //call.CallProgress += (s, r, h, t, b) => { Log("Progress response of " + s + " received on CallBack Dial" + "."); }; call.CallProgress += CallProgress; call.CallFailed += (s, r, h) => { waitForCallCompleted.Set(); }; call.CallAnswered += (s, r, toTag, h, t, b, d, transferMode) => { answeredDialogue = d; waitForCallCompleted.Set(); }; try { Queue <List <SIPCallDescriptor> > callsQueue = m_dialStringParser.ParseDialString(DialPlanContextsEnum.Script, clientRequest, data, customHeaders, null, null, null, null, null, null, null, CustomerServiceLevels.None); call.Start(callsQueue); // Wait for an answer. ringTimeout = (ringTimeout > MAXCALLBACK_RINGTIME_SECONDS || ringTimeout <= 0) ? MAXCALLBACK_RINGTIME_SECONDS : ringTimeout; logger.Debug("Set callback cancel timeout to " + ringTimeout + " seconds."); if (!waitForCallCompleted.WaitOne(ringTimeout * 1000, false)) { call.CancelNotRequiredCallLegs(CallCancelCause.TimedOut); } logger.Debug("Callback dial returning has dialogue ? " + (answeredDialogue == null) + "."); return(answeredDialogue); } catch (Exception excp) { logger.Error("Exception CallbackApp Dial. " + excp); return(null); } }