Merge "res/res_http_websocket: Add a pre-session established callback"
authorMatt Jordan <mjordan@digium.com>
Thu, 21 May 2015 12:21:04 +0000 (07:21 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Thu, 21 May 2015 12:21:04 +0000 (07:21 -0500)
apps/app_playback.c
funcs/func_periodic_hook.c
main/file.c
main/sdp_srtp.c
tests/test_message.c

index feb7b63..2875ec2 100644 (file)
@@ -490,7 +490,9 @@ static int playback_exec(struct ast_channel *chan, const char *data)
                                ast_stopstream(chan);
                        }
                        if (res) {
-                               ast_log(LOG_WARNING, "Playback failed on %s for %s\n", ast_channel_name(chan), (char *)data);
+                               if (!ast_check_hangup(chan)) {
+                                       ast_log(LOG_WARNING, "Playback failed on %s for %s\n", ast_channel_name(chan), (char *)data);
+                               }
                                res = 0;
                                mres = 1;
                        }
index 6ddab56..bb0ee0d 100644 (file)
@@ -446,13 +446,9 @@ static struct ast_custom_function hook_function = {
        .write = hook_write,
 };
 
-static struct ast_context *func_periodic_hook_context;
-
 static int unload_module(void)
 {
-       if (func_periodic_hook_context) {
-               ast_context_destroy(func_periodic_hook_context, AST_MODULE);
-       }
+       ast_context_destroy(NULL, AST_MODULE);
 
        return ast_custom_function_unregister(&hook_function);
 }
@@ -461,9 +457,7 @@ static int load_module(void)
 {
        int res;
 
-       func_periodic_hook_context = ast_context_find_or_create(NULL, NULL,
-                       context_name, AST_MODULE);
-       if (!func_periodic_hook_context) {
+       if (!ast_context_find_or_create(NULL, NULL, context_name, AST_MODULE)) {
                ast_log(LOG_ERROR, "Failed to create %s dialplan context.\n", context_name);
                return AST_MODULE_LOAD_DECLINE;
        }
index acd2cc6..bfad6e0 100644 (file)
@@ -897,7 +897,7 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
 
                if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
                        if (fr) {
-                               ast_log(LOG_WARNING, "Failed to write frame\n");
+                               ast_debug(2, "Failed to write frame\n");
                                ast_frfree(fr);
                        }
                        goto return_failure;
@@ -954,7 +954,7 @@ static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
 
                if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
                        if (fr) {
-                               ast_log(LOG_WARNING, "Failed to write frame\n");
+                               ast_debug(2, "Failed to write frame\n");
                                ast_frfree(fr);
                        }
                        ast_channel_vstreamid_set(s->owner, -1);
index 4ec9f81..e576258 100644 (file)
@@ -238,7 +238,8 @@ int ast_sdp_crypto_process(struct ast_rtp_instance *rtp, struct ast_sdp_srtp *sr
                return -1;
        }
 
-       if (sscanf(tag, "%30d", &crypto->tag) != 1 || crypto->tag <= 0 || crypto->tag > 9) {
+       /* RFC4568 9.1 - tag is 1-9 digits, greater than zero */
+       if (sscanf(tag, "%30d", &crypto->tag) != 1 || crypto->tag <= 0 || crypto->tag > 999999999) {
                ast_log(LOG_WARNING, "Unacceptable a=crypto tag: %s\n", tag);
                return -1;
        }
index 26cd90a..2c9334a 100644 (file)
@@ -51,8 +51,6 @@ ASTERISK_REGISTER_FILE()
 /*! \brief The number of user events we should get in a dialplan test */
 #define DEFAULT_EXPECTED_EVENTS 4
 
-static struct ast_context *test_message_context;
-
 /*! \brief The current number of received user events */
 static int received_user_events;
 
@@ -822,9 +820,7 @@ static int unload_module(void)
        AST_TEST_UNREGISTER(test_message_has_destination_handler);
        AST_TEST_UNREGISTER(test_message_msg_send);
 
-       if (test_message_context) {
-               ast_context_destroy(test_message_context, AST_MODULE);
-       }
+       ast_context_destroy(NULL, AST_MODULE);
 
        ast_manager_unregister_hook(&user_event_hook);
 
@@ -835,8 +831,7 @@ static int create_test_dialplan(void)
 {
        int res = 0;
 
-       test_message_context = ast_context_find_or_create(NULL, NULL, TEST_CONTEXT, AST_MODULE);
-       if (!test_message_context) {
+       if (!ast_context_find_or_create(NULL, NULL, TEST_CONTEXT, AST_MODULE)) {
                return -1;
        }