Exemplo n.º 1
0
$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]');
$secret = $sec[0]->attr['value'];
PrintPre::out();
//echo count();
Exemplo n.º 2
0
 public function update(SIP $sip)
 {
     //initialize sip extension core
     $se = new SIPExtension();
     $se->action = 'edit';
     $se->extDisplay = $sip->id;
     $se->extension = $sip->extension;
     $se->SIPName = $sip->extension;
     $se->name = $sip->name;
     $dv = new DevInfo();
     $dv->secret = $sip->secret;
     $se->setDevInfo($dv);
     $ad = new AssignDIDAndCID();
     $se->setAssignDidAndCid($ad);
     //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->getUpdateURL();
     $this->curl->post($u1, $d1);
 }