FS-9851: [freeswitch-core] Add abstimeout to CoreSession:getDigits in switch_cpp #resolve

This commit is contained in:
Brian West 2016-12-14 14:27:41 -06:00
parent e755b430da
commit 553f3ac1ac
10 changed files with 417 additions and 8 deletions

View File

@ -308,6 +308,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);

View File

@ -219,6 +219,10 @@ public class CoreSession {
return freeswitchJNI.CoreSession_getDigits__SWIG_1(swigCPtr, this, maxdigits, terminators, timeout, interdigit);
}
public String getDigits(int maxdigits, String terminators, int timeout, int interdigit, int abstimeout) {
return freeswitchJNI.CoreSession_getDigits__SWIG_2(swigCPtr, this, maxdigits, terminators, timeout, interdigit, abstimeout);
}
public int transfer(String extension, String dialplan, String context) {
return freeswitchJNI.CoreSession_transfer(swigCPtr, this, extension, dialplan, context);
}

View File

@ -136,6 +136,7 @@ public class freeswitchJNI {
public final static native int CoreSession_collectDigits__SWIG_1(long jarg1, CoreSession jarg1_, int jarg2, int jarg3);
public final static native String CoreSession_getDigits__SWIG_0(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4);
public final static native String CoreSession_getDigits__SWIG_1(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4, int jarg5);
public final static native String CoreSession_getDigits__SWIG_2(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4, int jarg5, int jarg6);
public final static native int CoreSession_transfer(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4);
public final static native String CoreSession_read(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, String jarg4, int jarg5, String jarg6, int jarg7);
public final static native String CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, String jarg9, String jarg10, int jarg11, String jarg12);

View File

@ -2679,6 +2679,36 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1g
}
SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1getDigits_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jstring jarg3, jint jarg4, jint jarg5, jint jarg6) {
jstring jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
int arg4 ;
int arg5 ;
int arg6 ;
char *result = 0 ;
(void)jenv;
(void)jcls;
(void)jarg1_;
arg1 = *(CoreSession **)&jarg1;
arg2 = (int)jarg2;
arg3 = 0;
if (jarg3) {
arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
if (!arg3) return 0;
}
arg4 = (int)jarg4;
arg5 = (int)jarg5;
arg6 = (int)jarg6;
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
if (result) jresult = jenv->NewStringUTF((const char *)result);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
return jresult;
}
SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1transfer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
jint jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;

View File

@ -5718,10 +5718,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);
@ -5788,11 +5827,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;
}

View File

@ -47189,6 +47189,28 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetDigits__SWIG_1(void * jarg1,
}
SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetDigits__SWIG_2(void * jarg1, int jarg2, char * jarg3, int jarg4, int jarg5, int jarg6) {
char * jresult ;
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
int arg4 ;
int arg5 ;
int arg6 ;
char *result = 0 ;
arg1 = (CoreSession *)jarg1;
arg2 = (int)jarg2;
arg3 = (char *)jarg3;
arg4 = (int)jarg4;
arg5 = (int)jarg5;
arg6 = (int)jarg6;
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
jresult = SWIG_csharp_string_callback((const char *)result);
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
int jresult ;
CoreSession *arg1 = (CoreSession *) 0 ;

View File

@ -400,6 +400,11 @@ public class CoreSession : IDisposable {
return ret;
}
public string GetDigits(int maxdigits, string terminators, int timeout, int interdigit, int abstimeout) {
string ret = freeswitchPINVOKE.CoreSession_GetDigits__SWIG_2(swigCPtr, maxdigits, terminators, timeout, interdigit, abstimeout);
return ret;
}
public int Transfer(string extension, string dialplan, string context) {
int ret = freeswitchPINVOKE.CoreSession_Transfer(swigCPtr, extension, dialplan, context);
return ret;
@ -19252,6 +19257,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetDigits__SWIG_1")]
public static extern string CoreSession_GetDigits__SWIG_1(HandleRef jarg1, int jarg2, string jarg3, int jarg4, int jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetDigits__SWIG_2")]
public static extern string CoreSession_GetDigits__SWIG_2(HandleRef jarg1, int jarg2, string jarg3, int jarg4, int jarg5, int jarg6);
[DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Transfer")]
public static extern int CoreSession_Transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4);

View File

@ -7116,6 +7116,85 @@ XS(_wrap_CoreSession_getDigits__SWIG_1) {
}
XS(_wrap_CoreSession_getDigits__SWIG_2) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
int arg4 ;
int arg5 ;
int arg6 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int val4 ;
int ecode4 = 0 ;
int val5 ;
int ecode5 = 0 ;
int val6 ;
int ecode6 = 0 ;
int argvi = 0;
char *result = 0 ;
dXSARGS;
if ((items < 6) || (items > 6)) {
SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout,interdigit,abstimeout);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
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 *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
if (!SWIG_IsOK(ecode4)) {
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
}
arg4 = static_cast< int >(val4);
ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
if (!SWIG_IsOK(ecode5)) {
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "int""'");
}
arg5 = static_cast< int >(val5);
ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
if (!SWIG_IsOK(ecode6)) {
SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "CoreSession_getDigits" "', argument " "6"" of type '" "int""'");
}
arg6 = static_cast< int >(val6);
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
XSRETURN(argvi);
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
SWIG_croak_null();
}
}
XS(_wrap_CoreSession_getDigits) {
dXSARGS;
@ -7230,12 +7309,83 @@ XS(_wrap_CoreSession_getDigits) {
}
check_2:
if (items == 6) {
SWIG_TypeRank _ranki = 0;
SWIG_TypeRank _rankm = 0;
SWIG_TypeRank _pi = 1;
int _v = 0;
{
void *vptr = 0;
int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
{
int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
_v = SWIG_CheckState(res);
}
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
_v = SWIG_CheckState(res);
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
{
int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
_v = SWIG_CheckState(res);
}
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
{
int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
_v = SWIG_CheckState(res);
}
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
{
{
int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), NULL);
_v = SWIG_CheckState(res);
}
}
if (!_v) goto check_3;
_ranki += _v*_pi;
_rankm += _pi;
_pi *= SWIG_MAXCASTRANK;
if (!_index || (_ranki < _rank)) {
_rank = _ranki; _index = 3;
if (_rank == _rankm) goto dispatch;
}
}
check_3:
dispatch:
switch(_index) {
case 1:
PUSHMARK(MARK); SWIG_CALLXS(_wrap_CoreSession_getDigits__SWIG_0); return;
case 2:
PUSHMARK(MARK); SWIG_CALLXS(_wrap_CoreSession_getDigits__SWIG_1); return;
case 3:
PUSHMARK(MARK); SWIG_CALLXS(_wrap_CoreSession_getDigits__SWIG_2); return;
}
}

View File

@ -7907,14 +7907,84 @@ fail:
}
SWIGINTERN PyObject *_wrap_CoreSession_getDigits__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
int arg2 ;
char *arg3 = (char *) 0 ;
int arg4 ;
int arg5 ;
int arg6 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
int res3 ;
char *buf3 = 0 ;
int alloc3 = 0 ;
int val4 ;
int ecode4 = 0 ;
int val5 ;
int ecode5 = 0 ;
int val6 ;
int ecode6 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
PyObject * obj5 = 0 ;
char *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
}
arg1 = reinterpret_cast< CoreSession * >(argp1);
ecode2 = SWIG_AsVal_int(obj1, &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(obj2, &buf3, NULL, &alloc3);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
}
arg3 = reinterpret_cast< char * >(buf3);
ecode4 = SWIG_AsVal_int(obj3, &val4);
if (!SWIG_IsOK(ecode4)) {
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
}
arg4 = static_cast< int >(val4);
ecode5 = SWIG_AsVal_int(obj4, &val5);
if (!SWIG_IsOK(ecode5)) {
SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_getDigits" "', argument " "5"" of type '" "int""'");
}
arg5 = static_cast< int >(val5);
ecode6 = SWIG_AsVal_int(obj5, &val6);
if (!SWIG_IsOK(ecode6)) {
SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "CoreSession_getDigits" "', argument " "6"" of type '" "int""'");
}
arg6 = static_cast< int >(val6);
result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5,arg6);
resultobj = SWIG_FromCharPtr((const char *)result);
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return resultobj;
fail:
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
return NULL;
}
SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *self, PyObject *args) {
int argc;
PyObject *argv[6];
PyObject *argv[7];
int ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? (int)PyObject_Length(args) : 0;
for (ii = 0; (ii < 5) && (ii < argc); ii++) {
for (ii = 0; (ii < 6) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 4) {
@ -7973,12 +8043,50 @@ SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *self, PyObject *args)
}
}
}
if (argc == 6) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_int(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_int(argv[3], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_int(argv[4], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_int(argv[5], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_CoreSession_getDigits__SWIG_2(self, args);
}
}
}
}
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of 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");
return 0;
}

View File

@ -868,10 +868,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 *)"");
@ -885,7 +891,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();