[asterisk-commits] mattf: branch mattf/asterisk-ss7 r40056 - /team/mattf/asterisk-ss7/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Aug 16 11:56:06 MST 2006


Author: mattf
Date: Wed Aug 16 13:56:06 2006
New Revision: 40056

URL: http://svn.digium.com/view/asterisk?rev=40056&view=rev
Log:
Add debug support

Modified:
    team/mattf/asterisk-ss7/channels/chan_zap.c

Modified: team/mattf/asterisk-ss7/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/mattf/asterisk-ss7/channels/chan_zap.c?rev=40056&r1=40055&r2=40056&view=diff
==============================================================================
--- team/mattf/asterisk-ss7/channels/chan_zap.c (original)
+++ team/mattf/asterisk-ss7/channels/chan_zap.c Wed Aug 16 13:56:06 2006
@@ -10769,6 +10769,7 @@
 	return 0;
 }
 
+#ifdef HAVE_SS7
 static int linkset_addsigchan(int sigchan)
 {
 	struct zt_ss7 *link;
@@ -10885,6 +10886,64 @@
 
 	return 0;
 }
+
+static int handle_ss7_no_debug(int fd, int argc, char *argv[])
+{
+	int span;
+	if (argc < 5)
+		return RESULT_SHOWUSAGE;
+	span = atoi(argv[4]);
+	if ((span < 1) || (span > NUM_SPANS)) {
+		ast_cli(fd, "Invalid linkset %s.  Should be a number %d to %d\n", argv[4], 1, NUM_SPANS);
+		return RESULT_SUCCESS;
+	}
+	if (!linksets[span-1].ss7) {
+		ast_cli(fd, "No SS7 running on linkset %d\n", span);
+		return RESULT_SUCCESS;
+	}
+	if (linksets[span-1].ss7)
+		ss7_set_debug(linksets[span-1].ss7, 0);
+
+	ast_cli(fd, "Disabled debugging on linkset %d\n", span);
+	return RESULT_SUCCESS;
+}
+
+static int handle_ss7_debug(int fd, int argc, char *argv[])
+{
+	int span;
+	if (argc < 5)
+		return RESULT_SHOWUSAGE;
+	span = atoi(argv[4]);
+	if ((span < 1) || (span > NUM_SPANS)) {
+		ast_cli(fd, "Invalid linkset %s.  Should be a number %d to %d\n", argv[4], 1, NUM_SPANS);
+		return RESULT_SUCCESS;
+	}
+	if (!linksets[span-1].ss7) {
+		ast_cli(fd, "No SS7 running on linkset %d\n", span);
+		return RESULT_SUCCESS;
+	}
+	if (linksets[span-1].ss7)
+		ss7_set_debug(linksets[span-1].ss7, SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP);
+
+	ast_cli(fd, "Enabled debugging on linkset %d\n", span);
+	return RESULT_SUCCESS;
+}
+
+static const char ss7_debug_help[] = 
+	"Usage: ss7 debug linkset <linkset>\n"
+	"       Enables debugging on a given SS7 linkset\n";
+	
+static const char ss7_no_debug_help[] = 
+	"Usage: ss7 no debug linkset <span>\n"
+	"       Disables debugging on a given SS7 linkset\n";
+
+static struct ast_cli_entry zap_ss7_cli[] = {
+	{ { "ss7", "debug", "linkset", NULL }, handle_ss7_debug,
+	  "Enables SS7 debugging on a linkset", ss7_debug_help, NULL },
+	{ { "ss7", "no", "debug", "linkset", NULL }, handle_ss7_no_debug,
+	  "Disables SS7 debugging on a linkset", ss7_no_debug_help, NULL },
+};
+#endif /* HAVE_SS7 */
 
 static int unload_module(void *mod)
 {
@@ -11834,6 +11893,10 @@
 	ast_string_field_set(&inuse, name, "GR-303InUse");
 	ast_cli_register_multiple(zap_pri_cli, sizeof(zap_pri_cli) / sizeof(zap_pri_cli[0]));
 #endif	
+#ifdef HAVE_SS7
+	ast_cli_register_multiple(zap_ss7_cli, sizeof(zap_ss7_cli) / sizeof(zap_ss7_cli[0]));
+#endif
+
 	ast_cli_register_multiple(zap_cli, sizeof(zap_cli) / sizeof(zap_cli[0]));
 	
 	memset(round_robin, 0, sizeof(round_robin));



More information about the asterisk-commits mailing list