From 899df042f517ee21d7d090db68eb393a2ff32f44 Mon Sep 17 00:00:00 2001
From: Damien Wedhorn <voip@facts.com.au>
Date: Fri, 14 Oct 2011 21:15:33 +0000
Subject: [PATCH] Fix simple switch to not progress a call when call already
 progressed.

If a simple switch was started on a device and then a specific call
made (such as redial or speed dial), on timeout of the simple switch
the call would be attempted again. This patch only allows the simple
switch to make a call if the substate is still in the collecting
digits mode.

Also added small debug message to dialAndAactivate sub.

Tested by snuff and myself.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@340973 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_skinny.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 070ad7b809..942cc30b1e 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4309,7 +4309,9 @@ static void *skinny_ss(void *data)
 					}
 					return NULL;
 				} else {
-					dialandactivatesub(sub, sub->exten);
+					if (sub->substate == SUBSTATE_OFFHOOK) {
+						dialandactivatesub(sub, sub->exten);
+					}
 					return NULL;
 				}
 			} else {
@@ -5463,6 +5465,9 @@ static void activatesub(struct skinny_subchannel *sub, int state)
 
 static void dialandactivatesub(struct skinny_subchannel *sub, char exten[AST_MAX_EXTENSION])
 {
+	if (skinnydebug) {
+		ast_verb(3, "Sub %d - Dial %s and Activate\n", sub->callid, exten);
+	}
 	ast_copy_string(sub->exten, exten, sizeof(sub->exten));
 	activatesub(sub, SUBSTATE_DIALING);
 }
-- 
GitLab