提交 8beb10d2 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-3367 --resolve the start was actually broken in the same way, instead of your…

FS-3367 --resolve the start was actually broken in the same way, instead of your exact patch I replaced both original functions to work as your patch suggests
上级 24863061
...@@ -183,23 +183,28 @@ SWITCH_STANDARD_APP(start_tone_detect_app) ...@@ -183,23 +183,28 @@ SWITCH_STANDARD_APP(start_tone_detect_app)
SWITCH_STANDARD_API(start_tone_detect_api) SWITCH_STANDARD_API(start_tone_detect_api)
{ {
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_core_session_t *psession = NULL;
if (zstr(cmd)) { if (zstr(cmd)) {
stream->write_function(stream, "-ERR missing descriptor name\n"); stream->write_function(stream, "-ERR missing descriptor name\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
if (!session) { if (!(psession = switch_core_session_locate(cmd))) {
stream->write_function(stream, "-ERR no session\n"); stream->write_function(stream, "-ERR Cannot locate session\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
status = callprogress_detector_start(psession, cmd);
status = callprogress_detector_start(session, cmd);
if (status == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK started\n"); stream->write_function(stream, "+OK started\n");
} else { } else {
stream->write_function(stream, "-ERR failed to start tone detector\n"); stream->write_function(stream, "-ERR failed to start tone detector\n");
} }
switch_core_session_rwunlock(psession);
return status; return status;
} }
...@@ -227,12 +232,22 @@ SWITCH_STANDARD_APP(stop_tone_detect_app) ...@@ -227,12 +232,22 @@ SWITCH_STANDARD_APP(stop_tone_detect_app)
SWITCH_STANDARD_API(stop_tone_detect_api) SWITCH_STANDARD_API(stop_tone_detect_api)
{ {
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!session) { switch_core_session_t *psession = NULL;
stream->write_function(stream, "-ERR no session\n");
if (zstr(cmd)) {
stream->write_function(stream, "-ERR missing descriptor name\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
callprogress_detector_stop(session);
stream->write_function(stream, "+OK stopped\n"); if (!(psession = switch_core_session_locate(cmd))) {
stream->write_function(stream, "-ERR Cannot locate session\n");
return SWITCH_STATUS_SUCCESS;
}
callprogress_detector_stop(psession);
stream->write_function(stream, "+OK stopped\n");
switch_core_session_rwunlock(psession);
return status; return status;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论