use channel flag to tell when to read from channel during some stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1590 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-06-09 22:59:13 +00:00
parent 1212c95e55
commit fe32a839df
6 changed files with 29 additions and 29 deletions
@@ -183,7 +183,7 @@ static void ivrtest_function(switch_core_session_t *session, char *data)
}
}
if (switch_ivr_collect_digits_count(session, buf, sizeof(buf), 10, "#*", &term, 10000, 1) != SWITCH_STATUS_SUCCESS) {
if (switch_ivr_collect_digits_count(session, buf, sizeof(buf), 10, "#*", &term, 10000) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
break;
}
@@ -559,8 +559,6 @@ static JSBool session_get_digits(JSContext *cx, JSObject *obj, uintN argc, jsval
char *buf;
int digits;
int32 timeout = 5000;
int32 poll_chan = 1;
if (argc > 0) {
char term;
@@ -571,11 +569,9 @@ static JSBool session_get_digits(JSContext *cx, JSObject *obj, uintN argc, jsval
if (argc > 2) {
JS_ValueToInt32(cx, argv[2], &timeout);
}
if (argc > 3) {
JS_ValueToInt32(cx, argv[3], &poll_chan);
}
buf = switch_core_session_alloc(jss->session, digits);
switch_ivr_collect_digits_count(jss->session, buf, digits, digits, terminators, &term, timeout, poll_chan ? SWITCH_TRUE : SWITCH_FALSE);
switch_ivr_collect_digits_count(jss->session, buf, digits, digits, terminators, &term, timeout);
*rval = STRING_TO_JSVAL ( JS_NewStringCopyZ(cx, buf) );
return JS_TRUE;
}