[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r139703 - /team/jdixon/chan_usbradio-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Aug 24 00:50:26 CDT 2008


Author: jdixon
Date: Sun Aug 24 00:50:25 2008
New Revision: 139703

URL: http://svn.digium.com/view/asterisk?view=rev&rev=139703
Log:
Added more stuff for echolink

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=139703&r1=139702&r2=139703
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Sun Aug 24 00:50:25 2008
@@ -21,7 +21,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.127 8/22/08 2055 EDT
+ *  version 0.128 8/23/08 2055 EDT
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -285,6 +285,8 @@
 
 #define	ALLOW_LOCAL_CHANNELS
 
+#define EL_DB_ROOT "echolink"
+
 enum {REM_OFF,REM_MONITOR,REM_TX};
 
 enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
@@ -362,6 +364,7 @@
 #include "asterisk/cdr.h"
 #include "asterisk/options.h"
 #include "asterisk/manager.h"
+#include "asterisk/astdb.h"
 #include <termios.h>
 
 #ifdef	NEW_ASTERISK
@@ -374,7 +377,7 @@
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.127  8/22/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.128  8/23/2008";
 
 static char *app = "Rpt";
 
@@ -5699,11 +5702,27 @@
 	int i,n;
 	ZT_CONFINFO ci;  /* conference info */
 
-	val = node_lookup(myrpt,node);
-	if (!val){
-		if(strlen(node) >= myrpt->longestnode)
-			return -1; /* No such node */
-		return 1; /* No match yet */
+
+	if (node[0] != '3')
+	{
+		val = node_lookup(myrpt,node);
+		if (!val){
+			if(strlen(node) >= myrpt->longestnode)
+				return -1; /* No such node */
+			return 1; /* No match yet */
+		}
+		strncpy(tmp,val,sizeof(tmp) - 1);
+	}
+	else
+	{
+		char actstr[10],dbstr[40],str1[40];
+
+		if (strlen(node) < 7) return 1;
+		if (ast_db_get(EL_DB_ROOT,"active",actstr,sizeof(actstr) - 1))
+			return -1;
+		sprintf(dbstr,"%s/nodenum/%d",actstr,atoi(node + 1));
+		if (ast_db_get(EL_DB_ROOT,dbstr,str1,sizeof(str1))) return -1;
+		sprintf(tmp,"echolink/el0/%s,%s",str1,str1);
 	}
 
 	if(!strcmp(myrpt->name,node)) /* Do not allow connections to self */
@@ -5716,7 +5735,6 @@
 		ast_log(LOG_NOTICE,"Connection type: %s\n",(perma)?"Permalink":"Normal");
 	}
 
-	strncpy(tmp,val,sizeof(tmp) - 1);
 	s = tmp;
 	s1 = strsep(&s,",");
 	if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6) && 
@@ -5926,13 +5944,27 @@
 		case 1: /* Link off */
 			if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
 				strcpy(digitbuf,myrpt->lastlinknode);
-			val = node_lookup(myrpt,digitbuf);
-			if (!val){
-				if(strlen(digitbuf) >= myrpt->longestnode)
+			if (digitbuf[0] != '3')
+			{
+				val = node_lookup(myrpt,digitbuf);
+				if (!val){
+					if(strlen(digitbuf) >= myrpt->longestnode)
+						return DC_ERROR;
+					break;
+				}
+				strncpy(tmp,val,sizeof(tmp) - 1);
+			}
+			else
+			{
+				char actstr[10],dbstr[40],str1[40];
+
+				if (strlen(digitbuf) < 7) break;
+				if (ast_db_get(EL_DB_ROOT,"active",actstr,sizeof(actstr) - 1))
 					return DC_ERROR;
-				break;
-			}
-			strncpy(tmp,val,sizeof(tmp) - 1);
+				sprintf(dbstr,"%s/nodenum/%d",actstr,atoi(digitbuf + 1));
+				if (ast_db_get(EL_DB_ROOT,dbstr,str1,sizeof(str1))) return DC_ERROR;
+				sprintf(tmp,"echolink/el0/%s,%s",str1,str1);
+			}
 			s = tmp;
 			s1 = strsep(&s,",");
 			if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
@@ -6039,12 +6071,25 @@
 			if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
 				strcpy(digitbuf,myrpt->lastlinknode);
 			/* node must at least exist in list */
-			val = node_lookup(myrpt,digitbuf);
-			if (!val){
-				if(strlen(digitbuf) >= myrpt->longestnode)
+			if (digitbuf[0] != '3')
+			{
+				val = node_lookup(myrpt,digitbuf);
+				if (!val){
+					if(strlen(digitbuf) >= myrpt->longestnode)
+						return DC_ERROR;
+					break;
+			
+				}
+			}
+			else
+			{
+				char actstr[10],dbstr[40],str1[40];
+
+				if (strlen(digitbuf) < 7) break;
+				if (ast_db_get(EL_DB_ROOT,"active",actstr,sizeof(actstr) - 1))
 					return DC_ERROR;
-				break;
-			
+				sprintf(dbstr,"%s/nodenum/%d",actstr,atoi(digitbuf + 1));
+				if (ast_db_get(EL_DB_ROOT,dbstr,str1,sizeof(str1))) return DC_ERROR;
 			}
 			rpt_mutex_lock(&myrpt->lock);
 			strcpy(myrpt->lastlinknode,digitbuf);




More information about the asterisk-commits mailing list