Created
September 27, 2011 17:37
-
-
Save carcus88/1245706 to your computer and use it in GitHub Desktop.
Broadfax API - A PHP class (cakePHP) for communicating with the BroadFax FAX server API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PEAR HTTP Request class | |
*/ | |
require_once('HTTP/Request.php'); | |
/** | |
* PEAR XML Serializer/Unserializer required | |
*/ | |
require_once('XML/Serializer.php'); | |
require_once('XML/Unserializer.php'); | |
/** | |
* Broadfax API Component | |
* | |
* Class to communicate with the broadfax server using its XML API. The API is run | |
* from the JAVA Tomcat server on the fax server. This class is based on all the | |
* functions defined in the broadfax API documentation. | |
* | |
* @see http://www.broadfax.com/api/doc/Broadfax%20XML%20API.pdf | |
*/ | |
class BroadfaxApiComponent { | |
public $protocol = 'http'; | |
public $server = 'fax01.riccagroup.local'; | |
public $port = '8080'; | |
public $url = '/MDXXML/redirector'; | |
public $user = 'Administrator'; | |
public $pass = ''; | |
/** | |
* HTTP_Request object | |
*/ | |
public $req = null; | |
/** | |
* Serializer object | |
*/ | |
public $serializer = null; | |
/** | |
* Unserializer object | |
*/ | |
public $unserializer = null; | |
public function startup(&$controller) { | |
$this->req =& new HTTP_Request($this->protocol.'://'.$this->server.':'.$this->port.$this->url); | |
$this->req->addHeader("Content-Type", "text/xml"); | |
$this->req->addHeader("Accept", "*/*"); | |
$this->req->setMethod(HTTP_REQUEST_METHOD_POST); | |
// Instantiate a serializer with options | |
$this->serializer = &new XML_Serializer(array ( | |
'addDecl' => TRUE, | |
'encoding' => 'UTF-8', | |
'indent' => ' ', | |
'rootName' => 'MDX', | |
)); | |
// Instantiate an unserializer | |
$this->unserializer = &new XML_Unserializer(); | |
return true; | |
} | |
/** | |
* Call an API function | |
* | |
* @param array $data API XML data represented as an array | |
* @return mixed Boolean false on errror else Array API XML result formtted as an array | |
*/ | |
public function call($data) { | |
$data['UserName'] = $this->user; | |
$data['UserPassword'] = $this->pass; | |
// Serialize the data structure | |
$status = $this->serializer->serialize($data); | |
if (PEAR::isError($status)) { | |
$this->log($status->getMessage()); | |
return false; | |
} | |
$xml = $this->serializer->getSerializedData(); | |
$this->req->addRawPostData($xml, true); | |
$this->req->sendRequest(); | |
$response = $this->req->getResponseBody(); | |
$status = $this->unserializer->unserialize($response); | |
if (PEAR::isError($status)) { | |
$this->log($status->getMessage()); | |
return false; | |
} | |
$ret = $this->unserializer->getUnserializedData(); | |
return $ret; | |
} | |
/** | |
* Call the GetBalance API function | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetBalanceResponse> Start tag for GetBalanceResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <Balance> </Balance> The user's current balance (in US$) | |
* <MinBalance> </MinBalance> The user's minimum balance (in US$) | |
* </GetBalanceResponse> End tag for GetBalanceResponse | |
*/ | |
public function GetBalance() { | |
return $this->call(array('GetBalance' => array())); | |
} | |
/** | |
* Call the EstimateJob API function | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <EstimateJobResponse> Start tag for GetBalanceResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <Balance> </Balance> The user's current balance (in US$) | |
* <MinBalance> </MinBalance> The user's minimum balance (in US$) | |
* <EstimatedPrice> </EstimatedPrice> The estimated cost of sending this job (in US$) | |
* <LackOfMoney> </LackOfMoney> Lack of money in the account to execute the job. If the | |
* value is zero, you have enough money. If it is greater | |
* than zero you don't have enough money in the account | |
* to execute the job. | |
* 0= enough money for this job | |
* </EstimateJobResponse> | |
*/ | |
public function EstimateJob($NumberOfFaxes,$NumberOfEMails) { | |
return $this->call(array('EstimateJob' => array('NumberOfFaxes' => $NumberOfFaxes, | |
'NumberOfEMails' => $NumberOfEMails))); | |
} | |
/** | |
* Call the GetVersion API function | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetVersionResponse> Start tag for GetVersionResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <Version> </Version> The MDX XML version code | |
* </GetVersionResponse> End tag for GetVersionResponse | |
*/ | |
public function GetVersion() { | |
return $this->call(array('GetVersion' => array())); | |
} | |
/** | |
* Call the GetMode API function | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetModeResponse> Start tag for GetModeResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <Mode> </Mode> Usage mode (privileges) | |
* </GetModeResponse> End tag for GetModeResponse | |
*/ | |
public function GetMode() { | |
return $this->call(array('GetMode' => array())); | |
} | |
/** | |
* Call the SendJob API function | |
* | |
* @param array $options Array of SendJob Options | |
* | |
* $options Array structure will match this XML structure | |
* | |
* <JobName> </JobName> Job name | |
* <ApplicationID> </ApplicationID> The application ID. Applications submitting MDX/BF jobs may be assigned an application ID number Optional. Valid pre-assigned numeric value | |
* <Priority> </Priority> Job priority 4 to 10 | |
* <Resolution> </Resolution> Fax resolution Values: fine or standard | |
* <Retries> </Retries> Number of retries for fax, 0=no retries 0 t0 5 | |
* <Prefix> </Prefix> Prefix that will be used in dialing. Applies to all numbers Optional | |
* <Suffix> </Suffix> Suffix that will be used in dialing. Applies to all numbers Optional, values: yes or no | |
* <StartLine> </StartLine> Shows where to start reading the fax list (s) Optional. If 0, the list is limited only by FinishLine | |
* <FinishLine> </FinishLine> Shows where to stop reading the fax list (s) Optional. If 0, the list is limited only by StartLine | |
* <SubAccount> </SubAccount> Additional account classifier for the user (e.g. Department) | |
* <SendLocal> </SendLocal> Send local numbers or not. Default value is "yes" Optional. Values: yes or no | |
* <SendLongDistance> </SendLongDistance> Send Long distance numbers or not. Default value is "yes" Optional. Values: yes or no | |
* <RetainDocuments> </RetainDocuments> Flag that indicates if to retain job"s document after job was completed or to delete them immediately. Default value is "yes;, keep docs Optional, values: yes or no | |
* <RetainRecipentList> </RetainRecipentList> Flag that indicates if to retain job"s recipients list after job was completed or to delete it immediately. Default value is "yes", keep list. Optional, values: yes or no | |
* <SenderEmail> </SenderEmail> Sender email address | |
* <SenderName> </SenderName> Sender name | |
* <SenderLocalCSID> </SenderLocalCSID> Sender Caller Sign ID (CSID) | |
* <ShowFaxHeaderLine> </ShowFaxHeaderLine> Show fax header line flag Values: yes or no | |
* <FaxHeaderLine> </FaxHeaderLine> Custom fax header line Optional, values: string containing custom header line see table 3.1.1.1 | |
* <EmailSubject> </EmailSubject> The subject line for email messages (not fax) | |
* <StartDateTime> </StartDateTime> Start date and time (format MM/DD/YY HH:MM:SS) 12/31/01 16:22:00 | |
* <Schedule> Start tag for job schedule | |
* <Tuesday> Start tag for Tuesday schedule (can be any other day) | |
* <Interval> Start tag for a time interval | |
* <Start> </Start> Interval start time 24 hour format e.g. 21:00 | |
* <Stop> </Stop> Interval stop time 24 hour format e.g. 23:00 | |
* </Interval> End tag for a time interval | |
* Can have an additional <Interval> for each day | |
* </Tuesday> End tag for Tuesday schedule | |
* Can have schedule for other days, e.g. <Wednesday>, and schedule for multiple days | |
* </Schedule> | |
* <Recipients Type="XML"> Start tag for the recipient list. If type is “XML”, provide the list with the tags showed below. If type is “CSV”, insert the | |
* CSV file here compressed with BASE64 | |
* <Recipient> Start tag for a recipient | |
* <RecipientAddress> </RecipientAddress> Recipient fax number or email address | |
* <RecipientName> </RecipientName> Recipient name | |
* <CompanyName> </CompanyName> Recipient company name Optional | |
* <Salutation> </Salutation> Recipient Salutation Optional. E.g. Mr. | |
* <Different> </Different> Special filed to store reference to other files Optional | |
* <AppSourceId> </AppSourceId> Application Source ID is an ID generated by the sending application. It enables associating the unique message (transaction) back to its source application message. | |
* Optional | |
* <UD0> </UD0> User Define 0. This filed can store value that can be inserted into the cover page or other places | |
* Optional Can have additional UD fields up to <UD9> | |
* </Recipient> End tag for a recipient | |
* Repeate <Recipient> tags for every item in the list when using <Recipients Type="XML"> | |
* </Recipients> End tag for the recipient list | |
* <Document ext="TIF" format=”BASE64”> Start tag for document to send. You must provide values for the attributes. Valid values for file extension (ext) are: | |
* TIF, XML, PDF, CPT etc. Valid values for file format (format) are BASE64, XML | |
* BASE64 TIF file goes here | |
* </Document> End tag for document | |
* additional <Document> </Document> can repeat for every document being sent | |
* NOTE: the order in which the documents are placed in this command is the order in which they well be sent to the fax machine. | |
* | |
* 3.1.1.1 CUSTOM HEADER LINE | |
* | |
* BroadFax allows creating a custom header line for your faxes. | |
* | |
* 1. Free form text | |
* 2. Fields from the fax list | |
* | |
* The following parameters from the fax list can be used: | |
* %NUMBER% | |
* %NAME% | |
* %COMPANY% | |
* %SALUTATION% | |
* %USERDEF0%…%USERDEF9% | |
* | |
* 3. Additional parameters | |
* | |
* The following additional parameters can be used in the header: | |
* | |
* %PAGE% - current page | |
* %MONTH% - number of the month | |
* %DAY% - number of the day | |
* %YEAR% - year | |
* %HOUR24% - hour for 24 hour format | |
* %MINUTES% - minutes | |
* %SHORTMONTH% - short month name string | |
* %LONGMONTH% - full month name string | |
* %SHORTYEAR% - 2 digit year | |
* %HOUR12% - for 12 hour am/pm format | |
* %AMPM% - am/pm string for 12 hour format | |
* %PAGES% - total fax pages | |
* %SENDER% - sender name | |
* | |
* Example | |
* | |
* To: %SALUTATION% %NAME% (Fax %NUMBER%) From: %SENDER% | |
* Page %PAGE% of %PAGES% | |
* Date: %MONTH%-%DAY%-%YEAR% %HOUR12%:%MINUTES% %AMPM% | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <SendJobResponse> Start tag for SendJobResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobId> </JobId> The created jobId | |
* </SendJobResponse> End tag for SendJobResponse | |
*/ | |
public function SendJob($options) { | |
return $this->call(array('SendJob' => array($options))); | |
} | |
/** | |
* Suspends the execution of an MDX/BF job | |
* | |
* @param integer $JobId The JobId to suspend | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <SuspendJobResponse> Start tag for SuspendJobResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobId> </JobId> The jobId being suspended | |
* </SuspendJobResponse> | |
*/ | |
public function SuspendJob($JobId) { | |
return $this->call(array('SuspendJob' => array('JobId' => $JobId))); | |
} | |
/** | |
* Resumes the execution of an MDX/BF job | |
* | |
* @param integer $JobId The JobId to Resume | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <ResumeJobResponse> Start tag for ResumeJobResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobId> </JobId> The jobId being Resumeed | |
* </ResumeJobResponse> | |
*/ | |
public function ResumeJob($JobId) { | |
return $this->call(array('ResumeJob' => array('JobId' => $JobId))); | |
} | |
/** | |
* Deletes the execution of an MDX/BF job | |
* | |
* @param integer $JobId The JobId to Delete | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <DeleteJobResponse> Start tag for DeleteJobResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobId> </JobId> The jobId being Deleteed | |
* </DeleteJobResponse> | |
*/ | |
public function DeleteJob($JobId) { | |
return $this->call(array('DeleteJob' => array('JobId' => $JobId))); | |
} | |
/** | |
* Returns a fax list for a job. It contains filters to select specific type of list based on the message completion code. | |
* Use this command to get fax list for a job. | |
* | |
* @param integer $JobId The JobId to Get | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* Type The type of report. Two options, XML or CSV (default XML) | |
* Successful Filter to return fax list of successful messages (when set to default yes) Values yes or no | |
* Error Filter to return fax list of error messages (when set to "yes") Values yes or no | |
* Unsent Filter to return fax list of unsent messages (when set to "yes")Values yes or no | |
* Retriable Filter to return error fax list that are retryable. Note that the <Error> filter has to be set to "yes" too. Default value = no, Values yes or no | |
* OnlyDifferent Filter to return the fax field <Different> only (when set to "yes"). Default value =no, Values yes or no | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetJobFaxListResponse> Start tag for GetJobFaxListResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobId> </JobId> The jobId | |
* <FaxListType="XML"> Start tag for fax list and type of data (XML or CSV) | |
* <Recipient> Start tag for Recipient's data | |
* <RecipientAddress></RecipientAddress> Recipient fax number or email address | |
* <RecipientName> </RecipientName> Recipient name | |
* <CompanyName>.</CompanyName> Recipient company name | |
* <Salutation> </Salutation> Recipient salutation | |
* <Different> </Different> System field used for file reference | |
* <AppSourceId> </AppSourceId> Application Source ID is an ID generated by the sending | |
* application. It enables associating the unique message | |
* (transaction) back to its source application message. | |
* <UD0> to UD9 go here… User defined fields UD0 to UD9 | |
* </Recipient> End tag for Recipient's data | |
* <Recipient> Start tag for Recipient's data | |
* Next recipient data goes here... | |
* </Recipient> End tag for Recipient's data | |
* </FaxList> End tag for fax list | |
*/ | |
public function GetJobFaxList($JobId, $options= array('Type' => 'XML', | |
'Successful' => 'Yes', | |
'Error'=>'Yes', | |
'Unsent'=>'No', | |
'Retriable'=>'No', | |
'OnlyDifferent'=>'No')) { | |
$options = $this->_filterOptions(array('Type', 'Successful','Error', 'Unsent','Retriable','OnlyDifferent'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('GetJobFaxList' => $options)); | |
} | |
/** | |
* Returns a list of MDX/BF jobs and their parameters for a given user name and a range of job IDs (or a single job) | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* Statuses Status code (default A) | |
* JobStatus Status code (default A) | |
* G – Generating | |
* I - In progress | |
* H - On hold | |
* C - Completed | |
* P - Suspended | |
* UserName User who submited the job | |
* MinJobId Starting range of job id | |
* MaxJobId Ending range of job id | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetListOfJobsResponse> Start tag for GetListOfJobsResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobList> Start tag for list of jobs | |
* <Job> Start tag for job info | |
* <JobId> </JobId> Job Id | |
* <JobName> </JobName> Job Name | |
* <JobSystemStatus> </JobSystemStatus> MDX/BF internal job status code | |
* <JobStatus> </JobStatus> Job status code G – Generating | |
* I - In progress | |
* H - On hold | |
* C - Completed | |
* <JobStatusText> </JobStatusText> Job status description Generating | |
* In progress | |
* On hold | |
* Completed | |
* <Priority> </Priority> Job priority | |
* <UserName> </UserName> Submitter user name | |
* <TimeOfCreation> </TimeOfCreation> The date and time the job was created E.g: 07/25/02 14:45:15 | |
* <NumTotalMessages> </NumTotalMessages> Total number of faxes & emails in the job list | |
* <NumMessageSentOK> </NumMessageSentOK> Total number of messages sent successfully | |
* <NumMessageSentError> </NumMessageSentError> Total number of messages sent unsuccessfully | |
* <NumRetryRequested> </NumRetryRequested> The number of retries requested | |
* <NumCurrentRetry> </NumCurrentRetry> The current number of retries executed | |
* </Job> End tag for job info | |
* additional <Job> </Job> will repeat for every job retrieved | |
* </JobList> End tag for list of jobs | |
* </GetListOfJobsResponse> End tag for GetListOfJobsResponse | |
* | |
*/ | |
public function GetListOfJobs($options=array()) { | |
$options = $this->_filterOptions(array('UserName', 'MinJobId','MaxJobId', 'JobStatus','Statuses'), $options); | |
return $this->call(array('GetListOfJobs' => array('Filter' => $options))); | |
} | |
/** | |
* Returns a list of MDX/BF active jobs (not finished) and their parameters for a given user name and a range of job IDs (or a single job) | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* Statuses Status code (default A) | |
* UserName User who submited the job | |
* MinJobId Starting range of job id | |
* MaxJobId Ending range of job id | |
* | |
* @return array XML serialized as array * | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetListOfActiveJobsResponse> Start tag for GetListOfActiveJobsResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobList> Start tag for list of jobs | |
* <Job> Start tag for job info | |
* <JobId> </JobId> Job Id | |
* <JobName> </JobName> Job Name | |
* <JobSystemStatus> </JobSystemStatus> MDX/BF internal job status code | |
* <JobStatus> </JobStatus> Job status code G – Generating | |
* I - In progress | |
* H - On hold | |
* C - Completed | |
* <JobStatusText> </JobStatusText> Job status description Generating | |
* In progress | |
* On hold | |
* Completed | |
* <Priority> </Priority> Job priority | |
* <UserName> </UserName> Submitter user name | |
* <TimeOfCreation> </TimeOfCreation> The date and time the job was created E.g: 07/25/02 14:45:15 | |
* <NumTotalMessages> </NumTotalMessages> Total number of faxes & emails in the job list | |
* <NumMessageSentOK> </NumMessageSentOK> Total number of messages sent successfully | |
* <NumMessageSentError> </NumMessageSentError> Total number of messages sent unsuccessfully | |
* <NumRetryRequested> </NumRetryRequested> The number of retries requested | |
* <NumCurrentRetry> </NumCurrentRetry> The current number of retries executed | |
* </Job> End tag for job info | |
* additional <Job> </Job> will repeat for every job retrieved | |
* </JobList> End tag for list of jobs | |
* </GetListOfActiveJobsResponse> End tag for GetListOfActiveJobsResponse | |
*/ | |
public function GetListOfActiveJobs($options=array('Statuses' => 'A')) { | |
$options = $this->_filterOptions(array('UserName', 'MinJobId','MaxJobId', 'Statuses'), $options); | |
if(empty($options['Statuses'])) { | |
$options['Statuses'] = 'A'; | |
} | |
return $this->call(array('GetListOfActiveJobs' => array('Filter' => $options))); | |
} | |
/** | |
* returns a number of MDX/BF active jobs that are currently active for a given user name | |
* | |
* @param string $UserName User who submited the job | |
* | |
* @deprecated This function exists in broadfax documentation but does not work when called always returning "Unknown command: GetActiveJobsCount" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetActiveJobsCountResponse> Start tag for GetActiveJobsCountResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <Count> Start tag for the counter of active jobs | |
* Number The number of currently active jobs | |
* </Count> End tag for the counter of active jobs | |
* </GetActiveJobsCountResponse> End tag for GetActiveJobsCountResponse | |
*/ | |
public function GetActiveJobsCount($UserName = null) { | |
$filter = array(); | |
if (!is_null($UserName)) { | |
$filter['UserName'] = $UserName; | |
} | |
return $this->call(array('GetActiveJobsCount' => array('Filter' => $filter))); | |
} | |
/** | |
* retrieves CSV report by Jobs to the station (Jobs Summary Report). Use this command to retreive CSV Report by Jobs | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* JobIdFrom Include jobs starting with this ID | |
* JobIdTo Include jobs up to this ID | |
* DateFrom Include jobs starting with this Date | |
* DateTo Include jobs up to this Date | |
* User Include jobs sent by this user | |
* ExpenseCode Include jobs sent with this expense code | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetCSVByJobsResponse> Start tag for GetCSVByJobsResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <ServerName> </ServerName> Server name | |
* <CSV> </CSV> The report in Base64 | |
* </GetCSVByJobsResponse> End tag for GetCSVByJobsResponse | |
*/ | |
public function GetCSVByJobs($options=array('Sort'=>"Date")) { | |
$options = $this->_filterOptions(array('JobIdFrom','JobIdTo','DateFrom','DateTo','User','ExpenseCode','Sort'), $options); | |
return $this->call(array('GetCSVByJobs' => $options)); | |
} | |
/** | |
* retrieves HTML report by Jobs to the station (Jobs Summary Report). Use this command to retreive HTML Report by Jobs | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* JobIdFrom Include jobs starting with this ID | |
* JobIdTo Include jobs up to this ID | |
* DateFrom Include jobs starting with this Date | |
* DateTo Include jobs up to this Date | |
* User Include jobs sent by this user | |
* ExpenseCode Include jobs sent with this expense code | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetHTMLByJobsResponse> Start tag for GetHTMLByJobsResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <HTML> </HTML> The report in Base64 | |
* </GetHTMLByJobsResponse> | |
*/ | |
public function GetHTMLByJobs($options=array('Sort'=>"Date")) { | |
$options = $this->_filterOptions(array('JobIdFrom','JobIdTo','DateFrom','DateTo','User','ExpenseCode','Sort'), $options); | |
return $this->call(array('GetHTMLByJobs' => $options)); | |
} | |
/** | |
* Gets CSV report by Messages (Job Detail Report). | |
* Use this command to bring CSV Report by messages for a specific jo | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* JobId Report job with this ID | |
* MaxLines Number of lines in report portion | |
* StartLine Start line in the current portion of the report | |
* DateFrom Include messages starting with this Date | |
* DateTo Include messages up to this Date | |
* OnlySuccessful Include only successful messages Values: "yes" or "no" | |
* OnlyFailed Include only failed messages Values: "yes" or "no" | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* SortOrder Sort report in this order. Default is "asc" Values: "asc" or "desc" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* < GetCSVByMessagesResponse> Start tag for GetCSVByMessagesResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <ServerName> </ServerName> Server name | |
* <TotalLines> </TotalLines> Number of lines in report | |
* <More> </More> If there are more messages to bring Values: "yes" or "no" | |
* <CSV> </CSV> The report in Base64 | |
* </GetCSVByMessagesResponse> End tag for GetCSVByMesagesResponse | |
*/ | |
public function GetCSVByMessages($JobId, $options = array()) { | |
$options = $this->_filterOptions(array('MaxLines','StartLine','DateFrom','DateTo','OnlySuccessful','OnlyFailed','Sort','SortOrder'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('GetCSVByMessages' => $options)); | |
} | |
/** | |
* Gets XML report by Messages (Job Detail Report). | |
* Use this command to bring XML Report by messages for a specific jo | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* JobId Report job with this ID | |
* MaxLines Number of lines in report portion | |
* StartLine Start line in the current portion of the report | |
* DateFrom Include messages starting with this Date | |
* DateTo Include messages up to this Date | |
* OnlySuccessful Include only successful messages Values: "yes" or "no" | |
* OnlyFailed Include only failed messages Values: "yes" or "no" | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* SortOrder Sort report in this order. Default is "asc" Values: "asc" or "desc" | |
* | |
* @deprecated This is defined in the API docs but does not work | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* < GetXMLByMessagesResponse> Start tag for GetXMLByMessagesResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <TotalLines> </TotalLines> Number of lines in report | |
* <More> </More> If there are more messages to bring Values: "yes" or "no" | |
* <Report> Start tag for the report | |
* <Message> Start tag for individual message | |
* <LineNum> </LineNum> Line number in faxlist | |
* <SendDateTime> </SendDateTime> Send date/time | |
* <SendTimeSeconds> </SendTimeSeconds> Duration of message | |
* <RecipientAddress> </RecipientAddress> Recipient fax number | |
* <RecipientName> </RecipientName> Recipient name | |
* <AccountNo> </AccountNo> Recipient account number | |
* <Retry> </Retry> Message retry number | |
* <ResultCode> </ResultCode> Error code | |
* <ResultText> </ResultText> Error description or Remote CSID | |
* <MessageStatus> </MessageStatus> Status of the message | |
* <MessageStatusText> </MessageStatusText> Status description | |
* <TotalPagesSent> </TotalPagesSent> Total number of pages sent | |
* <Cost> </Cost> Message cost | |
* </Message> End tag for individual message | |
* additional <Message> </Message> will | |
* repeat for every message retrieved | |
* </Report> End tag for the report | |
* </GetXMLByMessagesResponse> | |
*/ | |
public function GetXMLByMessages($JobId, $options = array()) { | |
$options = $this->_filterOptions(array('MaxLines','StartLine','DateFrom','DateTo','OnlySuccessful','OnlyFailed','Sort','SortOrder'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('GetXMLByMessages' => $options)); | |
} | |
/** | |
* Gets HTML report by Messages (Job Detail Report). | |
* Use this command to bring HTML Report by messages for a specific jo | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* JobId Report job with this ID | |
* MaxLines Number of lines in report portion | |
* StartLine Start line in the current portion of the report | |
* DateFrom Include messages starting with this Date | |
* DateTo Include messages up to this Date | |
* OnlySuccessful Include only successful messages Values: "yes" or "no" | |
* OnlyFailed Include only failed messages Values: "yes" or "no" | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* SortOrder Sort report in this order. Default is "asc" Values: "asc" or "desc" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* < GetHTMLByMessagesResponse> Start tag for GetHTMLByMessagesResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <TotalLines> </TotalLines> Number of lines in report | |
* <More> </More> If there are more messages to bring Values: "yes" or "no" | |
* <HTML> </HTML> The report in Base64 | |
* </GetHTMLByMessagesResponse> End tag for GetHTMLByMesagesResponse | |
*/ | |
public function GetHTMLByMessages($JobId, $options = array()) { | |
$options = $this->_filterOptions(array('MaxLines','StartLine','DateFrom','DateTo','OnlySuccessful','OnlyFailed','Sort','SortOrder'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('GetHTMLByMessages' => $options)); | |
} | |
/** | |
* Get CSV report by Received Messages. Use this command to bring CSV Report by Received messages | |
* | |
* @param string $user User Name to get messages for | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* DateFrom Include messages starting with this Date | |
* DateTo Include messages up to this Date | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* SortOrder Sort report in this order. Default is "asc" Values: "asc" or "desc" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* < GetCSVByReceivedMessagesResponse> Start tag for GetCSVByReceivedMessagesResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <ServerName> </ServerName> Server name | |
* <TotalLines> </TotalLines> Number of lines in report | |
* <CSV> </CSV> The report in Base64 | |
* </GetCSVByReceivedMessagesResponse> End tag for GetCSVByReceivedMesagesResponse | |
*/ | |
public function GetCSVByReceivedMessages($User=null, $options = array()) { | |
$options = $this->_filterOptions(array('DateFrom','DateTo','Sort'), $options); | |
$options['User'] = $User; | |
return $this->call(array('GetCSVByReceivedMessages' => $options)); | |
} | |
/** | |
* Get HTML report by Received Messages. Use this command to bring HTML Report by Received messages | |
* | |
* @param string $user User Name to get messages for | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* DateFrom Include messages starting with this Date | |
* DateTo Include messages up to this Date | |
* Sort Sort report by this field. Default is "Date" Values: "Date" or "Recipient" or "Status" or "Duration" | |
* SortOrder Sort report in this order. Default is "asc" Values: "asc" or "desc" | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* < GetHTMLByReceivedMessagesResponse> Start tag for GetHTMLByReceivedMessagesResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <ServerName> </ServerName> Server name | |
* <TotalLines> </TotalLines> Number of lines in report | |
* <HTML> </HTML> The report in Base64 | |
* </GetHTMLByReceivedMessagesResponse> End tag for GetHTMLByReceivedMesagesResponse | |
*/ | |
public function GetHTMLByReceivedMessages($User, $options = array()) { | |
$options = $this->_filterOptions(array('DateFrom','DateTo','Sort'), $options); | |
$options['User'] = $User; | |
return $this->call(array('GetHTMLByReceivedMessages' => $options)); | |
} | |
/** | |
* This command returns the parameters of an MDX/BF job. This provides the user with information on the job parameters" setup and allows him, as | |
* needed, to modify these parameters using the SetJobParameters XML command. Use this command to retrieve the parameters of an MDX/BF job. | |
* | |
* @param integer $JobId Job ID | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetJobParametersResponse> Start tag for GetJobParametersResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <JobID> </JobID> Job Id | |
* <JobName> </JobName> Job name | |
* <JobSystemStatus> </JobSystemStatus> MDX/BF internal job status code | |
* <JobStatus> </JobStatus> Job status code G – Generating | |
* I - In progress | |
* H - On hold | |
* C - Completed | |
* <JobStatusText> </JobStatusText> Job status description Generating | |
* In progress | |
* On hold | |
* Completed | |
* <Priority> </Priority> Job priority | |
* <Resolution> </Resolution> Resolution Values: fine or standard | |
* <ShowFaxHeaderLine> </ShowFaxHeaderLine> Show fax header line flag Values: yes or no | |
* <SenderName> </SenderName> Sender name | |
* <SenderEmail> </SenderEmail> Sender email address | |
* <SenderLocalCSID> </SenderLocalCSID> Sender Caller Sign ID (CSID) | |
* <EmailSubject> </EmailSubject> The subject line for email messages (not fax) | |
* <Prefix> </Prefix> Prefix that will be used in dialing. Applies to all numbers Optional | |
* <Suffix> </Suffix> Suffix that will be used in dialing. Applies to all numbers Optional, values: yes or no | |
* <StartLine> </StartLine> Shows where to start reading the fax list (s) Optional. If 0, the list is limited only by FinishLine | |
* <FinishLine> </FinishLine> Shows where to stop reading the fax list (s) Optional. If 0, the list is limited only by StartLine | |
* <SubAccount> </SubAccount> Additional account classifier for the user (e.g. Department) | |
* <SendLocal> </SendLocal> Send local numbers or not Default value is "yes" Optional. Values: yes or no | |
* <SendLongDistance> </SendLongDistance> Send Long distance numbers or not Default value is "yes" Optional. Values: yes or no | |
* <RetainDocuments> </RetainDocuments> Flag that indicates if to retain job"s document after job was completed or to delete them immediately. | |
* Default value is "yes;, keep docs | |
* Optional, values: yes or no | |
* <RetainRecipentList> </RetainRecipentList> Flag that indicates if to retain job"s recipients list after job was completed or to delete it immediately. Default value is "yes", keep list. Optional, values: yes or no | |
* <FileNames> </FileNames> List of documents | |
* <FaxListNames> </FaxListNames> List of Fax Lists | |
* <StartDateTime> </StartDateTime> Start date and time (format MM/DD/YY HH:MM:SS) | |
* E.g: 12/31/01 16:00:00 | |
* <Schedule> Start tag for job schedule | |
* <Monday> Start tag for Monday schedule (can be any other | |
* day) | |
* <Interval> Start tag for a time interval | |
* <Start> </Start> Interval start time Military time, e.g. 21:00 | |
* <Stop> </Stop> Interval stop time Military time, e.g. 23:00 | |
* </Interval> End tag for a time interval | |
* Can have an additional <Interval> for each day | |
* </Monday> End tag for Monday schedule | |
* Can have schedule for other days, e.g. <Tuesday>, and schedule for multiple days | |
* </Schedule> End tag for job schedule | |
* </GetJobParametersResponse> End tag for GetJobParametersResponse | |
*/ | |
public function GetJobParameters($JobId) { | |
return $this->call(array('GetJobParameters' => array('JobId' => $JobId))); | |
} | |
/** | |
* This command sets (modifies) the parameters of an existing MDX/BF job. For example the user can change the job name or its schedule. Use this | |
* command to modify job parameters. Note, to review the results of this command use GetJobParameters XML command. | |
* | |
* @param integer $JobId Job ID | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* JobName Job Name | |
* SenderEmail Sender email address | |
* ShowFaxHeaderLine Show fax header line flag Values: yes or no | |
* SenderLocalCSID Sender Caller Sign ID (CSID) | |
* SenderName Sender name | |
* Priority Job priority | |
* Resolution Resolution Values: fine or standard | |
* EmailSubject The subject line for email messages (not fax) | |
* StartDateTime Start date and time (format MM/DD/YY HH:MM:SS) E.g: 12/31/01 16:22:00 | |
* Schedule Array of schedule days | |
* Tuesday Array of interval values | |
* Interval Array | |
* Start Interval start time Military time, e.g. 21:00 | |
* Stop Interval stop time Military time, e.g. 23:00 | |
* | |
* Can have an additional <Interval> for each day | |
* Can have schedule for other days, e.g. <Wednesday>, and schedule for multiple days | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <SetJobParametersResponse> Start tag for SetJobParametersResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* </SetJobParametersResponse> End tag for SetJobParametersResponse | |
*/ | |
public function SetJobParameters($JobId, $options=array()) { | |
$options = $this->_filterOptions(array('JobName','SenderEmail','ShowFaxHeaderLine','SenderLocalCSID','SenderName','Priority','Resolution','EmailSubject','StartDateTime','Schedule'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('SetJobParameters' => $options)); | |
} | |
/** | |
* This command returns a list of servers and their parameters. Use this command to retrieve a list of server | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetListOfServersResponse> Start tag for GetListOfServersResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <ServerList> Start tag for list of servers | |
* <Server> Start tag for server info | |
* <ServerName> </ServerName> Name of the server to change | |
* <Active> </Active> If the server is active or not Values: "yes" or "no" | |
* <Computer> </Computer> Name of the computer where the server is running | |
* <Pause> </Pause> NOT USED | |
* <UserName> </Username> User name for logging in to the server For CAS20 type: "SUPERVISOR" | |
* <Password> </Password> Login Password For CAS20 type: "" | |
* <Protocol> </Protocol> Protocol used 0 for Memory, 1 for TCP/IP, 2 for IPX, 3 for NetBIOS | |
* <LogonName> </LogonName> Internal parameter. For CAS20 type: \\DOMAIN\CAS20 SERVER | |
* <Router> </Router> Server Domain | |
* </Server> End tag for server info | |
* additional <Job> </Job> will repeat for every job retrieved | |
* </ServerList> End tag for list of Servers | |
* </GetListOfServersResponse> End tag for GetListOfServersResponse | |
*/ | |
public function GetListOfServers() { | |
return $this->call(array('GetListOfServers' => array())); | |
} | |
/** | |
* This command returns a list of servers and their parameters. Use this command to retrieve a list of server | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* ServerName Name of the server to add | |
* ServerType Type of the Server Currently only 2 types of servers can be used: "CAS20" for faxing or "SMTP" for sending e-mails | |
* Active If the server is active or not Values: "yes" or "no" | |
* Computer Name of the computer where the server is running | |
* Pause NOT USED | |
* Username User name for logging in to the server For CAS20 type: "SUPERVISOR" | |
* Password Login Password For CAS20 type: "" | |
* Protocol Protocol used 0 for Memory, 1 for TCP/IP, 2 for IPX, 3 for NetBIOS | |
* LogonName Internal parameter. For CAS20 type: \\DOMAIN\CAS20 SERVER | |
* Router Server Domain | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <AddServerResponse> Start tag for AddServerResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* </AddServerResponse> End tag for AddServerResponse | |
*/ | |
public function AddServer($options=array()) { | |
$options = $this->_filterOptions(array('ServerName','ServerType','Active','Computer','Pause','Username','Password','Protocol','LogonName','Router'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('AddServer' => $options)); | |
} | |
/** | |
* This XML command changes a fax server manager parameters. Use this command to change fax server manager | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* ServerName Name of the server to change | |
* Active If the server is active or not Values: "yes" or "no" | |
* Computer Name of the computer where the server is running | |
* Pause NOT USED | |
* Username User name for logging in to the server For CAS20 type: "SUPERVISOR" | |
* Password Login Password For CAS20 type: "" | |
* Protocol Protocol used 0 for Memory, 1 for TCP/IP, 2 for IPX, 3 for NetBIOS | |
* LogonName Internal parameter. For CAS20 type: \\DOMAIN\CAS20 SERVER | |
* Router Server Domain | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <ChangeServerResponse> Start tag for ChangeServerResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* </ChangeServerResponse> End tag for ChangeServerResponse | |
*/ | |
public function ChangeServer($options=array()) { | |
$options = $this->_filterOptions(array('ServerName','Active','Computer','Pause','Username','Password','Protocol','LogonName','Router'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('ChangeServer' => $options)); | |
} | |
/** | |
* Deletes fax server manager. Use this command to delete a fax server manager | |
* | |
* @param string $ServerName Server name to delete | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* DeleteServerResponse Start tag for DeleteServerResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* </DeleteServerResponse> End tag for DeleteServerResponse | |
*/ | |
public function DeleteServer($ServerName) { | |
return $this->call(array('DeleteServer' => array('ServerName' => $ServerName))); | |
} | |
/** | |
* This command returns a list of ports and their parameters. Use this command to retrieve a list of ports | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetListOfPortsResponse> Start tag for GetListOfPortsResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <PortList> Start tag for list of ports | |
* <Port> Start tag for port info | |
* <ServerName> </ServerName> Server Name | |
* <PortName> </PortName> PortName | |
* <AllowSend> </ AllowSend > If the port is enabled for sending Values: "yes" or "no" | |
* <AllowReceive> </AllowReceive> If the port is enabled for receiving Values: "yes" or "no" | |
* <MaxSched> </MaxSched> Maximum messages that can be scheduled for sending to this port as one chunk (default: 10) | |
* <Local> </Local> If the port is enabled for sending local numbers Values: "yes" or "no" | |
* <LongDistance> </LongDistance> If the port is enabled for sending long distance numbersValues: "yes" or "no" | |
* <DialPrefix> </DialPrefix> All messages sent to this port should add a prefix to dial | |
* </Port> End tag for port infoadditional <Port> </Port> will repeat for every job retrieved | |
* </PortList> End tag for list of ports | |
* </GetListOfPortsResponse> End tag for GetListOfPortsResponse | |
*/ | |
public function GetListOfPorts() { | |
return $this->call(array('GetListOfPorts' => array())); | |
} | |
/** | |
* This command changes port parameters. Use this command to change port parameters | |
* | |
* @param array $options Associative array of options, Case is sensitive. Valid options are as follows | |
* AllowSend If the port is enabled for sending Values: "yes" or "no" | |
* AllowReceive If the port is enabled for receiving Values: "yes" or "no" | |
* MaxSched Maximum messages that can be scheduled for sending to this port as one chunk (default: 10) | |
* Local If the port is enabled for sending local numbers Values: "yes" or "no" | |
* LongDistance If the port is enabled for sending long distance numbers Values: "yes" or "no" | |
* DialPrefix All messages sent to this port should add a prefix to dial | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <ChangePortResponse> Start tag for ChangePortResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* </ChangePortResponse> End tag for ChangePortResponse | |
*/ | |
public function ChangePort($options=array()) { | |
$options = $this->_filterOptions(array('AllowSend','AllowReceive','MaxSched','Local','LongDistance','DialPrefix'), $options); | |
$options['JobId'] = $JobId; | |
return $this->call(array('ChangePort' => $options)); | |
} | |
/** | |
* This command brings ports status report as CSV. Use this command to bring ports status in CSV format | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetPortStatusResponse> Start tag for GetPortStatusResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <PortList> </PortList> The report in Base64 | |
* </GetPortStatusResponse> End tag for GetPortStatusResponse | |
*/ | |
public function GetPortStatus() { | |
return $this->call(array('GetPortStatus' => array())); | |
} | |
/** | |
* This command brings ports status report as HTML. Use this command to bring ports status in HTML format | |
* | |
* @return array XML serialized as array | |
* <SessionReturnCode> </SessionReturnCode> XML session return code 0=OK; +1=warning; -1=error | |
* <SessionReturnMessage> </SessionReturnMessage> XML session message OK= successful | |
* <GetPortStatusHTMLResponse> Start tag for GetPortStatusHTMLResponse | |
* <ReturnCode> </ReturnCode> Return code 0=OK; +1=warning; -1=error | |
* <ReturnMessage> </ReturnMessage> Return message OK= successful | |
* <PortList> </PortList> The report in Base64 | |
* </GetPortStatusHTMLResponse> End tag for GetPortStatusHTMLResponse | |
*/ | |
public function GetPortStatusHTML() { | |
return $this->call(array('GetPortStatusHTML' => array())); | |
} | |
/** | |
* Filter a list of options by available options | |
* | |
* @param array $validOpts List of valid options | |
* @param array $options Associative array of options, Case is sensitive | |
* @return array $options filtered by only valid options | |
*/ | |
private function _filterOptions($validOpts, $options) { | |
foreach($options as $k=>$v) { | |
if(!in_array($k,$validOpts)) { | |
unset($options[$k]); // Remove options that are not allowed | |
} | |
} | |
return $options; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment