--- Agentes.class.php	2009-03-18 18:08:06.000000000 -0500
+++ Agentes.class.php.new	2009-05-13 10:21:43.000000000 -0500
@@ -52,11 +52,13 @@
 
         if (is_null($id)) {
             $where = "";
+            $qorder="ORDER BY `agent`.`number` ASC";
+
         } else {
             $where = " and number=$id";
         }
-
-        $sQuery = "SELECT * FROM agent WHERE estatus='A' ".$where;
+//        $sQuery = "SELECT * FROM agent WHERE estatus='A' ".$where;
+        $sQuery = "SELECT * FROM agent WHERE estatus='A' ".$where.$qorder;
 
         $arr_result = array();
         $arr_result =& $pDB->fetchTable($sQuery, true);
@@ -392,7 +394,8 @@
             if (!$astman->connect($ip_asterisk, $user_asterisk , $pass_asterisk)) {
                 $resultado = "Error when connecting to Asterisk Manager";
             } else {
-                $strReload = $astman->Command(" reload");
+                // $strReload = $astman->Command(" reload");
+                $strReload = $astman->Command(" module reload chan_agent.so");
                 $astman->disconnect();
             }
         }
@@ -625,4 +628,4 @@
 }
 
 
-?>
\ No hay ningún carácter de nueva línea al final del fichero
+?>
