fix paramater checking on switch_ivr_phrase_macro and it's consumers.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4187 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d41b3e14dc
commit
712976653d
|
@ -128,9 +128,8 @@ static void phrase_function(switch_core_session_t *session, char *data)
|
||||||
if ((mdata = strchr(macro, ','))) {
|
if ((mdata = strchr(macro, ','))) {
|
||||||
*mdata++ = '\0';
|
*mdata++ = '\0';
|
||||||
}
|
}
|
||||||
if (!(lang = switch_channel_get_variable(channel, "language"))) {
|
|
||||||
lang = "en";
|
lang = switch_channel_get_variable(channel, "language");
|
||||||
}
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, mdata, lang);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, mdata, lang);
|
||||||
switch_ivr_phrase_macro(session, macro, mdata, lang, NULL);
|
switch_ivr_phrase_macro(session, macro, mdata, lang, NULL);
|
||||||
|
|
|
@ -1029,8 +1029,11 @@ static JSBool session_sayphrase(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||||
if (switch_strlen_zero(phrase_name)) {
|
if (switch_strlen_zero(phrase_name)) {
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
phrase_data = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
|
phrase_data = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4617,6 +4617,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
|
if (!macro_name) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No phrase macro specified.\n");
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!lang) {
|
||||||
|
lang = "en";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
data = "";
|
||||||
|
}
|
||||||
|
|
||||||
switch_url_encode(data, enc_hint, sizeof(enc_hint));
|
switch_url_encode(data, enc_hint, sizeof(enc_hint));
|
||||||
snprintf(hint_data, sizeof(hint_data), "macro_name=%s&lang=%s&data=%s", macro_name, lang, enc_hint);
|
snprintf(hint_data, sizeof(hint_data), "macro_name=%s&lang=%s&data=%s", macro_name, lang, enc_hint);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue