]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add test events for time limit-related hangups
authorKinsey Moore <kmoore@digium.com>
Tue, 18 Dec 2012 17:38:22 +0000 (17:38 +0000)
committerKinsey Moore <kmoore@digium.com>
Tue, 18 Dec 2012 17:38:22 +0000 (17:38 +0000)
This patch adds hangup-related test events in order to support testing
of time-limited bridges. This aids in testing the S() and L() bridge
options.

(issue SWP-4713)
........

Merged revisions 378119 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@378120 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 82253d0ac2fde809825c05a38ca366b0805d0437..1e7d07b28ffe5d8e8549f9d1ab2c42650363f31a 100644 (file)
@@ -72,6 +72,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/global_datastores.h"
 #include "asterisk/data.h"
 #include "asterisk/features.h"
+#include "asterisk/test.h"
 
 #ifdef HAVE_EPOLL
 #include <sys/epoll.h>
@@ -3263,6 +3264,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
                                now = ast_tvnow();
                        diff = ast_tvsub(c[x]->whentohangup, now);
                        if (diff.tv_sec < 0 || ast_tvzero(diff)) {
+                               ast_test_suite_event_notify("HANGUP_TIME", "Channel: %s", c[x]->name);
                                /* Should already be hungup */
                                c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
                                ast_channel_unlock(c[x]);
@@ -3331,6 +3333,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
                now = ast_tvnow();
                for (x = 0; x < n; x++) {
                        if (!ast_tvzero(c[x]->whentohangup) && ast_tvcmp(c[x]->whentohangup, now) <= 0) {
+                               ast_test_suite_event_notify("HANGUP_TIME", "Channel: %s", c[x]->name);
                                c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
                                if (winner == NULL)
                                        winner = c[x];
@@ -7765,6 +7768,7 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
                                        bridge_playfile(c1, c0, config->end_sound, 0);
                                *fo = NULL;
                                res = 0;
+                               ast_test_suite_event_notify("BRIDGE_TIMELIMIT", "Channel1: %s\r\nChannel2: %s", c0->name, c1->name);
                                break;
                        }