Example #1
0
 }
 if (in_array($model["username"], $chan->sections())) {
     __invalid_entry($model, "username", "Duplicate Username");
 }
 $chan->add($model["username"], "authname", $model["username"]);
 $chan->add($model["username"], "secret", $model["password"]);
 $chan->add($model["username"], "host", "dynamic");
 $chan->add($model["username"], "disallow", "all");
 $chan->add($model["username"], "allow", "g729,g723");
 $chan->add($model["username"], "mac", $model["mac"]);
 $sip = new Ini();
 $sip->load($g_sip);
 $hosts = array();
 foreach ($sip->sections() as $host) {
     if ($sip->get($host, "context") == $old_user) {
         $sip->deleteSection($host);
     } else {
         $hosts[] = $host;
     }
 }
 foreach ($model["switch"] as $i => $switch) {
     if (in_array($switch["host"], $hosts)) {
         __invalid_entry($model, "switch[{$i}][host]", "Duplicate Switch Host");
     } else {
         $hosts[] = $switch["host"];
     }
     $sip->add($switch["host"], "type", "friend");
     $sip->add($switch["host"], "host", $switch["host"]);
     $sip->add($switch["host"], "context", $model["username"]);
     $sip->add($switch["host"], "call-limit", $switch["call-limit"]);
 }
Example #2
0
         if ($host != "general") {
             $ini->deleteSection($host);
         }
     }
     $ini->dump($g_sip);
     file_put_contents($g_ext_ael, "");
     file_put_contents($g_ext_usr, "");
     reload_all($g_vpn);
 } else {
     $mac = valid_mac($_GET["del"]);
     if ($mac !== false) {
         $ini = new Ini();
         $ini->load($g_chan_sync);
         foreach ($ini->sections() as $user) {
             if ($ini->get($user, "mac") == $mac) {
                 $ini->deleteSection($user);
                 $ini->dump($g_chan_sync);
                 $target_user = $user;
                 break;
             }
         }
         if (isset($target_user)) {
             $ini->load($g_sip);
             foreach ($ini->sections() as $host) {
                 if ($ini->get($host, "context") == $target_user) {
                     $ini->deleteSection($host);
                 }
             }
             $ini->dump($g_sip);
         }
         if (isset($target_user)) {