NAME
Switchvox::API - Perl interface to the Switchvox Extend API.
SYNOPSIS
This module provides a simple interface to interface with the Extend API on a Digium, Switchvox PBX. For more complete documentation on the entire Switchvox Extend API please visit http://developers.digium.com/switchvox. For more information on the Digium, Switchvox PBX product please visit the project home page at http://www.switchvox.com.
Note: The Switchvox::API
object is a subclass of LWP::UserAgent so you can use all functionality of LWP::UserAgent.
An example of requesting information about two accounts (1106,1107) from the Switchvox PBX.
my
$api
= new Switchvox::API(
hostname
=>
'192.168.0.50'
,
username
=>
'admin'
,
password
=>
'your_admin_password'
);
my
$response
=
$api
->api_request(
method
=>
'switchvox.extensions.getInfo'
,
parameters
=>
{
account_ids
=>
[
{
'account_id'
=> [1106,1107] }
],
}
);
if
(
$response
->{api_status} eq
'success'
)
{
my
$extensions
=
$response
->{api_result}{response}[0]{result}[0]{extensions}[0]{extension};
foreach
my
$extension
(
@$extensions
)
{
"Extension:$extension->{number}, Full Name:$extension->{first_name} $extension->{last_name}\n"
;
}
}
else
{
"Encountered Errors:\n"
;
foreach
my
$error
( @{
$response
->{api_errors}} )
{
"-Code:$error->{code},Message:$error->{message}\n"
;
}
}
AUTHOR
Written by David W. Podolsky <api at switchvox dot com>
Copyright (C) 2009 Digium, Inc
SEE ALSO
Switchvox::API::Request, Switchvox::API::Response, http://developers.digium.com/switchvox/