[asterisk-commits] russell: branch russell/chan_console r49051 - /team/russell/chan_console/chan...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 28 22:43:16 MST 2006


Author: russell
Date: Thu Dec 28 23:43:15 2006
New Revision: 49051

URL: http://svn.digium.com/view/asterisk?view=rev&rev=49051
Log:
Add a few minor changes, and also, increase the sillyness level in the output.

Modified:
    team/russell/chan_console/channels/chan_console.c

Modified: team/russell/chan_console/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/channels/chan_console.c?view=diff&rev=49051&r1=49050&r2=49051
==============================================================================
--- team/russell/chan_console/channels/chan_console.c (original)
+++ team/russell/chan_console/channels/chan_console.c Thu Dec 28 23:43:15 2006
@@ -93,12 +93,12 @@
 	char read_buf[NUM_SAMPLES * 2 + AST_FRIENDLY_OFFSET];
 	char write_buf[NUM_SAMPLES * 2];
 	unsigned int write_dst;
-	ast_cond_t cond;
-	ast_mutex_t lock;
 	int cur_sound;
 	unsigned int hookstate:1;
 	unsigned int overridecontext:1;
 	unsigned int incallback:1;
+	ast_cond_t cond;
+	ast_mutex_t lock;
 	AST_LIST_HEAD_NOLOCK(, ast_frame) frames;
 } pvt = {
 	.name = "default",
@@ -208,21 +208,21 @@
 
 static int console_digit_begin(struct ast_channel *c, char digit)
 {
-	ast_verbose(" -=- Console Received Beginning of Digit %c -=-\n", digit);
+	ast_verbose(" --- <(\"<) --- Console Received Beginning of Digit %c --- (>\")> ---\n", digit);
 
 	return 0;
 }
 
 static int console_digit_end(struct ast_channel *c, char digit)
 {
-	ast_verbose(" -=- Console Received End of Digit %c -=-\n", digit);
+	ast_verbose(" --- <(\"<) --- Console Received End of Digit %c --- (>\")> ---\n", digit);
 
 	return 0;
 }
 
 static int console_text(struct ast_channel *c, const char *text)
 {
-	ast_verbose(" -=- Console Received Text '%s' -=-\n", text);
+	ast_verbose(" --- <(\"<) --- Console Received Text '%s' --- (>\")> ---\n", text);
 
 	return 0;
 }
@@ -231,10 +231,14 @@
 {
 	int res = 0;
 
-	ast_verbose(" -=- Hangup on Console -=-\n");
+	ast_verbose(" --- <(\"<) --- Hangup on Console --- (>\")> ---\n");
 
 	pvt.hookstate = 0;
-
+	c->tech_pvt = NULL;
+	pvt.owner = NULL;
+
+	/* Wait until the callback has exited before stopping the stream, also
+	 * ensuring that the callback isn't blocking while waiting on a frame. */
 	while (pvt.incallback) { /* :( */
 		ast_mutex_lock(&pvt.lock);
 		ast_cond_signal(&pvt.cond);
@@ -242,8 +246,6 @@
 		usleep(10);
 	}
 
-	c->tech_pvt = NULL;
-	pvt.owner = NULL;
 	stop_stream();
 
 	return res;
@@ -253,7 +255,7 @@
 {
 	int res = 0;
 
-	ast_verbose(" -=- Call from Console has been Answered -=-\n");
+	ast_verbose(" --- <(\"<) --- Call from Console has been Answered --- (>\")> ---\n");
 
 	ast_mutex_lock(&pvt.lock);
 	ast_setstate(c, AST_STATE_UP);
@@ -275,10 +277,9 @@
 	struct ast_frame f = { 0, };
 	int res = 0;
 
-	ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console "
-		"from '%s' <%s> >>\n", dest, c->cid.cid_dnid, 
-		c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num);
-	ast_verbose(" << Auto-answered >> \n");
+	ast_verbose(" --- <(\"<) --- Call to device '%s' on console from '%s' <%s> --- (>\")> ---\n",
+		dest, c->cid.cid_name, c->cid.cid_num);
+	ast_verbose(" --- <(\"<) --- Auto-answered --- (>\")> --- \n");
 	pvt.hookstate = 1;
 	f.frametype = AST_FRAME_CONTROL;
 	f.subclass = AST_CONTROL_ANSWER;
@@ -312,13 +313,14 @@
 		/* \todo Play appropriate sound to console */
 		break;
 	case AST_CONTROL_VIDUPDATE:
+	case -1:
 		break;
 	case AST_CONTROL_HOLD:
-		ast_verbose(" << Console Has Been Placed on Hold >> \n");
+		ast_verbose(" --- <(\"<) --- Console Has Been Placed on Hold --- (>\")> --- \n");
 		ast_moh_start(chan, data, pvt.mohinterpret);
 		break;
 	case AST_CONTROL_UNHOLD:
-		ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
+		ast_verbose(" --- <(\"<) --- Console Has Been Retrieved from Hold --- (>\")> --- \n");
 		ast_moh_stop(chan);
 		break;
 	default:



More information about the asterisk-commits mailing list