[svn-commits] jdixon: branch jdixon/chan_usbradio-1.4 r115604 - /team/jdixon/chan_usbradio-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun May 11 18:16:19 CDT 2008


Author: jdixon
Date: Sun May 11 18:16:19 2008
New Revision: 115604

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115604
Log:
Update to version 0.114, added initial support for version 1.6 and other stuff

Modified:
    team/jdixon/chan_usbradio-1.4/apps/app_rpt.c

Modified: team/jdixon/chan_usbradio-1.4/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/apps/app_rpt.c?view=diff&rev=115604&r1=115603&r2=115604
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Sun May 11 18:16:19 2008
@@ -1,3 +1,4 @@
+/* #define	NEW_ASTERISK */
 /* #define OLD_ASTERISK */
 /*
  * Asterisk -- An open source telephony toolkit.
@@ -20,7 +21,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.113 5/11/08 
+ *  version 0.112 4/13/08 2055 EDT
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -363,12 +364,17 @@
 #include "asterisk/manager.h"
 #include <termios.h>
 
+#ifdef	NEW_ASTERISK
+struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
+#endif
+
+
 /* Start a tone-list going */
 int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.113  5/11/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.112  4/13/2008";
 
 static char *app = "Rpt";
 
@@ -1216,6 +1222,8 @@
 "Usage: rpt cmd <nodename> <cmd-name> <cmd-index> <cmd-args.\n"
 "       Send a command to a node.\n        i.e. rpt cmd 2000 ilink 3 2001\n";
 
+#ifndef	NEW_ASTERISK
+
 static struct ast_cli_entry  cli_debug =
         { { "rpt", "debug", "level" }, rpt_do_debug, 
 		"Enable app_rpt debugging", debug_usage };
@@ -1259,6 +1267,8 @@
 static struct ast_cli_entry  cli_cmd =
         { { "rpt", "cmd" }, rpt_do_cmd,
 		"Execute a DTMF function", cmd_usage };
+
+#endif
 
 /*
 * Telemetry defaults
@@ -1528,7 +1538,11 @@
                        l = l->next;
                        continue;
                }
+#ifdef	NEW_ASTERISK
+               if (l->chan) ast_senddigit(l->chan,c,0);
+#else
                if (l->chan) ast_senddigit(l->chan,c);
+#endif
                l = l->next;
        }
        return;
@@ -1592,6 +1606,9 @@
 	/* if at timeout */
 	if (myrpt->dtmf_local_timer == 1)
 	{
+		if(debug > 6)
+			ast_log(LOG_NOTICE,"time out dtmf_local_timer=%i\n",myrpt->dtmf_local_timer);
+
 		/* if anything in the string */
 		if (myrpt->dtmf_local_str[0])
 		{
@@ -1988,7 +2005,11 @@
 	if (mystat.st_mtime > last)
 	{
 		if (ourcfg) ast_config_destroy(ourcfg);
+#ifdef	NEW_ASTERISK
+		ourcfg = ast_config_load(myrpt->p.extnodefile,config_flags);
+#else
 		ourcfg = ast_config_load(myrpt->p.extnodefile);
+#endif
 		/* if file not there, just bail */
 		if (!ourcfg)
 		{
@@ -2144,6 +2165,18 @@
 
 */
 
+#ifdef	NEW_ASTERISK
+static void rpt_localtime( time_t * t, struct ast_tm *lt)
+{
+struct timeval tv;
+
+	tv.tv_sec = *t;
+	tv.tv_usec = 0;
+	ast_localtime(&tv, lt, NULL);
+
+}
+
+#else
 static void rpt_localtime( time_t * t, struct tm *lt)
 {
 #ifdef OLD_ASTERISK
@@ -2152,6 +2185,8 @@
 	ast_localtime(t, lt, NULL);
 #endif
 }
+#endif
+
 
 /* Retrieve an int from a config file */
                                                                                 
@@ -2198,7 +2233,11 @@
 			(init) ? "Loading initial" : "Re-Loading",rpt_vars[n].name);
 	ast_mutex_lock(&rpt_vars[n].lock);
 	if (rpt_vars[n].cfg) ast_config_destroy(rpt_vars[n].cfg);
+#ifdef	NEW_ASTERISK
+	cfg = ast_config_load("rpt.conf",config_flags);
+#else
 	cfg = ast_config_load("rpt.conf");
+#endif
 	if (!cfg) {
 		ast_mutex_unlock(&rpt_vars[n].lock);
  		ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf.  Radio Repeater disabled.\n");
@@ -3229,6 +3268,192 @@
 	return play_tone_pair(chan, 0, 0, duration, 0);
 }
 
+#ifdef	NEW_ASTERISK
+
+static char *res2cli(int r)
+
+{
+	switch (r)
+	{
+	    case RESULT_SUCCESS:
+		return(CLI_SUCCESS);
+	    case RESULT_SHOWUSAGE:
+		return(CLI_SHOWUSAGE);
+	    default:
+		return(CLI_FAILURE);
+	}
+}
+
+static char *handle_cli_debug(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt debug level";
+                e->usage = debug_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_debug(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_dump(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt dump level";
+                e->usage = dump_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_dump(a->fd,a->argc,a->argv));
+}
+
+
+static char *handle_cli_stats(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt stats";
+                e->usage = dump_stats;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_stats(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_nodes(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt nodes";
+                e->usage = dump_nodes;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_nodes(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_local_nodes(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt localnodes";
+                e->usage = usage_local_nodes;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_local_nodes(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_lstats(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt lstats";
+                e->usage = dump_lstats;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_lstats(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_reload(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt reload";
+                e->usage = reload_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_reload(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_restart(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt restart";
+                e->usage = restart_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_restart(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_fun(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt fun";
+                e->usage = fun_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_fun(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_fun1(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt fun1";
+                e->usage = fun_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_fun1(a->fd,a->argc,a->argv));
+}
+
+static char *handle_cli_cmd(struct ast_cli_entry *e,
+	int cmd, struct ast_cli_args *a)
+{
+        switch (cmd) {
+        case CLI_INIT:
+                e->command = "rpt cmd";
+                e->usage = cmd_usage;
+                return NULL;
+        case CLI_GENERATE:
+                return NULL;
+	}
+	return res2cli(rpt_do_cmd(a->fd,a->argc,a->argv));
+}
+
+static struct ast_cli_entry rpt_cli[] = {
+	AST_CLI_DEFINE(handle_cli_debug,"Enable app_rpt debugging"),
+	AST_CLI_DEFINE(handle_cli_dump,"Dump app_rpt structs for debugging"),
+	AST_CLI_DEFINE(handle_cli_stats,"Dump node statistics"),
+	AST_CLI_DEFINE(handle_cli_nodes,"Dump node list"),
+	AST_CLI_DEFINE(handle_cli_local_nodes,	"Dump list of local node numbers"),
+	AST_CLI_DEFINE(handle_cli_lstats,"Dump link statistics"),
+	AST_CLI_DEFINE(handle_cli_reload,"Reload app_rpt config"),
+	AST_CLI_DEFINE(handle_cli_restart,"Restart app_rpt"),
+	AST_CLI_DEFINE(handle_cli_fun,"Execute a DTMF function"),
+	AST_CLI_DEFINE(handle_cli_fun1,"Execute a DTMF function"),
+	AST_CLI_DEFINE(handle_cli_cmd,"Execute a DTMF function")
+};
+
+#endif
 
 static int send_morse(struct ast_channel *chan, char *string, int speed, int freq, int amplitude)
 {
@@ -3690,14 +3915,12 @@
 /*
 * Wait a configurable interval of time 
 */
-
-
 static void wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan)
 {
 	int interval;
 	interval = get_wait_interval(myrpt, type);
 	if(debug)
-		ast_log(LOG_NOTICE," Delay interval = %d\n", interval);
+		ast_log(LOG_NOTICE,"Delay interval = %d\n", interval);
 	if(interval)
 		ast_safe_sleep(chan,interval);
 	if(debug)
@@ -3719,7 +3942,11 @@
 int id_malloc, vmajor, vminor, m;
 char *p,*ct,*ct_copy,*ident, *nodename,*cp;
 time_t t;
+#ifdef	NEW_ASTERISK
+struct ast_tm localtm;
+#else
 struct tm localtm;
+#endif
 char lbuf[MAXLINKLIST],*strs[MAXLINKLIST];
 int	i,ns,rbimode;
 char mhz[MAXREMSTR];
@@ -3735,14 +3962,14 @@
 	rpt_mutex_lock(&myrpt->lock);
 	nodename = ast_strdup(myrpt->name);
 	if(!nodename)
-        {
-                fprintf(stderr,"rpt:Sorry unable strdup nodename\n");
-                rpt_mutex_lock(&myrpt->lock);
-                remque((struct qelem *)mytele);
-                ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-                rpt_mutex_unlock(&myrpt->lock);
-                ast_free(mytele);
-                pthread_exit(NULL);
+	{
+	    fprintf(stderr,"rpt:Sorry unable strdup nodename\n");
+	    rpt_mutex_lock(&myrpt->lock);
+	    remque((struct qelem *)mytele);
+	    ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
+	    rpt_mutex_unlock(&myrpt->lock);
+	    ast_free(mytele);
+	    pthread_exit(NULL);
 	}
 
 	if (myrpt->p.ident){
@@ -4985,6 +5212,9 @@
 pthread_attr_t attr;
 char *v1, *v2;
 
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"mode=%i  data=%s\n",mode, (char *)data);
+
 	switch(mode)
 	{
 	    case UNKEY:
@@ -5316,7 +5546,11 @@
 			wf.subclass = myrpt->mydtmf;
 			rpt_mutex_unlock(&myrpt->lock);
 			ast_queue_frame(mychannel,&wf);
+#ifdef	NEW_ASTERISK
+			ast_senddigit(genchannel,myrpt->mydtmf,0);
+#else
 			ast_senddigit(genchannel,myrpt->mydtmf);
+#endif
 			rpt_mutex_lock(&myrpt->lock);
 			myrpt->mydtmf = 0;
 		}
@@ -5419,15 +5653,16 @@
 	return;
 }
 
-/* send newkey message */
+/* send newkey request */
 
 static void send_newkey(struct ast_channel *chan)
 {
 
-        ast_safe_sleep(chan,10);
-        ast_sendtext(chan,newkeystr);
-        return;
-}
+	ast_safe_sleep(chan,10);
+	ast_sendtext(chan,newkeystr);
+	return;
+}
+
 
 /* 
  * Connect a link 
@@ -6348,19 +6583,20 @@
 /*
 * Collect digits one by one until something matches
 */
-
 static int collect_function_digits(struct rpt *myrpt, char *digits, 
 	int command_source, struct rpt_link *mylink)
 {
-	int i;
+	int i,rv;
 	char *stringp,*action,*param,*functiondigits;
 	char function_table_name[30] = "";
 	char workstring[200];
 	
 	struct ast_variable *vp;
 	
-	if(debug)	
-		printf("@@@@ Digits collected: %s, source: %d\n", digits, command_source);
+	if (debug > 6) ast_log(LOG_NOTICE,"digits=%s  source=%d\n",digits, command_source);
+
+	//if(debug)	
+	//	printf("@@@@ Digits collected: %s, source: %d\n", digits, command_source);
 	
 	if (command_source == SOURCE_DPHONE) {
 		if (!myrpt->p.dphone_functions) return DC_INDETERMINATE;
@@ -6378,12 +6614,14 @@
 		strncpy(function_table_name, myrpt->p.link_functions, sizeof(function_table_name) - 1);
 	else
 		strncpy(function_table_name, myrpt->p.functions, sizeof(function_table_name) - 1);
+    /* find context for function table in rpt.conf file */
 	vp = ast_variable_browse(myrpt->cfg, function_table_name);
 	while(vp) {
 		if(!strncasecmp(vp->name, digits, strlen(vp->name)))
 			break;
 		vp = vp->next;
 	}	
+	/* if function context not found */
 	if(!vp) {
 		int n;
 
@@ -6426,7 +6664,9 @@
 		return DC_ERROR;
 	}
 	functiondigits = digits + strlen(vp->name);
-	return (*function_table[i].function)(myrpt, param, functiondigits, command_source, mylink);
+	rv=(*function_table[i].function)(myrpt, param, functiondigits, command_source, mylink);
+	if (debug > 6) ast_log(LOG_NOTICE,"rv=%i\n",rv);
+	return(rv);
 }
 
 
@@ -8342,52 +8582,47 @@
 */
 
 /* Check to see that the frequency is valid */
-/* Hard coded limits now, configurable later, maybe? */
-
+/* returns 0 if frequency is valid          */
 
 static int check_freq_ic706(int m, int d, int *defmode, char mars)
 {
 	int dflmd = REM_MODE_FM;
-
-	if(debug)
-		printf("check_freq_ic706(%i,%i,%i,%i)\n",m,d,*defmode,mars);
-
-	if(m == 1){ /* 160 meters */
+	int rv=0;
+
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"(%i,%i,%i,%i)\n",m,d,*defmode,mars);
+
+	/* first test for standard amateur radio bands */
+
+	if(m == 1){ 					/* 160 meters */
 		dflmd =	REM_MODE_LSB; 
-		if(d < 80000)
-			return -1;
-	}
-	else if(m == 3){ /* 80 meters */
+		if(d < 80000)rv=-1;
+	}
+	else if(m == 3){ 				/* 80 meters */
 		dflmd = REM_MODE_LSB;
-		if(d < 50000)
-			return -1;
-	}
-	else if(m == 7){ /* 40 meters */
+		if(d < 50000)rv=-1;
+	}
+	else if(m == 7){ 				/* 40 meters */
 		dflmd = REM_MODE_LSB;
-		if(d > 30000)
-			return -1;
-	}
-	else if(m == 14){ /* 20 meters */
+		if(d > 30000)rv=-1;
+	}
+	else if(m == 14){ 				/* 20 meters */
 		dflmd = REM_MODE_USB;
-		if(d > 35000)
-			return -1;
-	}
-	else if(m == 18){ /* 17 meters */
+		if(d > 35000)rv=-1;
+	}
+	else if(m == 18){ 							/* 17 meters */
 		dflmd = REM_MODE_USB;
-		if((d < 6800) || (d > 16800))
-			return -1;
+		if((d < 6800) || (d > 16800))rv=-1;
 	}
 	else if(m == 21){ /* 15 meters */
 		dflmd = REM_MODE_USB;
-		if((d < 20000) || (d > 45000))
-			return -1;
+		if((d < 20000) || (d > 45000))rv=-1;
 	}
 	else if(m == 24){ /* 12 meters */
 		dflmd = REM_MODE_USB;
-		if((d < 89000) || (d > 99000))
-			return -1;
-	}
-	else if(m == 28){ /* 10 meters */
+		if((d < 89000) || (d > 99000))rv=-1;
+	}
+	else if(m == 28){ 							/* 10 meters */
 		dflmd = REM_MODE_USB;
 	}
 	else if(m == 29){ 
@@ -8395,15 +8630,13 @@
 			dflmd = REM_MODE_FM;
 		else
 			dflmd = REM_MODE_USB;
-		if(d > 70000)
-			return -1;
-	}
-	else if(m == 50){ /* 6 meters */
+		if(d > 70000)rv=-1;
+	}
+	else if(m == 50){ 							/* 6 meters */
 		if(d >= 30000)
 			dflmd = REM_MODE_FM;
 		else
 			dflmd = REM_MODE_USB;
-
 	}
 	else if((m >= 51) && ( m < 54)){
 		dflmd = REM_MODE_FM;
@@ -8417,53 +8650,56 @@
 	else if((m >= 145) && (m < 148)){
 		dflmd = REM_MODE_FM;
 	}
-	else if((m >= 430) && (m < 450)){ /* 70 centimeters */
+	else if((m >= 430) && (m < 450)){ 			/* 70 centimeters */
 		if(m  < 438)
 			dflmd = REM_MODE_USB;
 		else
 			dflmd = REM_MODE_FM;
-		;
-	}
-	// expanded coverage
-	if(mars){
-		if((m >= 450) && (m < 470)){ /* LMR */
+	}
+
+	/* check expanded coverage */
+	if(mars && rv<0){
+		if((m >= 450) && (m < 470)){ 			/* LMR */
 			dflmd = REM_MODE_FM;
-		}
-		else if((m >= 148) && (m < 174)){ /* LMR */
+			rv=0;
+		}
+		else if((m >= 148) && (m < 174)){ 		/* LMR */
 			dflmd = REM_MODE_FM;
-		}
-		else if((m >= 138) && (m < 144)){ /* VHF-AM AIRCRAFT */
+			rv=0;
+		}
+		else if((m >= 138) && (m < 144)){ 		/* VHF-AM AIRCRAFT */
 			dflmd = REM_MODE_AM;
-		}
-		else if((m >= 108) && (m < 138)){ /* VHF-AM AIRCRAFT */
+			rv=0;
+		}
+		else if((m >= 108) && (m < 138)){ 		/* VHF-AM AIRCRAFT */
 			dflmd = REM_MODE_AM;
-		}
-		else if( (m==0 && d>=55000) || (m==1 && d<=75000) ){ /* AM BCB*/
+			rv=0;
+		}
+		else if( (m==0 && d>=55000) || (m==1 && d<=75000) ){ 	/* AM BCB*/
 			dflmd = REM_MODE_AM;
-		}
-  		else if( (m == 1 && d>75000) || (m>1 && m<30) ){ /* HF SWL*/
+			rv=0;
+		}
+  		else if( (m == 1 && d>75000) || (m>1 && m<30) ){ 		/* HF SWL*/
 			dflmd = REM_MODE_AM;
-		}
-		else
-			return -1;
-	}
-	else
-		return -1;
+			rv=0;
+		}
+	}
 
 	if(defmode)
 		*defmode = dflmd;
 
-	if(debug)
-		printf("check_freq_ic706(%i,%i,%i,%i) return 0\n",m,d,*defmode,mars);
-
-	return 0;
+	if(debug > 1)
+		ast_log(LOG_NOTICE,"(%i,%i,%i,%i) returning %i\n",m,d,*defmode,mars,rv);
+
+	return rv;
 }
 
 /* take a PL frequency and turn it into a code */
 static int ic706_pltocode(char *str)
 {
-int i;
-char *s;
+	int i;
+	char *s;
+	int rv=-1;
 
 	s = strchr(str,'.');
 	i = 0;
@@ -8472,107 +8708,110 @@
 	switch(i)
 	{
 	    case 670:
-		return 0;
+			rv=0;
 	    case 693:
-		return 1;
+			rv=1;
 	    case 719:
-		return 2;
+			rv=2;
 	    case 744:
-		return 3;
+			rv=3;
 	    case 770:
-		return 4;
+			rv=4;
 	    case 797:
-		return 5;
+			rv=5;
 	    case 825:
-		return 6;
+			rv=6;
 	    case 854:
-		return 7;
+			rv=7;
 	    case 885:
-		return 8;
+			rv=8;
 	    case 915:
-		return 9;
+			rv=9;
 	    case 948:
-		return 10;
+			rv=10;
 	    case 974:
-		return 11;
+			rv=11;
 	    case 1000:
-		return 12;
+			rv=12;
 	    case 1035:
-		return 13;
+			rv=13;
 	    case 1072:
-		return 14;
+			rv=14;
 	    case 1109:
-		return 15;
+			rv=15;
 	    case 1148:
-		return 16;
+			rv=16;
 	    case 1188:
-		return 17;
+			rv=17;
 	    case 1230:
-		return 18;
+			rv=18;
 	    case 1273:
-		return 19;
+			rv=19;
 	    case 1318:
-		return 20;
+			rv=20;
 	    case 1365:
-		return 21;
+			rv=21;
 	    case 1413:
-		return 22;
+			rv=22;
 	    case 1462:
-		return 23;
+			rv=23;
 	    case 1514:
-		return 24;
+			rv=24;
 	    case 1567:
-		return 25;
+			rv=25;
 	    case 1598:
-		return 26;
+			rv=26;
 	    case 1622:
-		return 27;
+			rv=27;
 	    case 1655:
-		return 28;		
+			rv=28;		
 	    case 1679:
-		return 29;
+			rv=29;
 	    case 1713:
-		return 30;
+			rv=30;
 	    case 1738:
-		return 31;
+			rv=31;
 	    case 1773:
-		return 32;
+			rv=32;
 	    case 1799:
-		return 33;
-            case 1835:
-		return 34;
+			rv=33;
+        case 1835:
+			rv=34;
 	    case 1862:
-		return 35;
+			rv=35;
 	    case 1899:
-		return 36;
+			rv=36;
 	    case 1928:
-		return 37;
+			rv=37;
 	    case 1966:
-		return 38;
+			rv=38;
 	    case 1995:
-		return 39;
+			rv=39;
 	    case 2035:
-		return 40;
+			rv=40;
 	    case 2065:
-		return 41;
+			rv=41;
 	    case 2107:
-		return 42;
+			rv=42;
 	    case 2181:
-		return 43;
+			rv=43;
 	    case 2257:
-		return 44;
+			rv=44;
 	    case 2291:
-		return 45;
+			rv=45;
 	    case 2336:
-		return 46;
+			rv=46;
 	    case 2418:
-		return 47;
+			rv=47;
 	    case 2503:
-		return 48;
+			rv=48;
 	    case 2541:
-		return 49;
-	}
-	return -1;
+			rv=49;
+	}
+	if(debug > 1)
+		ast_log(LOG_NOTICE,"%i  rv=%i\n",i, rv);
+
+	return rv;
 }
 
 /* ic-706 simple commands */
@@ -8603,7 +8842,7 @@
 
 	fd = 0;
 	if(debug) 
-		printf("New frequency: %s\n",newfreq);
+		ast_log(LOG_NOTICE,"newfreq:%s\n",newfreq); 			
 
 	if(split_freq(mhz, decimals, newfreq))
 		return -1; 
@@ -8633,6 +8872,9 @@
 {
 	unsigned char c;
 
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"offset=%i\n",offset);
+
 	switch(offset){
 		case	REM_SIMPLEX:
 			c = 0x10;
@@ -8660,6 +8902,9 @@
 {
 	unsigned char c;
 	
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"newmode=%i\n",newmode);
+
 	switch(newmode){
 		case	REM_MODE_FM:
 			c = 5;
@@ -8689,6 +8934,9 @@
 {
 	unsigned char cmdstr[10];
 	int rv;
+
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"txplon=%i  rxplon=%i \n",txplon,rxplon);
 
 	cmdstr[0] = cmdstr[1] = 0xfe;
 	cmdstr[2] = myrpt->p.civaddr;
@@ -8722,6 +8970,9 @@
 	int h,d,rv;
 
 	memset(cmdstr, 0, 5);
+
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"txtone=%s  rxtone=%s \n",txtone,rxtone);
 
 	if(split_ctcss_freq(hertz, decimal, txtone))
 		return -1; 
@@ -9015,11 +9266,12 @@
 
 /*
  * Check TX frequency before transmitting
- */
+   rv=1 if tx frequency in ok.
+*/
 
 static char check_tx_freq(struct rpt *myrpt)
 {
-	int i;
+	int i,rv=0;
 	int radio_mhz, radio_decimals, ulimit_mhz, ulimit_decimals, llimit_mhz, llimit_decimals;
 	char radio_mhz_char[MAXREMSTR];
 	char radio_decimals_char[MAXREMSTR];
@@ -9029,13 +9281,17 @@
 	char *limit_ranges[40];
 	struct ast_variable *limitlist;
 	
+	if(debug > 3){
+		ast_log(LOG_NOTICE, "myrpt->freq = %s\n", myrpt->freq);
+	}
 
 	/* Must have user logged in and tx_limits defined */
 
 	if(!myrpt->p.txlimitsstanzaname || !myrpt->loginuser[0] || !myrpt->loginlevel[0]){
 		if(debug > 3){
-			ast_log(LOG_NOTICE, "No tx band table defined, or no user logged in\n");
-		}
+			ast_log(LOG_NOTICE, "No tx band table defined, or no user logged in. rv=1\n");
+		}
+		rv=1;
 		return 1; /* Assume it's ok otherwise */
 	}
 
@@ -9043,7 +9299,8 @@
 	limitlist = ast_variable_browse(myrpt->cfg, myrpt->p.txlimitsstanzaname);
 
 	if(!limitlist){
-		ast_log(LOG_WARNING, "No entries in %s band table stanza\n", myrpt->p.txlimitsstanzaname);
+		ast_log(LOG_WARNING, "No entries in %s band table stanza. rv=0\n", myrpt->p.txlimitsstanzaname);
+		rv=0;
 		return 0;
 	}
 
@@ -9051,7 +9308,6 @@
 	radio_mhz = atoi(radio_mhz_char);
 	radio_decimals = decimals2int(radio_decimals_char);
 
-
 	if(debug > 3){
 		ast_log(LOG_NOTICE, "Login User = %s, login level = %s\n", myrpt->loginuser, myrpt->loginlevel);
 	}
@@ -9064,12 +9320,13 @@
 	}
 
 	if(!limitlist){
-		ast_log(LOG_WARNING, "Can't find %s entry in band table stanza %s\n", myrpt->loginlevel, myrpt->p.txlimitsstanzaname);
-		return 0;
+		ast_log(LOG_WARNING, "Can't find %s entry in band table stanza %s. rv=0\n", myrpt->loginlevel, myrpt->p.txlimitsstanzaname);
+		rv=0;
+	    return 0;
 	}
 	
 	if(debug > 3){
-		ast_log(LOG_NOTICE, "Auth %s = %s\n", limitlist->name, limitlist->value);
+		ast_log(LOG_NOTICE, "Auth: %s = %s\n", limitlist->name, limitlist->value);
 	}
 
 	/* Parse the limits */
@@ -9082,14 +9339,14 @@
 		char *r,*s;
 		strncpy(range, limit_ranges[i], 40);
 		range[39] = 0;
-                if(debug > 3){
-			ast_log(LOG_NOTICE, "Checking to see if %s is within limits of %s\n", myrpt->freq, range);
-                }        
+        if(debug > 3) 
+        	ast_log(LOG_NOTICE, "Check %s within %s\n", myrpt->freq, range);
 	
 		r = strchr(range, '-');
 		if(!r){
-			ast_log(LOG_WARNING, "Malformed range in %s tx band table entry\n", limitlist->name);
-			return 0;
+			ast_log(LOG_WARNING, "Malformed range in %s tx band table entry. rv=0\n", limitlist->name);
+			rv=0;
+			break;
 		}
 		*r++ = 0;
 		s = eatwhite(range);
@@ -9106,41 +9363,53 @@
 				if(radio_decimals >= llimit_decimals){ /* Cannot be below llimit decimals */
 					if(llimit_mhz == ulimit_mhz){ /* If bandwidth < 1Mhz, check ulimit decimals */
 						if(radio_decimals <= ulimit_decimals){
-							return 1;
+							rv=1;
+							break;
 						}
 						else{
 							if(debug > 3)
 								ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 1\n");
-							return 0;
+							rv=0;
+							break;
 						}
 					}
 					else{
-						return 1;
+						rv=1;
+						break;
 					}
 				}
 				else{ /* Is below llimit decimals */
 					if(debug > 3)
 						ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 2\n");
-					return 0;
+					rv=0;
+					break;
 				}
 			}
 			else if(radio_mhz == ulimit_mhz){ /* CASE 2: TX freq not in llimit mhz portion of band */
 				if(radio_decimals <= ulimit_decimals){
-					return 1;
+					if(debug > 3)
+						ast_log(LOG_NOTICE, "radio_decimals <= ulimit_decimals\n");
+					rv=1;
+					break;
 				}
 				else{ /* Is above ulimit decimals */
 					if(debug > 3)
 						ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 3\n");
-					return 0;
+					rv=0;
+					break;
 				}
 			}
 			else /* CASE 3: TX freq within a multi-Mhz band and ok */
-				return 1; 
-		}
-	}
-	if(debug > 3) /* No match found in TX band table */
-		ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 4\n");
-	return 0;
+				if(debug > 3)
+						ast_log(LOG_NOTICE, "Valid TX freq within a multi-Mhz band and ok.\n");
+				rv=1;
+				break;
+		}
+	}
+	if(debug > 3)  
+		ast_log(LOG_NOTICE, "rv=%i\n",rv);
+
+	return rv;
 }
 
 
@@ -9310,6 +9579,10 @@
 	char oc,*cp,*cp1,*cp2;
 	char tmp[20], freq[20] = "", savestr[20] = "";
 	char mhz[MAXREMSTR], decimals[MAXREMSTR];
+
+    if(debug > 6) {
+    	ast_log(LOG_NOTICE,"%s param=%s digitbuf=%s source=%i\n",myrpt->name,param,digitbuf,command_source);
+	}
 
 	if((!param) || (command_source == SOURCE_RPT) || (command_source == SOURCE_LNK))
 		return DC_ERROR;
@@ -9420,14 +9693,14 @@
 			snprintf(freq, sizeof(freq), "%s.%03d%02d",s1, k, ht);
 
 			if(debug)
-				printf("New frequency: %s\n", freq);		
+				ast_log(LOG_NOTICE, "New frequency: %s\n", freq);
 	
 			split_freq(mhz, decimals, freq);
 			m = atoi(mhz);
 			d = atoi(decimals);
 
-                        if(check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */
-                                goto invalid_freq;
+			if(check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */
+			        goto invalid_freq;
 
 
  			if((defmode == REM_MODE_FM) && (digitbuf[i] == '*')) /* If FM, user must enter and additional offset digit */
@@ -9522,9 +9795,18 @@
 			/* cant set tx tone on RBI (rx tone does both) */
 			if(!strcmp(myrpt->remoterig, remote_rig_rbi))
 				return DC_ERROR;
+			/*  eventually for the ic706 instead of just throwing the exception
+				we can check if we are in encode only mode and allow the tx
+				ctcss code to be changed. but at least the warning message is
+				issued for now.
+			*/
 			if(!strcmp(myrpt->remoterig, remote_rig_ic706))
+			{
+				if(debug)
+					ast_log(LOG_WARNING,"Setting IC706 Tx CTCSS Code Not Supported. Set Rx Code for both.\n");
 				return DC_ERROR;
-	    		for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */
+			}
+	    	for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */
 				if(digitbuf[i] == '*'){
 					j++;
 					continue;
@@ -9727,6 +10009,8 @@
 			rpt_telemetry(myrpt,REMXXX,(void *)p);
 			return DC_COMPLETEQUIET;
 		case 119: /* Tune Request */
+			if(debug > 3)
+				ast_log(LOG_NOTICE,"TUNE REQUEST\n");
 			/* if not currently going, and valid to do */
 			if((!myrpt->tunerequest) && 
 			    ((!strcmp(myrpt->remoterig, remote_rig_ft897) || 
@@ -9773,6 +10057,9 @@
 {
 time_t	now;
 int	ret,res = 0,src;
+
+	if(debug > 6)
+		ast_log(LOG_NOTICE,"c=%c  phonemode=%i  dtmfidx=%i\n",c,phonemode,myrpt->dtmfidx);
 
 	time(&myrpt->last_activity_time);
 	/* Stop scan mode if in scan mode */
@@ -10246,7 +10533,12 @@
 static void do_scheduler(struct rpt *myrpt)
 {
 	int i,res;
+
+#ifdef	NEW_ASTERISK
+	struct ast_tm tmnow;
+#else
 	struct tm tmnow;
+#endif
 	struct ast_variable *skedlist;
 	char *strs[5],*vp,*val,value[100];
 
@@ -10296,8 +10588,8 @@
 		return;
 	}
 
-        /* get pointer to linked list of scheduler entries */
-        skedlist = ast_variable_browse(myrpt->cfg, myrpt->p.skedstanzaname);
+    /* get pointer to linked list of scheduler entries */
+    skedlist = ast_variable_browse(myrpt->cfg, myrpt->p.skedstanzaname);
 
 	if(debug > 6){
 		ast_log(LOG_NOTICE, "Time now: %02d:%02d %02d %02d %02d\n",
@@ -12563,7 +12855,11 @@
         while(!ast_test_flag(&ast_options,AST_OPT_FLAG_FULLY_BOOTED))
                 usleep(250000);
 #endif
+#ifdef	NEW_ASTERISK
+	rpt_vars[n].cfg = ast_config_load("rpt.conf",config_flags);
+#else
 	rpt_vars[n].cfg = ast_config_load("rpt.conf");
+#endif
 	cfg = rpt_vars[n].cfg;
 	if (!cfg) {
 		ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf.  Radio Repeater disabled.\n");
@@ -13800,11 +14096,16 @@
 		rpt_mutex_lock(&myrpt->lock);
 		do_dtmf_local(myrpt,0);
 		rpt_mutex_unlock(&myrpt->lock);
+		//
 		rem_totx =  myrpt->dtmf_local_timer && (!phone_mode);
 		rem_totx |= keyed && (!myrpt->tunerequest);
 		rem_rx = (remkeyed && (!setting)) || (myrpt->tele.next != &myrpt->tele);
 		if(!strcmp(myrpt->remoterig, remote_rig_ic706))
 			rem_totx |= myrpt->tunerequest;
+		//
+	    if((debug > 6) && rem_totx) {
+	    	ast_log(LOG_NOTICE,"Set rem_totx=%i.  dtmf_local_timer=%i phone_mode=%i keyed=%i tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,phone_mode,keyed,myrpt->tunerequest);
+		}
 		if (keyed && (!keyed1))
 		{
 			keyed1 = 1;
@@ -13870,10 +14171,14 @@
 		}
 		if (rem_totx && (!myrpt->remotetx))
 		{
-			/* if not authed, and needed, dont transmit */
+			/* if not authed, and needed, do not transmit */
 			if ((!myrpt->p.authlevel) || myrpt->loginlevel[0])
 			{
+				if(debug > 6)
+					ast_log(LOG_NOTICE,"Handle rem_totx=%i.  dtmf_local_timer=%i  tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,myrpt->tunerequest);
+
 				myrpt->remotetx = 1;
+				/* asdf maw ??? is this really what you want? Doesn't it always get executed? */
 				if((myrpt->remtxfreqok = check_tx_freq(myrpt)))
 				{
 					time(&myrpt->last_activity_time);
@@ -14243,6 +14548,472 @@
     astman_append(s, "\r\n");	/* Properly terminate Manager output */
     return RESULT_SUCCESS;
 } /* manager_rpt_local_nodes() */
+
+
+
+/*
+ * Append Success and ActionID to manager response message
+ */
+
+static void rpt_manager_success(struct mansession *s, const struct message *m)
+{
+	const char *id = astman_get_header(m, "ActionID");
+	if (!ast_strlen_zero(id))
+		astman_append(s, "ActionID: %s\r\n", id);
+	astman_append(s, "Response: Success\r\n");
+}
+
+/*
+* Dump statistics to manager session
+*/
+
+static int rpt_manager_do_stats(struct mansession *s, const struct message *m, char *str)
+{
+	int i,j,numoflinks;
+	int dailytxtime, dailykerchunks;
+	time_t now;
+	int totalkerchunks, dailykeyups, totalkeyups, timeouts;
+	int totalexecdcommands, dailyexecdcommands, hours, minutes, seconds;
+	long long totaltxtime;
+	struct	rpt_link *l;
+	char *listoflinks[MAX_STAT_LINKS];	
+	char *lastdtmfcommand,*parrot_ena;
+	char *tot_state, *ider_state, *patch_state;
+	char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena;
+	char *sch_ena, *input_signal, *called_number, *user_funs, *tail_type;
+	char *transmitterkeyed;
+	const char *node = astman_get_header(m, "Node");
+	struct rpt *myrpt;
+
+	static char *not_applicable = "N/A";
+
+	tot_state = ider_state = 
+	patch_state = reverse_patch_state = 
+	input_signal = not_applicable;
+	called_number = lastdtmfcommand = transmitterkeyed = NULL;
+
+	time(&now);
+	for(i = 0; i < nrpts; i++)
+	{
+		if ((node)&&(!strcmp(node,rpt_vars[i].name))){
+			rpt_manager_success(s,m);
+
+			myrpt = &rpt_vars[i];
+
+			if(myrpt->remote){ /* Remote base ? */
+				char *loginuser, *loginlevel, *freq, *rxpl, *txpl, *modestr;
+				char offset,powerlevel,rxplon,txplon,remoteon,remmode,reportfmstuff;
+				char offsetc,powerlevelc;
+
+				loginuser = loginlevel = freq = rxpl = txpl = NULL;
+				/* Make a copy of all stat variables while locked */
+				rpt_mutex_lock(&myrpt->lock); /* LOCK */
+				if((remoteon = myrpt->remoteon)){
+					if(!ast_strlen_zero(myrpt->loginuser))
+						loginuser = ast_strdup(myrpt->loginuser);
+					if(!ast_strlen_zero(myrpt->loginlevel))
+						loginlevel = ast_strdup(myrpt->loginlevel);
+					if(!ast_strlen_zero(myrpt->freq))
+						freq = ast_strdup(myrpt->freq);
+					if(!ast_strlen_zero(myrpt->rxpl))
+						rxpl = ast_strdup(myrpt->rxpl);
+					if(!ast_strlen_zero(myrpt->txpl))
+						txpl = ast_strdup(myrpt->txpl);
+					remmode = myrpt->remmode;
+					offset = myrpt->offset;
+					powerlevel = myrpt->powerlevel;
+					rxplon = myrpt->rxplon;
+					txplon = myrpt->txplon;			
+				}
+				rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
+				astman_append(s, "IsRemoteBase: YES\r\n");
+				astman_append(s, "RemoteOn: %s\r\n",(remoteon) ? "YES": "NO");
+				if(remoteon){
+					if(loginuser){
+						astman_append(s, "LogInUser: %s\r\n", loginuser);
+						ast_free(loginuser);
+					}
+					if(loginlevel){
+						astman_append(s, "LogInLevel: %s\r\n", loginlevel);
+						ast_free(loginlevel);
+					}
+					if(freq){
+						astman_append(s, "Freq: %s\r\n", freq);
+						ast_free(freq);
+					}
+					reportfmstuff = 0;
+					switch(remmode){
+						case REM_MODE_FM:
+							modestr = "FM";	
+							reportfmstuff = 1;
+							break;
+						case REM_MODE_AM:
+							modestr = "AM";
+							break;
+						case REM_MODE_USB:
+							modestr = "USB";
+							break;
+						default:
+							modestr = "LSB";
+							break;
+					}
+					astman_append(s, "RemMode: %s\r\n", modestr);
+					if(reportfmstuff){
+						switch(offset){
+							case REM_SIMPLEX:
+								offsetc = 'S';
+								break;
+							case REM_MINUS:
+								offsetc = '-';
+								break;
+							default:
+								offsetc = '+';
+								break;
+						}
+						astman_append(s, "RemOffset: %c\r\n", offsetc);
+						if(rxplon && rxpl){
+							astman_append(s, "RxPl: %s\r\n",rxpl);
+							free(rxpl);
+						}
+						if(txplon && txpl){
+							astman_append(s, "TxPl: %s\r\n",txpl);
+							free(txpl);
+						}
+					}
+					switch(powerlevel){
+						case REM_LOWPWR:
+							powerlevelc = 'L';
+							break;
+						case REM_MEDPWR:
+							powerlevelc = 'M';
+							break;
+						default:
+							powerlevelc = 'H';
+							break;
+					}
+					astman_append(s,"PowerLevel: %c\r\n", powerlevelc);
+				}
+				astman_append(s, "\r\n");
+				return 0; /* End of remote base status reporting */
+			}	
+
+			/* ELSE Process as a repeater node */
+			/* Make a copy of all stat variables while locked */
+			rpt_mutex_lock(&myrpt->lock); /* LOCK */
+			dailytxtime = myrpt->dailytxtime;
+			totaltxtime = myrpt->totaltxtime;
+			dailykeyups = myrpt->dailykeyups;
+			totalkeyups = myrpt->totalkeyups;
+			dailykerchunks = myrpt->dailykerchunks;
+			totalkerchunks = myrpt->totalkerchunks;
+			dailyexecdcommands = myrpt->dailyexecdcommands;
+			totalexecdcommands = myrpt->totalexecdcommands;
+			timeouts = myrpt->timeouts;
+
+
+			/* Traverse the list of connected nodes */
+			reverse_patch_state = "DOWN";
+			numoflinks = 0;
+			l = myrpt->links.next;
+			while(l && (l != &myrpt->links)){
+				if(numoflinks >= MAX_STAT_LINKS){
+					ast_log(LOG_NOTICE,
+					"maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
+					break;
+				}
+				if (l->name[0] == '0'){ /* Skip '0' nodes */
+					reverse_patch_state = "UP";
+					l = l->next;
+					continue;
+				}
+				listoflinks[numoflinks] = ast_strdup(l->name);
+				if(listoflinks[numoflinks] == NULL){
+					break;
+				}
+				else{
+					numoflinks++;
+				}
+				l = l->next;
+			}
+
+			if(myrpt->keyed)
+				input_signal = "YES";
+			else
+				input_signal = "NO";
+			
+			if(myrpt->txkeyed)
+				transmitterkeyed = "YES";
+			else
+				transmitterkeyed = "NO";
+
+			if(myrpt->p.parrotmode)
+				parrot_ena = "ENABLED";
+			else
+				parrot_ena = "DISABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable)
+				sys_ena = "DISABLED";
+			else
+				sys_ena = "ENABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable)
+				tot_ena = "DISABLED";
+			else
+				tot_ena = "ENABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable)
+				link_ena = "DISABLED";
+			else
+				link_ena = "ENABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
+				patch_ena = "DISABLED";
+			else
+				patch_ena = "ENABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable)
+				sch_ena = "DISABLED";
+			else
+				sch_ena = "ENABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable)
+				user_funs = "DISABLED";
+			else
+				user_funs = "ENABLED";
+
+			if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail)
+				tail_type = "ALTERNATE";
+			else
+				tail_type = "STANDARD";
+
+			if(!myrpt->totimer)
+				tot_state = "TIMED OUT!";
+			else if(myrpt->totimer != myrpt->p.totime)
+				tot_state = "ARMED";
+			else
+				tot_state = "RESET";
+
+			if(myrpt->tailid)
+				ider_state = "QUEUED IN TAIL";
+			else if(myrpt->mustid)
+				ider_state = "QUEUED FOR CLEANUP";
+			else
+				ider_state = "CLEAN";
+
+			switch(myrpt->callmode){
+				case 1:
+					patch_state = "DIALING";
+					break;
+				case 2:
+					patch_state = "CONNECTING";
+					break;
+				case 3:
+					patch_state = "UP";
+					break;
+
+				case 4:
+					patch_state = "CALL FAILED";
+					break;
+
+				default:
+					patch_state = "DOWN";
+			}
+
+			if(strlen(myrpt->exten)){
+				called_number = ast_strdup(myrpt->exten);
+			}
+
+			if(strlen(myrpt->lastdtmfcommand)){
+				lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand);
+			}
+			rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
+
+			astman_append(s, "IsRemoteBase: NO\r\n");
+			astman_append(s, "NodeState: %d\r\n", myrpt->p.sysstate_cur);
+			astman_append(s, "SignalOnInput: %s\r\n", input_signal);
+			astman_append(s, "TransmitterKeyed: %s\r\n", transmitterkeyed);
+			astman_append(s, "Transmitter: %s\r\n", sys_ena);
+			astman_append(s, "Parrot: %s\r\n", parrot_ena);
+			astman_append(s, "Scheduler: %s\r\n", sch_ena);
+			astman_append(s, "TailLength: %s\r\n", tail_type);
+			astman_append(s, "TimeOutTimer: %s\r\n", tot_ena);
+			astman_append(s, "TimeOutTimerState: %s\r\n", tot_state);
+			astman_append(s, "TimeOutsSinceSystemInitialization: %d\r\n", timeouts);
+			astman_append(s, "IdentifierState: %s\r\n", ider_state);
+			astman_append(s, "KerchunksToday: %d\r\n", dailykerchunks);
+			astman_append(s, "KerchunksSinceSystemInitialization: %d\r\n", totalkerchunks);
+			astman_append(s, "KeyupsToday: %d\r\n", dailykeyups);
+			astman_append(s, "KeyupsSinceSystemInitialization: %d\r\n", totalkeyups);
+			astman_append(s, "DtmfCommandsToday: %d\r\n", dailyexecdcommands);
+			astman_append(s, "DtmfCommandsSinceSystemInitialization: %d\r\n", totalexecdcommands);
+			astman_append(s, "LastDtmfCommandExecuted: %s\r\n", 
+			(lastdtmfcommand && strlen(lastdtmfcommand)) ? lastdtmfcommand : not_applicable);
+			hours = dailytxtime/3600000;
+			dailytxtime %= 3600000;
+			minutes = dailytxtime/60000;
+			dailytxtime %= 60000;
+			seconds = dailytxtime/1000;
+			dailytxtime %= 1000;
+
+			astman_append(s, "TxTimeToday: %02d:%02d:%02d.%d\r\n",
+				hours, minutes, seconds, dailytxtime);
+
+			hours = (int) totaltxtime/3600000;
+			totaltxtime %= 3600000;
+			minutes = (int) totaltxtime/60000;
+			totaltxtime %= 60000;
+			seconds = (int)  totaltxtime/1000;
+			totaltxtime %= 1000;
+
+			astman_append(s, "TxTimeSinceSystemInitialization: %02d:%02d:%02d.%d\r\n",
+				 hours, minutes, seconds, (int) totaltxtime);
+
+  			sprintf(str, "NodesCurrentlyConnectedToUs: ");
+                        if(!numoflinks){
+  	                      strcat(str,"<NONE>");
+                        }
+			else{
+				for(j = 0 ;j < numoflinks; j++){
+					sprintf(str+strlen(str), "%s", listoflinks[j]);
+					if(j < numoflinks - 1)
+						strcat(str,",");
+				}
+			}
+			astman_append(s,"%s\r\n", str);
+
+			astman_append(s, "Autopatch: %s\r\n", patch_ena);
+			astman_append(s, "AutopatchState: %s\r\n", patch_state);
+			astman_append(s, "AutopatchCalledNumber: %s\r\n",
+			(called_number && strlen(called_number)) ? called_number : not_applicable);
+			astman_append(s, "ReversePatchIaxrptConnected: %s\r\n", reverse_patch_state);
+			astman_append(s, "UserLinkingCommands: %s\r\n", link_ena);
+			astman_append(s, "UserFunctions: %s\r\n", user_funs);
+
+			for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */

[... 174 lines stripped ...]



More information about the svn-commits mailing list