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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Aug 16 17:59:30 CDT 2008


Author: jdixon
Date: Sat Aug 16 17:59:30 2008
New Revision: 138472

URL: http://svn.digium.com/view/asterisk?view=rev&rev=138472
Log:
Smoothed out telemetry stuff

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

Modified: team/jdixon/chan_usbradio-1.4/dev-1.0/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/dev-1.0/apps/app_rpt.c?view=diff&rev=138472&r1=138471&r2=138472
==============================================================================
--- team/jdixon/chan_usbradio-1.4/dev-1.0/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/dev-1.0/apps/app_rpt.c Sat Aug 16 17:59:30 2008
@@ -22,7 +22,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.904 (1.0-dev4) 8/6/08 
+ *  version 0.905 (1.0-dev4) 8/16/08 
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -375,7 +375,7 @@
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.904  8/6/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.905  8/16/2008";
 
 static char *app = "Rpt";
 
@@ -511,6 +511,11 @@
 	struct rpt_rxtelem *qe_back;
 	struct ast_channel *chan;
 	char cmode;
+#ifdef OLD_ASTERISK
+        AST_LIST_HEAD(, ast_frame) telq;
+#else
+	AST_LIST_HEAD_NOLOCK(, ast_frame) telq;
+#endif
 } ;
 
 struct vox {
@@ -1233,6 +1238,7 @@
 	struct timeval now;
 	struct rpt_link *l,*m;
 	struct ast_frame *f1;
+	struct rpt_rxtelem *rxtelem;
 	
 	for(n = 0; n < nrpts; n++)
 	{
@@ -1275,8 +1281,6 @@
 	            {
         	        if (!l->chan) continue;
 			if (!l->ready) continue;
-			x = 0;
-			AST_LIST_TRAVERSE(&l->linq, f1,frame_list) x++;
 			if (l->lastrx)
 			{
 				x = 0;
@@ -1297,6 +1301,27 @@
 				}
 			}
 		    }
+		/* go thru telem list */
+		rxtelem = rpt_vars[n].rxtele.qe_forw;
+		while(rxtelem != &rpt_vars[n].rxtele)
+		{
+			x = 0;
+			AST_LIST_TRAVERSE(&rxtelem->telq, f1,frame_list) x++;
+			if (x > 1)
+			{
+				f1 = AST_LIST_REMOVE_HEAD(&rxtelem->telq,frame_list);
+				if (rxtelem->cmode == 'T')
+				{
+					rpt_mixer_put(&rpt_vars[n].txconf,f1->data,NULL);
+				}
+				else
+				{
+					rpt_mixer_put(&rpt_vars[n].conf,f1->data,NULL);
+				}
+				ast_frfree(f1);
+			}
+			rxtelem = rxtelem->qe_forw;
+		}
 	        rpt_mixer_voyeur(&rpt_vars[n].conf,&rpt_vars[n].txconf);
 	        rpt_mixer_next(&rpt_vars[n].conf);				
 	        rpt_mixer_next(&rpt_vars[n].txconf);				
@@ -4434,8 +4459,10 @@
 		ast_free(mytele);		
 		pthread_exit(NULL);
 	}
+	memset(rp,0,sizeof(struct rpt_rxtelem));
 	rp->chan = rchannel;
 	rp->cmode = confc;
+	AST_LIST_HEAD_INIT_NOLOCK(&rp->telq);
 	mytele->rxtelem = rp;
 	insque((struct qelem *)rp,(struct qelem *)myrpt->rxtele.qe_back);
 	rpt_mutex_unlock(&myrpt->lock);
@@ -11931,7 +11958,7 @@
 			}
             if ((!l->chan) && (!l->disctime) && (!l->outbound))
             {
-				if(debug)ast_log(LOG_NOTICE, "LINKDISC AA\n");
+		if(debug)ast_log(LOG_NOTICE, "LINKDISC AA\n");
                 /* remove from queue */
                 remque((struct qelem *) l);
 				if(myrpt->links.next==&myrpt->links)channel_revert(myrpt);
@@ -12767,26 +12794,36 @@
 				{
 					if (debug) printf("@@@@ rpt:Hung Up\n");
 					if (rxtelem->chan) ast_hangup(rxtelem->chan);
+					while(!AST_LIST_EMPTY(&rxtelem->telq))
+					{
+						f1 = AST_LIST_REMOVE_HEAD(&rxtelem->telq,
+							frame_list);
+						ast_frfree(f1);
+					}
 					remque((struct qelem *)rxtelem);
 					break;
 				}
 				if (f->frametype == AST_FRAME_VOICE)
 				{
-					if (rxtelem->cmode == 'T')
-					{
-						rpt_mixer_put(&myrpt->txconf,f->data,NULL);
-					}
-					else
-					{
-						rpt_mixer_put(&myrpt->conf,f->data,NULL);
-					}
+
+					rpt_mutex_lock(&myrpt->lock);
+					f1 = ast_frdup(f);
+					AST_LIST_INSERT_TAIL(&rxtelem->telq,f1,frame_list);
+					rpt_mutex_unlock(&myrpt->lock);
 				}
+	
 				if (f->frametype == AST_FRAME_CONTROL)
 				{
 					if (f->subclass == AST_CONTROL_HANGUP)
 					{					
 						if (debug) printf("@@@@ rpt:Hung Up\n");
 						if (rxtelem->chan) ast_hangup(rxtelem->chan);
+						while(!AST_LIST_EMPTY(&rxtelem->telq))
+						{
+							f1 = AST_LIST_REMOVE_HEAD(&rxtelem->telq,
+								frame_list);
+							ast_frfree(f1);
+						}
 						remque((struct qelem *)rxtelem);
 						ast_frfree(f);
 						break;




More information about the svn-commits mailing list