public static void GenerateDialPlan(DesignerCanvas d)
        {

            
                StartActivity s = null;
                Connection position = null;
                DialPlanList.Clear();

                IEnumerable<Connection> connections = d.Children.OfType<Connection>();
                IEnumerable<DesignerItem> designerItems = d.Children.OfType<DesignerItem>();

                //Busco Actividad inicial para arrancar por ella
                //Obtengo contexto y DNIS de ella
                foreach (Connection item in connections)
                {
                    if (item.Source.ParentDesignerItem.Activity.AppName == "StartActivity")
                    {
                        position = item;
                        s = (StartActivity)item.Source.ParentDesignerItem.Activity;
                        DNIS = s.exten;
                        Context = s.context;
                        DialPlanList.Add(item.Source.ParentDesignerItem.Activity);
                    }
                }


                BuildPlanLines(position, d);

          
            //pongo used en falso para permitir una nueva recorrida de 0
            foreach (DesignerItem item in designerItems)
            {
                Connection c = new Connection(null,null);

                if (item.GetType() != c.GetType())
                item.Activity.Used = false;
            }

            Dialplan = "";
            foreach (var item in DialPlanList)
            {
                if (item.prio != 0 && item.AppName != "include")
                {
                    Dialplan = Dialplan + "exten=> " + DNIS + "," + item.prio + "," + item.ToString() + "\n";
                }
                else if (item.AppName == "include")
                {
                    Dialplan = Dialplan + item.ToString() + "\n";
                }

            }
         

        }