提交 7e890c45 authored 作者: Andrey Volk's avatar Andrey Volk

Merge pull request #1635 in FS/freeswitch from…

Merge pull request #1635 in FS/freeswitch from ~DRAGOS_OANCEA/freeswitch-dragos:bugfix/FS-11554-conference-moh-null-check to master

* commit '551ce4c4':
  FS-11554: fix crash in conference API when no param given to "moh".
...@@ -2709,6 +2709,9 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc ...@@ -2709,6 +2709,9 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
switch_status_t conference_api_set_moh(conference_obj_t *conference, const char *what) switch_status_t conference_api_set_moh(conference_obj_t *conference, const char *what)
{ {
if (!what) {
return SWITCH_STATUS_FALSE;
}
if (!strcasecmp(what, "toggle")) { if (!strcasecmp(what, "toggle")) {
if (conference_utils_test_flag(conference, CFLAG_NO_MOH)) { if (conference_utils_test_flag(conference, CFLAG_NO_MOH)) {
...@@ -2737,7 +2740,15 @@ switch_status_t conference_api_set_moh(conference_obj_t *conference, const char ...@@ -2737,7 +2740,15 @@ switch_status_t conference_api_set_moh(conference_obj_t *conference, const char
switch_status_t conference_api_sub_moh(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) switch_status_t conference_api_sub_moh(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{ {
conference_api_set_moh(conference, argv[2]); if (conference_api_set_moh(conference, argv[2]) == SWITCH_STATUS_SUCCESS) {
if (stream) {
stream->write_function(stream, "+OK moh\n");
}
} else {
if (stream) {
stream->write_function(stream, "-ERR invalid moh param\n");
}
}
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论