}
-static int _wrap_Session_setHangupHook(lua_State* L) {
+static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
LUA::Session *arg1 = (LUA::Session *) 0 ;
char *arg2 = (char *) 0 ;
}
+static int _wrap_Session_setHangupHook__SWIG_1(lua_State* L) {
+ int SWIG_arg = -1;
+ LUA::Session *arg1 = (LUA::Session *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ SWIG_check_num_args("setHangupHook",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
+ SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ (arg1)->setHangupHook(arg2);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_Session_setHangupHook(lua_State* L) {
+ int argc;
+ int argv[4]={
+ 1,2,3,4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ return _wrap_Session_setHangupHook__SWIG_1(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[2]);
+ }
+ if (_v) {
+ return _wrap_Session_setHangupHook__SWIG_0(L);
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L,"No matching function for overloaded 'Session_setHangupHook'");
+ lua_error(L);return 0;
+}
+
+
static int _wrap_Session_ready(lua_State* L) {
int SWIG_arg = -1;
LUA::Session *arg1 = (LUA::Session *) 0 ;
sizeof(dtmf_buf),
digits_regex);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "playAndGetDigits dtmf_buf: %s\n", dtmf_buf);
-
end_allow_threads();
return dtmf_buf;
}
SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
{
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a.session), SWITCH_LOG_DEBUG, "bridge called, session_a uuid: %s\n", session_a.get_uuid());
switch_input_callback_function_t dtmf_func = NULL;
switch_input_args_t args;
switch_channel_t *channel_a = NULL, *channel_b = NULL;
CoreSession *coresession = NULL;
switch_channel_state_t state = switch_channel_get_state(channel);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_hungup), SWITCH_LOG_DEBUG, "hangup_hook called\n");
-
-
if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
if (coresession->hook_state != state) {
coresession->hook_state = state;
switch_channel_t *channel = switch_core_session_get_channel(session_cb);
CoreSession *coresession = NULL;
- switch_status_t result;
-
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_cb), SWITCH_LOG_INFO, "dtmf_callback called\n");
-
- //coresession = (CoreSession *) buf;
coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession");
if (!coresession) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_cb), SWITCH_LOG_ERROR, "Invalid CoreSession\n");
return SWITCH_STATUS_FALSE;
}
- result = coresession->run_dtmf_callback(input, itype);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_cb), SWITCH_LOG_DEBUG, "process_callback_result returned\n");
- if (result) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_cb), SWITCH_LOG_DEBUG, "process_callback_result returned: %d\n", result);
- }
- return result;
-
+ return coresession->run_dtmf_callback(input, itype);
}
unsigned int pos = 0;
char *p;
codec = switch_core_session_get_read_codec(session);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "got codec\n");
+
if ((p = strchr(result, ':'))) {
p++;
if (*p == '+' || *p == '-') {
int step;
+ int target;
if (!(step = atoi(p))) {
step = 1000;
}
- if (step > 0) {
- samps = step * (codec->implementation->samples_per_second / 1000);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "going to seek\n");
- switch_core_file_seek(fhp, &pos, samps, SEEK_CUR);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done seek\n");
- } else {
- samps = step * (codec->implementation->samples_per_second / 1000);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "going to seek\n");
- switch_core_file_seek(fhp, &pos, fhp->pos - samps, SEEK_SET);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done seek\n");
+
+ samps = step * (codec->implementation->samples_per_second / 1000);
+ target = fhp->pos + samps;
+
+ if (target < 0) {
+ target = 0;
}
+
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", target);
+ switch_core_file_seek(fhp, &pos, target, SEEK_SET);
+
} else {
samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "going to seek\n");
+ if (samps < 0) {
+ samps = 0;
+ }
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", samps);
switch_core_file_seek(fhp, &pos, samps, SEEK_SET);
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done seek\n");
}
}
}
if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "return success\n");
return SWITCH_STATUS_SUCCESS;
}
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "no callback result match for '%s', return false\n", result);
return SWITCH_STATUS_FALSE;
}