use Elastic\FreePBX\Manager\Entity\SIP; use Elastic\FreePBX\Utils\PrintPre; $c = new CurlCore(); $curl = $c->getCurl(); $lf = new LoginForm(); $le = new Login(); $le->ipaddr = "192.168.56.101"; $le->username = "******"; $le->password = "******"; $lf->setEntity($le); $sf = new SIPExtensionForm(); $se = new SIPExtension(); $se->action = 'edit'; $se->extDisplay = 2016; $sf->setEntity($se); $sf->setLogin($le); //login curl $data = $lf->getPostData(); $url = $lf->getURL(); $curl->get($url); $curl->post($url, $data); //second execution for adding new sip extension $d2 = $sf->getSIPData(); $u2 = $sf->getUpdateURL(); $curl->get($u2, $d2); $dom = HtmlDomParser::str_get_html($curl->response); $nm = $dom->find('input[name=name]'); $name = $nm[0]->attr['value']; $spname = $dom->find('input[name=sipname]'); $extension = $spname[0]->attr['value']; $sec = $dom->find('input[name=devinfo_secret]');
public function delete($id) { $se = new SIPExtension(); $se->type = 'setup'; $se->action = 'del'; $se->display = 'extensions'; $se->extDisplay = $id; //initialize sip extension form executor $sf = new SIPExtensionForm(); $sf->setEntity($se); $sf->setLogin($this->login); //do login to elastic $this->initLogin(); //execution for update sip extension $d1 = $sf->getSIPData(); $u1 = $sf->getDeleteURL(); $this->curl->get($u1, $d1); }