PHP Classes

File: classTest.php

Recommend this page to a friend!
  Classes of Ben D.Benner   Jaduka API Class   classTest.php   Download  
File: classTest.php
Role: Example script
Content type: text/plain
Description: Quick Test/Example Script
Class: Jaduka API Class
Access a public telephone network with Jaduka API
Author: By
Last change:
Date: 18 years ago
Size: 5,399 bytes
 

Contents

Class file image Download
<?php
   
/* ------------------------------ BSD License Information ---------------------------------
        Copyright (c) 2006, Network Enhanced Telecom, LLP
        All rights reserved.

        Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

            * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
            * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
            * Neither the name of Jaduka or Network Enhanced Telecom, LLP nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. Contact info@jaduka.com, 800-880-5910.

        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

        --------------------------------------------------------------------------------------
    */

   
include('api_user.config.php');
    include(
'product.config.php');
    require_once(
'jaduka.class.php');

   
//account data
   
$pin = "";
   
$extension = "";

   
   
$jaduka = new Jaduka;
       
$jaduka->setAPIData($username, $privateKey);
       
$jaduka->setProductData ($customer, $subCustomer, $dnisSet, $webCallAccessNumber, $webCallBackAccessNumber);
       
$jaduka->setAccountData($pin, $extension);

   
$accountSummary = $jaduka->getVFAccountSummary();
   
$accountSummaryCheck = $jaduka->parseFaultString($accountSummary);
   

    print
"Account Summary: getVFAccountSummary() <br>";
    print
"------------------------------------------------------- <br>";
    if(
$accountSummaryCheck[faultString] == 'OK') {
       
print_r ($jaduka->parseHTMLtoArray($accountSummary));
       
$accountSummaryData = $jaduka->parseHTMLtoArray($accountSummary);
    } else {
       
print_r ($jaduka->parseFaultString($accountSummary));
    }

    print
"<br>";
    print
"<br>";

    print
"Call Records: getCallRecords() <br>";
    print
"------------------------------------------------------- <br>";
   
$callRecords = $jaduka->getCallRecords('2006-10-01T00:00:00-0600','2006-11-31T00:00:00-0600',4,0);
   
$callRecordsCheck = $jaduka->parseFaultString($callRecords);
    if(
$callRecordsCheck[faultString] == 'OK') {
       
print_r ($jaduka->parseHTMLtoArray($callRecords));
    } else {
       
print_r ($jaduka->parseFaultString($callRecords));
    }

    print
"<br>";
    print
"<br>";


    print
"Rate Summary: getRateSummary() <br>";
    print
"------------------------------------------------------- <br>";

   
$accessNumber = $accountSummaryData[accessNumber];
   
$toPhoneNumber = '512-785-0660';
   
$rateSummary = $jaduka->getRateSummary($accessNumber, $toPhoneNumber);
   
$rateSummaryCheck = $jaduka->parseFaultString($rateSummary);
    if(
$rateSummaryCheck[faultString] == 'OK') {
       
print_r ($jaduka->parseHTMLtoArray($rateSummary));
    } else {
       
print_r ($jaduka->parseFaultString($rateSummary));
    }

    print
"<br>";
    print
"<br>";


    print
"Web Rate Summary: getWebRateSummary() <br>";
    print
"------------------------------------------------------- <br>";
   
$webRateSummary = $jaduka->getWebRateSummary('webCallBack', '5127850660', '+448704009110');
   
$webRateSummaryCheck = $jaduka->parseFaultString($webRateSummary);
    if(
$webRateSummaryCheck[faultString] == 'OK') {
       
print_r ($jaduka->parseHTMLtoArray($webRateSummary));
    } else {
       
print_r ($jaduka->parseFaultString($webRateSummary));
    }

    print
"<br>";
    print
"<br>";

   
$callingPartyNumber = $_REQUEST["callingPartyNumber"];
   
$calledPartyNumber = $_REQUEST["calledPartyNumber"];

    if (
$callingPartyNumber && $calledPartyNumber) {

    print
"Starting CallBack (LD) call: startWebCallBack() <br>";
    print
"------------------------------------------------------- <br>";
       
$webCallBackReturn = $jaduka->startWebCallBack($callingPartyNumber, $calledPartyNumber);
       
$webCallBackReturnCheck = $jaduka->parseFaultString($webCallBackReturn);
        if(
$webCallBackReturnCheck[faultString] == 'OK') {
           
$callId = $jaduka->parseCallId($webCallBackReturn);
            print
"callId: ".$callid;
        } else {
           
print_r ($jaduka->parseFaultString($webCallBackReturn));
        }

        print
"<br>";
        print
"<br>";

    print
"Parsing Call Status <br>";
    print
"------------------------------------------------------- <br>";
        if(
$webCallBackReturnCheck[faultString] == 'OK') {
           
$callStatusReturn = $jaduka->getWebCallStatus($callId);
           
$englishCallStatus = $jaduka->parseCallStatus($callStatusReturn);
            print(
$englishCallStatus);
        }

    }
// closing the if ($callingPartyNumber && $calledPartyNumber)





?>