Sample code
110
SIPxNano IP-PBX Getting Started Guide
C • Configuration APIs
Sample code
The SimpleClient class in the com.Patton.pds.applications package demonstrates how to use LoaderCommand
objects to send requests to SIPxNano. A sample Java application follows.
//////////////////////////////////////////////////////////////////////////
// Public Methods
////
public static void *main(String[] args) {
if(args.length != 3){
System.err.println("Usage: <hostname> <use TLS (true|false)> <superadmin-password>");
}
try {
// create the specific LoaderCommand object. In this case we
// are going to add a new user to the system.
AddUserCommand addUserCmd =
new AddUserCommand( args[0], // hostname
Boolean.valueOf(args[1]).booleanValue(), // user TLS
args[2], // superadmin password
null); // no ’raw’ record.
// set the various AddUserCommand properties
addUserCmd.setId("jsmith");
addUserCmd.setPIN("1234");
addUserCmd.setFirstName("John");
addUserCmd.setLastName("Smith");
addUserCmd.setUserGroupName("default");
// execute the command.
addUserCmd.execute();
}
catch(LoaderException e) {
e.printStackTrace();
}
}
//////////////////////////////////////////////////////////////////////////
// Implementation Methods
////
//////////////////////////////////////////////////////////////////////////
// Nested / Inner classes
////
//////////////////////////////////////////////////////////////////////////
// Native Method Declarations
////
}