[Asterisk-cvs] asterisk/channels chan_skinny.c,1.43,1.44

jeremy at lists.digium.com jeremy at lists.digium.com
Sun May 30 22:34:12 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv5372

Modified Files:
	chan_skinny.c 
Log Message:
make sending indications more robust and proper

Index: chan_skinny.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_skinny.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- chan_skinny.c	29 May 2004 03:40:35 -0000	1.43
+++ chan_skinny.c	31 May 2004 02:49:53 -0000	1.44
@@ -617,6 +617,8 @@
 	struct skinny_line *parent;
 	struct ast_rtp *rtp;
 	time_t lastouttime;
+	int progress;
+	int ringing;
 	int lastout;
 	int cxmode;
 	int nat;
@@ -1697,17 +1699,40 @@
     	}
 	switch(ind) {
 	case AST_CONTROL_RINGING:
-		transmit_tone(s, SKINNY_ALERT);
-		transmit_callstate(s, l->instance, SKINNY_PROGRESS, sub->callid);
-		break;
+		if (ast->_state == AST_STATE_RINGING) {
+			if (!sub->progress) {		
+				transmit_tone(s, SKINNY_ALERT);
+				transmit_callstate(s, l->instance, SKINNY_RINGOUT, sub->callid);
+				sub->ringing = 1;
+				break;
+			}
+		}
+		return -1;
 	case AST_CONTROL_BUSY:
-		transmit_tone(s, SKINNY_BUSYTONE);
-		transmit_callstate(s, l->instance, SKINNY_BUSY, sub->callid);
-		break;
+		if (ast->_state != AST_STATE_UP) {		
+			transmit_tone(s, SKINNY_BUSYTONE);
+			transmit_callstate(s, l->instance, SKINNY_BUSY, sub->callid);
+			sub->alreadygone = 1;
+			ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
+                        break;
+                }
+                return -1;
 	case AST_CONTROL_CONGESTION:
-		transmit_tone(s, SKINNY_REORDER);
-		transmit_callstate(s, l->instance, SKINNY_CONGESTION, sub->callid);
-		break;
+		if (ast->_state != AST_STATE_UP) {		
+			transmit_tone(s, SKINNY_REORDER);
+			transmit_callstate(s, l->instance, SKINNY_CONGESTION, sub->callid);
+			sub->alreadygone = 1;
+                        ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
+                        break;
+                }
+                return -1;
+	case AST_CONTROL_PROGRESS:
+                if ((ast->_state != AST_STATE_UP) && !sub->progress && !sub->outgoing) {
+			transmit_callstate(s, l->instance, SKINNY_PROGRESS, sub->callid);
+                        sub->progress = 1;
+                        break;
+                }
+                return -1;  
 	case -1:
 		transmit_tone(s, SKINNY_SILENCE);
 		break;		




More information about the svn-commits mailing list