revert svn revisions 9682-9684 (FSCORE-183 is totally broken) (fixes FSCORE-194)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9692 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-09-28 03:48:36 +00:00
parent e8022664a0
commit 4424a4d6c7
11 changed files with 27 additions and 76 deletions

View File

@ -10,7 +10,6 @@
timeout ="10000"
inter-digit-timeout="2000"
max-failures="3"
max-timeouts="3"
digit-len="4">
<entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888@conference.freeswitch.org"/>
<entry action="menu-exec-app" digits="2" param="transfer 9996 XML default"/> <!-- FS echo -->
@ -27,8 +26,7 @@
invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
exit-sound="voicemail/vm-goodbye.wav"
timeout="15000"
max-failures="3"
max-timeouts="3">
max-failures="3">
<entry action="menu-top" digits="*"/>
</menu>

View File

@ -92,8 +92,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
const char *exit_sound,
const char *confirm_macro,
const char *confirm_key,
int confirm_attempts, int inter_timeout, int digit_len,
int timeout, int max_failures, int max_timeouts);
int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures);
virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
SWITCH_DECLARE(void) execute(CoreSession * session, const char *name);

View File

@ -680,8 +680,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
const char *confirm_macro,
const char *confirm_key,
int confirm_attempts,
int inter_timeout, int digit_len, int timeout, int max_failures,
int max_timeouts, switch_memory_pool_t *pool);
int inter_timeout, int digit_len, int timeout, int max_failures, switch_memory_pool_t *pool);
/*!
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.

View File

@ -33,8 +33,8 @@ public class IVRMenu {
swigCPtr = 0;
}
public IVRMenu(IVRMenu main, String name, String greeting_sound, String short_greeting_sound, String invalid_sound, String exit_sound, String confirm_macro, String confirm_key, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) {
this(freeswitchJNI.new_IVRMenu(IVRMenu.getCPtr(main), main, name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true);
public IVRMenu(IVRMenu main, String name, String greeting_sound, String short_greeting_sound, String invalid_sound, String exit_sound, String confirm_macro, String confirm_key, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures) {
this(freeswitchJNI.new_IVRMenu(IVRMenu.getCPtr(main), main, name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures), true);
}
public void bindAction(String action, String arg, String bind) {

View File

@ -11,7 +11,7 @@ package org.freeswitch.swig;
class freeswitchJNI {
public final static native void consoleLog(String jarg1, String jarg2);
public final static native void consoleCleanLog(String jarg1);
public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13, int jarg14);
public final static native long new_IVRMenu(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4, String jarg5, String jarg6, String jarg7, String jarg8, int jarg9, int jarg10, int jarg11, int jarg12, int jarg13);
public final static native void delete_IVRMenu(long jarg1);
public final static native void IVRMenu_bindAction(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4);
public final static native void IVRMenu_execute(long jarg1, IVRMenu jarg1_, long jarg2, CoreSession jarg2_, String jarg3);

View File

@ -244,7 +244,7 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_consoleCleanLog(J
}
SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jint jarg9, jint jarg10, jint jarg11, jint jarg12, jint jarg13, jint jarg14) {
SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jint jarg9, jint jarg10, jint jarg11, jint jarg12, jint jarg13) {
jlong jresult = 0 ;
IVRMenu *arg1 = (IVRMenu *) 0 ;
char *arg2 = (char *) 0 ;
@ -259,7 +259,6 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNI
int arg11 ;
int arg12 ;
int arg13 ;
int arg14 ;
IVRMenu *result = 0 ;
(void)jenv;
@ -306,8 +305,7 @@ SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1IVRMenu(JNI
arg11 = (int)jarg11;
arg12 = (int)jarg12;
arg13 = (int)jarg13;
arg14 = (int)jarg14;
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
*(IVRMenu **)&jresult = result;
if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);

View File

@ -1593,10 +1593,9 @@ static int _wrap_new_IVRMenu(lua_State* L) {
int arg11 ;
int arg12 ;
int arg13 ;
int arg14 ;
IVRMenu *result = 0 ;
SWIG_check_num_args("IVRMenu",14,14)
SWIG_check_num_args("IVRMenu",13,13)
if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
@ -1610,7 +1609,6 @@ static int _wrap_new_IVRMenu(lua_State* L) {
if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
if(!lua_isnumber(L,14)) SWIG_fail_arg("IVRMenu",14,"int");
if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
@ -1628,8 +1626,7 @@ static int _wrap_new_IVRMenu(lua_State* L) {
arg11 = (int)lua_tonumber(L, 11);
arg12 = (int)lua_tonumber(L, 12);
arg13 = (int)lua_tonumber(L, 13);
arg14 = (int)lua_tonumber(L, 14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
SWIG_arg=0;
SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++;
return SWIG_arg;

View File

@ -1995,7 +1995,6 @@ XS(_wrap_new_IVRMenu) {
int arg11 ;
int arg12 ;
int arg13 ;
int arg14 ;
IVRMenu *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
@ -2030,13 +2029,11 @@ XS(_wrap_new_IVRMenu) {
int ecode12 = 0 ;
int val13 ;
int ecode13 = 0 ;
int val14 ;
int ecode14 = 0 ;
int argvi = 0;
dXSARGS;
if ((items < 14) || (items > 14)) {
SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures,max_timeouts);");
if ((items < 13) || (items > 13)) {
SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
if (!SWIG_IsOK(res1)) {
@ -2103,12 +2100,7 @@ XS(_wrap_new_IVRMenu) {
SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
}
arg13 = static_cast< int >(val13);
ecode14 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(13), &val14);
if (!SWIG_IsOK(ecode14)) {
SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "new_IVRMenu" "', argument " "14"" of type '" "int""'");
}
arg14 = static_cast< int >(val14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
@ -2123,7 +2115,6 @@ XS(_wrap_new_IVRMenu) {
XSRETURN(argvi);
fail:
@ -2139,7 +2130,6 @@ XS(_wrap_new_IVRMenu) {
SWIG_croak_null();
}
}

View File

@ -3084,7 +3084,6 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject
int arg11 ;
int arg12 ;
int arg13 ;
int arg14 ;
IVRMenu *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
@ -3119,8 +3118,6 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject
int ecode12 = 0 ;
int val13 ;
int ecode13 = 0 ;
int val14 ;
int ecode14 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
@ -3134,9 +3131,8 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject
PyObject * obj10 = 0 ;
PyObject * obj11 = 0 ;
PyObject * obj12 = 0 ;
PyObject * obj13 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12,&obj13)) SWIG_fail;
if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
@ -3202,12 +3198,7 @@ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject
SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
}
arg13 = static_cast< int >(val13);
ecode14 = SWIG_AsVal_int(obj13, &val14);
if (!SWIG_IsOK(ecode14)) {
SWIG_exception_fail(SWIG_ArgError(ecode14), "in method '" "new_IVRMenu" "', argument " "14"" of type '" "int""'");
}
arg14 = static_cast< int >(val14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13,arg14);
result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0 );
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;

View File

@ -112,8 +112,7 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
int inter_timeout,
int digit_len,
int timeout,
int max_failures,
int max_timeouts)
int max_failures)
{
menu = NULL;
switch_core_new_memory_pool(&pool);
@ -123,7 +122,7 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
}
switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound,
exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, pool);
exit_sound, confirm_macro, confirm_key, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, pool);
}

View File

@ -47,7 +47,6 @@ struct switch_ivr_menu {
int confirm_attempts;
int digit_len;
int max_failures;
int max_timeouts;
int timeout;
int inter_timeout;
switch_size_t inlen;
@ -103,7 +102,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
int inter_timeout,
int digit_len,
int timeout, int max_failures,
int max_timeouts,
switch_memory_pool_t *pool)
{
switch_ivr_menu_t *menu;
@ -169,8 +167,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
menu->max_failures = max_failures;
menu->max_timeouts = max_timeouts;
menu->timeout = timeout;
menu->inter_timeout = inter_timeout;
@ -349,7 +345,7 @@ static switch_status_t play_and_collect(switch_core_session_t *session, switch_i
SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t * stack, char *name, void *obj)
{
int reps = 0, errs = 0, timeouts = 0, match = 0, running = 1;
int reps = 0, errs = 0, match = 0, running = 1;
char *greeting_sound = NULL, *aptr = NULL;
char arg[512];
switch_ivr_action_t todo = SWITCH_IVR_ACTION_DIE;
@ -376,22 +372,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing IVR menu %s\n", menu->name);
switch_channel_set_variable(channel, "ivr_menu_status", "success");
for (reps = 0; running && status == SWITCH_STATUS_SUCCESS; reps++) {
for (reps = 0; (running && status == SWITCH_STATUS_SUCCESS && errs < menu->max_failures); reps++) {
if (!switch_channel_ready(channel)) {
break;
}
if (errs == menu->max_failures) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Maximum failures\n");
switch_channel_set_variable(channel, "ivr_menu_status", "failure");
break;
}
if (timeouts == menu->max_timeouts) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Maximum timeouts\n");
switch_channel_set_variable(channel, "ivr_menu_status", "timeout");
break;
}
if (reps > 0 && menu->short_greeting_sound) {
greeting_sound = menu->short_greeting_sound;
@ -405,11 +390,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
memset(arg, 0, sizeof(arg));
memset(menu->buf, 0, menu->inlen + 1);
if (play_and_collect(session, menu, greeting_sound, menu->inlen) == SWITCH_STATUS_TIMEOUT) {
timeouts++;
continue;
}
status = play_and_collect(session, menu, greeting_sound, menu->inlen);
if (*menu->buf != '\0') {
@ -513,12 +494,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
if (*menu->buf) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", menu->name, menu->buf);
if (menu->invalid_sound) {
play_and_collect(session, menu, menu->invalid_sound, 0);
status = play_and_collect(session, menu, menu->invalid_sound, 0);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IVR menu '%s' no input detected\n", menu->name);
}
errs++;
if (status == SWITCH_STATUS_TIMEOUT) {
status = SWITCH_STATUS_SUCCESS;
}
if (status == SWITCH_STATUS_SUCCESS) {
status = switch_ivr_sleep(session, 1000, NULL);
}
@ -707,7 +693,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
const char *exit_sound = switch_xml_attr(xml_menu, "exit-sound"); /* if the attr doesn't exist, return NULL */
const char *timeout = switch_xml_attr_soft(xml_menu, "timeout"); /* if the attr doesn't exist, return "" */
const char *max_failures = switch_xml_attr_soft(xml_menu, "max-failures"); /* if the attr doesn't exist, return "" */
const char *max_timeouts = switch_xml_attr_soft(xml_menu, "max-timeouts");
const char *confirm_macro= switch_xml_attr(xml_menu, "confirm-macro");
const char *confirm_key= switch_xml_attr(xml_menu, "confirm-key");
const char *confirm_attempts = switch_xml_attr_soft(xml_menu, "confirm-attempts");
@ -716,10 +701,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
switch_ivr_menu_t *menu = NULL;
if (switch_strlen_zero(max_timeouts)) {
max_timeouts = max_failures;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "building menu '%s'\n", menu_name);
status = switch_ivr_menu_init(&menu,
@ -735,8 +716,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
atoi(inter_timeout),
atoi(digit_len),
atoi(timeout),
strlen(max_failures)? atoi(max_failures): 1,
strlen(max_timeouts)? atoi(max_timeouts): 1,
atoi(max_failures),
xml_menu_ctx->pool);
/* set the menu_stack for the caller */
if (status == SWITCH_STATUS_SUCCESS && *menu_stack == NULL) {