#!/usr/bin/php
<?
include("SOAP/Client.php");   // Available in PHP PEAR SOAP library
require("ngnpro_soap_lib.php"); 

// Initialize SOAP client / SIP port
$SipPort = new WebService_NGNPro_SipPort();

// Login credentials to Managed DNS
$credentials = array("username"=>"MDNSusername","password"=>"MDNSpassword");
$auth_header = array('auth', $credentials , 'urn:AGProjects:NGNPro', 0, '');

//////////////////////////////////////////////
// Create a SIP account
//////////////////////////////////////////////

$SipPort->addHeader($auth_header);
$result=$SipPort->addAccount(array("id" => array("username" => 'alice',"domain"=> 'example.com'),"password"=> "1234"));
if (PEAR::isError($result)) {
    $error_msg=$result->getMessage();
    $error_fault=$result->getFault();
    $error_code=$result->getCode();
    print "$error_msg\n";
    printf ("%s %s\n",$error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring);
} else {
    print "SIP account created\n";
}

?>
