1)and(count($disallow)>$g)){ $disallow2.=','; } } } $allow = $_POST["allow"]; $allow2=""; $g=0; if(isset($allow)) { foreach($allow as $al) { $g++; $allow2.=$al; if ((count($allow)>1)and(count($allow)>$g)){ $allow2.=','; } } } $context= trim($_POST["context"]); $callerid= trim($_POST["callerid"]); $allowguest= trim($_POST["allowguest"]); $allowoverlap= trim($_POST["allowoverlap"]); $allowtransfer= trim($_POST["allowtransfer"]); $realm= trim($_POST["realm"]); $bindport= trim($_POST["bindport"]); $bindaddr= trim($_POST["bindaddr"]); $srvlookup= trim($_POST["srvlookup"]); $pedantic = trim($_POST["pedantic"]); $tos_sip= trim($_POST["tos_sip"]); $tos_audio= trim($_POST["tos_audio"]); $tos_video= trim($_POST["tos_video"]); $maxexpiry= trim($_POST["maxexpiry"]); $minexpiry= trim($_POST["minexpiry"]); $defaultexpiry = trim($_POST["defaultexpiry"]); $t1min= trim($_POST["t1min"]); $notifymimetype= trim($_POST["notifymimetype"]); $checkmwi= trim($_POST["checkmwi"]); $buggymwi= trim($_POST["buggymwi"]); $vmexten= trim($_POST["vmexten"]); $mohinterpret = trim($_POST["mohinterpret"]); $mohsuggest= trim($_POST["mohsuggest"]); $language= trim($_POST["language"]); $relaxdtmf= trim($_POST["relaxdtmf"]); $trustrpid= trim($_POST["trustrpid"]); $sendrpid= trim($_POST["sendrpid"]); $progressinband= trim($_POST["progressinband"]); $useragent= trim($_POST["useragent"]); $promiscredir= trim($_POST["promiscredir"]); $userqphone= trim($_POST["userqphone"]); $dtmfmode= trim($_POST["dtmfmode"]); $compactheaders= trim($_POST["compactheaders"]); $videosupport= trim($_POST["videosupport"]); $maxcallbitrate= trim($_POST["maxcallbitrate"]); $alwaysauthreject= trim($_POST["alwaysauthreject"]); $g726nonstandard= trim($_POST["g726nonstandard"]); $matchexterniplocally= trim($_POST["matchexterniplocally"]); $regcontext= trim($_POST["regcontext"]); $rtptimeout= trim($_POST["rtptimeout"]); $rtpholdtimeout= trim($_POST["rtpholdtimeout"]); $rtpkeepalive= trim($_POST["rtpkeepalive"]); $sipdebug= trim($_POST["sipdebug"]); $recordhistory= trim($_POST["recordhistory"]); $dumphistory= trim($_POST["dumphistory"]); $allowsubscribe = trim($_POST["allowsubscribe"]); $subscribecontext= trim($_POST["subscribecontext"]); $notifyringing= trim($_POST["notifyringing"]); $notifyhold= trim($_POST["notifyhold"]); $limitonpeers= trim($_POST["limitonpeers"]); $t38pt_udptl= trim($_POST["t38pt_udptl"]); $externip= trim($_POST["externip"]); $externhost= trim($_POST["externhost"]); $externrefresh= trim($_POST["externrefresh"]); $localnet= trim($_POST["localnet"]); $nat= trim($_POST["nat"]); $canreinvite= trim($_POST["canreinvite"]); $directrtpsetup= trim($_POST["directrtpsetup"]); $rtcachefriends= trim($_POST["rtcachefriends"]); $rtsavesysname= trim($_POST["rtsavesysname"]); $rtupdate= trim($_POST["rtupdate"]); $rtautoclear = trim($_POST["rtautoclear"]); $ignoreregexpire= trim($_POST["ignoreregexpire"]); $domain= trim($_POST["domain"]); $autodomain= trim($_POST["autodomain"]); $allowexternaldomains = trim($_POST["allowexternaldomains"]); $fromdomain= trim($_POST["fromdomain"]); $jbenable= trim($_POST["jbenable"]); $jbforce= trim($_POST["jbforce"]); $jbmaxsize= trim($_POST["jbmaxsize"]); $jbresyncthreshold= trim($_POST["jbresyncthreshold"]); $jbimpl= trim($_POST["jbimpl"]); $jblog= trim($_POST["jblog"]); $auth= trim($_POST["auth"]); $query = "UPDATE pbx_sip_general SET disallow='$disallow2', allow='$allow2', context='$context', callerid='$callerid', allowguest='$allowguest', allowoverlap='$allowoverlap', allowtransfer='$allowtransfer', realm='$realm', bindport='$bindport', bindaddr='$bindaddr', srvlookup='$srvlookup', pedantic='$pedantic', tos_sip='$tos_sip', tos_audio='$tos_audio', tos_video='$tos_video', maxexpiry='$maxexpiry', minexpiry='$minexpiry', defaultexpiry='$defaultexpiry', t1min='$t1min', notifymimetype='$notifymimetype', checkmwi='$checkmwi', buggymwi='$buggymwi', vmexten='$vmexten', mohinterpret='$mohinterpret', mohsuggest='$mohsuggest', language='$language', relaxdtmf='$relaxdtmf', trustrpid='$trustrpid', sendrpid='$sendrpid', progressinband='$progressinband', useragent='$useragent', promiscredir='$promiscredir', userqphone='$userqphone', dtmfmode='$dtmfmode', compactheaders='$compactheaders', videosupport='$videosupport', maxcallbitrate='$maxcallbitrate', alwaysauthreject='$alwaysauthreject', g726nonstandard='$g726nonstandard', matchexterniplocally='$matchexterniplocally', regcontext='$regcontext', rtptimeout='$rtptimeout', rtpholdtimeout='$rtpholdtimeout', rtpkeepalive='$rtpkeepalive', sipdebug='$sipdebug', recordhistory='$recordhistory', dumphistory='$dumphistory', allowsubscribe='$allowsubscribe', subscribecontext='$subscribecontext', notifyringing='$notifyringing', notifyhold='$notifyhold', limitonpeers='$limitonpeers', t38pt_udptl='$t38pt_udptl', externip='$externip', externhost='$externhost', externrefresh='$externrefresh', localnet='$localnet', nat='$nat', canreinvite='$canreinvite', directrtpsetup='$directrtpsetup', rtcachefriends='$rtcachefriends', rtsavesysname='$rtsavesysname', rtupdate='$rtupdate', rtautoclear='$rtautoclear', ignoreregexpire='$ignoreregexpire', domain='$domain', autodomain='$autodomain', allowexternaldomains='$allowexternaldomains', fromdomain='$fromdomain', jbenable='$jbenable', jbforce='$jbforce', jbmaxsize='$jbmaxsize', jbresyncthreshold='$jbresyncthreshold', jbimpl='$jbimpl', jblog='$jblog', auth='$auth'"; // $result = pg_query($dbcon, $query); pg_query($dbcon,$query); //faz o backup do arquivo $ano= date("Y"); $mes=date("m"); $dia=date("d"); $hora=date("G"); $min=date("i"); $arq2 = $caminho_back.$ano.$mes.$dia.$hora.$min."_sip.conf"; $lines = file($arq); $escreve = fopen($arq2, 'w'); for ($i = 0; $i < sizeof($lines); $i++){ fwrite($escreve,$lines[$i]); } fclose($escreve); //fim do backup //grava o arquivo novo $escreve = fopen($arq, 'w'); fwrite($escreve,"[general]".chr(13).chr(10)); $query = "SELECT * FROM pbx_sip_general"; $result = pg_query($dbcon, $query); while($dados = pg_fetch_array($result)){ $x++; for ($i=1; pg_num_fields($result)>$i;$i++){ if (trim($dados[pg_field_name($result,$i)])!=''){ fwrite($escreve,pg_field_name($result,$i).'='.$dados[pg_field_name($result,$i)].chr(13).chr(10)); }} } fwrite($escreve,"#include sip_adicional.conf"); fclose($escreve); CommandAsterisk($dbcon,'SIP'); header('ramais.php'); } $query = "SELECT * FROM pbx_sip_general"; $result = pg_query($dbcon, $query); while($dados = pg_fetch_array($result)){?>

CONFIGURAÇÃO GLOBAL DO SIP
Desabilitado:
> gsm > g726 > g729 > ilbc > ulaw > alaw > all
Habilitado:
> gsm > g726 > g729 > ilbc > ulaw > alaw > all
Identificador:
" size="10" maxlength="20">
ACEITA CONVIDADOS:
> SIM > NÃO
Context:
" size="10" maxlength="20">
realm:
" size="10" maxlength="20">
allowoverlap:
> SIM > NÃO
allowtransfer:
> SIM > NÃO
BIND ADDR:
">
BIND PORT:
">
srvlookup:
> SIM > NÃO
pedantic:
> SIM > NÃO
tos_sip:
">
tos_audio:
">
tos_video:
">
maxexpiry:
">
minexpiry:
">
defaultexpiry:
">
t1min:
">
notifymimetype :
">
checkmwi:
">
buggymwi:
SIM NÃO
vmexten:
">
mohinterpret:
">
mohsuggest:
">
language:
">
relaxdtmf:
> SIM > NÃO
trustrpid:
> SIM > NÃO
sendrpid:
> SIM > NÃO
progressinband:
> SIM > NÃO > NUNCA
useragent:
">
promiscredir:
> SIM > NÃO
dtmfmode:
">
videosupport:
> SIM > NÃO
maxcallbitrate:
">
alwaysauthreject:
> SIM > NÃO
g726nonstandard:
SIM NÃO
matchexterniplocally:
> SIM > NÃO
regcontext:
">
rtptimeout:
">
rtpholdtimeout:
">
rtpkeepalive:
">
DEBUG:
> SIM > NÃO
recordhistory:
> SIM > NÃO
dumphistory:
> SIM > NÃO
allowsubscribe:
> SIM > SIM
subscribecontext:
">
notifyringing:
> SIM > NÃO
notifyhold;
> SIM > NÃO
limitonpeers:
> SIM > NÃO
t38pt_udptl:
> SIM > NÃO
externip:
>
externhost:
">
externrefresh:
">
localnet:
">
nat:
> SIM > NÃO > NUNCA > ROTA
canreinvite:
> SIM > NÃO > SEM NAT > UPDATE
directrtpsetup:
> SIM > NÃO
rtcachefriends:
> SIM > NÃO
rtsavesysname:
> SIM > NÃO
rtupdate:
> SIM > NÃO
rtautoclear:
> SIM > NÃO
ignoreregexpire:
> SIM > NÃO
Dominio:
">
autodomain:
> SIM > NÃO
allowexternaldomains:
> SIM > NÃO
fromdomain:
">
jbenable:
> SIM > NÃO
jbforce:
> SIM > NÃO
jbmaxsize:
">
jbresyncthreshold:
">
jbimpl:
> SIM > NÃO
jblog:
> SIM > NÃO
auth:
">
usereqphone:
> SIM > NÃO
compactheaders:
> SIM > NÃO