pbxlab-Tutorials
Created by: hoowa,Last modification on Wed 11 of Oct, 2006 [06:32 UTC]
Contents - XMLRPC - Tutorials - Specifications - pbxLab-1.0 - ENGLISH - 中文
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'));
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'));

Comments