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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 4 02:44:02 CDT 2011


Author: wedhorn
Date: Wed May  4 02:43:58 2011
New Revision: 316552

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316552
Log:
Make skinny_answer use setsubsate_connected.

Cosolidated the code so that skinny_answer now uses the setsubstate procedures
rather than doing the handling inline.

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=316552&r1=316551&r2=316552
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Wed May  4 02:43:58 2011
@@ -1406,7 +1406,9 @@
 static int skinny_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
 static void mwi_event_cb(const struct ast_event *event, void *userdata);
 static int skinny_reload(void);
+
 static void setsubstate_ringout(struct skinny_subchannel *sub, char exten[AST_MAX_EXTENSION]);
+static void setsubstate_connected(struct skinny_subchannel *sub);
 
 static struct ast_channel_tech skinny_tech = {
 	.type = "Skinny",
@@ -4197,22 +4199,12 @@
 	}
 
 	sub->cxmode = SKINNY_CX_SENDRECV;
-	if (!sub->rtp) {
-		start_rtp(sub);
-	}
+
 	if (skinnydebug)
 		ast_verb(1, "skinny_answer(%s) on %s@%s-%d\n", ast->name, l->name, d->name, sub->callid);
-	if (ast->_state != AST_STATE_UP) {
-		ast_setstate(ast, AST_STATE_UP);
-	}
-
-	transmit_stop_tone(d, l->instance, sub->callid);
-	transmit_callinfo(sub);
-	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_CONNECTED);
-	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_CONNECTED);
-	transmit_dialednumber(d, l->lastnumberdialed, l->instance, sub->callid);
-	transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
-	l->activesub = sub;
+	
+	setsubstate_connected(sub);
+
 	return res;
 }
 
@@ -4786,13 +4778,24 @@
 
 	transmit_activatecallplane(d, l);
 	transmit_stop_tone(d, l->instance, sub->callid);
+	transmit_callinfo(sub);
 	transmit_callstate(d, sub->parent->instance, sub->callid, SKINNY_CONNECTED);
 	transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
 	transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_CONNECTED);
-	start_rtp(sub);
+	if (!sub->rtp) {
+		start_rtp(sub);
+	}
+	if (sub->substate != SUBSTATE_RINGOUT) { /* Bad form, neet to test for RINGIN, when it's implemented */
+		ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
+	}
+	if (sub->substate == SUBSTATE_RINGOUT) {
+		transmit_dialednumber(d, l->lastnumberdialed, l->instance, sub->callid);
+	}
+	if (sub->owner->_state != AST_STATE_UP) {
+		ast_setstate(sub->owner, AST_STATE_UP);
+	}
 	sub->substate = SUBSTATE_CONNECTED;
-	ast_queue_control(sub->owner, AST_CONTROL_ANSWER);
-	ast_setstate(sub->owner, AST_STATE_UP);
+	l->activesub = sub;
 }
 
 static int skinny_hold(struct skinny_subchannel *sub)




More information about the asterisk-commits mailing list