-
-
11 Mar 2009 23:11:40 UTC
- Distribution: Switchvox-API
- Module version: 1.0
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (43 / 0 / 13)
- Kwalitee
Bus factor: 0- License: unknown
- Activity
24 month- Tools
- Download (3.81KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Crypt::SSLeay
- HTTP::Request
- HTTP::Response
- LWP::UserAgent
- XML::Parser
- XML::Simple
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
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) { print "Extension:$extension->{number}, Full Name:$extension->{first_name} $extension->{last_name}\n"; } } else { print "Encountered Errors:\n"; foreach my $error ( @{$response->{api_errors}} ) { print "-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/
METHODS
- new( %args )
-
Returns a new
Switchvox::API
object.- hostname
-
The hostname or IP address of the Switchvox PBX.
- username
-
The admin name or the extension used for authentication with the Switchvox. If you use an extension you can only call user methods via the Extend API.
- password
-
The admin password or extension password used for authentication.
- api_request( %args )
-
Returns an
Switchvox::API::Response
object.- method
-
Name of the API method you want to call.
- parameters
-
List of parameters to pass to the API.
Module Install Instructions
To install Switchvox::API, copy and paste the appropriate command in to your terminal.
cpanm Switchvox::API
perl -MCPAN -e shell install Switchvox::API
For more information on module installation, please visit the detailed CPAN module installation guide.