示例#1
0
 /** Reserve a DID
  */
 function reserve()
 {
     require_once PATH_MODULES . "voip_did_plugin/voip_did_plugin.inc.php";
     $plugin = new voip_did_plugin();
     return $plugin->reserve($this->id, $this->did);
 }
示例#2
0
	/** 
	 * Reserve a DID
	 *
	 * sub ReserveDIDByNumber ($UserID,$Password,$DIDNumber)
	 */
    function reserve() {
    	return true;
    	
		$this->config();

    	# include the soap classes
    	include_once(PATH_INCLUDES."nusoap/lib/nusoap.php");

		$bOk = false;
		$client = new soapclient("http://didx.org/cgi-bin/WebReserveDIDServer.cgi", false);

		$err = $client->getError();
		if ($err) {
			global $C_debug;
			$C_debug->error('DIDX.php', 'reserve', 'Could not acquire information from DIDx.org');
		} else {
			$params = array(
				'UserID' 		=> $this->user,
				'Password' 		=> $this->pass,
				'DIDNumber' 	=> $this->did
			);
			$result = $client->call('ReserveDIDByNumber', $params, 'http://didx.org/Reserve');
			if (is_array($result)) {
				while ((list($k,$v)=each($result)) !== false) {
					if (is_array($v)) {
						if ($v[0] < 0) {
							# error occured, let's log it!
							$this->log_message('reserve', 'SOAP Response: '.$this->codes[$v[0]]);
						} else {
							$bOk = true;
						}
					}
				}
			} else {
				if ($result < 0) {
					# error occured, let's log it!
					$this->log_message('reserve', 'SOAP Response: '.$this->codes[$result]);
				} else {
					$bOk = true;
				}
			}
		}		
		if ($bOk == false) {
			$this->log_message('reserve', $this->did.':SOAP Request for reserve DID failed:'.$result);
			return false;
		}	
    	require_once(PATH_MODULES."voip_did_plugin/voip_did_plugin.inc.php");
		$plugin = new voip_did_plugin;
		
		return $plugin->reserve($this->id, $this->did);
    }