public static DialedNumberTester TestDialNumber(Extension originatingCall, string dialNumber, string pin, DateTime?currentTime)
        {
            DialedNumberTester tester = new DialedNumberTester(originatingCall, dialNumber, pin, currentTime);

            ADialPlan[] plans = new ADialPlan[0];
            lock (_plans)
            {
                plans = _plans.ToArray();
            }
            bool exit = false;

            while (!exit)
            {
                bool startFromTop = false;
                foreach (ADialPlan plan in plans)
                {
                    //build code here to test dialplans
                    //plan.RunDialPlanWithConditions(tester, out exit, out startFromTop);
                    if (exit || startFromTop)
                    {
                        break;
                    }
                }
            }
            return(tester);
        }
 public RegisteredConfigurationRegenerationCall(Type dialPlanType, ADialPlan.sUpdateConfigurationsCall[] configurationCall,IEvent[] triggerEvents)
 {
     _dialPlanType = dialPlanType.FullName;
     _configurationCalls = configurationCall;
     _triggerEvents = null;
     if (triggerEvents != null)
     {
         _triggerEvents = new object[triggerEvents.Length];
         for (int x = 0; x < triggerEvents.Length; x++)
             _triggerEvents[x] = (object)triggerEvents[x];
     }
 }
 public static void UnDeployPlan(ADialPlan plan)
 {
     lock (_plans)
     {
         _controller.DialplanUnDeployed(plan);
         _plans.Remove(plan);
         _plans.Sort();
         List <string> planNames = new List <string>();
         foreach (ADialPlan p in _plans)
         {
             planNames.Add(p.GetType().FullName);
         }
         Settings.Current[_MODULE_NAME, _PLANS_LIST_ID] = planNames;
         List <string> contexts = plan.ContextsUsed;
         CoreGenerator.RegenerateContexts(contexts.ToArray());
     }
 }
 public static void DeployDialPlan(ADialPlan plan)
 {
     lock (_plans){
         if (!_plans.Contains(plan))
         {
             plan.LoadInitialConfiguration();
             _plans.Add(plan);
             _plans.Sort();
             List <string> planNames = new List <string>();
             foreach (ADialPlan p in _plans)
             {
                 planNames.Add(p.GetType().FullName);
             }
             Settings.Current[_MODULE_NAME, _PLANS_LIST_ID] = planNames;
             _controller.DialplanDeployed(plan, _plans.IndexOf(plan));
             List <string> contexts = plan.ContextsUsed;
             CoreGenerator.RegenerateContexts(contexts.ToArray());
         }
     }
 }
 public static DialedNumberTester TestDialNumber(Extension originatingCall, string dialNumber, string pin, DateTime? currentTime)
 {
     DialedNumberTester tester = new DialedNumberTester(originatingCall, dialNumber, pin, currentTime);
     ADialPlan[] plans = new ADialPlan[0];
     lock (_plans)
     {
         plans = _plans.ToArray();
     }
     bool exit=false;
     while(!exit){
         bool startFromTop=false;
         foreach (ADialPlan plan in plans)
         {
             //build code here to test dialplans
             //plan.RunDialPlanWithConditions(tester, out exit, out startFromTop);
             if (exit || startFromTop)
                 break;
         }
     }
     return tester;
 }
Пример #6
0
 public int CompareTo(object obj)
 {
     if (obj.GetType().IsSubclassOf(typeof(ADialPlan)))
     {
         ADialPlan adp = (ADialPlan)obj;
         if (((int)adp.Priority).CompareTo((int)Priority) == 0)
         {
             if (((int)adp.SubPriority).CompareTo((int)SubPriority) == 0)
             {
                 return(adp.Name.CompareTo(Name));
             }
             else
             {
                 return(((int)adp.SubPriority).CompareTo((int)SubPriority));
             }
         }
         else
         {
             return(((int)adp.Priority).CompareTo((int)Priority));
         }
     }
     throw new Exception("Unable to compare an object of the type DialPlan with a non-DialPlan object.");
 }
 public static void RegisterChangeCall(Type dialPlanType, ADialPlan.sUpdateConfigurationsCall[] configurationCalls, IEvent[] triggerEvents)
 {
     Monitor.Enter(_lock);
     ArrayList changes = _Changes;
     if (changes == null)
         changes = new ArrayList();
     bool add = true;
     RegisteredConfigurationRegenerationCall call = new RegisteredConfigurationRegenerationCall(dialPlanType, configurationCalls, triggerEvents);
     foreach (object obj in changes)
     {
         if (obj is RegisteredConfigurationRegenerationCall)
         {
             if (call.Equals(obj))
             {
                 add = false;
                 break;
             }
         }
     }
     if (add)
         changes.Add(call);
     _Changes = changes;
     Monitor.Exit(_lock);
 }
 public RegisteredConfigurationRegenerationCall(Type dialPlanType, ADialPlan.sUpdateConfigurationsCall configurationCall, IEvent[] triggerEvents)
     : this(dialPlanType,new ADialPlan.sUpdateConfigurationsCall[]{configurationCall},triggerEvents)
 {
 }
 public RegisteredExtensionRegenerationCall(string extensionNumber,string domain,Type dialPlanType, ADialPlan.sUpdateConfigurationsCall[] configurationCall,IEvent[] triggerEvents)
     : base(dialPlanType,configurationCall,triggerEvents)
 {
     _extensionNumber=extensionNumber;
     _domain=domain;
 }
 public RegisteredExtensionRegenerationCall(string extensionNumber,string domain,Type dialPlanType, ADialPlan.sUpdateConfigurationsCall configurationCall, IEvent[] triggerEvents)
     : this(extensionNumber,domain,dialPlanType,new ADialPlan.sUpdateConfigurationsCall[]{configurationCall},triggerEvents)
 {
 }
 public static void DeployDialPlan(ADialPlan plan)
 {
     lock(_plans){
         if (!_plans.Contains(plan))
         {
             plan.LoadInitialConfiguration();
             _plans.Add(plan);
             _plans.Sort();
             List<string> planNames = new List<string>();
             foreach (ADialPlan p in _plans)
                 planNames.Add(p.GetType().FullName);
             Settings.Current[_MODULE_NAME, _PLANS_LIST_ID] = planNames;
             _controller.DialplanDeployed(plan, _plans.IndexOf(plan));
             List<string> contexts = plan.ContextsUsed;
             CoreGenerator.RegenerateContexts(contexts.ToArray());
         }
     }
 }
 public static void UnDeployPlan(ADialPlan plan)
 {
     lock (_plans)
     {
         _controller.DialplanUnDeployed(plan);
         _plans.Remove(plan);
         _plans.Sort();
         List<string> planNames = new List<string>();
         foreach (ADialPlan p in _plans)
             planNames.Add(p.GetType().FullName);
         Settings.Current[_MODULE_NAME, _PLANS_LIST_ID] = planNames;
         List<string> contexts = plan.ContextsUsed;
         CoreGenerator.RegenerateContexts(contexts.ToArray());
     }
 }
 public static void UpdateDialPlan(Type type,ADialPlan.sUpdateConfigurationsCall call)
 {
     lock(_plans){
         for (int x = 0; x < _plans.Count; x++)
         {
             if (_plans[x].GetType().FullName == type.FullName)
             {
                 _plans[x].UpdateConfiguration(call);
                 _controller.DialplanUpdated(_plans[x]);
                 List<string> contexts = _plans[x].ContextsUsed;
                 CoreGenerator.RegenerateContexts(contexts.ToArray());
                 break;
             }
         }
     }
 }
 public static void RegisterChangeCall(Type dialPlanType, ADialPlan.sUpdateConfigurationsCall configurationCall, IEvent[] triggerEvents)
 {
     RegisterChangeCall(dialPlanType, new ADialPlan.sUpdateConfigurationsCall[] { configurationCall }, triggerEvents);
 }
 public static void RegisterExtensionChangeCall(string extensionNumber, string domain, Type dialPlanType, ADialPlan.sUpdateConfigurationsCall configurationCall, IEvent[] triggerEvents)
 {
     RegisterExtensionChangeCall(extensionNumber, domain, dialPlanType, new ADialPlan.sUpdateConfigurationsCall[] { configurationCall }, triggerEvents);
 }