diff options
author | David M. Lee <dlee@digium.com> | 2013-07-26 17:42:08 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-07-26 17:42:08 +0000 |
commit | b6f9b398308865fcb2c42995d4277e10ab9518e7 (patch) | |
tree | 55afbe94f436f38585831e1a7b2d8aa1935c98de /res/stasis_http | |
parent | 9a46c1d0199e5e3627665b68f88d4ec21f09d2a9 (diff) |
Fix /stasis/res/app_replaced unit test.
A typo in recent changes caused the JSON ApplicationReplaced message to
fail to build, so the message wasn't being sent out the WebSocket.
Related, the replaced application would also unregister itself when it
disconnected, which would actually unregister the new application. This
was also fixed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395527 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis_http')
-rw-r--r-- | res/stasis_http/resource_events.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/res/stasis_http/resource_events.c b/res/stasis_http/resource_events.c index 9e9bfab3e..d632339c0 100644 --- a/res/stasis_http/resource_events.c +++ b/res/stasis_http/resource_events.c @@ -113,6 +113,19 @@ static void app_handler(void *data, const char *app_name, { struct event_session *session = data; int res; + const char *msg_type = S_OR( + ast_json_string_get(ast_json_object_get(message, "type")), + ""); + const char *msg_application = S_OR( + ast_json_string_get(ast_json_object_get(message, "application")), + ""); + + /* Determine if we've been replaced */ + if (strcmp(msg_type, "ApplicationReplaced") == 0 && + strcmp(msg_application, app_name) == 0) { + ao2_find(session->websocket_apps, msg_application, + OBJ_UNLINK | OBJ_NODATA); + } res = ast_json_object_set(message, "application", ast_json_string_create(app_name)); |