summaryrefslogtreecommitdiff
path: root/main/core_unreal.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-07-23 13:11:42 -0500
committerMark Michelson <mmichelson@digium.com>2015-07-24 09:33:19 -0500
commitf63552052710d2b0a0f33b8fd93dd00083f74b74 (patch)
tree14c7230b1bc7d681a8168535b57d2a0c7c105189 /main/core_unreal.c
parent4d8f47f4bffc8d750e8b0bcc8e5242577b6adfc1 (diff)
Local channels: Alternate solution to ringback problem.
Commit 54b25c80c8387aea9eb20f9f4f077486cbdf3e5d solved an issue where a specific scenario involving local channels and a native local RTP bridge could result in ringback still being heard on a calling channel even after the call is bridged. That commit caused many tests in the testsuite to fail with alarming consequences, such as not sending DialBegin and DialEnd events, and giving incorrect hangup causes during calls. This commit reverts the previous commit and implements and alternate solution. This new solution involves only passing AST_CONTROL_RINGING frames across local channels if the local channel is in AST_STATE_RING. Otherwise, the frame does not traverse the local channels. By doing this, we can ensure that a playtones generator does not get started on the calling channel but rather is started on the local channel on which the ringing frame was initially indicated. ASTERISK-25250 #close Reported by Etienne Lessard Change-Id: I3bc87a18a38eb2b68064f732d098edceb5c19f39
Diffstat (limited to 'main/core_unreal.c')
-rw-r--r--main/core_unreal.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/main/core_unreal.c b/main/core_unreal.c
index cbeb1d3ed..d57e01f18 100644
--- a/main/core_unreal.c
+++ b/main/core_unreal.c
@@ -409,7 +409,12 @@ static int unreal_queue_indicate(struct ast_unreal_pvt *p, struct ast_channel *a
int isoutbound;
ao2_lock(p);
- if (ast_test_flag(p, AST_UNREAL_NO_OPTIMIZATION)) {
+ /*
+ * Block -1 stop tones events if we are to be optimized out. We
+ * don't need a flurry of these events on an unreal channel chain
+ * when initially connected to slow the optimization process.
+ */
+ if (0 <= condition || ast_test_flag(p, AST_UNREAL_NO_OPTIMIZATION)) {
struct ast_frame f = {
.frametype = AST_FRAME_CONTROL,
.subclass.integer = condition,
@@ -549,6 +554,18 @@ int ast_unreal_indicate(struct ast_channel *ast, int condition, const void *data
}
res = unreal_queue_indicate(p, ast, condition, data, datalen);
break;
+ case AST_CONTROL_RINGING:
+ /* Don't queue ringing frames if the channel is not in a "ring" state. Otherwise,
+ * the real channel on the other end will likely start a playtones generator. It is
+ * possible that this playtones generator will never be stopped under certain
+ * circumstances.
+ */
+ if (ast_channel_state(ast) == AST_STATE_RING) {
+ res = unreal_queue_indicate(p, ast, condition, data, datalen);
+ } else {
+ res = -1;
+ }
+ break;
default:
res = unreal_queue_indicate(p, ast, condition, data, datalen);
break;