public Start ( List |
||
callDescriptors | List |
|
Résultat | void |
public void Start(List<SIPCallDescriptor> callDescriptors)
{
if (callDescriptors != null && callDescriptors.Count > 0)
{
for (int index = 0; index < callDescriptors.Count; index++)
{
int availableThreads = 0;
int ioCompletionThreadsAvailable = 0;
ThreadPool.GetAvailableThreads(out availableThreads, out ioCompletionThreadsAvailable);
if (availableThreads <= 0)
{
logger.Warn("The ThreadPool had no threads available in the pool to start a ForkCall leg, task will be queued.");
}
SIPCallDescriptor callDescriptor = callDescriptors[index];
FireProxyLogEvent(new SIPMonitorConsoleEvent(SIPMonitorServerTypesEnum.AppServer, SIPMonitorEventTypesEnum.DialPlan, "ForkCall commencing call leg to " + callDescriptor.Uri + ".", m_username));
ThreadPool.QueueUserWorkItem(delegate { StartNewCallAsync(callDescriptor); });
}
}
else
{
CallLegCompleted();
}
}
ForkCall::Start ( Queue |
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); } }