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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 6 16:38:46 CST 2008


Author: jdixon
Date: Thu Nov  6 16:38:46 2008
New Revision: 155118

URL: http://svn.digium.com/view/asterisk?view=rev&rev=155118
Log:
Attempt to fix pre-mature text messages upon connect

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=155118&r1=155117&r2=155118
==============================================================================
--- team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/dev-temp/app_rpt.c Thu Nov  6 16:38:46 2008
@@ -22,7 +22,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.159 11/4/08 
+ *  version 0.160 11/6/08 
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -408,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.159  11/4/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.160  11/6/2008";
 
 static char *app = "Rpt";
 
@@ -613,6 +613,11 @@
         AST_LIST_HEAD(, ast_frame) rxq;
 #else
 	AST_LIST_HEAD_NOLOCK(, ast_frame) rxq;
+#endif
+#ifdef OLD_ASTERISK
+        AST_LIST_HEAD(, ast_frame) textq;
+#else
+	AST_LIST_HEAD_NOLOCK(, ast_frame) textq;
 #endif
 } ;
 
@@ -1538,6 +1543,16 @@
 	return(0);
 }
 
+static void rpt_qwrite(struct rpt_link *l,struct ast_frame *f)
+{
+struct	ast_frame *f1;
+
+	if (!l->chan) return;
+	f1 = ast_frdup(f);
+	AST_LIST_INSERT_TAIL(&l->textq,f1,frame_list);
+	return;
+}
+
 static int linkcount(struct rpt *myrpt)
 {
 	struct	rpt_link *l;
@@ -1909,6 +1924,7 @@
 	wf.mallocd = 0;
 	wf.datalen = strlen(str) + 1;
 	wf.samples = 0;
+	wf.src = "mdc1200_send";
 
 
 	l = myrpt->links.next;
@@ -1921,7 +1937,7 @@
 			continue;
 		}
 		wf.data = str;
-		if (l->chan) ast_write(l->chan,&wf); 
+		if (l->chan) rpt_qwrite(l,&wf); 
 		l = l->next;
 	}
 	return;
@@ -2047,6 +2063,7 @@
 	wf.datalen = strlen(txt) + 1;
 	wf.data = txt;
 	wf.samples = 0;
+	wf.src = "send_usb_txt";
 	ast_write(myrpt->txchannel,&wf); 
 	return 0;
 }
@@ -6255,6 +6272,7 @@
 	wf.mallocd = 0;
 	wf.datalen = strlen(str) + 1;
 	wf.samples = 0;
+	wf.src = "send_link_dtmf";
 	l = myrpt->links.next;
 	/* first, see if our dude is there */
 	while(l != &myrpt->links)
@@ -6268,7 +6286,7 @@
 		if (!strcmp(l->name,myrpt->cmdnode))
 		{
 			wf.data = str;
-			if (l->chan) ast_write(l->chan,&wf);
+			if (l->chan) rpt_qwrite(l,&wf);
 			return;
 		}
 		l = l->next;
@@ -6278,7 +6296,7 @@
 	while(l != &myrpt->links)
 	{
 		wf.data = str;
-		if (l->chan) ast_write(l->chan,&wf);
+		if (l->chan) rpt_qwrite(l,&wf);
 		l = l->next;
 	}
 	return;
@@ -6302,12 +6320,13 @@
 	wf.mallocd = 0;
 	wf.datalen = strlen(str) + 1;
 	wf.samples = 0;
+	wf.src = "send_link_keyquery";
 	l = myrpt->links.next;
 	/* give it to everyone */
 	while(l != &myrpt->links)
 	{
 		wf.data = str;
-		if (l->chan) ast_write(l->chan,&wf);
+		if (l->chan) rpt_qwrite(l,&wf);
 		l = l->next;
 	}
 	return;
@@ -6326,12 +6345,13 @@
 	wf.mallocd = 0;
 	wf.datalen = strlen(str) + 1;
 	wf.samples = 0;
+	wf.src = "send_tele_link";
 	l = myrpt->links.next;
 	/* give it to everyone */
 	while(l != &myrpt->links)
 	{
 		wf.data = str;
-		if (l->chan) ast_write(l->chan,&wf);
+		if (l->chan) rpt_qwrite(l,&wf);
 		l = l->next;
 	}
 	rpt_telemetry(myrpt,VARCMD,cmd);
@@ -6720,9 +6740,10 @@
 				wf.datalen = strlen(discstr) + 1;
 				wf.samples = 0;
 				wf.data = discstr;
+				wf.src = "function_ilink:1";
 				if (l->chan)
 				{
-					ast_write(l->chan,&wf);
+					rpt_qwrite(l,&wf);
 					if (ast_safe_sleep(l->chan,250) == -1) return DC_ERROR;
 					ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
 				}
@@ -6866,9 +6887,10 @@
                                 wf.datalen = strlen(discstr) + 1;
                                 wf.samples = 0;
                                 wf.data = discstr;
+				wf.src = "function_ilink:6";
                                 if (l->chan)
                                 {
-                                        ast_write(l->chan,&wf);
+                                        rpt_qwrite(l,&wf);
                                         ast_safe_sleep(l->chan,250); /* It's dead already, why check the return value? */
                                         ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
                                 }
@@ -7620,6 +7642,7 @@
 	wf.mallocd = 0;
 	wf.datalen = strlen(str) + 1;
 	wf.samples = 0;
+	wf.src = "handle_link_data";
  	/* put string in our buffer */
 	strncpy(tmp,str,sizeof(tmp) - 1);
 
@@ -7681,7 +7704,7 @@
 			/* send, but not to src */
 			if (strcmp(l->name,src)) {
 				wf.data = str;
-				if (l->chan) ast_write(l->chan,&wf); 
+				if (l->chan) rpt_qwrite(l,&wf); 
 			}
 			l = l->next;
 		}
@@ -7726,7 +7749,7 @@
 					/* send, but not to src */
 					if (strcmp(l->name,src)) {
 						wf.data = str;
-						if (l->chan) ast_write(l->chan,&wf);
+						if (l->chan) rpt_qwrite(l,&wf);
 					}
 					return;
 				}
@@ -7754,7 +7777,7 @@
 				/* send, but not to src */
 				if (strcmp(l->name,src)) {
 					wf.data = str;
-					if (l->chan) ast_write(l->chan,&wf); 
+					if (l->chan) rpt_qwrite(l,&wf); 
 				}
 				l = l->next;
 			}
@@ -7774,7 +7797,7 @@
 			sprintf(tmp1,"K %s %s %d %d",src,myrpt->name,myrpt->keyed,n);
 			wf.data = tmp1;
 			wf.datalen = strlen(tmp1) + 1;
-			if (mylink->chan) ast_write(mylink->chan,&wf); 
+			if (mylink->chan) rpt_qwrite(mylink,&wf); 
 			return;
 		}
 		if (myrpt->topkeystate != 1) return;
@@ -7851,7 +7874,7 @@
 				/* send, but not to src */
 				if (strcmp(l->name,src)) {
 					wf.data = str;
-					if (l->chan) ast_write(l->chan,&wf);
+					if (l->chan) rpt_qwrite(l,&wf);
 				}
 				return;
 			}
@@ -7875,7 +7898,7 @@
 			/* send, but not to src */
 			if (strcmp(l->name,src)) {
 				wf.data = str;
-				if (l->chan) ast_write(l->chan,&wf); 
+				if (l->chan) rpt_qwrite(l,&wf); 
 			}
 			l = l->next;
 		}
@@ -12816,6 +12839,14 @@
 		{
 			int myrx,mymaxct;
 			
+			
+			if (l->chan && l->thisconnected && (!AST_LIST_EMPTY(&l->textq)))
+			{
+				f = AST_LIST_REMOVE_HEAD(&l->textq,frame_list);
+				ast_write(l->chan,f);
+				ast_frfree(f);
+			}
+
 			if (l->rxlingertimer) l->rxlingertimer -= elap;
 			if (l->rxlingertimer < 0) l->rxlingertimer = 0;
 
@@ -12908,7 +12939,7 @@
 				{
 					lf.datalen = strlen(lstr) + 1;
 					lf.data = lstr;
-					ast_write(l->chan,&lf);
+					rpt_qwrite(l,&lf);
 					if (debug > 6) ast_log(LOG_NOTICE,
 						"@@@@ node %s sent node string %s to node %s\n",
 							myrpt->name,lstr,l->name);
@@ -14896,7 +14927,10 @@
 		l->dtmfed = 0;
 		l->rxlingertimer = RX_LINGER_TIME;
 		l->newkeytimer = NEWKEYTIME;
-		l->newkey = 2;
+		l->newkey = 0;
+		if ((!phone_mode) && (l->name[0] != '0') &&
+		    strncasecmp(chan->name,"echolink",8) &&
+			strncasecmp(chan->name,"irlp",4)) 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