[asterisk-commits] dvossel: branch dvossel/generic_aoc r257243 - in /team/dvossel/generic_aoc: a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 13 15:39:03 CDT 2010


Author: dvossel
Date: Tue Apr 13 15:39:01 2010
New Revision: 257243

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257243
Log:
AOC debug to include optional channel name 

Modified:
    team/dvossel/generic_aoc/apps/app_dial.c
    team/dvossel/generic_aoc/apps/app_queue.c
    team/dvossel/generic_aoc/channels/chan_sip.c
    team/dvossel/generic_aoc/channels/sig_pri.c
    team/dvossel/generic_aoc/include/asterisk/aoc.h
    team/dvossel/generic_aoc/main/aoc.c
    team/dvossel/generic_aoc/main/manager.c

Modified: team/dvossel/generic_aoc/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/apps/app_dial.c?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/apps/app_dial.c (original)
+++ team/dvossel/generic_aoc/apps/app_dial.c Tue Apr 13 15:39:01 2010
@@ -1019,7 +1019,7 @@
 					if (o->aoc_s_rate_list) {
 						size_t encoded_size;
 						struct ast_aoc_encoded *encoded;
-						if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size))) {
+						if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size, o->chan))) {
 							ast_indicate_data(in, AST_CONTROL_AOC, encoded, encoded_size);
 							ast_aoc_destroy_encoded(encoded);
 						}
@@ -1089,7 +1089,7 @@
 						if (o->aoc_s_rate_list) {
 							size_t encoded_size;
 							struct ast_aoc_encoded *encoded;
-							if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size))) {
+							if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size, o->chan))) {
 								ast_indicate_data(in, AST_CONTROL_AOC, encoded, encoded_size);
 								ast_aoc_destroy_encoded(encoded);
 							}
@@ -1210,7 +1210,7 @@
 					break;
 				case AST_CONTROL_AOC:
 					{
-						struct ast_aoc_decoded *decoded = ast_aoc_decode(f->data.ptr, f->datalen);
+						struct ast_aoc_decoded *decoded = ast_aoc_decode(f->data.ptr, f->datalen, o->chan);
 						if (decoded && (ast_aoc_get_msg_type(decoded) == AST_AOC_S)) {
 							ast_aoc_destroy_decoded(o->aoc_s_rate_list);
 							o->aoc_s_rate_list = decoded;

Modified: team/dvossel/generic_aoc/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/apps/app_queue.c?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/apps/app_queue.c (original)
+++ team/dvossel/generic_aoc/apps/app_queue.c Tue Apr 13 15:39:01 2010
@@ -3264,7 +3264,7 @@
 					if (o->aoc_s_rate_list) {
 						size_t encoded_size;
 						struct ast_aoc_encoded *encoded;
-						if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size))) {
+						if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size, o->chan))) {
 							ast_indicate_data(in, AST_CONTROL_AOC, encoded, encoded_size);
 							ast_aoc_destroy_encoded(encoded);
 						}
@@ -3377,7 +3377,7 @@
 								if (o->aoc_s_rate_list) {
 									size_t encoded_size;
 									struct ast_aoc_encoded *encoded;
-									if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size))) {
+									if ((encoded = ast_aoc_encode(o->aoc_s_rate_list, &encoded_size, o->chan))) {
 										ast_indicate_data(in, AST_CONTROL_AOC, encoded, encoded_size);
 										ast_aoc_destroy_encoded(encoded);
 									}
@@ -3452,7 +3452,7 @@
 							break;
 						case AST_CONTROL_AOC:
 							{
-								struct ast_aoc_decoded *decoded = ast_aoc_decode(f->data.ptr, f->datalen);
+								struct ast_aoc_decoded *decoded = ast_aoc_decode(f->data.ptr, f->datalen, o->chan);
 								if (decoded && (ast_aoc_get_msg_type(decoded) == AST_AOC_S)) {
 									ast_aoc_destroy_decoded(o->aoc_s_rate_list);
 									o->aoc_s_rate_list = decoded;

Modified: team/dvossel/generic_aoc/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/chan_sip.c?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/channels/chan_sip.c (original)
+++ team/dvossel/generic_aoc/channels/chan_sip.c Tue Apr 13 15:39:01 2010
@@ -6231,7 +6231,7 @@
 		break;
 	case AST_CONTROL_AOC:
 		{
-			struct ast_aoc_decoded *decoded = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen);
+			struct ast_aoc_decoded *decoded = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen, ast);
 			if (!decoded) {
 				ast_log(LOG_ERROR, "Error decoding indicated AOC data\n");
 				res = -1;

Modified: team/dvossel/generic_aoc/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/channels/sig_pri.c?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/channels/sig_pri.c (original)
+++ team/dvossel/generic_aoc/channels/sig_pri.c Tue Apr 13 15:39:01 2010
@@ -2199,7 +2199,7 @@
 		}
 	}
 
-	if (passthrough && (encoded = ast_aoc_encode(decoded, &encoded_size))) {
+	if (passthrough && (encoded = ast_aoc_encode(decoded, &encoded_size, owner))) {
 		ast_queue_control_data(owner, AST_CONTROL_AOC, encoded, encoded_size);
 	}
 
@@ -2355,7 +2355,7 @@
 		}
 	}
 
-	if (passthrough && (encoded = ast_aoc_encode(decoded, &encoded_size))) {
+	if (passthrough && (encoded = ast_aoc_encode(decoded, &encoded_size, owner))) {
 		ast_queue_control_data(owner, AST_CONTROL_AOC, encoded, encoded_size);
 	}
 
@@ -2474,7 +2474,7 @@
 		}
 	}
 
-	if (passthrough && owner && (encoded = ast_aoc_encode(decoded, &encoded_size))) {
+	if (passthrough && owner && (encoded = ast_aoc_encode(decoded, &encoded_size, owner))) {
 		ast_queue_control_data(owner, AST_CONTROL_AOC, encoded, encoded_size);
 	}
 
@@ -2780,7 +2780,7 @@
 
 	ast_aoc_set_termination_request(decoded);
 
-	if (!(encoded = ast_aoc_encode(decoded, &encoded_size))) {
+	if (!(encoded = ast_aoc_encode(decoded, &encoded_size, ast))) {
 		ast_aoc_destroy_decoded(decoded);
 		ast_softhangup_nolock(ast, AST_SOFTHANGUP_DEV);
 		return;
@@ -5754,7 +5754,7 @@
 	case AST_CONTROL_AOC:
 		#if defined(HAVE_PRI_AOC_EVENTS)
 		{
-			struct ast_aoc_decoded *decoded = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen);
+			struct ast_aoc_decoded *decoded = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen, chan);
 			ast_debug(1, "Received AST_CONTROL_AOC on %s\n", chan->name);
 			if (decoded && p->pri && !pri_grab(p, p->pri)) {
 				switch (ast_aoc_get_msg_type(decoded)) {

Modified: team/dvossel/generic_aoc/include/asterisk/aoc.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/include/asterisk/aoc.h?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/include/asterisk/aoc.h (original)
+++ team/dvossel/generic_aoc/include/asterisk/aoc.h Tue Apr 13 15:39:01 2010
@@ -213,21 +213,23 @@
  *
  * \param ast_aoc_encoded, the encoded payload to decode.
  * \param total size of encoded payload
+ * \param ast channel, Optional for DEBUG output purposes
  *
  * \retval heap allocated ast_aoc_decoded object ptr on success
  * \retval NULL failure
  */
-struct ast_aoc_decoded *ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size);
+struct ast_aoc_decoded *ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan);
 
 /*! \brief encodes a decoded aoc structure so it can be passed on the wire
  *
  * \param ast_aoc_decoded struct to be encoded
  * \param output parameter representing size of encoded data
+ * \param ast channel, Optional for DEBUG output purposes
  *
  * \retval pointer to encoded data
  * \retval NULL failure
  */
-struct ast_aoc_encoded *ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size);
+struct ast_aoc_encoded *ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan);
 
 /*! \brief Sets the type of total for a AOC-D message
  *

Modified: team/dvossel/generic_aoc/main/aoc.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/main/aoc.c?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/main/aoc.c (original)
+++ team/dvossel/generic_aoc/main/aoc.c Tue Apr 13 15:39:01 2010
@@ -55,7 +55,7 @@
 
 
 static char aoc_debug_enabled = 0;
-static void aoc_display_decoded_debug(const struct ast_aoc_decoded *decoded, int decoding);
+static void aoc_display_decoded_debug(const struct ast_aoc_decoded *decoded, int decoding, struct ast_channel *chan);
 static int aoc_s_add_entry(struct ast_aoc_decoded *decoded, struct ast_aoc_s_entry *entry);
 
 /* AOC Payload Header. Holds all the encoded AOC data to pass on the wire */
@@ -310,7 +310,7 @@
 	return 0;
 }
 
-struct ast_aoc_decoded *ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size)
+struct ast_aoc_decoded *ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
 {
 	struct ast_aoc_decoded *decoded;
 
@@ -367,7 +367,7 @@
 	aoc_parse_ie(decoded, encoded->data, ntohs(encoded->datalen));
 
 	if (aoc_debug_enabled) {
-		aoc_display_decoded_debug(decoded, 1);
+		aoc_display_decoded_debug(decoded, 1, chan);
 	}
 
 	return decoded;
@@ -503,7 +503,7 @@
 	}
 }
 
-struct ast_aoc_encoded *ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size)
+struct ast_aoc_encoded *ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan)
 {
 	struct aoc_ie_data ied;
 	struct ast_aoc_encoded *encoded = NULL;
@@ -590,7 +590,7 @@
 	*out_size = size;
 
 	if (aoc_debug_enabled) {
-		aoc_display_decoded_debug(decoded, 0);
+		aoc_display_decoded_debug(decoded, 0, chan);
 	}
 
 	return encoded;
@@ -1153,11 +1153,11 @@
 	size_t size;
 	int res = 0;
 
-	if (!(encoded = ast_aoc_encode(decoded, &size))) {
+	if (!(encoded = ast_aoc_encode(decoded, &size, NULL))) {
 		return -1;
 	}
 
-	if (!(new = ast_aoc_decode(encoded, size))) {
+	if (!(new = ast_aoc_decode(encoded, size, NULL))) {
 		ast_free(encoded);
 		return -1;
 	}
@@ -1257,10 +1257,10 @@
 		if (decoded->request_flag & AST_AOC_REQUEST_E) {
 			ast_str_append(msg, 0, "E");
 		}
-		ast_str_append(msg, 0, "AOCRequest: \r\n");
+		ast_str_append(msg, 0, "\r\n");
 
 	} else {
-		ast_str_append(msg, 0, "AOCRequest: NONE");
+		ast_str_append(msg, 0, "AOCRequest: NONE\r\n");
 	}
 }
 
@@ -1506,12 +1506,21 @@
 	return 0;
 }
 
-static void aoc_display_decoded_debug(const struct ast_aoc_decoded *decoded, int decoding)
+static void aoc_display_decoded_debug(const struct ast_aoc_decoded *decoded, int decoding, struct ast_channel *chan)
 {
 	struct ast_str *msg;
 
 	if (!decoded || !(msg = ast_str_create(1024))) {
 		return;
+	}
+
+	if (decoding) {
+		ast_str_append(&msg, 0, "---- DECODED AOC MSG ----\r\n");
+	} else {
+		ast_str_append(&msg, 0, "---- ENCODED AOC MSG ----\r\n");
+	}
+	if (chan) {
+		ast_str_append(&msg, 0, "CHANNEL: %s\r\n", chan->name);
 	}
 
 	if (ast_aoc_decoded2str(decoded, &msg)) {
@@ -1519,11 +1528,6 @@
 		return;
 	}
 
-	if (decoding) {
-		ast_verb(1, "---- DECODED AOC MSG ----\r\n");
-	} else {
-		ast_verb(1, "---- ENCODED AOC MSG ----\r\n");
-	}
 	ast_verb(1, "%s\r\n", ast_str_buffer(msg));
 	ast_free(msg);
 }

Modified: team/dvossel/generic_aoc/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/generic_aoc/main/manager.c?view=diff&rev=257243&r1=257242&r2=257243
==============================================================================
--- team/dvossel/generic_aoc/main/manager.c (original)
+++ team/dvossel/generic_aoc/main/manager.c Tue Apr 13 15:39:01 2010
@@ -3731,7 +3731,7 @@
 	ast_aoc_set_total_type(decoded, _totaltype);
 
 
-	if ((encoded = ast_aoc_encode(decoded, &encoded_size)) && !ast_indicate_data(chan, AST_CONTROL_AOC, encoded, encoded_size)) {
+	if ((encoded = ast_aoc_encode(decoded, &encoded_size, NULL)) && !ast_indicate_data(chan, AST_CONTROL_AOC, encoded, encoded_size)) {
 		astman_send_ack(s, m, "AOC Message successfully queued on channel");
 	} else {
 		astman_send_error(s, m, "Error encoding AOC message, could not queue onto channel");




More information about the asterisk-commits mailing list