<?php
class voip_innovations {
private $login = "spbx";
// "spherepbx";
private $secret = "WelcomeSPBX2015";
private $ubF;
// Create the SoapClient instance
// $url = "http://dev.voipinnovations.com/VOIP/Services/APIService.asmx?wsdl";
// $client = new SoapClient($url, array("trace" => 1));
private $url;
private $soapURL;
// $client = new SoapClient(null, array("location" => $url, "uri" => "http://tempuri.org/", "trace" => 1, 'soap_version'=>'SOAP_1_2','use' => SOAP_LITERAL, 'style' => SOAP_DOCUMENT));
private $client;
// var_dump($client->__getFunctions());
// Call wsdl function
private $params;
// = array("login" => "ubixtech", "secret" => "WelcomeUBT2015");
// $result = $client->__soapCall("auditDIDs", $params);//,array("soapaction" => "http://tempuri.org/auditDIDs"));
private $result;
// = $client->auditDIDs ( $params ); //__soapCall("auditDIDs", $params);//,array("soapaction" => "http://tempuri.org/auditDIDs"));
// echo "[" . print_r($params) . "]\n";
// echo "<pre>".print_r($client->__getLastRequest()) . "</pre>\n";
// echo "<pre>".print_r($result->auditDIDsResult->DIDS->DID, true)."</pre>";
// print_r($result->auditDIDsResult->DIDs->DID);
// print json_encode($result);
// print "[$result]";
public function __construct($_data) {
$this->ubF = &$_data;
// Set API URL
$this->url = "https://backoffice.voipinnovations.com/Services/APIService.asmx";
$this->soapURL = "https://backoffice.voipinnovations.com/Services/APIService.asmx?wsdl";
// $this->soapURL = "http://dev.voipinnovations.com/VOIP/Services/APIService.asmx?wsdl";
// Setup Client
$this->client = new SoapClient ( $this->soapURL
/*array (
"location" => $this->url,
"uri" => "http://tempuri.org/",
"trace" => 1
)
*/
);
}
public function getDIDs($state, $npa, $nxx, $t38, $cnam, $sms) {
$params = array (
"login" => $this->login,
"secret" => $this->secret,
'state' => $state,
'lata' => '',
'rateCenter' => '',
'npa' => $npa,
'nxx' => $nxx,
'tier' => '',
't38' => $t38,
'cnam' => $cnam,
'sms' => $sms,
'Network' => ''
);
$result = $this->client->getDIDs ( $params );
return ($result);
// $ubF->json_return ( 0, json_encode ( $result ) );
}
public function auditDIDs() {
$params = array (
"login" => $this->login,
"secret" => $this->secret
);
$result = $this->client->auditDIDs ( $params );
return ($result);
}
public function GetDIDGroups() {
$params = array (
"login" => $this->login,
"secret" => $this->secret
);
$result = $this->client->GetDIDGroups ( $params );
return ($result);
}
function uhm() {
$i = 0;
foreach ( $result->auditDIDsResult->DIDs->DID as $key ) {
$cN = "";
$cV = "";
foreach ( $key as $s_key => $s_val ) {
if ($s_val != "") {
$cN .= "," . $s_key;
/*
* if (is_int($s_val))
* $cV .= "," . $s_val;
* else
*/
$cV .= ",'" . $data ['voip_db']->real_escape_string ( $s_val ) . "'";
}
}
$query = "REPLACE INTO did_list (" . substr ( $cN, 1 ) . ") VALUES(" . substr ( $cV, 1 ) . ")";
$res = $data ['voip_db']->query ( $query );
print "[$res][" . $i ++ . "][$query]\n";
}
}
}
?>