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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 2 03:35:07 CDT 2008


Author: jdixon
Date: Tue Sep  2 03:35:07 2008
New Revision: 140556

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140556
Log:
added features for irlp

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=140556&r1=140555&r2=140556
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Tue Sep  2 03:35:07 2008
@@ -22,7 +22,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.136 8/28/08 2055 EDT
+ *  version 0.137 9/2/08 
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -378,7 +378,7 @@
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.136  8/28/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.137  9/2/2008";
 
 static char *app = "Rpt";
 
@@ -5707,7 +5707,12 @@
 	ZT_CONFINFO ci;  /* conference info */
 
 
-	if (node[0] != '3')
+	if (node[0] == '4')
+	{
+		if (strlen(node) < 5) return 1;
+		sprintf(tmp,"irlp/%d,NONE",atoi(node + 1));
+	}
+	else if (node[0] != '3')
 	{
 		val = node_lookup(myrpt,node);
 		if (!val){
@@ -5742,7 +5747,7 @@
 	s = tmp;
 	s1 = strsep(&s,",");
 	if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6) && 
-		strncasecmp(s1,"echolink/",9))
+		strncasecmp(s1,"echolink/",9) && strncasecmp(s1,"irlp/",5))
 	{
 		sy = strchr(s1,'/');		
 		*sy = 0;
@@ -5771,7 +5776,8 @@
 			rpt_mutex_unlock(&myrpt->lock);
 			return 2; /* Already linked */
 		}
-		if (!strncasecmp(l->chan->name,"echolink",8))
+		if ((!strncasecmp(l->chan->name,"echolink",8)) ||
+			(!strncasecmp(l->chan->name,"irlp",4)))
 		{
 			l->mode = mode;
 			strncpy(myrpt->lastlinknode,node,MAXNODESTR - 1);
@@ -5784,7 +5790,8 @@
 		l->retries = l->max_retries + 1;
 		l->disced = 2;
 		modechange = 1;
-	} else
+	}
+	else
 	{
 		__mklinklist(myrpt,NULL,lstr);
 		rpt_mutex_unlock(&myrpt->lock);
@@ -5819,9 +5826,10 @@
 	l->hasconnected = l->perma = perma;
 #ifdef ALLOW_LOCAL_CHANNELS
 	if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1, "local/", 6) == 0) ||
-	    (strncasecmp(s1,"echolink/",9) == 0))
+	    (strncasecmp(s1,"echolink/",9) == 0) || (strncasecmp(s1,"irlp/",5) == 0))
 #else
-	if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1,"echolink/",9) == 0))
+	if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1,"echolink/",9) == 0) ||
+	    (strncasecmp(s1,"irlp/",5) == 0))
 #endif
         	strncpy(deststr, s1, sizeof(deststr));
 	else
@@ -5833,13 +5841,14 @@
 		return -1;
 	}
 	*tele++ = 0;
-	if (!strncasecmp(deststr,"echolink",8))
+	if ((!strncasecmp(deststr,"echolink",8)) ||
+	    (!strncasecmp(deststr,"irlp",4)))
 	{
 		tel1 = strdup(tele);
 		cp = strchr(tel1,'/');
 		if (cp) cp++; else cp = tel1;
-		strcpy(cp,node);
-		l->chan = ast_request(deststr, AST_FORMAT_SLINEAR, /* tele */ tel1,NULL);
+		strcpy(cp,node + 1);
+		l->chan = ast_request(deststr, AST_FORMAT_SLINEAR,  tel1,NULL);
 		free(tel1);
 	}
 	else
@@ -5864,7 +5873,7 @@
 		if(l->chan->cid.cid_num)
 			ast_free(l->chan->cid.cid_num);
 		l->chan->cid.cid_num = ast_strdup(myrpt->name);
-		ast_call(l->chan,tele,999);
+		ast_call(l->chan,tele,(node[0] == '4') ? 25000 : 2000);
 	}
 	else {
 		if(debug > 3) 
@@ -5955,7 +5964,12 @@
 		case 1: /* Link off */
 			if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
 				strcpy(digitbuf,myrpt->lastlinknode);
-			if (digitbuf[0] != '3')
+			if (digitbuf[0] == '4')
+			{
+				if (strlen(digitbuf) < 5) break;
+				sprintf(tmp,"irlp/%d,NONE",atoi(digitbuf + 1));
+			}
+			else if (digitbuf[0] != '3')
 			{
 				val = node_lookup(myrpt,digitbuf);
 				if (!val){
@@ -5978,7 +5992,8 @@
 			}
 			s = tmp;
 			s1 = strsep(&s,",");
-			if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
+			if ((!strchr(s1,':')) && strchr(s1,'/') && strncasecmp(s1, "local/", 6) &&
+				strncasecmp(s1,"echolink/",9) && strncasecmp(s1, "irlp/",5))
 			{
 				sy = strchr(s1,'/');		
 				*sy = 0;
@@ -7136,7 +7151,9 @@
 	{
 		if (c == myrpt->p.endchar)
 		{
-			if (mylink->lastrx && strncmp(mylink->chan->name,"echolink",8))
+			if (mylink->lastrx && 
+			    ((strncmp(mylink->chan->name,"echolink",8)) ||
+				strncmp(mylink->chan->name,"echolink",8)))
 			{
 				mylink->lastrealrx = 0;
 				rpt_mutex_unlock(&myrpt->lock);
@@ -7228,7 +7245,8 @@
 					SOURCE_ALT,mylink);
 				break;
 			    default:
-				if (!strncasecmp(mylink->chan->name,"echolink",8))
+				if ((!strncasecmp(mylink->chan->name,"echolink",8)) ||
+				    (!strncasecmp(mylink->chan->name,"irlp",4)))
 				{
 					res = collect_function_digits(myrpt, cmd, 
 						SOURCE_RPT, mylink);
@@ -10540,6 +10558,8 @@
 
 	/* cannot apply to echolink */
 	if (!strncasecmp(val,"echolink",8)) return 0;
+	/* nor to irlp */
+	if (!strncasecmp(val,"irlp",4)) return 0;
 	rpt_mutex_lock(&myrpt->lock);
 	/* remove from queue */
 	remque((struct qelem *) l);
@@ -11995,7 +12015,7 @@
 				}
 				else 
 				{
-					l->retrytimer = l->max_retries + 1;
+					l->retries = l->max_retries + 1;
 				}
 
 				rpt_mutex_lock(&myrpt->lock);
@@ -12623,7 +12643,8 @@
 					rpt_mutex_lock(&myrpt->lock);
 					__kickshort(myrpt);
 					rpt_mutex_unlock(&myrpt->lock);
-					if (strncasecmp(l->chan->name,"echolink",8))
+					if ((strncasecmp(l->chan->name,"echolink",8)) &&
+					    (strncasecmp(l->chan->name,"irlp",4)))
 					{
 						if ((!l->disced) && (!l->outbound))
 						{
@@ -12692,7 +12713,9 @@
 				{
 					int ismuted,n1;
 
-					if (((l->phonemode) && (l->phonevox)) || (!strncasecmp(l->chan->name,"echolink",8)))
+					if (((l->phonemode) && (l->phonevox)) || 
+					    (!strncasecmp(l->chan->name,"echolink",8)) ||
+						(!strncasecmp(l->chan->name,"irlp",4)))
 					{
 						if (l->phonevox)
 						{
@@ -12744,7 +12767,9 @@
 						/* if not receiving, zero-out audio */
 						ismuted |= (!l->lastrx);
 						if (l->dtmfed && 
-							(l->phonemode || (!strncasecmp(l->chan->name,"echolink",8)))) ismuted = 1;
+							(l->phonemode || 
+							    (!strncasecmp(l->chan->name,"echolink",8)) ||
+								(!strncasecmp(l->chan->name,"irlp",4)))) ismuted = 1;
 						l->dtmfed = 0;
 						if (ismuted)
 						{
@@ -12817,7 +12842,8 @@
 						if (!l->isremote) l->retries = 0;
 						if (!lconnected) 
 						{
-							if (strncasecmp(l->chan->name,"echolink",8))
+							if ((strncasecmp(l->chan->name,"echolink",8)) ||
+							    (strncasecmp(l->chan->name,"irlp",4)))
 								rpt_telemetry(myrpt,CONNECTED,l);
 							if (myrpt->p.archivedir)
 							{
@@ -12877,7 +12903,8 @@
 						rpt_mutex_lock(&myrpt->lock);
 						__kickshort(myrpt);
 						rpt_mutex_unlock(&myrpt->lock);
-						if (strncasecmp(l->chan->name,"echolink",8))
+						if ((strncasecmp(l->chan->name,"echolink",8)) &&
+						    (strncasecmp(l->chan->name,"irlp",4)))
 						{
 							if ((!l->outbound) && (!l->disced))
 							{
@@ -13518,12 +13545,13 @@
 #ifdef ALLOW_LOCAL_CHANNELS
 	        /* Check to insure the connection is IAX2 or Local*/
 	        if ( (strncmp(chan->name,"IAX2",4)) && (strncmp(chan->name,"Local",5)) &&
-		  (strncasecmp(chan->name,"echolink",8)) ) {
-	            ast_log(LOG_WARNING, "We only accept links via IAX2, Echolink  or Local!!\n");
+		  (strncasecmp(chan->name,"echolink",8)) && (strncasecmp(chan->name,"irlp",4)) ) {
+	            ast_log(LOG_WARNING, "We only accept links via IAX2, Echolink, IRLP or Local!!\n");
 	            return -1;
 	        }
 #else
-		if (strncmp(chan->name,"IAX2",4) && strncasecmp(chan->name,"Echolink",8))
+		if (strncmp(chan->name,"IAX2",4) && strncasecmp(chan->name,"Echolink",8) &&
+		    strncasecmp(chan->name,"irlp",4))
 		{
 			ast_log(LOG_WARNING, "We only accept links via IAX2 or Echolink!!\n");
 			return -1;
@@ -13887,7 +13915,8 @@
 			donodelog(myrpt,str);
 		}
 		if (!phone_mode) send_newkey(chan);
-		if (!strncasecmp(l->chan->name,"echolink",8))
+		if ((!strncasecmp(l->chan->name,"echolink",8)) ||
+		    (!strncasecmp(l->chan->name,"irlp",4)))
 			rpt_telemetry(myrpt,CONNECTED,l);
 		return AST_PBX_KEEPALIVE;
 	}




More information about the asterisk-commits mailing list