pbxlab-Tutorials

Contents - Tutorials - pbxLab-1.0 - ENGLISH - 中文

pbxLab Tutorials


PBXLAB Server

#!/opt/perl/bin/perl

use XMLRPC::Transport::HTTP;

XMLRPC::Transport::HTTP::CGI
-> dispatch_to('pbxlab')
-> handle
;

package pbxlab;

use Digest::MD5 qw(md5_hex);

sub getAddressBook { shift if UNIVERSAL::isa($_[0] => __PACKAGE__);
my $name = shift;
my $pass = shift;

if ($name eq "1001" && $pass eq md5_hex("123456")) {

return {
statecode=>"200",
msg=>"OK",
book=>[
{group=>"Tech",
name=>"Mr Sun",
calleridname=>"sun",
calleridnum=>"1001",
cellphone=>"42817738901",
officephone=>"86-411-123333",
email=>"sun@china.com",
address=>""},
{group=>"Tech",
name=>"Wang",
calleridname=>"wang",
calleridnum=>"1002",
cellphone=>"3332241",
officephone=>"86-411-55443",
email=>"wang@china.com",
address=>""},
{group=>"market",
name=>"Li",
calleridname=>"Li",
calleridnum=>"1003",
cellphone=>"57645447 ",
officephone=>"86-411-11223",
email=>"li@china.com",
address=>""},
],
};
} else {
return {
statecode=>"401",
msg=>"No Authorization",
};
}
}


PBXLAB Client

#!/usr/bin/perl

use Frontier::Client;
use Digest::MD5 qw(md5_hex);

my $url = 'http://192.168.1.114:8010/pbxlab.cgi';

my $client = Frontier::Client->new(
url => $url,
debug => 1,
);

$client->call('pbxlab.getAddressBook','1001',md5_hex('123456'));
Contents - Tutorials - pbxLab-1.0 - ENGLISH - 中文

pbxLab Tutorials


PBXLAB Server

#!/opt/perl/bin/perl

use XMLRPC::Transport::HTTP;

XMLRPC::Transport::HTTP::CGI
-> dispatch_to('pbxlab')
-> handle
;

package pbxlab;

use Digest::MD5 qw(md5_hex);

sub getAddressBook { shift if UNIVERSAL::isa($_[0] => __PACKAGE__);
my $name = shift;
my $pass = shift;

if ($name eq "1001" && $pass eq md5_hex("123456")) {

return {
statecode=>"200",
msg=>"OK",
book=>[
{group=>"Tech",
name=>"Mr Sun",
calleridname=>"sun",
calleridnum=>"1001",
cellphone=>"42817738901",
officephone=>"86-411-123333",
email=>"sun@china.com",
address=>""},
{group=>"Tech",
name=>"Wang",
calleridname=>"wang",
calleridnum=>"1002",
cellphone=>"3332241",
officephone=>"86-411-55443",
email=>"wang@china.com",
address=>""},
{group=>"market",
name=>"Li",
calleridname=>"Li",
calleridnum=>"1003",
cellphone=>"57645447 ",
officephone=>"86-411-11223",
email=>"li@china.com",
address=>""},
],
};
} else {
return {
statecode=>"401",
msg=>"No Authorization",
};
}
}


PBXLAB Client

#!/usr/bin/perl

use Frontier::Client;
use Digest::MD5 qw(md5_hex);

my $url = 'http://192.168.1.114:8010/pbxlab.cgi';

my $client = Frontier::Client->new(
url => $url,
debug => 1,
);

$client->call('pbxlab.getAddressBook','1001',md5_hex('123456'));
Created by: hoowa, Last modification: Fri 15 of Jun, 2012 (06:45 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+