$sql .= "and hunt_group_uuid = '{$hunt_group_uuid}'";
 $db->exec(check_sql($sql));
 unset($sql);
 //update the dialplan entry
 require_once "resources/classes/dialplan.php";
 $dialplan = new dialplan();
 $dialplan->domain_uuid = $_SESSION['domain_uuid'];
 $dialplan->app_uuid = $app_uuid;
 $dialplan->dialplan_uuid = $dialplan_uuid;
 $dialplan->dialplan_name = $hunt_group_name;
 //$dialplan->dialplan_continue = $dialplan_continue;
 //$dialplan->dialplan_order = '330';
 $dialplan->dialplan_context = $_SESSION['context'];
 $dialplan->dialplan_enabled = $hunt_group_enabled;
 $dialplan->dialplan_description = $hunt_group_description;
 $dialplan->dialplan_update();
 unset($dialplan);
 //update the condition
 $sql = "update v_dialplan_details set ";
 $sql .= "dialplan_detail_data = '^" . $hunt_group_extension . "\$' ";
 $sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
 $sql .= "and dialplan_detail_tag = 'condition' ";
 $sql .= "and dialplan_detail_type = 'destination_number' ";
 $sql .= "and dialplan_uuid = '{$dialplan_uuid}' ";
 $sql .= "and dialplan_detail_group = '1' ";
 $db->query($sql);
 unset($sql);
 //update the action
 $sql = "update v_dialplan_details set ";
 $sql .= "dialplan_detail_data = 'v_huntgroup_" . $_SESSION['domain_name'] . "_" . $hunt_group_extension . ".lua', ";
 $sql .= "dialplan_detail_type = 'lua' ";