ruin everything, sorry jamesdotcom

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3815 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-12-23 16:40:37 +00:00
1 parent ca18721695
commit 591c9b87aa
15 files changed
+852 -2604

No files matched your search

+16 -55
View File
@@ -791,8 +791,6 @@ SWIGEXPORT(void) SWIG_init (pTHXo_ CV* cv);
SWIGEXPORT(void) SWIG_init (CV *cv, CPerlObj *);
#endif
#include <switch.h>
extern void fs_core_set_globals(void);
extern int fs_core_init(char *);
extern int fs_core_destroy(void);
@@ -808,7 +806,7 @@ extern void fs_channel_hangup(switch_core_session_t *,char *);
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
extern void fs_channel_get_variable(switch_core_session_t *,char *);
extern void fs_channel_set_state(switch_core_session_t *,char *);
extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
extern int fs_ivr_play_file(switch_core_session_t *,char *);
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
@@ -816,10 +814,11 @@ extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
#include "switch.h"
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_fs_perl_var::
@@ -1210,16 +1209,12 @@ XS(_wrap_fs_ivr_play_file) {
{
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
char *arg2 ;
char *arg3 ;
switch_input_callback_function_t arg4 ;
void *arg5 = (void *) 0 ;
unsigned int arg6 ;
int result;
int argvi = 0;
dXSARGS;
if ((items < 6) || (items > 6)) {
SWIG_croak("Usage: fs_ivr_play_file(session,file,timer_name,dtmf_callback,buf,buflen);");
if ((items < 2) || (items > 2)) {
SWIG_croak("Usage: fs_ivr_play_file(session,file);");
}
{
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
@@ -1228,22 +1223,7 @@ XS(_wrap_fs_ivr_play_file) {
}
if (!SvOK((SV*) ST(1))) arg2 = 0;
else arg2 = (char *) SvPV(ST(1), PL_na);
if (!SvOK((SV*) ST(2))) arg3 = 0;
else arg3 = (char *) SvPV(ST(2), PL_na);
{
switch_input_callback_function_t * argp;
if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,0) < 0) {
SWIG_croak("Type error in argument 4 of fs_ivr_play_file. Expected _p_switch_input_callback_function_t");
}
arg4 = *argp;
}
{
if (SWIG_ConvertPtr(ST(4), (void **) &arg5, 0,0) < 0) {
SWIG_croak("Type error in argument 5 of fs_ivr_play_file. Expected _p_void");
}
}
arg6 = (unsigned int) SvUV(ST(5));
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
result = (int)fs_ivr_play_file(arg1,arg2);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
@@ -1546,18 +1526,14 @@ XS(_wrap_fs_switch_ivr_speak_text) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
char *arg2 ;
char *arg3 ;
char *arg4 ;
uint32_t arg5 ;
switch_input_callback_function_t arg6 ;
char *arg7 ;
void *arg8 = (void *) 0 ;
unsigned int arg9 ;
uint32_t arg4 ;
char *arg5 ;
int result;
int argvi = 0;
dXSARGS;
if ((items < 9) || (items > 9)) {
SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,timer_name,rate,dtmf_callback,text,buf,buflen);");
if ((items < 5) || (items > 5)) {
SWIG_croak("Usage: fs_switch_ivr_speak_text(session,tts_name,voice_name,rate,text);");
}
{
if (SWIG_ConvertPtr(ST(0), (void **) &arg1, SWIGTYPE_p_switch_core_session_t,0) < 0) {
@@ -1568,31 +1544,16 @@ XS(_wrap_fs_switch_ivr_speak_text) {
else arg2 = (char *) SvPV(ST(1), PL_na);
if (!SvOK((SV*) ST(2))) arg3 = 0;
else arg3 = (char *) SvPV(ST(2), PL_na);
if (!SvOK((SV*) ST(3))) arg4 = 0;
else arg4 = (char *) SvPV(ST(3), PL_na);
{
uint32_t * argp;
if (SWIG_ConvertPtr(ST(4),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
SWIG_croak("Type error in argument 5 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
if (SWIG_ConvertPtr(ST(3),(void **) &argp, SWIGTYPE_p_uint32_t,0) < 0) {
SWIG_croak("Type error in argument 4 of fs_switch_ivr_speak_text. Expected _p_uint32_t");
}
arg5 = *argp;
arg4 = *argp;
}
{
switch_input_callback_function_t * argp;
if (SWIG_ConvertPtr(ST(5),(void **) &argp, SWIGTYPE_p_switch_input_callback_function_t,0) < 0) {
SWIG_croak("Type error in argument 6 of fs_switch_ivr_speak_text. Expected _p_switch_input_callback_function_t");
}
arg6 = *argp;
}
if (!SvOK((SV*) ST(6))) arg7 = 0;
else arg7 = (char *) SvPV(ST(6), PL_na);
{
if (SWIG_ConvertPtr(ST(7), (void **) &arg8, 0,0) < 0) {
SWIG_croak("Type error in argument 8 of fs_switch_ivr_speak_text. Expected _p_void");
}
}
arg9 = (unsigned int) SvUV(ST(8));
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
if (!SvOK((SV*) ST(4))) arg5 = 0;
else arg5 = (char *) SvPV(ST(4), PL_na);
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) result);
+15 -67
View File
@@ -576,7 +576,7 @@ extern void fs_channel_hangup(switch_core_session_t *,char *);
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
extern void fs_channel_get_variable(switch_core_session_t *,char *);
extern void fs_channel_set_state(switch_core_session_t *,char *);
extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
extern int fs_ivr_play_file(switch_core_session_t *,char *);
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
@@ -584,7 +584,7 @@ extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
@@ -1081,19 +1081,15 @@ ZEND_NAMED_FUNCTION(_wrap_fs_channel_set_state) {
ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
char *arg2 ;
char *arg3 ;
switch_input_callback_function_t arg4 ;
void *arg5 = (void *) 0 ;
unsigned int arg6 ;
int result;
zval **args[7];
zval **args[3];
int argbase=0 ;
if (this_ptr && this_ptr->type==IS_OBJECT) {
/* fake this_ptr as first arg (till we can work out how to do it better */
argbase++;
}
if(((ZEND_NUM_ARGS() + argbase )!= 6) || (zend_get_parameters_array_ex(6-argbase, args)!= SUCCESS)) {
if(((ZEND_NUM_ARGS() + argbase )!= 2) || (zend_get_parameters_array_ex(2-argbase, args)!= SUCCESS)) {
WRONG_PARAM_COUNT;
}
@@ -1106,29 +1102,7 @@ ZEND_NAMED_FUNCTION(_wrap_fs_ivr_play_file) {
convert_to_string_ex(args[1-argbase]);
arg2 = (char *) Z_STRVAL_PP(args[1-argbase]);
convert_to_string_ex(args[2-argbase]);
arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
{
switch_input_callback_function_t * argp;
if(SWIG_ConvertPtr(*args[3-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 4-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
}
arg4 = *argp;
}
if(SWIG_ConvertPtr(*args[4-argbase], (void **) &arg5, 0) < 0) {
/* Allow NULL from php for void* */
if ((*args[4-argbase])->type==IS_NULL) arg5=0;
else zend_error(E_ERROR, "Type error in argument %d of fs_ivr_play_file. Expected %s", 5-argbase, SWIGTYPE_p_void->name);
}
convert_to_long_ex(args[5-argbase]);
arg6 = (unsigned int) Z_LVAL_PP(args[5-argbase]);
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
result = (int)fs_ivr_play_file(arg1,arg2);
ZVAL_LONG(return_value,result);
@@ -1469,21 +1443,17 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
char *arg2 ;
char *arg3 ;
char *arg4 ;
uint32_t arg5 ;
switch_input_callback_function_t arg6 ;
char *arg7 ;
void *arg8 = (void *) 0 ;
unsigned int arg9 ;
uint32_t arg4 ;
char *arg5 ;
int result;
zval **args[10];
zval **args[6];
int argbase=0 ;
if (this_ptr && this_ptr->type==IS_OBJECT) {
/* fake this_ptr as first arg (till we can work out how to do it better */
argbase++;
}
if(((ZEND_NUM_ARGS() + argbase )!= 9) || (zend_get_parameters_array_ex(9-argbase, args)!= SUCCESS)) {
if(((ZEND_NUM_ARGS() + argbase )!= 5) || (zend_get_parameters_array_ex(5-argbase, args)!= SUCCESS)) {
WRONG_PARAM_COUNT;
}
@@ -1500,40 +1470,18 @@ ZEND_NAMED_FUNCTION(_wrap_fs_switch_ivr_speak_text) {
convert_to_string_ex(args[2-argbase]);
arg3 = (char *) Z_STRVAL_PP(args[2-argbase]);
convert_to_string_ex(args[3-argbase]);
arg4 = (char *) Z_STRVAL_PP(args[3-argbase]);
{
uint32_t * argp;
if(SWIG_ConvertPtr(*args[4-argbase], (void **) &argp, SWIGTYPE_p_uint32_t) < 0) {
zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 5-argbase, SWIGTYPE_p_uint32_t->name);
if(SWIG_ConvertPtr(*args[3-argbase], (void **) &argp, SWIGTYPE_p_uint32_t) < 0) {
zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 4-argbase, SWIGTYPE_p_uint32_t->name);
}
arg5 = *argp;
}
{
switch_input_callback_function_t * argp;
if(SWIG_ConvertPtr(*args[5-argbase], (void **) &argp, SWIGTYPE_p_switch_input_callback_function_t) < 0) {
zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 6-argbase, SWIGTYPE_p_switch_input_callback_function_t->name);
}
arg6 = *argp;
arg4 = *argp;
}
convert_to_string_ex(args[6-argbase]);
arg7 = (char *) Z_STRVAL_PP(args[6-argbase]);
convert_to_string_ex(args[4-argbase]);
arg5 = (char *) Z_STRVAL_PP(args[4-argbase]);
if(SWIG_ConvertPtr(*args[7-argbase], (void **) &arg8, 0) < 0) {
/* Allow NULL from php for void* */
if ((*args[7-argbase])->type==IS_NULL) arg8=0;
else zend_error(E_ERROR, "Type error in argument %d of fs_switch_ivr_speak_text. Expected %s", 8-argbase, SWIGTYPE_p_void->name);
}
convert_to_long_ex(args[8-argbase]);
arg9 = (unsigned int) Z_LVAL_PP(args[8-argbase]);
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
ZVAL_LONG(return_value,result);
+6 -14
View File
@@ -1,10 +1,10 @@
# This file was created automatically by SWIG 1.3.27.
# This file was created automatically by SWIG.
# Don't modify this file, modify the SWIG interface instead.
# This file is compatible with both classic and new-style classes.
import _freeswitch
# This file is compatible with both classic and new-style classes.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
def _swig_setattr(self,class_type,name,value):
if (name == "this"):
if isinstance(value, class_type):
self.__dict__[name] = value.this
@@ -13,13 +13,7 @@ def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static) or hasattr(self,name) or (name == "thisown"):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
self.__dict__[name] = value
def _swig_getattr(self,class_type,name):
method = class_type.__swig_getmethods__.get(name,None)
@@ -44,7 +38,7 @@ class SessionContainer(_object):
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, SessionContainer, name)
def __repr__(self):
return "<%s.%s; proxy of C++ SessionContainer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
return "<C SessionContainer instance at %s>" % (self.this,)
def __init__(self, *args):
_swig_setattr(self, SessionContainer, 'this', _freeswitch.new_SessionContainer(*args))
_swig_setattr(self, SessionContainer, 'thisown', 1)
@@ -52,7 +46,6 @@ class SessionContainer(_object):
try:
if self.thisown: destroy(self)
except: pass
def console_log(*args): return _freeswitch.SessionContainer_console_log(*args)
def console_clean_log(*args): return _freeswitch.SessionContainer_console_clean_log(*args)
def answer(*args): return _freeswitch.SessionContainer_answer(*args)
@@ -73,9 +66,8 @@ class SessionContainerPtr(SessionContainer):
def __init__(self, this):
_swig_setattr(self, SessionContainer, 'this', this)
if not hasattr(self,"thisown"): _swig_setattr(self, SessionContainer, 'thisown', 0)
self.__class__ = SessionContainer
_swig_setattr(self, SessionContainer,self.__class__,SessionContainer)
_freeswitch.SessionContainer_swigregister(SessionContainerPtr)
cvar = _freeswitch.cvar
File diff suppressed because it is too large. Load diff
+13 -37
View File
@@ -627,7 +627,7 @@ extern void fs_channel_hangup(switch_core_session_t *,char *);
extern void fs_channel_set_variable(switch_core_session_t *,char *,char *);
extern void fs_channel_get_variable(switch_core_session_t *,char *);
extern void fs_channel_set_state(switch_core_session_t *,char *);
extern int fs_ivr_play_file(switch_core_session_t *,char *,char *,switch_input_callback_function_t,void *,unsigned int);
extern int fs_ivr_play_file(switch_core_session_t *,char *);
extern int fs_switch_ivr_record_file(switch_core_session_t *,switch_file_handle_t *,char *,switch_input_callback_function_t,void *,unsigned int,unsigned int);
extern int fs_switch_ivr_sleep(switch_core_session_t *,uint32_t);
extern int fs_ivr_play_file2(switch_core_session_t *,char *);
@@ -635,7 +635,7 @@ extern int fs_switch_ivr_collect_digits_callback(switch_core_session_t *,switch_
extern int fs_switch_ivr_collect_digits_count(switch_core_session_t *,char *,unsigned int,unsigned int,char const *,char *,unsigned int);
extern int fs_switch_ivr_originate(switch_core_session_t *,switch_core_session_t **,char *,uint32_t);
extern int fs_switch_ivr_session_transfer(switch_core_session_t *,char *,char *,char *);
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,char *,uint32_t,switch_input_callback_function_t,char *,void *,unsigned int);
extern int fs_switch_ivr_speak_text(switch_core_session_t *,char *,char *,uint32_t,char *);
extern char *fs_switch_channel_get_variable(switch_channel_t *,char *);
extern int fs_switch_channel_set_variable(switch_channel_t *,char *,char *);
@@ -859,26 +859,14 @@ static VALUE
_wrap_fs_ivr_play_file(int argc, VALUE *argv, VALUE self) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
char *arg2 ;
char *arg3 ;
switch_input_callback_function_t arg4 ;
void *arg5 = (void *) 0 ;
unsigned int arg6 ;
int result;
VALUE vresult = Qnil;
if ((argc < 6) || (argc > 6))
rb_raise(rb_eArgError, "wrong # of arguments(%d for 6)",argc);
if ((argc < 2) || (argc > 2))
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc);
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
arg2 = StringValuePtr(argv[1]);
arg3 = StringValuePtr(argv[2]);
{
switch_input_callback_function_t * ptr;
SWIG_ConvertPtr(argv[3], (void **) &ptr, SWIGTYPE_p_switch_input_callback_function_t, 1);
if (ptr) arg4 = *ptr;
}
SWIG_ConvertPtr(argv[4], (void **) &arg5, 0, 1);
arg6 = NUM2UINT(argv[5]);
result = (int)fs_ivr_play_file(arg1,arg2,arg3,arg4,arg5,arg6);
result = (int)fs_ivr_play_file(arg1,arg2);
vresult = INT2NUM(result);
return vresult;
@@ -1066,35 +1054,23 @@ _wrap_fs_switch_ivr_speak_text(int argc, VALUE *argv, VALUE self) {
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
char *arg2 ;
char *arg3 ;
char *arg4 ;
uint32_t arg5 ;
switch_input_callback_function_t arg6 ;
char *arg7 ;
void *arg8 = (void *) 0 ;
unsigned int arg9 ;
uint32_t arg4 ;
char *arg5 ;
int result;
VALUE vresult = Qnil;
if ((argc < 9) || (argc > 9))
rb_raise(rb_eArgError, "wrong # of arguments(%d for 9)",argc);
if ((argc < 5) || (argc > 5))
rb_raise(rb_eArgError, "wrong # of arguments(%d for 5)",argc);
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 1);
arg2 = StringValuePtr(argv[1]);
arg3 = StringValuePtr(argv[2]);
arg4 = StringValuePtr(argv[3]);
{
uint32_t * ptr;
SWIG_ConvertPtr(argv[4], (void **) &ptr, SWIGTYPE_p_uint32_t, 1);
if (ptr) arg5 = *ptr;
SWIG_ConvertPtr(argv[3], (void **) &ptr, SWIGTYPE_p_uint32_t, 1);
if (ptr) arg4 = *ptr;
}
{
switch_input_callback_function_t * ptr;
SWIG_ConvertPtr(argv[5], (void **) &ptr, SWIGTYPE_p_switch_input_callback_function_t, 1);
if (ptr) arg6 = *ptr;
}
arg7 = StringValuePtr(argv[6]);
SWIG_ConvertPtr(argv[7], (void **) &arg8, 0, 1);
arg9 = NUM2UINT(argv[8]);
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
arg5 = StringValuePtr(argv[4]);
result = (int)fs_switch_ivr_speak_text(arg1,arg2,arg3,arg4,arg5);
vresult = INT2NUM(result);
return vresult;
@@ -850,6 +850,7 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval
switch_file_handle_t fh = {0};
JSFunction *function;
int32 limit = 0;
switch_input_args_t args = {0};
channel = switch_core_session_get_channel(jss->session);
assert(channel != NULL);
@@ -904,7 +905,10 @@ static JSBool session_recordfile(JSContext *cx, JSObject *obj, uintN argc, jsval
cb_state.extra = &fh;
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
cb_state.saveDepth = JS_SuspendRequest(cx);
switch_ivr_record_file(jss->session, &fh, file_name, dtmf_func, bp, len, limit);
args.input_callback = dtmf_func;
args.buf = bp;
args.buflen = len;
switch_ivr_record_file(jss->session, &fh, file_name, &args, limit);
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;
@@ -922,6 +926,7 @@ static JSBool session_collect_input(JSContext *cx, JSObject *obj, uintN argc, js
switch_input_callback_function_t dtmf_func = NULL;
struct input_callback_state cb_state = {0};
JSFunction *function;
switch_input_args_t args = {0};
channel = switch_core_session_get_channel(jss->session);
assert(channel != NULL);
@@ -956,7 +961,10 @@ static JSBool session_collect_input(JSContext *cx, JSObject *obj, uintN argc, js
}
cb_state.saveDepth = JS_SuspendRequest(cx);
switch_ivr_collect_digits_callback(jss->session, dtmf_func, bp, len, to);
args.input_callback = dtmf_func;
args.buf = bp;
args.buflen = len;
switch_ivr_collect_digits_callback(jss->session, &args, to);
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;
@@ -969,7 +977,6 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
struct js_session *jss = JS_GetPrivate(cx, obj);
switch_channel_t *channel;
char *file_name = NULL;
char *timer_name = NULL;
//char *input_callback = NULL;
void *bp = NULL;
int len = 0;
@@ -977,6 +984,7 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
struct input_callback_state cb_state = {0};
switch_file_handle_t fh = {0};
JSFunction *function;
switch_input_args_t args = {0};
channel = switch_core_session_get_channel(jss->session);
assert(channel != NULL);
@@ -994,19 +1002,14 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
return JS_FALSE;
}
}
if (argc > 1) {
timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
if (switch_strlen_zero(timer_name)) {
timer_name = NULL;
}
}
if (argc > 2) {
if ((function = JS_ValueToFunction(cx, argv[2]))) {
if ((function = JS_ValueToFunction(cx, argv[1]))) {
memset(&cb_state, 0, sizeof(cb_state));
cb_state.function = function;
if (argc > 3) {
cb_state.arg = argv[3];
if (argc > 2) {
cb_state.arg = argv[2];
}
cb_state.session_state = jss;
@@ -1018,16 +1021,19 @@ static JSBool session_streamfile(JSContext *cx, JSObject *obj, uintN argc, jsval
}
}
if (argc > 4) {
if (argc > 3) {
int32 samps;
JS_ValueToInt32(cx, argv[4], &samps);
JS_ValueToInt32(cx, argv[3], &samps);
fh.samples = samps;
}
cb_state.extra = &fh;
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
cb_state.saveDepth = JS_SuspendRequest(cx);
switch_ivr_play_file(jss->session, &fh, file_name, timer_name, dtmf_func, bp, len);
args.input_callback = dtmf_func;
args.buf = bp;
args.buflen = len;
switch_ivr_play_file(jss->session, &fh, file_name, &args);
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;
@@ -1104,13 +1110,13 @@ static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
char *tts_name = NULL;
char *voice_name = NULL;
char *text = NULL;
char *timer_name = NULL;
switch_codec_t *codec;
void *bp = NULL;
int len = 0;
struct input_callback_state cb_state = {0};
switch_input_callback_function_t dtmf_func = NULL;
JSFunction *function;
switch_input_args_t args = {0};
channel = switch_core_session_get_channel(jss->session);
assert(channel != NULL);
@@ -1148,10 +1154,6 @@ static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
}
}
if (argc > 5) {
timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
}
if (!tts_name && text) {
return JS_FALSE;
}
@@ -1159,15 +1161,15 @@ static JSBool session_speak(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
codec = switch_core_session_get_read_codec(jss->session);
cb_state.ret = BOOLEAN_TO_JSVAL( JS_FALSE );
cb_state.saveDepth = JS_SuspendRequest(cx);
args.input_callback = dtmf_func;
args.buf = bp;
args.buflen = len;
switch_ivr_speak_text(jss->session,
tts_name,
voice_name && strlen(voice_name) ? voice_name : NULL,
timer_name,
codec->implementation->samples_per_second,
dtmf_func,
text,
bp,
len);
&args);
JS_ResumeRequest(cx, cb_state.saveDepth);
*rval = cb_state.ret;