return SWITCH_STATUS_SUCCESS;
}
-
-
-#if 0
-int Session::answer() {}
-int Session::preAnswer() {}
-void Session::hangup(char *cause) {}
-void Session::setVariable(char *var, char *val) {}
-const char *Session::getVariable(char *var) {}
-int Session::recordFile(char *file_name, int max_len, int silence_threshold, int silence_secs) {}
-void Session::setCallerData(char *var, char *val) {}
-int Session::originate(CoreSession *a_leg_session, char *dest, int timeout) {}
-void Session::setDTMFCallback(void *cbfunc, char *funcargs) {}
-int Session::speak(char *text) {}
-void Session::set_tts_parms(char *tts_name, char *voice_name) {}
-int Session::collectDigits(int timeout) {}
-int Session::getDigits(char *dtmf_buf,
- switch_size_t buflen,
- switch_size_t maxdigits,
- char *terminators,
- char *terminator,
- int timeout) {}
-
-int Session::transfer(char *extensions, char *dialplan, char *context) {}
-int Session::playAndGetDigits(int min_digits,
- int max_digits,
- int max_tries,
- int timeout,
- char *terminators,
- char *audio_files,
- char *bad_input_audio_files,
- char *dtmf_buf,
- char *digits_regex) {}
-
-int Session::streamFile(char *file, int starting_sample_count) {}
-int Session::flushEvents() {}
-int Session::flushDigits() {}
-int Session::setAutoHangup(bool val) {}
-void Session::setHangupHook(void *hangup_func) {}
-bool Session::ready() {}
-void Session::execute(char *app, char *data) {}
-char* Session::get_uuid() {}
-const switch_input_args_t& Session::get_cb_args() {}
-
-#endif
static STRLEN n_a;
+#define init_me() cb_function = hangup_func_str = NULL; hh = mark = 0; my_perl = NULL; cb_arg = NULL
+
Session::Session() : CoreSession()
{
- cb_function = cb_arg = hangup_func_str = NULL;
- hh = mark = 0;
+ init_me();
}
Session::Session(char *uuid) : CoreSession(uuid)
{
- cb_function = cb_arg = hangup_func_str = NULL;
- hh = mark = 0;
+ init_me();
}
Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
{
- cb_function = cb_arg = hangup_func_str = NULL;
- hh = mark = 0;
+ init_me();
}
static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
Session::~Session()
switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
{
- const char *ret;
-
if (!getPERL()) {
return SWITCH_STATUS_FALSE;;
}
sv_setpv(this_sv, str);
hv_store(hash, "duration", 8, this_sv, 0);
- if (cb_arg) {
- //this_sv = get_sv(cb_arg, TRUE); DOH!
- }
-
- code = switch_mprintf("%s('dtmf', \\%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
- Perl_eval_pv(my_perl, code, TRUE);
+ code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
+ Perl_eval_pv(my_perl, code, FALSE);
free(code);
- return process_callback_result(SvPV(get_sv(cb_function, FALSE), n_a));
+ return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
case SWITCH_INPUT_TYPE_EVENT:
mod_perl_conjure_event(my_perl, event, "__Input_Event__");
- code = switch_mprintf("%s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
+ code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
Perl_eval_pv(my_perl, code, TRUE);
free(code);
-
- return process_callback_result((char *)ret);
+ return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
}
#define SWIGTYPE_p_switch_input_args_t swig_types[13]
#define SWIGTYPE_p_switch_input_type_t swig_types[14]
#define SWIGTYPE_p_switch_priority_t swig_types[15]
-#define SWIGTYPE_p_switch_size_t swig_types[16]
-#define SWIGTYPE_p_switch_status_t swig_types[17]
-#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
-#define SWIGTYPE_p_void swig_types[19]
-static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+#define SWIGTYPE_p_switch_status_t swig_types[16]
+#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
+#define SWIGTYPE_p_void swig_types[18]
+static swig_type_info *swig_types[20];
+static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
XS(_wrap_CoreSession_getDigits) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
- switch_size_t arg2 ;
+ int arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
int arg5 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
+ int val2 ;
+ int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_size_t, 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "switch_size_t""'");
- } else {
- arg2 = *(reinterpret_cast< switch_size_t * >(argp2));
- }
- }
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
+ }
+ arg2 = static_cast< int >(val2);
res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
XSRETURN(argvi);
fail:
+
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_size_t = {"_p_switch_size_t", "switch_size_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
&_swigt__p_switch_input_args_t,
&_swigt__p_switch_input_type_t,
&_swigt__p_switch_priority_t,
- &_swigt__p_switch_size_t,
&_swigt__p_switch_status_t,
&_swigt__p_switch_stream_handle_t,
&_swigt__p_void,
static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_size_t[] = { {&_swigt__p_switch_size_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
_swigc__p_switch_input_args_t,
_swigc__p_switch_input_type_t,
_swigc__p_switch_priority_t,
- _swigc__p_switch_size_t,
_swigc__p_switch_status_t,
_swigc__p_switch_stream_handle_t,
_swigc__p_void,