if ((($tipo == 1) or ( $tipo == 2)) && !($getAgt || $getClass || $getItem)) {
$query = "DROP TABLE IF EXISTS tmp_restricao_ramal$org_id;
CREATE TEMPORARY TABLE tmp_restricao_ramal AS
CREATE TEMPORARY TABLE tmp_restricao_ramal$org_id AS
SELECT DISTINCT x.nome FROM pbx_grupo_audio_ramal x, pbx_grupo_usuario y WHERE y.gp_id = x.gp_id AND y.user_id = '{$idUser}' and x.org_id = y.org_id and x.org_id = $org_id;
CREATE INDEX \"tmpRestricaoRamalNome\" on tmp_restricao_ramal$org_id(nome);\n\n";
$query .= "DROP TABLE IF EXISTS tmp_restricao_sigame$org_id;