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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 4 02:59:30 CST 2008


Author: jdixon
Date: Tue Nov  4 02:59:29 2008
New Revision: 154145

URL: http://svn.digium.com/view/asterisk?view=rev&rev=154145
Log:
Fixed silly problem with newkey negotiation

Modified:
    team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c

Modified: team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c?view=diff&rev=154145&r1=154144&r2=154145
==============================================================================
--- team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c Tue Nov  4 02:59:29 2008
@@ -22,7 +22,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.157 11/2/08 
+ *  version 0.158 11/4/08 
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -199,6 +199,7 @@
 #define	TOPKEYN 32
 #define	TOPKEYWAIT 3
 #define	TOPKEYMAXSTR 30
+#define	NEWKEYTIME 2000
 
 #define	AUTHTELLTIME 7000
 #define	AUTHTXTIME 1000
@@ -407,7 +408,7 @@
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.157  11/2/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.158  11/4/2008";
 
 static char *app = "Rpt";
 
@@ -607,6 +608,7 @@
 	char voxtostate;
 	char newkey;
 	int linkmode;
+	int newkeytimer;
 #ifdef OLD_ASTERISK
         AST_LIST_HEAD(, ast_frame) rxq;
 #else
@@ -6491,6 +6493,8 @@
 	l->isremote = (s && ast_true(s));
 	if (modechange) l->connected = 1;
 	l->hasconnected = l->perma = perma;
+	l->newkeytimer = NEWKEYTIME;
+	l->newkey = 2;
 #ifdef ALLOW_LOCAL_CHANNELS
 	if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1, "local/", 6) == 0) ||
 	    (strncasecmp(s1,"echolink/",9) == 0) || (strncasecmp(s1,"irlp/",5) == 0))
@@ -6602,6 +6606,7 @@
 	if (perma)
 		l->max_retries = MAX_RETRIES_PERM;
 	if (l->isremote) l->retries = l->max_retries + 1;
+	l->rxlingertimer = RX_LINGER_TIME;
 	insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
 	__kickshort(myrpt);
 	rpt_mutex_unlock(&myrpt->lock);
@@ -7629,13 +7634,14 @@
         {
 		if (!mylink->newkey)
 		{
-			send_old_newkey(mylink->chan);
+			mylink->newkeytimer = 0;
 			mylink->newkey = 1;
 		}
                 return;
         }
         if (!strcmp(tmp,newkey1str))
         {
+		mylink->newkeytimer = 0;
 		mylink->newkey = 2;
                 return;
         }
@@ -11508,6 +11514,11 @@
 	l->newkey = 0;
 	l->chan = ast_request(deststr, AST_FORMAT_SLINEAR, tele,NULL);
 	l->linkmode = 0;
+	l->lastrx1 = 0;
+	l->lastrealrx = 0;
+	l->rxlingertimer = RX_LINGER_TIME;
+	l->newkeytimer = NEWKEYTIME;
+	l->newkey = 2;
 	if (l->chan){
 		ast_set_read_format(l->chan, AST_FORMAT_SLINEAR);
 		ast_set_write_format(l->chan, AST_FORMAT_SLINEAR);
@@ -12807,6 +12818,21 @@
 			if (l->rxlingertimer) l->rxlingertimer -= elap;
 			if (l->rxlingertimer < 0) l->rxlingertimer = 0;
 
+			x = l->newkeytimer;
+			if (l->newkeytimer) l->newkeytimer -= elap;
+			if (l->newkeytimer < 0) l->newkeytimer = 0;
+
+			if ((x > 0) && (!l->newkeytimer))
+			{
+				if (l->thisconnected)
+				{
+					if (l->newkey == 2) l->newkey = 0;
+				}
+				else
+				{
+					l->newkeytimer = NEWKEYTIME;
+				}
+			}
 			if ((l->linkmode > 1) && (l->linkmode < 0x7ffffffe)) 
 			{
 				l->linkmode -= elap;
@@ -12825,8 +12851,9 @@
 						donodelog(myrpt,str);
 					}
 					l->lastrx1 = 0;
-					if(myrpt->p.duplex) 
+					if(myrpt->p.duplex) {
 						rpt_telemetry(myrpt,LINKUNKEY,l);
+					}
 				}
 			}				
 
@@ -12914,8 +12941,9 @@
 							sprintf(str,"RXUNKEY(T),%s",l->name);
 							donodelog(myrpt,str);
 						}
-						if(myrpt->p.duplex) 
+						if(myrpt->p.duplex) {
 							rpt_telemetry(myrpt,LINKUNKEY,l);
+						}
 						l->lastrx1 = 0;
 					}
 				}
@@ -13582,10 +13610,6 @@
 					(myrpt->dtmfidx > -1)));
 				totx = (((l->isremote) ? (remnomute) : 
 					myrpt->localtx || myrpt->callmode) || remrx) && l->mode;
-#if 0
-				totx = (((l->isremote) ? (remnomute) : 
-					myrpt->exttx) || remrx) && l->mode;
-#endif
 				/* foop */
 				if ((!l->lastrx) && altlink(myrpt,l)) totx = myrpt->txkeyed;
 				if (l->phonemode == 0 && l->chan && (l->lasttx != totx))
@@ -13692,6 +13716,7 @@
 					int ismuted,n1;
 
 					l->rxlingertimer = RX_LINGER_TIME;
+
 					if ((l->newkey == 2) && (!l->lastrealrx))
 					{
 						l->lastrealrx = 1;
@@ -13829,6 +13854,7 @@
 						char lconnected = l->connected;
 
 						__kickshort(myrpt);
+						myrpt->rxlingertimer = RX_LINGER_TIME;
 						l->connected = 1;
 						l->hasconnected = 1;
 						l->thisconnected = 1;
@@ -13887,8 +13913,9 @@
 								donodelog(myrpt,str);
 							}
 							l->lastrx1 = 0;
-							if(myrpt->p.duplex) 
+							if(myrpt->p.duplex) {
 								rpt_telemetry(myrpt,LINKUNKEY,l);
+							}
 						}
 					}
 					if (f->subclass == AST_CONTROL_HANGUP)
@@ -14869,6 +14896,9 @@
 		l->lastf1 = NULL;
 		l->lastf2 = NULL;
 		l->dtmfed = 0;
+		l->rxlingertimer = RX_LINGER_TIME;
+		l->newkeytimer = NEWKEYTIME;
+		l->newkey = 2;
 		voxinit_link(l,1);
 		if (!strncasecmp(chan->name,"echolink",8)) 
 			init_linkmode(myrpt,l,LINKMODE_ECHOLINK);




More information about the asterisk-commits mailing list