The Voicent Perl IVR module contains the following functions:
call_ivr <phoneno> <appname> <selfdelete>
call_ivr('123-4567', 'reminderApp', 1)Make a call to phone number '123-4567' and use 'reminderApp' on the gateway for call interaction. You can use call_status_responses to get the call status and responses, or use call_remove to remove the call record.
call_status_response <reqId> <responses>
$status = call_status('11234035434', responses)
package
Voicent;
use LWP::UserAgent;
use HTTP::Request::Common;
$voicent::host = "localhost";
$voicent::port = 8155;
...
sub call_ivr {
my ($phoneno, $appname, $selfdelete) = @_;
my %params = ();
$params{'info'} = 'call ' . $phoneno;
$params{'phoneno'} = $phoneno;
$params{'firstocc'} = '10';
$params{'startapp'} = $appname;
$params{'selfdelete'} = $selfdelete;
return _call_now(\%params);
}
sub call_status_response {
my ($reqId, $responses) = @_;
my $url = 'http://' . $host . ':' . $port;
$url = $url . '/ocall/callstatusHandler.jsp';
$url = $url . '?reqid=' . $reqId;
my $ua = LWP::UserAgent->new(agent => 'Mozilla/4.0');
my $resp = $ua->request(GET $url);
unless ($resp->is_success) {
print "Error sending call request to
Voicent Gateway";
return "";
}
$result = $resp->content();
@rcarr = split(/^/, $result);
// responses is the 9th field
@resparr = split(/|/, $rcarr[8]);
foreach $resp (@resparr) {
// each is a name value pair
@nvarr = split(/=/, $resp);
my $key = $nvarr[0];
my $value = $nvarr[1];
$responses[$key] = $value;
}
// call status is the 3rd field
return $rcarr[2];
}
...
}