mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-02 19:16:15 +00:00
res_speech_aeap: add aeap error handling
res_speech_aeap previously did not register an error handler
with aeap, so it was not notified of a disconnect. This resulted
in SpeechBackground never exiting upon a websocket disconnect.
Resolves: #303
(cherry picked from commit 8c934fb7ed
)
This commit is contained in:
committed by
Asterisk Development Team
parent
0a834c8d75
commit
c47a386cf2
@@ -350,11 +350,29 @@ static const struct ast_aeap_message_handler request_handlers[] = {
|
|||||||
{ "set", handle_request_set },
|
{ "set", handle_request_set },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \internal
|
||||||
|
* \brief Handle an error from an external application by setting state to done
|
||||||
|
*
|
||||||
|
* \param aeap Pointer to an Asterisk external application object
|
||||||
|
*/
|
||||||
|
static void ast_aeap_speech_on_error(struct ast_aeap *aeap)
|
||||||
|
{
|
||||||
|
struct ast_speech *speech = ast_aeap_user_data_object_by_id(aeap, "speech");
|
||||||
|
if (!speech) {
|
||||||
|
ast_log(LOG_ERROR, "aeap generated error with no associated speech object");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ast_speech_change_state(speech, AST_SPEECH_STATE_DONE);
|
||||||
|
}
|
||||||
|
|
||||||
static struct ast_aeap_params speech_aeap_params = {
|
static struct ast_aeap_params speech_aeap_params = {
|
||||||
.response_handlers = response_handlers,
|
.response_handlers = response_handlers,
|
||||||
.response_handlers_size = ARRAY_LEN(response_handlers),
|
.response_handlers_size = ARRAY_LEN(response_handlers),
|
||||||
.request_handlers = request_handlers,
|
.request_handlers = request_handlers,
|
||||||
.request_handlers_size = ARRAY_LEN(request_handlers),
|
.request_handlers_size = ARRAY_LEN(request_handlers),
|
||||||
|
.on_error = ast_aeap_speech_on_error,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Reference in New Issue
Block a user