[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r146800 - /team/jdixon/chan_usbradio-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 6 16:01:06 CDT 2008
Author: jdixon
Date: Mon Oct 6 16:01:05 2008
New Revision: 146800
URL: http://svn.digium.com/view/asterisk?view=rev&rev=146800
Log:
Added localplay stuff
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=146800&r1=146799&r2=146800
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Mon Oct 6 16:01:05 2008
@@ -22,7 +22,7 @@
/*! \file
*
* \brief Radio Repeater / Remote Base program
- * version 0.150 9/15/08
+ * version 0.151 9/28/08
*
* \author Jim Dixon, WB6NIL <jim at lambdatel.com>
*
@@ -139,8 +139,10 @@
* 200 thru 215 - (Send DTMF 0-9,*,#,A-D) (200=0, 201=1, 210=*, etc)
*
* playback cmds:
- * specify the name of the file to be played (for example, 25=rpt/foo)
+ * specify the name of the file to be played globally (for example, 25=rpt/foo)
*
+ * localplay cmds:
+ * specify the name of the file to be played locally (for example, 25=rpt/foo)
*
* 'duplex' modes: (defaults to duplex=2)
*
@@ -293,7 +295,7 @@
enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
CONNECTED,CONNFAIL,STATUS,TIMEOUT,ID1, STATS_TIME, PLAYBACK,
- STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH,
+ LOCALPLAY, STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH,
TAILMSG, MACRO_NOTFOUND, MACRO_BUSY, LASTNODEKEY, FULLSTATUS,
MEMNOTFOUND, INVFREQ, REMMODE, REMLOGIN, REMXXX, REMSHORTSTATUS,
REMLONGSTATUS, LOGINREQ, SCAN, SCANSTAT, TUNE, SETREMOTE, TOPKEY,
@@ -380,7 +382,7 @@
/*! Stop the tones from playing */
void ast_playtones_stop(struct ast_channel *chan);
-static char *tdesc = "Radio Repeater / Remote Base version 0.150 9/15/2008";
+static char *tdesc = "Radio Repeater / Remote Base version 0.151 9/28/2008";
static char *app = "Rpt";
@@ -1188,6 +1190,7 @@
static int rpt_do_reload(int fd, int argc, char *argv[]);
static int rpt_do_restart(int fd, int argc, char *argv[]);
static int rpt_do_playback(int fd, int argc, char *argv[]);
+static int rpt_do_localplay(int fd, int argc, char *argv[]);
static int rpt_do_fun(int fd, int argc, char *argv[]);
static int rpt_do_fun1(int fd, int argc, char *argv[]);
static int rpt_do_cmd(int fd, int argc, char *argv[]);
@@ -1226,7 +1229,12 @@
static char playback_usage[] =
"Usage: rpt playback <nodename> <sound_file_base_name>\n"
-" Send an Audio File to a node\n";
+" Send an Audio File to a node, send to all other connected nodes (global)\n";
+
+static char localplay_usage[] =
+"Usage: rpt localplay <nodename> <sound_file_base_name>\n"
+" Send an Audio File to a node, do not send to other connected nodes (local)\n";
+
static char fun_usage[] =
"Usage: rpt fun <nodename> <command>\n"
@@ -1272,7 +1280,12 @@
static struct ast_cli_entry cli_playback =
{ { "rpt", "playback" }, rpt_do_playback,
- "Play Back an Audio File", playback_usage };
+ "Play Back an Audio File Globally", playback_usage };
+
+static struct ast_cli_entry cli_localplay =
+ { { "rpt", "localplay" }, rpt_do_localplay,
+ "Play Back an Audio File Locally", localplay_usage };
+
static struct ast_cli_entry cli_fun =
{ { "rpt", "fun" }, rpt_do_fun,
@@ -1334,6 +1347,8 @@
static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
static int function_macro(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
static int function_playback(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
+static int function_localplay(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
+
/*
* Function table
*/
@@ -1346,7 +1361,9 @@
{"status", function_status},
{"remote", function_remote},
{"macro", function_macro},
- {"playback", function_playback}
+ {"playback", function_playback},
+ {"localplay", function_localplay}
+
} ;
static long diskavail(struct rpt *myrpt)
@@ -3170,6 +3187,26 @@
}
return RESULT_FAILURE;
}
+
+static int rpt_do_localplay(int fd, int argc, char *argv[])
+{
+ int i,busy=0;
+
+ if (argc != 4) return RESULT_SHOWUSAGE;
+
+ for(i = 0; i < nrpts; i++){
+ if(!strcmp(argv[2], rpt_vars[i].name)){
+ struct rpt *myrpt = &rpt_vars[i];
+ rpt_telemetry(myrpt,LOCALPLAY,argv[3]);
+ }
+ }
+ if(busy){
+ ast_cli(fd, "Function decoder busy");
+ }
+ return RESULT_FAILURE;
+}
+
+
/*
the convention is that macros in the data from the rpt() application
are all at the end of the data, separated by the | and start with a *
@@ -4102,7 +4139,7 @@
/* linked systems can't hear it */
ci.confno = (((mytele->mode == ID) || (mytele->mode == IDTALKOVER) || (mytele->mode == UNKEY) ||
(mytele->mode == TAILMSG) || (mytele->mode == LINKUNKEY) || (mytele->mode == TIMEOUT) ||
- (mytele->mode == PARROT) || (mytele->mode == STATS_TIME_LOCAL)) ?
+ (mytele->mode == PARROT) || (mytele->mode == STATS_TIME_LOCAL) || (mytele->mode == LOCALPLAY)) ?
myrpt->txconf : myrpt->conf);
ci.confmode = ZT_CONF_CONFANN;
/* first put the channel on the conference in announce mode */
@@ -4515,6 +4552,7 @@
res = ast_streamfile(mychannel, "rpt/memory_notfound", mychannel->language);
break;
case PLAYBACK:
+ case LOCALPLAY:
/* wait a little bit */
wait_interval(myrpt, DLY_TELEM, mychannel);
res = ast_streamfile(mychannel, mytele->param, mychannel->language);
@@ -5340,7 +5378,7 @@
memcpy(&tele->mylink,mylink,sizeof(struct rpt_link));
}
}
- else if ((mode == ARB_ALPHA) || (mode == REV_PATCH) || (mode == PLAYBACK)) {
+ else if ((mode == ARB_ALPHA) || (mode == REV_PATCH) || (mode == PLAYBACK) || (mode == LOCALPLAY)) {
strncpy(tele->param, (char *) data, TELEPARAMSIZE - 1);
tele->param[TELEPARAMSIZE - 1] = 0;
}
@@ -6525,7 +6563,7 @@
}
/*
-* Playback a recording
+* Playback a recording globally
*/
static int function_playback(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
@@ -6543,6 +6581,28 @@
rpt_telemetry(myrpt,PLAYBACK,param);
return DC_COMPLETE;
}
+
+/*
+ * * Playback a recording locally
+ * */
+
+static int function_localplay(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
+{
+
+ if (myrpt->remote)
+ return DC_ERROR;
+
+ if(debug)
+ printf("@@@@ localplay param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
+
+ if (ast_fileexists(param,NULL,myrpt->rxchannel->language) <= 0)
+ return DC_ERROR;
+
+ rpt_telemetry(myrpt,LOCALPLAY,param);
+ return DC_COMPLETE;
+}
+
+
/*
* COP - Control operator
@@ -11686,7 +11746,7 @@
{
tailmessagequeued = 1; /* Tail message telemetry */
}
- else if(telem->mode == STATS_TIME_LOCAL)
+ else if((telem->mode == STATS_TIME_LOCAL) || (telem->mode == LOCALPLAY))
{
localmsgqueued = 1; /* Local message */
}
@@ -11712,7 +11772,10 @@
totx = totx || remrx;
/* If 3/4 or full duplex, add in ident, CT telemetry, and local messages */
if (myrpt->p.duplex > 0)
- totx = totx || identqueued || ctqueued || localmsgqueued;
+ totx = totx || identqueued || ctqueued;
+ /* If 3/4 or full duplex, or half-duplex with link to link, add in localmsg ptt */
+ if (myrpt->p.duplex > 0 || myrpt->p.linktolink)
+ totx = totx || localmsgqueued;
/* If full duplex, add local dtmf stuff active */
if (myrpt->p.duplex > 1)
{
@@ -15549,6 +15612,7 @@
ast_cli_register(&cli_reload);
ast_cli_register(&cli_restart);
ast_cli_register(&cli_playback);
+ ast_cli_register(&cli_localplay);
ast_cli_register(&cli_fun);
ast_cli_register(&cli_fun1);
res = ast_cli_register(&cli_cmd);
More information about the asterisk-commits
mailing list