[asterisk-commits] wedhorn: trunk r316584 - /trunk/channels/chan_skinny.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 4 03:25:50 CDT 2011


Author: wedhorn
Date: Wed May  4 03:25:47 2011
New Revision: 316584

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316584
Log:
Add setsubstate_ringin.

Added setsubstate_ringin. skinny_call now calls sss_ringin rather than inline.
Fixed previous issue so that setsubstate_connected now use SUBSTATE_RINGIN
to determine is an AST_CONTROL_ANSWER should be queued.

Modified:
    trunk/channels/chan_skinny.c

Modified: trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=316584&r1=316583&r2=316584
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Wed May  4 03:25:47 2011
@@ -1408,6 +1408,7 @@
 static int skinny_reload(void);
 
 static void setsubstate_ringout(struct skinny_subchannel *sub, char exten[AST_MAX_EXTENSION]);
+static void setsubstate_ringin(struct skinny_subchannel *sub);
 static void setsubstate_connected(struct skinny_subchannel *sub);
 
 static struct ast_channel_tech skinny_tech = {
@@ -4064,26 +4065,7 @@
 		return -1;
 	}
 	
-	switch (l->hookstate) {
-	case SKINNY_OFFHOOK:
-		break;
-	case SKINNY_ONHOOK:
-		l->activesub = sub;
-		break;
-	default:
-		ast_log(LOG_ERROR, "Don't know how to deal with hookstate %d\n", l->hookstate);
-		break;
-	}
-
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_RINGIN);
-	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGIN);
-	transmit_displaypromptstatus(d, "Ring-In", 0, l->instance, sub->callid);
-	transmit_callinfo(sub);
-	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
-	transmit_ringer_mode(d, SKINNY_RING_INSIDE);
-
-	ast_setstate(ast, AST_STATE_RINGING);
-	ast_queue_control(ast, AST_CONTROL_RINGING);
+	setsubstate_ringin(sub);
 	return res;
 }
 
@@ -4771,6 +4753,28 @@
 	}
 }
 
+static void setsubstate_ringin(struct skinny_subchannel *sub)
+{
+	struct skinny_line *l = sub->parent;
+	struct skinny_device *d = l->device;
+	struct ast_channel *c = sub->owner;
+
+	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_RINGIN);
+	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_RINGIN);
+	transmit_displaypromptstatus(d, "Ring-In", 0, l->instance, sub->callid);
+	transmit_callinfo(sub);
+	transmit_lamp_indication(d, STIMULUS_LINE, l->instance, SKINNY_LAMP_BLINK);
+	transmit_ringer_mode(d, SKINNY_RING_INSIDE);
+
+	if (l->hookstate == SKINNY_ONHOOK) {
+		l->activesub = sub;
+	}
+	
+	ast_setstate(c, AST_STATE_RINGING);
+	ast_queue_control(c, AST_CONTROL_RINGING);
+	sub->substate = SUBSTATE_RINGIN;
+}
+
 static void setsubstate_connected(struct skinny_subchannel *sub)
 {
 	struct skinny_line *l = sub->parent;
@@ -4785,7 +4789,7 @@
 	if (!sub->rtp) {
 		start_rtp(sub);
 	}
-	if (sub->substate != SUBSTATE_RINGOUT) { /* Bad form, neet to test for RINGIN, when it's implemented */
+	if (sub->substate != SUBSTATE_RINGIN) {
 		ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
 	}
 	if (sub->substate == SUBSTATE_RINGOUT) {




More information about the asterisk-commits mailing list