match ESL to last commit and check in ESL::IVR perl mod

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12760 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-03-24 18:03:26 +00:00
parent 67984e765c
commit ebc4acf666
14 changed files with 436 additions and 40 deletions

View File

@@ -140,7 +140,8 @@ sub DESTROY {
*filter = *ESLc::ESLconnection_filter;
*events = *ESLc::ESLconnection_events;
*execute = *ESLc::ESLconnection_execute;
*setBlockingExecute = *ESLc::ESLconnection_setBlockingExecute;
*executeAsync = *ESLc::ESLconnection_executeAsync;
*setAsyncExecute = *ESLc::ESLconnection_setAsyncExecute;
*setEventLock = *ESLc::ESLconnection_setEventLock;
*disconnect = *ESLc::ESLconnection_disconnect;
sub DISOWN {

88
libs/esl/perl/ESL/IVR.pm Normal file
View File

@@ -0,0 +1,88 @@
package ESL::IVR;
use ESL;
use Data::Dumper;
sub new($$) {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
$self->{_esl} = new ESL::ESLconnection(fileno(STDIN));
$self->{_info} = $self->{_esl}->getInfo();
$self->{_uuid} = $self->{_info}->getHeader("unique-id");
return bless($self, $class);
}
sub getHeader($;) {
my $self = shift;
return $self->{_info} ? $self->{_info}->getHeader(shift) : undef;
}
sub execute($;) {
my $self = shift;
return $self->{_esl}->execute(@_);
}
sub api($;) {
my $self = shift;
return $self->{_esl}->api(@_);
}
sub disconnect($;) {
my $self = shift;
return $self->{_esl}->disconnect(@_);
}
sub getVar($;) {
my $self = shift;
my ($var) = @_;
my $e = $self->api("uuid_getvar", "$self->{_uuid} $var");
my $input;
if ($e) {
$input = $e->getBody() . "\n";
if ($input eq "_undef_") {
$input = undef;
}
}
chomp $input;
return $input;
}
sub playAndGetDigits($;) {
my $self = shift;
my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var) = @_;
$self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var");
return $self->getVar($var);
}
sub read($;) {
my $self = shift;
my ($min, $max, $file, $var, $to, $term) = @_;
$self->execute("read", "$min $max $file $var $to $term");
return $self->getVar($var);
}
sub playback($;) {
my $self = shift;
my ($file) = @_;
$self->execute("playback", $file);
return $self->getVar("playback_terminators_used");
}
1;

View File

@@ -3252,7 +3252,72 @@ XS(_wrap_ESLconnection_execute) {
}
XS(_wrap_ESLconnection_setBlockingExecute) {
XS(_wrap_ESLconnection_executeAsync) {
{
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) NULL ;
char *arg4 = (char *) NULL ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
int res2 ;
char *buf2 = 0 ;
int alloc2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int res4 ;
char *buf4 = 0 ;
int alloc4 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 2) || (items > 4)) {
SWIG_croak("Usage: ESLconnection_executeAsync(self,app,arg,uuid);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'");
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
if (items > 2) {
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
}
if (items > 3) {
res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'");
}
arg4 = reinterpret_cast< char * >(buf4);
}
result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
XSRETURN(argvi);
fail:
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
SWIG_croak_null();
}
}
XS(_wrap_ESLconnection_setAsyncExecute) {
{
ESLconnection *arg1 = (ESLconnection *) 0 ;
char *arg2 = (char *) 0 ;
@@ -3266,19 +3331,19 @@ XS(_wrap_ESLconnection_setBlockingExecute) {
dXSARGS;
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: ESLconnection_setBlockingExecute(self,val);");
SWIG_croak("Usage: ESLconnection_setAsyncExecute(self,val);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_ESLconnection, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setBlockingExecute" "', argument " "1"" of type '" "ESLconnection *""'");
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'");
}
arg1 = reinterpret_cast< ESLconnection * >(argp1);
res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setBlockingExecute" "', argument " "2"" of type '" "char const *""'");
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'");
}
arg2 = reinterpret_cast< char * >(buf2);
result = (int)(arg1)->setBlockingExecute((char const *)arg2);
result = (int)(arg1)->setAsyncExecute((char const *)arg2);
ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@@ -3461,7 +3526,8 @@ static swig_command_info swig_commands[] = {
{"ESLc::ESLconnection_filter", _wrap_ESLconnection_filter},
{"ESLc::ESLconnection_events", _wrap_ESLconnection_events},
{"ESLc::ESLconnection_execute", _wrap_ESLconnection_execute},
{"ESLc::ESLconnection_setBlockingExecute", _wrap_ESLconnection_setBlockingExecute},
{"ESLc::ESLconnection_executeAsync", _wrap_ESLconnection_executeAsync},
{"ESLc::ESLconnection_setAsyncExecute", _wrap_ESLconnection_setAsyncExecute},
{"ESLc::ESLconnection_setEventLock", _wrap_ESLconnection_setEventLock},
{"ESLc::ESLconnection_disconnect", _wrap_ESLconnection_disconnect},
{"ESLc::eslSetLogLevel", _wrap_eslSetLogLevel},