public function delete($id) { $st = new SIPTrunk(); $st->display = 'extensions'; $st->action = "deltrunk"; $st->extDisplay = $id; $pd = new SIPTrunkPeerDetails(); $st->setPeerDetails($pd); $rs = new RegisterString(); $st->setRegisterString($rs); $stf = new SIPTrunkForm(); $stf->setEntity($st); $stf->setLogin($this->login); $this->initLogin(); $dadd = $stf->getData(); $uadd = $stf->getDelURL(); $this->curl->get($uadd, $dadd); }
private function getPeerDetails($login, $id) { $st = new SIPTrunk(); $st->extDisplay = $id; $stf = new SIPTrunkForm(); $stf->setEntity($st); $stf->setLogin($login); $this->initLogin($login); $this->curl->get($stf->getListURL()); $dom = HtmlDomParser::str_get_html($this->curl->response); $text = ""; foreach ($dom->find('textarea[name=peerdetails]') as $value) { $text .= $value->innertext; } preg_match_all('/(?P<name>\\w+)=(?P<value>[\\w\\.*\\,*]+)/', $text, $matches); $ds = []; foreach ($matches['value'] as $k => $v) { $ds["value" . $k] = $v; } $d = array_combine(array('fromuser', 'username', 'authuser', 'secret', 'host', 'fromdomain', 'context', 'type', 'nat', 'canreinvite', 'insecure', 'qualify'), $ds); return $d; }