[Asterisk-cvs] asterisk/apps app_rpt.c,1.11,1.12
jim at lists.digium.com
jim at lists.digium.com
Sat Jun 26 15:23:03 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv19061
Modified Files:
app_rpt.c
Log Message:
Fixed a couple of silly things that I overlooked before :-)
Index: app_rpt.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_rpt.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- app_rpt.c 26 Jun 2004 18:06:17 -0000 1.11
+++ app_rpt.c 26 Jun 2004 19:08:57 -0000 1.12
@@ -3,7 +3,7 @@
* Asterisk -- A telephony toolkit for Linux.
*
* Radio Repeater / Remote Base program
- * version 0.8 6/26/04
+ * version 0.9 6/26/04
*
* Copyright (C) 2002-2004, Jim Dixon, WB6NIL
*
@@ -110,7 +110,7 @@
#include <tonezone.h>
#include <linux/zaptel.h>
-static char *tdesc = "Radio Repeater / Remote Base version 0.8 06/26/2004";
+static char *tdesc = "Radio Repeater / Remote Base version 0.9 06/26/2004";
static char *app = "Rpt";
static char *synopsis = "Radio Repeater/Remote Base Control System";
@@ -1621,6 +1621,7 @@
{
char str[MAXDTMF],*s,*s1;
time_t now;
+int res = 0;
time(&now);
/* if timed-out */
@@ -1696,41 +1697,73 @@
/* okay, we got it */
break;
case '5': /* status, just deux it here */
- if (sayfile(mychannel,"rpt/node") == -1) return -1;
- if (saycharstr(mychannel,myrpt->name) == -1) return -1;
- if (sayfile(mychannel,"rpt/frequency") == -1) return -1;
- if (saycharstr(mychannel,myrpt->freq) == -1) return -1;
+ myrpt->remotetx = 0;
+ ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_KEY);
+ }
+ if ((sayfile(mychannel,"rpt/node") == -1) ||
+ (saycharstr(mychannel,myrpt->name) == -1) ||
+ (sayfile(mychannel,"rpt/frequency") == -1) ||
+ (saycharstr(mychannel,myrpt->freq) == -1))
+ {
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_UNKEY);
+ }
+ return -1;
+ }
switch(myrpt->offset)
{
case REM_MINUS:
- if (sayfile(mychannel,"rpt/minus") == -1) return -1;
+ res = sayfile(mychannel,"rpt/minus");
break;
case REM_SIMPLEX:
- if (sayfile(mychannel,"rpt/simplex") == -1) return -1;
+ res = sayfile(mychannel,"rpt/simplex");
break;
case REM_PLUS:
- if (sayfile(mychannel,"rpt/plus") == -1) return -1;
+ res = sayfile(mychannel,"rpt/plus");
break;
}
+ if (res == -1)
+ {
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_UNKEY);
+ }
+ return -1;
+ }
switch(myrpt->powerlevel)
{
case REM_LOWPWR:
- if (sayfile(mychannel,"rpt/lopwr") == -1) return -1;
+ res = sayfile(mychannel,"rpt/lopwr") ;
break;
case REM_MEDPWR:
- if (sayfile(mychannel,"rpt/medpwr") == -1) return -1;
+ res = sayfile(mychannel,"rpt/medpwr");
break;
case REM_HIPWR:
- if (sayfile(mychannel,"rpt/hipwr") == -1) return -1;
+ res = sayfile(mychannel,"rpt/hipwr");
break;
}
- if (sayfile(mychannel,"rpt/rxpl") == -1) return -1;
- if (sayfile(mychannel,"rpt/frequency") == -1) return -1;
- if (saycharstr(mychannel,myrpt->rxpl) == -1) return -1;
- if (sayfile(mychannel,"rpt/txpl") == -1) return -1;
- if (sayfile(mychannel,((myrpt->txplon) ? "rpt/on" : "rpt/off")) == -1) return -1;
- if (sayfile(mychannel,"rpt/rxpl") == -1) return -1;
- if (sayfile(mychannel,((myrpt->rxplon) ? "rpt/on" : "rpt/off")) == -1) return -1;
+ if (res || (sayfile(mychannel,"rpt/rxpl") == -1) ||
+ (sayfile(mychannel,"rpt/frequency") == -1) ||
+ (saycharstr(mychannel,myrpt->rxpl) == -1) ||
+ (sayfile(mychannel,"rpt/txpl") == -1) ||
+ (sayfile(mychannel,((myrpt->txplon) ? "rpt/on" : "rpt/off")) == -1) ||
+ (sayfile(mychannel,"rpt/rxpl") == -1) ||
+ (sayfile(mychannel,((myrpt->rxplon) ? "rpt/on" : "rpt/off")) == -1))
+ {
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_UNKEY);
+ }
+ return -1;
+ }
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_UNKEY);
+ }
myrpt->dtmfidx = -1;
myrpt->dtmfbuf[0] = 0;
myrpt->dtmf_time_rem = 0;
@@ -1742,10 +1775,21 @@
return 0;
}
strcpy(str,myrpt->dtmfbuf);
+ myrpt->remotetx = 0;
+ ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_KEY);
+ }
myrpt->dtmfidx = -1;
myrpt->dtmfbuf[0] = 0;
myrpt->dtmf_time_rem = 0;
- return(remote_function(myrpt,str,mychannel));
+ res = remote_function(myrpt,str,mychannel);
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_UNKEY);
+ }
+ return res;
}
static int handle_remote_data(struct rpt *myrpt, char *str, struct ast_channel *mychannel)
@@ -1769,8 +1813,19 @@
if (strcmp(dest,myrpt->name)) return 0;
res = handle_dtmf_digit(myrpt,c,mychannel);
if (res != 1) return res;
+ myrpt->remotetx = 0;
+ ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_KEY);
+ }
if (ast_safe_sleep(mychannel,1000) == -1) return -1;
- return(sayfile(mychannel,"rpt/functioncomplete"));
+ res = sayfile(mychannel,"rpt/functioncomplete");
+ if (!myrpt->remoterx)
+ {
+ ast_indicate(mychannel,AST_CONTROL_RADIO_UNKEY);
+ }
+ return res;
}
/* single thread with one file (request) to dial */
@@ -2296,6 +2351,8 @@
ast_mutex_lock(&myrpt->lock);
/* remove from queue */
remque((struct qelem *) l);
+ if (!strcmp(myrpt->cmdnode,l->name))
+ myrpt->cmdnode[0] = 0;
ast_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt,REMDISC,l);
/* hang-up on call to device */
@@ -2338,6 +2395,8 @@
ast_mutex_lock(&myrpt->lock);
/* remove from queue */
remque((struct qelem *) l);
+ if (!strcmp(myrpt->cmdnode,l->name))
+ myrpt->cmdnode[0] = 0;
ast_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt,REMDISC,l);
/* hang-up on call to device */
More information about the svn-commits
mailing list