diff --git a/admin/funcoes.php b/admin/funcoes.php index 72b5f600..43addb51 100644 --- a/admin/funcoes.php +++ b/admin/funcoes.php @@ -1214,7 +1214,7 @@ function gera_arquivos($dbcon, $tipo, $reload = 1, $reloadUra = 1) $arq = $caminho_producao . "sip_general.conf"; $escreve = fopen($arq, 'w'); //externip='$externip', externhost='$externhost', localnet='$localnet', - $query = "SELECT nome, context, callerid, allowguest, allowoverlap, allowtransfer, + $query = sprintf("SELECT nome, context, callerid, allowguest, allowoverlap, allowtransfer, realm, bindport, bindaddr, srvlookup, pedantic, tos_sip, tos_audio, tos_video, maxexpiry, minexpiry, notifymimetype, buggymwi, vmexten, mohinterpret, mohsuggest, language, relaxdtmf, trustrpid, sendrpid, @@ -1226,7 +1226,7 @@ function gera_arquivos($dbcon, $tipo, $reload = 1, $reloadUra = 1) localnet, nat, canreinvite, directrtpsetup, rtcachefriends, rtsavesysname, rtupdate, rtautoclear, ignoreregexpire, domain, autodomain, allowexternaldomains, fromdomain, jbenable, jbforce, jbmaxsize, - jbresyncthreshold, jbimpl, jblog, auth FROM pbx_sip_general limit 1"; + jbresyncthreshold, jbimpl, jblog, auth FROM pbx_sip_general where org_id = (select id from pbx_organizacao where master = '%s')", GetOrganizacaoMaster()); $result = pg_query($dbcon, $query); while ($dados = pg_fetch_array($result)) { $x++; diff --git a/include/util/funcoesApl.php b/include/util/funcoesApl.php index 8c8b6acc..87f43909 100755 --- a/include/util/funcoesApl.php +++ b/include/util/funcoesApl.php @@ -1351,6 +1351,17 @@ function GetOrganizacao() return $_SESSION['SSEmpresaPadrao']; } +function GetOrganizacaoMaster(){ + global $dbcon; + if (empty($_SESSION['SSEmpresaMaster']) && IsUserConnect()) { + $query = "select id from pbx_organizacao where master = '1'"; + $result = pg_query($dbcon, $query); + $res = pg_fetch_assoc($result); + $_SESSION['SSEmpresaMaster'] = $res['id']; + } + return $_SESSION['SSEmpresaMaster']; +} + function GetAllOrganizacao() { global $dbcon;