From 48fab6f6dbff43f06189c8bf9504a1eb1b71a659 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 14 Dec 2016 14:02:04 -0600 Subject: [PATCH] FS-9851: [freeswitch-core] Add abstimeout to CoreSession:getDigits in switch_cpp #resolve --- src/include/switch_cpp.h | 1 + src/mod/languages/mod_lua/mod_lua_wrap.cpp | 85 +++++++++++++++++++++- src/switch_cpp.cpp | 10 ++- 3 files changed, 91 insertions(+), 5 deletions(-) diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 9a9adb83a1..ce068aed22 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -309,6 +309,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod */ SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout); SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout, int interdigit); + SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout, int interdigit, int abstimeout); SWITCH_DECLARE(int) transfer(char *extension, char *dialplan = NULL, char *context = NULL); diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index fc66408093..5dd9efdf3d 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -5745,10 +5745,49 @@ fail: } +static int _wrap_CoreSession_getDigits__SWIG_2(lua_State* L) { + int SWIG_arg = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + int arg2 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int arg5 ; + int arg6 ; + char *result = 0 ; + + SWIG_check_num_args("CoreSession::getDigits",6,6) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("CoreSession::getDigits",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("CoreSession::getDigits",2,"int"); + if(!SWIG_lua_isnilstring(L,3)) SWIG_fail_arg("CoreSession::getDigits",3,"char *"); + if(!lua_isnumber(L,4)) SWIG_fail_arg("CoreSession::getDigits",4,"int"); + if(!lua_isnumber(L,5)) SWIG_fail_arg("CoreSession::getDigits",5,"int"); + if(!lua_isnumber(L,6)) SWIG_fail_arg("CoreSession::getDigits",6,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (int)lua_tonumber(L, 2); + arg3 = (char *)lua_tostring(L, 3); + arg4 = (int)lua_tonumber(L, 4); + arg5 = (int)lua_tonumber(L, 5); + arg6 = (int)lua_tonumber(L, 6); + result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6); + lua_pushstring(L,(const char *)result); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static int _wrap_CoreSession_getDigits(lua_State* L) { int argc; - int argv[6]={ - 1,2,3,4,5,6 + int argv[7]={ + 1,2,3,4,5,6,7 }; argc = lua_gettop(L); @@ -5815,11 +5854,51 @@ static int _wrap_CoreSession_getDigits(lua_State* L) { } } } + if (argc == 6) { + int _v; + { + void *ptr; + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + _v = 0; + } else { + _v = 1; + } + } + if (_v) { + { + _v = lua_isnumber(L,argv[1]); + } + if (_v) { + { + _v = SWIG_lua_isnilstring(L,argv[2]); + } + if (_v) { + { + _v = lua_isnumber(L,argv[3]); + } + if (_v) { + { + _v = lua_isnumber(L,argv[4]); + } + if (_v) { + { + _v = lua_isnumber(L,argv[5]); + } + if (_v) { + return _wrap_CoreSession_getDigits__SWIG_2(L); + } + } + } + } + } + } + } SWIG_Lua_pusherrstring(L,"Wrong arguments for overloaded function 'CoreSession_getDigits'\n" " Possible C/C++ prototypes are:\n" " CoreSession::getDigits(int,char *,int)\n" - " CoreSession::getDigits(int,char *,int,int)\n"); + " CoreSession::getDigits(int,char *,int,int)\n" + " CoreSession::getDigits(int,char *,int,int,int)\n"); lua_error(L);return 0; } diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 038a0df651..648c70c81b 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -878,10 +878,16 @@ SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators, return getDigits(maxdigits, terminators, timeout, 0); } +SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators, int timeout, int interdigit) +{ + return getDigits(maxdigits, terminators, timeout, interdigit, 0); +} + SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, char *terminators, int timeout, - int interdigit) + int interdigit, + int abstimeout) { this_check((char *)""); sanity_check((char *)""); @@ -895,7 +901,7 @@ SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, maxdigits, terminators, &terminator, - (uint32_t) timeout, (uint32_t)interdigit, 0); + (uint32_t) timeout, (uint32_t)interdigit, (uint32_t)abstimeout); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "getDigits dtmf_buf: %s\n", dtmf_buf); end_allow_threads();