[asterisk-commits] jdixon: trunk r116731 - in /trunk: apps/ channels/ channels/xpmr/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 15 19:51:14 CDT 2008
Author: jdixon
Date: Thu May 15 19:51:14 2008
New Revision: 116731
URL: http://svn.digium.com/view/asterisk?view=rev&rev=116731
Log:
Bring all app_rpt and chan_usbradio stuff up to date
Modified:
trunk/apps/app_rpt.c
trunk/channels/Makefile
trunk/channels/chan_usbradio.c
trunk/channels/xpmr/sinetabx.h
trunk/channels/xpmr/xpmr.c
trunk/channels/xpmr/xpmr.h
trunk/channels/xpmr/xpmr_coef.h
Modified: trunk/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_rpt.c?view=diff&rev=116731&r1=116730&r2=116731
==============================================================================
--- trunk/apps/app_rpt.c (original)
+++ trunk/apps/app_rpt.c Thu May 15 19:51:14 2008
@@ -1,7 +1,9 @@
+#define NEW_ASTERISK
+/* #define OLD_ASTERISK */
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2002-2005, Jim Dixon, WB6NIL
+ * Copyright (C) 2002-2008, Jim Dixon, WB6NIL
*
* Jim Dixon, WB6NIL <jim at lambdatel.com>
* Serious contributions by Steve RoDgers, WA6ZFT <hwstar at rodgers.sdcoxmail.com>
@@ -16,16 +18,16 @@
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
-
/*! \file
*
* \brief Radio Repeater / Remote Base program
- * version 0.48 06/13/06
+ * version 0.115 5/12/08 2055 EDT
*
* \author Jim Dixon, WB6NIL <jim at lambdatel.com>
*
* \note Serious contributions by Steve RoDgers, WA6ZFT <hwstar at rodgers.sdcoxmail.com>
- *
+ * \note Steven Henke, W9SH, <w9sh at arrl.net> added a few features here and there.
+ *
* See http://www.zapatatelephony.org/app_rpt.html
*
*
@@ -51,18 +53,43 @@
*
* status cmds:
*
- * 1 - Force ID
- * 2 - Give Time of Day
- * 3 - Give software Version
+ * 1 - Force ID (global)
+ * 2 - Give Time of Day (global)
+ * 3 - Give software Version (global)
+ * 11 - Force ID (local only)
+ * 12 - Give Time of Day (local only)
*
* cop (control operator) cmds:
*
* 1 - System warm boot
* 2 - System enable
* 3 - System disable
- * 4 - Test Tone On
+ * 4 - Test Tone On/Off
* 5 - Dump System Variables on Console (debug)
* 6 - PTT (phone mode only)
+ * 7 - Time out timer enable
+ * 8 - Time out timer disable
+ * 9 - Autopatch enable
+ * 10 - Autopatch disable
+ * 11 - Link enable
+ * 12 - Link disable
+ * 13 - Query System State
+ * 14 - Change System State
+ * 15 - Scheduler Enable
+ * 16 - Scheduler Disable
+ * 17 - User functions (time, id, etc) enable
+ * 18 - User functions (time, id, etc) disable
+ * 19 - Select alternate hang timer
+ * 20 - Select standard hang timer
+ * 21 - Enable Parrot Mode
+ * 22 - Disable Parrot Mode
+ * 23 - Birdbath (Current Parrot Cleanup/Flush)
+ * 24 - Flush all telemetry
+ * 25 - Query last node un-keyed
+ * 26 - Query all nodes keyed/unkeyed
+ * 30 - Recall Memory Setting in Attached Xcvr
+ * 31 - Channel Selector for Parallel Programmed Xcvr
+ * 32 - Touchtone pad test: command + Digit string + # to playback all digits pressed
*
* ilink cmds:
*
@@ -72,6 +99,12 @@
* 4 - Enter command mode on specified link
* 5 - System status
* 6 - Disconnect all links
+ * 11 - Disconnect a previously permanently connected link
+ * 12 - Permanently connect specified link -- monitor only
+ * 13 - Permanently connect specified link -- tranceive
+ * 15 - Full system status (all nodes)
+ * 16 - Reconnect links disconnected with "disconnect all links"
+ * 200 thru 215 - (Send DTMF 0-9,*,#,A-D) (200=0, 201=1, 210=*, etc)
*
* remote cmds:
*
@@ -102,7 +135,10 @@
* 118 - Scan Up Fast
* 119 - Transmit allowing auto-tune
* 140 - Link Status (brief)
+ * 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)
*
*
* 'duplex' modes: (defaults to duplex=2)
@@ -131,14 +167,33 @@
/* maximum digits in DTMF buffer, and seconds after * for DTMF command timeout */
+#ifdef OLD_ASTERISK
+#define ast_free free
+#define ast_malloc malloc
+#define ast_strdup strdup
+#endif
+
+
#define MAXDTMF 32
#define MAXMACRO 2048
-#define MAXGOSUB 2048
+#define MAXLINKLIST 512
+#define LINKLISTTIME 10000
+#define LINKLISTSHORTTIME 200
+#define LINKPOSTTIME 30000
+#define LINKPOSTSHORTTIME 200
+#define KEYPOSTTIME 30000
+#define KEYPOSTSHORTTIME 200
#define MACROTIME 100
-#define GOSUBTIME 100
#define MACROPTIME 500
-#define GOSUBPTIME 500
#define DTMF_TIMEOUT 3
+#define KENWOOD_RETRIES 5
+#define TOPKEYN 32
+#define TOPKEYWAIT 3
+#define TOPKEYMAXSTR 30
+
+#define AUTHTELLTIME 7000
+#define AUTHTXTIME 1000
+#define AUTHLOGOUTTIME 25000
#ifdef __RPT_NOTCH
#define MAXFILTERS 10
@@ -146,10 +201,21 @@
#define DISC_TIME 10000 /* report disc after 10 seconds of no connect */
#define MAX_RETRIES 5
+#define MAX_RETRIES_PERM 1000000000
#define REDUNDANT_TX_TIME 2000
#define RETRY_TIMER_MS 5000
+
+#define PATCH_DIALPLAN_TIMEOUT 1500
+
+#ifdef OLD_ASTERISK
+#define START_DELAY 10
+#else
+#define START_DELAY 2
+#endif
+
+#define RPT_LOCKOUT_SECS 10
#define MAXPEERSTR 31
#define MAXREMSTR 15
@@ -157,22 +223,42 @@
#define DELIMCHR ','
#define QUOTECHR 34
+#define MONITOR_DISK_BLOCKS_PER_MINUTE 38
+
+#define DEFAULT_MONITOR_MIN_DISK_BLOCKS 10000
+#define DEFAULT_REMOTE_INACT_TIMEOUT (15 * 60)
+#define DEFAULT_REMOTE_TIMEOUT (60 * 60)
+#define DEFAULT_REMOTE_TIMEOUT_WARNING (3 * 60)
+#define DEFAULT_REMOTE_TIMEOUT_WARNING_FREQ 30
+
#define NODES "nodes"
+#define EXTNODES "extnodes"
#define MEMORY "memory"
#define MACRO "macro"
-#define GOSUB "gosub"
#define FUNCTIONS "functions"
#define TELEMETRY "telemetry"
#define MORSE "morse"
+#define TONEMACRO "tonemacro"
#define FUNCCHAR '*'
#define ENDCHAR '#'
+#define EXTNODEFILE "/var/lib/asterisk/rpt_extnodes"
+#define NODENAMES "rpt/nodenames"
+#define PARROTFILE "/tmp/parrot_%s_%u"
+
+#define PARROTTIME 1000
#define DEFAULT_IOBASE 0x378
+#define DEFAULT_CIV_ADDR 0x58
+
#define MAXCONNECTTIME 5000
#define MAXNODESTR 300
+#define MAXNODELEN 16
+
+#define MAXIDENTLEN 32
+
#define MAXPATCHCONTEXT 100
#define ACTIONSIZE 32
@@ -181,69 +267,122 @@
#define REM_SCANTIME 100
-
-enum {REM_OFF, REM_MONITOR, REM_TX};
-
-enum {ID, PROC, TERM, COMPLETE, UNKEY, REMDISC, REMALREADY, REMNOTFOUND, REMGO,
- CONNECTED, CONNFAIL, STATUS, TIMEOUT, ID1, STATS_TIME,
+#define DTMF_LOCAL_TIME 250
+#define DTMF_LOCAL_STARTTIME 500
+
+#define IC706_PL_MEMORY_OFFSET 50
+
+#define VOX_ON_DEBOUNCE_COUNT 3
+#define VOX_OFF_DEBOUNCE_COUNT 20
+#define VOX_MAX_THRESHOLD 10000.0
+#define VOX_MIN_THRESHOLD 3000.0
+#define VOX_TIMEOUT_MS 5000
+#define VOX_RECOVER_MS 500
+#define SIMPLEX_PATCH_DELAY 25
+#define SIMPLEX_PHONE_DELAY 25
+
+#define STATPOST_PROGRAM "/usr/bin/wget,-q,--output-document=/dev/null,--no-check-certificate"
+
+#define ALLOW_LOCAL_CHANNELS
+
+enum {REM_OFF,REM_MONITOR,REM_TX};
+
+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,
- TAILMSG, MACRO_NOTFOUND, GOSUB_NOTFOUND, MACRO_BUSY, GOSUB_BUSY, LASTNODEKEY};
-
-enum {REM_SIMPLEX, REM_MINUS, REM_PLUS};
-
-enum {REM_LOWPWR, REM_MEDPWR, REM_HIPWR};
-
-enum {DC_INDETERMINATE, DC_REQ_FLUSH, DC_ERROR, DC_COMPLETE, DC_DOKEY};
-
-enum {SOURCE_RPT, SOURCE_LNK, SOURCE_RMT, SOURCE_PHONE, SOURCE_DPHONE};
-
-enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM};
-
-enum {REM_MODE_FM, REM_MODE_USB, REM_MODE_LSB, REM_MODE_AM};
-
-enum {HF_SCAN_OFF, HF_SCAN_DOWN_SLOW, HF_SCAN_DOWN_QUICK,
- HF_SCAN_DOWN_FAST, HF_SCAN_UP_SLOW, HF_SCAN_UP_QUICK, HF_SCAN_UP_FAST};
+ TAILMSG, MACRO_NOTFOUND, MACRO_BUSY, LASTNODEKEY, FULLSTATUS,
+ MEMNOTFOUND, INVFREQ, REMMODE, REMLOGIN, REMXXX, REMSHORTSTATUS,
+ REMLONGSTATUS, LOGINREQ, SCAN, SCANSTAT, TUNE, SETREMOTE, TOPKEY,
+ TIMEOUT_WARNING, ACT_TIMEOUT_WARNING, LINKUNKEY, UNAUTHTX, PARROT,
+ STATS_TIME_LOCAL};
+
+
+enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
+
+enum {REM_LOWPWR,REM_MEDPWR,REM_HIPWR};
+
+enum {DC_INDETERMINATE, DC_REQ_FLUSH, DC_ERROR, DC_COMPLETE, DC_COMPLETEQUIET, DC_DOKEY};
+
+enum {SOURCE_RPT, SOURCE_LNK, SOURCE_RMT, SOURCE_PHONE, SOURCE_DPHONE, SOURCE_ALT};
+
+enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM, DLY_COMP, DLY_LINKUNKEY, DLY_PARROT};
+
+enum {REM_MODE_FM,REM_MODE_USB,REM_MODE_LSB,REM_MODE_AM};
+
+enum {HF_SCAN_OFF,HF_SCAN_DOWN_SLOW,HF_SCAN_DOWN_QUICK,
+ HF_SCAN_DOWN_FAST,HF_SCAN_UP_SLOW,HF_SCAN_UP_QUICK,HF_SCAN_UP_FAST};
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
#include <search.h>
+#include <sys/types.h>
#include <sys/stat.h>
+#include <errno.h>
#include <dirent.h>
#include <ctype.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/io.h>
+#include <sys/vfs.h>
#include <math.h>
+#ifdef OLD_ASTERISK
+#include <linux/zaptel.h>
+#include <tonezone.h>
+#else
+#include <zaptel/zaptel.h>
+#include <zaptel/tonezone.h>
+#endif
#include <netinet/in.h>
#include <arpa/inet.h>
#include "asterisk/utils.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
+#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/callerid.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/features.h"
+#include "asterisk/options.h"
#include "asterisk/cli.h"
#include "asterisk/config.h"
#include "asterisk/say.h"
#include "asterisk/localtime.h"
-#include "asterisk/app.h"
-
-#include "asterisk/zapata.h"
+#include "asterisk/cdr.h"
+#include "asterisk/options.h"
+#include "asterisk/manager.h"
+#include <termios.h>
+
+#ifdef NEW_ASTERISK
+struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
+#endif
+
+
+/* Start a tone-list going */
+int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
+/*! Stop the tones from playing */
+void ast_playtones_stop(struct ast_channel *chan);
+
+static char *tdesc = "Radio Repeater / Remote Base version 0.115 5/12/2008";
static char *app = "Rpt";
static char *synopsis = "Radio Repeater/Remote Base Control System";
static char *descrip =
-" Rpt(nodename[,options]): Radio Remote Link or Remote Base Link Endpoint Process.\n"
+" Rpt(nodename[|options][|M][|*]): \n"
+" Radio Remote Link or Remote Base Link Endpoint Process.\n"
"\n"
" Not specifying an option puts it in normal endpoint mode (where source\n"
" IP and nodename are verified).\n"
@@ -254,7 +393,7 @@
" this if you have checked security already (like with an IAX2\n"
" user/password or something).\n"
"\n"
-" Rannounce-string[,timeout[,timeout-destination]] - Amateur Radio\n"
+" Rannounce-string[|timeout[|timeout-destination]] - Amateur Radio\n"
" Reverse Autopatch. Caller is put on hold, and announcement (as\n"
" specified by the 'announce-string') is played on radio system.\n"
" Users of radio system can access autopatch, dial specified\n"
@@ -275,17 +414,66 @@
" this mode), the 'dphone_functions' parameter must be specified\n"
" for the node in 'rpt.conf'. Otherwise no DTMF control will be\n"
" available to the phone user.\n"
+"\n"
+" S - Simplex Dumb Phone Control mode. This allows a regular phone user\n"
+" audio-only access to the radio system. In this mode, the\n"
+" transmitter is toggled on and off when the phone user presses the\n"
+" funcchar (*) key on the telephone set. In addition, the transmitter\n"
+" will turn off if the endchar (#) key is pressed. When a user first\n"
+" calls in, the transmitter will be off, and the user can listen for\n"
+" radio traffic. When the user wants to transmit, they press the *\n"
+" key, start talking, then press the * key again or the # key to turn\n"
+" the transmitter off. No other functions can be executed by the\n"
+" user on the phone when this mode is selected. Note: If your\n"
+" radio system is full-duplex, we recommend using either P or D\n"
+" modes as they provide more flexibility.\n"
+"\n"
+" q - Query Status. Sets channel variables and returns + 101 in plan.\n"
+"\n"
+" M - Memory Channel Steer as MXX where XX is the memory channel number.\n"
+"\n"
+" * - Alt Macro to execute (e.g. *7 for status)\n"
"\n";
-
-static unsigned int vmajor = 0;
-static unsigned int vminor = 47;
-
-static int debug = 0; /* FIXME Set this >0 for extra debug output */
+;
+
+static int debug = 0; /* Set this >0 for extra debug output */
static int nrpts = 0;
+static char remdtmfstr[] = "0123456789*#ABCD";
+
+enum {TOP_TOP,TOP_WON,WON_BEFREAD,BEFREAD_AFTERREAD};
+
+int max_chan_stat [] = {22000,1000,22000,100,22000,2000,22000};
+
+#define NRPTSTAT 7
+
+struct rpt_chan_stat
+{
+ struct timeval last;
+ long long total;
+ unsigned long count;
+ unsigned long largest;
+ struct timeval largest_time;
+};
+
char *discstr = "!!DISCONNECT!!";
-static char *remote_rig_ft897 = "ft897";
-static char *remote_rig_rbi = "rbi";
+char *newkeystr = "!NEWKEY!";
+static char *remote_rig_ft897="ft897";
+static char *remote_rig_rbi="rbi";
+static char *remote_rig_kenwood="kenwood";
+static char *remote_rig_tm271="tm271";
+static char *remote_rig_ic706="ic706";
+static char *remote_rig_rtx150="rtx150";
+static char *remote_rig_rtx450="rtx450";
+static char *remote_rig_ppp16="ppp16"; // parallel port programmable 16 channels
+
+#define ISRIG_RTX(x) ((!strcmp(x,remote_rig_rtx150)) || (!strcmp(x,remote_rig_rtx450)))
+#define IS_XPMR(x) (!strncasecmp(x->rxchanname,"rad",3))
+
+#ifdef OLD_ASTERISK
+STANDARD_LOCAL_USER;
+LOCAL_USER_DECL;
+#endif
#define MSWAIT 200
#define HANGTIME 5000
@@ -296,9 +484,44 @@
#define POLITEID 30000
#define FUNCTDELAY 1500
+#define MAXXLAT 20
+#define MAXXLATTIME 3
+
+#define MAX_SYSSTATES 10
+
+struct vox {
+ float speech_energy;
+ float noise_energy;
+ int enacount;
+ char voxena;
+ char lastvox;
+ int offdebcnt;
+ int ondebcnt;
+} ;
+
+#define mymax(x,y) ((x > y) ? x : y)
+#define mymin(x,y) ((x < y) ? x : y)
+
+struct rpt_topkey
+{
+char node[TOPKEYMAXSTR];
+int timesince;
+int keyed;
+} ;
+
+struct rpt_xlat
+{
+char funccharseq[MAXXLAT];
+char endcharseq[MAXXLAT];
+char passchars[MAXXLAT];
+int funcindex;
+int endindex;
+time_t lastone;
+} ;
+
+static time_t starttime = 0;
+
static pthread_t rpt_master_thread;
-
-struct timeval cancel_atimeout = { 0, 0 };
struct rpt;
@@ -309,11 +532,17 @@
char mode; /* 1 if in tx mode */
char isremote;
char phonemode;
+ char phonevox; /* vox the phone */
char name[MAXNODESTR]; /* identifier (routing) string */
char lasttx;
+ char lasttx1;
char lastrx;
+ char lastrealrx;
+ char lastrx1;
char connected;
char hasconnected;
+ char perma;
+ char thisconnected;
char outbound;
char disced;
char killme;
@@ -321,11 +550,31 @@
long disctime;
long retrytimer;
long retxtimer;
+ long rerxtimer;
int retries;
+ int max_retries;
int reconnects;
long long connecttime;
struct ast_channel *chan;
struct ast_channel *pchan;
+ char linklist[MAXLINKLIST];
+ time_t linklistreceived;
+ long linklisttimer;
+ int dtmfed;
+ int linkunkeytocttimer;
+ struct timeval lastlinktv;
+ struct ast_frame *lastf1,*lastf2;
+ struct rpt_chan_stat chan_stat[NRPTSTAT];
+ struct vox vox;
+ char wasvox;
+ int voxtotimer;
+ char voxtostate;
+ char newkey;
+#ifdef OLD_ASTERISK
+ AST_LIST_HEAD(, ast_frame) rxq;
+#else
+ AST_LIST_HEAD_NOLOCK(, ast_frame) rxq;
+#endif
} ;
struct rpt_lstat
@@ -337,7 +586,9 @@
char mode;
char outbound;
char reconnects;
+ char thisconnected;
long long connecttime;
+ struct rpt_chan_stat chan_stat[NRPTSTAT];
} ;
struct rpt_tele
@@ -349,6 +600,8 @@
int mode;
struct rpt_link mylink;
char param[TELEPARAMSIZE];
+ int submode;
+ unsigned int parrot;
pthread_t threadid;
} ;
@@ -374,85 +627,163 @@
} ;
+struct sysstate
+{
+ char txdisable;
+ char totdisable;
+ char linkfundisable;
+ char autopatchdisable;
+ char schedulerdisable;
+ char userfundisable;
+ char alternatetail;
+};
+
+/* rpt cmd support */
+#define CMD_DEPTH 1
+#define CMD_STATE_IDLE 0
+#define CMD_STATE_BUSY 1
+#define CMD_STATE_READY 2
+#define CMD_STATE_EXECUTING 3
+
+struct rpt_cmd_struct
+{
+ int state;
+ int functionNumber;
+ char param[MAXDTMF];
+ char digits[MAXDTMF];
+ int command_source;
+};
+
static struct rpt
{
ast_mutex_t lock;
+ ast_mutex_t remlock;
+ ast_mutex_t statpost_lock;
struct ast_config *cfg;
char reload;
+ char xlink; // cross link state of a share repeater/remote radio
+ unsigned int statpost_seqno;
char *name;
char *rxchanname;
char *txchanname;
- char *remote;
+ char remote;
+ char *remoterig;
+ struct rpt_chan_stat chan_stat[NRPTSTAT];
+ unsigned int scram;
struct {
- char ourcontext[80];
- char ourcallerid[80];
- char acctcode[21];
- char ident[80];
- char tonezone[80];
+ char *ourcontext;
+ char *ourcallerid;
+ char *acctcode;
+ char *ident;
+ char *tonezone;
char simple;
- char functions[80];
- char link_functions[80];
- char phone_functions[80];
- char dphone_functions[80];
- char nodes[80];
+ char *functions;
+ char *link_functions;
+ char *phone_functions;
+ char *dphone_functions;
+ char *alt_functions;
+ char *nodes;
+ char *extnodes;
+ char *extnodefile;
int hangtime;
+ int althangtime;
int totime;
int idtime;
int tailmessagetime;
int tailsquashedtime;
int duplex;
int politeid;
- char *tailmsgbuf;
- AST_DECLARE_APP_ARGS(tailmsg,
- AST_APP_ARG(msgs)[100];
- );
- char memory[80];
- char macro[80];
- char gosub[80];
- char startupmacro[80];
- char startupgosub[80];
+ char *tailmessages[500];
+ int tailmessagemax;
+ char *memory;
+ char *macro;
+ char *tonemacro;
+ char *startupmacro;
int iobase;
+ char *ioport;
char funcchar;
char endchar;
char nobusyout;
+ char notelemtx;
+ char propagate_dtmf;
+ char propagate_phonedtmf;
+ char linktolink;
+ unsigned char civaddr;
+ struct rpt_xlat inxlat;
+ struct rpt_xlat outxlat;
+ char *archivedir;
+ int authlevel;
+ char *csstanzaname;
+ char *skedstanzaname;
+ char *txlimitsstanzaname;
+ long monminblocks;
+ int remoteinacttimeout;
+ int remotetimeout;
+ int remotetimeoutwarning;
+ int remotetimeoutwarningfreq;
+ int sysstate_cur;
+ struct sysstate s[MAX_SYSSTATES];
+ char parrotmode;
+ int parrottime;
+ char *rptnode;
+ char remote_mars;
+ int voxtimeout_ms;
+ int voxrecover_ms;
+ int simplexpatchdelay;
+ int simplexphonedelay;
+ char *statpost_program;
+ char *statpost_url;
} p;
struct rpt_link links;
int unkeytocttimer;
+ time_t lastkeyedtime;
+ time_t lasttxkeyedtime;
char keyed;
+ char txkeyed;
char exttx;
char localtx;
char remoterx;
char remotetx;
char remoteon;
+ char remtxfreqok;
char tounkeyed;
char tonotify;
- char enable;
char dtmfbuf[MAXDTMF];
char macrobuf[MAXMACRO];
- char gosubbuf[MAXGOSUB];
char rem_dtmfbuf[MAXDTMF];
char lastdtmfcommand[MAXDTMF];
char cmdnode[50];
- struct ast_channel *rxchannel, *txchannel;
- struct ast_channel *pchannel, *txpchannel, *remchannel;
+ char nowchan; // channel now
+ char waschan; // channel selected initially or by command
+ char bargechan; // barge in channel
+ char macropatch; // autopatch via tonemacro state
+ char parrotstate;
+ int parrottimer;
+ unsigned int parrotcnt;
+ struct ast_channel *rxchannel,*txchannel, *monchannel, *parrotchannel;
+ struct ast_channel *pchannel,*txpchannel, *zaprxchannel, *zaptxchannel;
+ struct ast_channel *voxchannel;
+ struct ast_frame *lastf1,*lastf2;
struct rpt_tele tele;
- struct timeval lasttv, curtv;
- pthread_t rpt_call_thread, rpt_thread;
- time_t dtmf_time, rem_dtmf_time, dtmf_time_rem;
- int tailtimer, totimer, idtimer, txconf, conf, callmode, cidx, scantimer, tmsgtimer, skedtimer;
- int mustid, tailid;
+ struct timeval lasttv,curtv;
+ pthread_t rpt_call_thread,rpt_thread;
+ time_t dtmf_time,rem_dtmf_time,dtmf_time_rem;
+ int calldigittimer;
+ int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer,tmsgtimer,skedtimer;
+ int mustid,tailid;
int tailevent;
int telemrefcount;
- int dtmfidx, rem_dtmfidx;
- int dailytxtime, dailykerchunks, totalkerchunks, dailykeyups, totalkeyups, timeouts;
+ int dtmfidx,rem_dtmfidx;
+ int dailytxtime,dailykerchunks,totalkerchunks,dailykeyups,totalkeyups,timeouts;
int totalexecdcommands, dailyexecdcommands;
- long retxtimer;
+ long retxtimer;
+ long rerxtimer;
long long totaltxtime;
char mydtmf;
char exten[AST_MAX_EXTENSION];
- char freq[MAXREMSTR], rxpl[MAXREMSTR], txpl[MAXREMSTR];
+ char freq[MAXREMSTR],rxpl[MAXREMSTR],txpl[MAXREMSTR];
char offset;
char powerlevel;
char txplon;
@@ -461,16 +792,18 @@
char tunerequest;
char hfscanmode;
int hfscanstatus;
+ char hfscanstop;
char lastlinknode[MAXNODESTR];
- char stopgen;
+ char savednodes[MAXNODESTR];
+ int stopgen;
char patchfarenddisconnect;
char patchnoct;
char patchquiet;
char patchcontext[MAXPATCHCONTEXT];
int patchdialtime;
int macro_longest;
- int gosub_longest;
int phone_longestfunc;
+ int alt_longestfunc;
int dphone_longestfunc;
int link_longestfunc;
int longestfunc;
@@ -479,31 +812,80 @@
int tailmessagen;
time_t disgorgetime;
time_t lastthreadrestarttime;
- long macrotimer;
- long gosubtimer;
- char lastnodewhichkeyedusup[MAXNODESTR];
+ long macrotimer;
+ char lastnodewhichkeyedusup[MAXNODESTR];
+ int dtmf_local_timer;
+ char dtmf_local_str[100];
+ struct ast_filestream *monstream,*parrotstream;
+ char loginuser[50];
+ char loginlevel[10];
+ long authtelltimer;
+ long authtimer;
+ int iofd;
+ time_t start_time,last_activity_time;
+ char lasttone[32];
+ struct rpt_tele *active_telem;
+ struct rpt_topkey topkey[TOPKEYN];
+ int topkeystate;
+ time_t topkeytime;
+ int topkeylong;
+ struct vox vox;
+ char wasvox;
+ int voxtotimer;
+ char voxtostate;
+ int linkposttimer;
+ int keyposttimer;
+ char newkey;
+ char inpadtest;
+#ifdef OLD_ASTERISK
+ AST_LIST_HEAD(, ast_frame) txq;
+#else
+ AST_LIST_HEAD_NOLOCK(, ast_frame) txq;
+#endif
+ char txrealkeyed;
#ifdef __RPT_NOTCH
struct rptfilter
{
- char desc[100];
- float x0;
- float x1;
- float x2;
- float y0;
- float y1;
- float y2;
- float gain;
- float const0;
- float const1;
- float const2;
+ char desc[100];
+ float x0;
+ float x1;
+ float x2;
+ float y0;
+ float y1;
+ float y2;
+ float gain;
+ float const0;
+ float const1;
+ float const2;
} filters[MAXFILTERS];
#endif
#ifdef _MDC_DECODE_H_
mdc_decoder_t *mdc;
unsigned short lastunit;
#endif
+ struct rpt_cmd_struct cmdAction;
} rpt_vars[MAXRPTS];
+struct nodelog {
+struct nodelog *next;
+struct nodelog *prev;
+time_t timestamp;
+char archivedir[MAXNODESTR];
+char str[MAXNODESTR * 2];
+} nodelog;
+
+static int service_scan(struct rpt *myrpt);
+static int set_mode_ft897(struct rpt *myrpt, char newmode);
+static int set_mode_ic706(struct rpt *myrpt, char newmode);
+static int simple_command_ft897(struct rpt *myrpt, char command);
+static int setrem(struct rpt *myrpt);
+static int setrtx_check(struct rpt *myrpt);
+static int channel_revert(struct rpt *myrpt);
+static int channel_steer(struct rpt *myrpt, char *data);
+
+AST_MUTEX_DEFINE_STATIC(nodeloglock);
+
+AST_MUTEX_DEFINE_STATIC(nodelookuplock);
#ifdef APP_RPT_LOCK_DEBUG
@@ -511,8 +893,8 @@
#define MAXLOCKTHREAD 100
-#define rpt_mutex_lock(x) _rpt_mutex_lock(x, myrpt, __LINE__)
-#define rpt_mutex_unlock(x) _rpt_mutex_unlock(x, myrpt, __LINE__)
+#define rpt_mutex_lock(x) _rpt_mutex_lock(x,myrpt,__LINE__)
+#define rpt_mutex_unlock(x) _rpt_mutex_unlock(x,myrpt,__LINE__)
struct lockthread
{
@@ -531,40 +913,42 @@
struct lockthread lockthread;
} lock_ring[32];
-
int lock_ring_index = 0;
AST_MUTEX_DEFINE_STATIC(locklock);
static struct lockthread *get_lockthread(pthread_t id)
{
- int i;
-
- for (i = 0; i < MAXLOCKTHREAD; i++) {
+int i;
+
+ for(i = 0; i < MAXLOCKTHREAD; i++)
+ {
+ if (lockthreads[i].id == id) return(&lockthreads[i]);
+ }
+ return(NULL);
+}
+
+static struct lockthread *put_lockthread(pthread_t id)
+{
+int i;
+
+ for(i = 0; i < MAXLOCKTHREAD; i++)
+ {
if (lockthreads[i].id == id)
return(&lockthreads[i]);
}
- return NULL;
-}
-
-static struct lockthread *put_lockthread(pthread_t id)
-{
- int i;
-
- for (i = 0; i < MAXLOCKTHREAD; i++) {
- if (lockthreads[i].id == id)
- return(&lockthreads[i]);
- }
- for (i = 0; i < MAXLOCKTHREAD; i++) {
- if (!lockthreads[i].id) {
+ for(i = 0; i < MAXLOCKTHREAD; i++)
+ {
+ if (!lockthreads[i].id)
+ {
lockthreads[i].lockcount = 0;
lockthreads[i].lastlock = 0;
lockthreads[i].lastunlock = 0;
lockthreads[i].id = id;
- return &lockthreads[i];
- }
- }
- return NULL;
+ return(&lockthreads[i]);
+ }
+ }
+ return(NULL);
}
@@ -572,10 +956,9 @@
{
struct by_lightning lock_ring_copy[32];
int lock_ring_index_copy;
- int i, j;
+ int i,j;
long long diff;
- char a[100] = "";
- struct ast_tm tm;
+ char a[100];
struct timeval lasttv;
ast_mutex_lock(&locklock);
@@ -584,27 +967,30 @@
ast_mutex_unlock(&locklock);
lasttv.tv_sec = lasttv.tv_usec = 0;
- for (i = 0; i < 32; i++) {
+ for(i = 0 ; i < 32 ; i++)
+ {
j = (i + lock_ring_index_copy) % 32;
- ast_strftime(a, sizeof(a) - 1, "%m/%d/%Y %H:%M:%S",
- ast_localtime(&lock_ring_copy[j].tv, &tm, NULL));
+ strftime(a,sizeof(a) - 1,"%m/%d/%Y %H:%M:%S",
+ localtime(&lock_ring_copy[j].tv.tv_sec));
diff = 0;
- if (lasttv.tv_sec) {
- diff = (lock_ring_copy[j].tv.tv_sec - lasttv.tv_sec) * 1000000;
+ if(lasttv.tv_sec)
+ {
+ diff = (lock_ring_copy[j].tv.tv_sec - lasttv.tv_sec)
+ * 1000000;
diff += (lock_ring_copy[j].tv.tv_usec - lasttv.tv_usec);
}
lasttv.tv_sec = lock_ring_copy[j].tv.tv_sec;
lasttv.tv_usec = lock_ring_copy[j].tv.tv_usec;
- if (!lock_ring_copy[j].tv.tv_sec)
- continue;
- if (lock_ring_copy[j].line < 0) {
- ast_log(LOG_NOTICE, "LOCKDEBUG [#%d] UNLOCK app_rpt.c:%d node %s pid %x diff %lld us at %s.%06d\n",
- i - 31, -lock_ring_copy[j].line, lock_ring_copy[j].rpt->name,
- (int) lock_ring_copy[j].lockthread.id, diff, a, (int)lock_ring_copy[j].tv.tv_usec);
- } else {
- ast_log(LOG_NOTICE, "LOCKDEBUG [#%d] LOCK app_rpt.c:%d node %s pid %x diff %lld us at %s.%06d\n",
- i - 31, lock_ring_copy[j].line, lock_ring_copy[j].rpt->name,
- (int) lock_ring_copy[j].lockthread.id, diff, a, (int)lock_ring_copy[j].tv.tv_usec);
+ if (!lock_ring_copy[j].tv.tv_sec) continue;
+ if (lock_ring_copy[j].line < 0)
+ {
+ ast_log(LOG_NOTICE,"LOCKDEBUG [#%d] UNLOCK app_rpt.c:%d node %s pid %x diff %lld us at %s.%06d\n",
+ i - 31,-lock_ring_copy[j].line,lock_ring_copy[j].rpt->name,(int) lock_ring_copy[j].lockthread.id,diff,a,(int)lock_ring_copy[j].tv.tv_usec);
+ }
+ else
+ {
+ ast_log(LOG_NOTICE,"LOCKDEBUG [#%d] LOCK app_rpt.c:%d node %s pid %x diff %lld us at %s.%06d\n",
+ i - 31,lock_ring_copy[j].line,lock_ring_copy[j].rpt->name,(int) lock_ring_copy[j].lockthread.id,diff,a,(int)lock_ring_copy[j].tv.tv_usec);
}
}
}
@@ -612,21 +998,22 @@
static void _rpt_mutex_lock(ast_mutex_t *lockp, struct rpt *myrpt, int line)
{
- struct lockthread *t;
- pthread_t id;
+struct lockthread *t;
+pthread_t id;
id = pthread_self();
ast_mutex_lock(&locklock);
t = put_lockthread(id);
- if (!t) {
+ if (!t)
+ {
ast_mutex_unlock(&locklock);
return;
}
- if (t->lockcount) {
+ if (t->lockcount)
+ {
int lastline = t->lastlock;
ast_mutex_unlock(&locklock);
- ast_log(LOG_NOTICE, "rpt_mutex_lock: Double lock request line %d node %s pid %x, last lock was line %d\n",
- line, myrpt->name, (int) t->id, lastline);
+ ast_log(LOG_NOTICE,"rpt_mutex_lock: Double lock request line %d node %s pid %x, last lock was line %d\n",line,myrpt->name,(int) t->id,lastline);
rpt_mutex_spew();
return;
}
@@ -634,9 +1021,9 @@
t->lockcount = 1;
gettimeofday(&lock_ring[lock_ring_index].tv, NULL);
lock_ring[lock_ring_index].rpt = myrpt;
- memcpy(&lock_ring[lock_ring_index].lockthread, t, sizeof(struct lockthread));
+ memcpy(&lock_ring[lock_ring_index].lockthread,t,sizeof(struct lockthread));
lock_ring[lock_ring_index++].line = line;
- if (lock_ring_index == 32)
+ if(lock_ring_index == 32)
lock_ring_index = 0;
ast_mutex_unlock(&locklock);
ast_mutex_lock(lockp);
@@ -645,21 +1032,22 @@
static void _rpt_mutex_unlock(ast_mutex_t *lockp, struct rpt *myrpt, int line)
{
- struct lockthread *t;
- pthread_t id;
+struct lockthread *t;
+pthread_t id;
id = pthread_self();
ast_mutex_lock(&locklock);
t = put_lockthread(id);
- if (!t) {
+ if (!t)
+ {
ast_mutex_unlock(&locklock);
return;
}
- if (!t->lockcount) {
+ if (!t->lockcount)
+ {
int lastline = t->lastunlock;
ast_mutex_unlock(&locklock);
- ast_log(LOG_NOTICE, "rpt_mutex_lock: Double un-lock request line %d node %s pid %x, last un-lock was line %d\n",
- line, myrpt->name, (int) t->id, lastline);
+ ast_log(LOG_NOTICE,"rpt_mutex_lock: Double un-lock request line %d node %s pid %x, last un-lock was line %d\n",line,myrpt->name,(int) t->id,lastline);
rpt_mutex_spew();
return;
}
@@ -667,9 +1055,9 @@
t->lockcount = 0;
gettimeofday(&lock_ring[lock_ring_index].tv, NULL);
lock_ring[lock_ring_index].rpt = myrpt;
- memcpy(&lock_ring[lock_ring_index].lockthread, t, sizeof(struct lockthread));
+ memcpy(&lock_ring[lock_ring_index].lockthread,t,sizeof(struct lockthread));
lock_ring[lock_ring_index++].line = -line;
- if (lock_ring_index == 32)
+ if(lock_ring_index == 32)
lock_ring_index = 0;
ast_mutex_unlock(&locklock);
ast_mutex_unlock(lockp);
@@ -683,25 +1071,205 @@
#endif /* APP_RPT_LOCK_DEBUG */
/*
+* Return 1 if rig is multimode capable
+*/
+
+static int multimode_capable(struct rpt *myrpt)
+{
+ if(!strcmp(myrpt->remoterig, remote_rig_ft897))
+ return 1;
+ if(!strcmp(myrpt->remoterig, remote_rig_ic706))
+ return 1;
+ return 0;
+}
+
+static void voxinit_rpt(struct rpt *myrpt,char enable)
+{
+
+ myrpt->vox.speech_energy = 0.0;
+ myrpt->vox.noise_energy = 0.0;
+ myrpt->vox.enacount = 0;
+ myrpt->vox.voxena = 0;
+ if (!enable) myrpt->vox.voxena = -1;
+ myrpt->vox.lastvox = 0;
+ myrpt->vox.ondebcnt = VOX_ON_DEBOUNCE_COUNT;
+ myrpt->vox.offdebcnt = VOX_OFF_DEBOUNCE_COUNT;
+ myrpt->wasvox = 0;
+ myrpt->voxtotimer = 0;
+ myrpt->voxtostate = 0;
+}
+
+static void voxinit_link(struct rpt_link *mylink,char enable)
+{
+
+ mylink->vox.speech_energy = 0.0;
+ mylink->vox.noise_energy = 0.0;
+ mylink->vox.enacount = 0;
+ mylink->vox.voxena = 0;
+ if (!enable) mylink->vox.voxena = -1;
+ mylink->vox.lastvox = 0;
+ mylink->vox.ondebcnt = VOX_ON_DEBOUNCE_COUNT;
+ mylink->vox.offdebcnt = VOX_OFF_DEBOUNCE_COUNT;
+ mylink->wasvox = 0;
+ mylink->voxtotimer = 0;
+ mylink->voxtostate = 0;
+}
+
+static int dovox(struct vox *v,short *buf,int bs)
+{
+
+ int i;
+ float esquare = 0.0;
+ float energy = 0.0;
+ float threshold = 0.0;
+
+ if (v->voxena < 0) return(v->lastvox);
+ for(i = 0; i < bs; i++)
+ {
+ esquare += (float) buf[i] * (float) buf[i];
+ }
+ energy = sqrt(esquare);
+
+ if (energy >= v->speech_energy)
+ v->speech_energy += (energy - v->speech_energy) / 4;
+ else
+ v->speech_energy += (energy - v->speech_energy) / 64;
+
+ if (energy >= v->noise_energy)
+ v->noise_energy += (energy - v->noise_energy) / 64;
+ else
+ v->noise_energy += (energy - v->noise_energy) / 4;
+
+ if (v->voxena) threshold = v->speech_energy / 8;
+ else
+ {
+ threshold = mymax(v->speech_energy / 16,v->noise_energy * 2);
+ threshold = mymin(threshold,VOX_MAX_THRESHOLD);
+ }
+ threshold = mymax(threshold,VOX_MIN_THRESHOLD);
+ if (energy > threshold)
+ {
+ if (v->voxena) v->noise_energy *= 0.75;
+ v->voxena = 1;
+ } else v->voxena = 0;
+ if (v->lastvox != v->voxena)
+ {
+ if (v->enacount++ >= ((v->lastvox) ? v->offdebcnt : v->ondebcnt))
+ {
+ v->lastvox = v->voxena;
+ v->enacount = 0;
+ }
+ } else v->enacount = 0;
+ return(v->lastvox);
+}
+
+
+
+
+/*
* CLI extensions
*/
/* Debug mode */
-static char *handle_cli_rpt_debug_level(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static char *handle_cli_rpt_dump(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static char *handle_cli_rpt_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static char *handle_cli_rpt_lstats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static char *handle_cli_rpt_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-static char *handle_cli_rpt_restart(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
-
-static struct ast_cli_entry cli_rpt[] = {
- AST_CLI_DEFINE(handle_cli_rpt_debug_level, "Enable app_rpt debuggin"),
- AST_CLI_DEFINE(handle_cli_rpt_dump, "Dump app_rpt structs for debugging"),
- AST_CLI_DEFINE(handle_cli_rpt_stats, "Dump node statistics"),
- AST_CLI_DEFINE(handle_cli_rpt_lstats, "Dump link statistics"),
- AST_CLI_DEFINE(handle_cli_rpt_reload, "Reload app_rpt config"),
- AST_CLI_DEFINE(handle_cli_rpt_restart, "Restart app_rpt")
-};
+static int rpt_do_debug(int fd, int argc, char *argv[]);
+static int rpt_do_dump(int fd, int argc, char *argv[]);
+static int rpt_do_stats(int fd, int argc, char *argv[]);
+static int rpt_do_lstats(int fd, int argc, char *argv[]);
+static int rpt_do_nodes(int fd, int argc, char *argv[]);
+static int rpt_do_local_nodes(int fd, int argc, char *argv[]);
+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_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[]);
+
+static char debug_usage[] =
+"Usage: rpt debug level {0-7}\n"
+" Enables debug messages in app_rpt\n";
+
+static char dump_usage[] =
+"Usage: rpt dump <nodename>\n"
+" Dumps struct debug info to log\n";
+
+static char dump_stats[] =
+"Usage: rpt stats <nodename>\n"
+" Dumps node statistics to console\n";
+
+static char dump_lstats[] =
+"Usage: rpt lstats <nodename>\n"
+" Dumps link statistics to console\n";
+
+static char dump_nodes[] =
+"Usage: rpt nodes <nodename>\n"
+" Dumps a list of directly and indirectly connected nodes to the console\n";
+
+static char usage_local_nodes[] =
+"Usage: rpt localnodes\n"
+" Dumps a list of the locally configured node numbers to the console.\n";
+
+static char reload_usage[] =
+"Usage: rpt reload\n"
+" Reloads app_rpt running config parameters\n";
+
+static char restart_usage[] =
+"Usage: rpt restart\n"
+" Restarts app_rpt\n";
+
+static char fun_usage[] =
+"Usage: rpt fun <nodename> <command>\n"
+" Send a DTMF function to a node\n";
+
+static char cmd_usage[] =
+"Usage: rpt cmd <nodename> <cmd-name> <cmd-index> <cmd-args.\n"
+" Send a command to a node.\n i.e. rpt cmd 2000 ilink 3 2001\n";
+
+#ifndef NEW_ASTERISK
+
+static struct ast_cli_entry cli_debug =
+ { { "rpt", "debug", "level" }, rpt_do_debug,
+ "Enable app_rpt debugging", debug_usage };
+
+static struct ast_cli_entry cli_dump =
+ { { "rpt", "dump" }, rpt_do_dump,
+ "Dump app_rpt structs for debugging", dump_usage };
+
+static struct ast_cli_entry cli_stats =
+ { { "rpt", "stats" }, rpt_do_stats,
+ "Dump node statistics", dump_stats };
+
+static struct ast_cli_entry cli_nodes =
+ { { "rpt", "nodes" }, rpt_do_nodes,
+ "Dump node list", dump_nodes };
+
+static struct ast_cli_entry cli_local_nodes =
+ { { "rpt", "localnodes" }, rpt_do_local_nodes,
+ "Dump list of local node numbers", usage_local_nodes };
+
+static struct ast_cli_entry cli_lstats =
+ { { "rpt", "lstats" }, rpt_do_lstats,
+ "Dump link statistics", dump_lstats };
+
+static struct ast_cli_entry cli_reload =
+ { { "rpt", "reload" }, rpt_do_reload,
+ "Reload app_rpt config", reload_usage };
+
+static struct ast_cli_entry cli_restart =
+ { { "rpt", "restart" }, rpt_do_restart,
+ "Restart app_rpt", restart_usage };
+
+static struct ast_cli_entry cli_fun =
+ { { "rpt", "fun" }, rpt_do_fun,
+ "Execute a DTMF function", fun_usage };
+
+static struct ast_cli_entry cli_fun1 =
+ { { "rpt", "fun1" }, rpt_do_fun1,
+ "Execute a DTMF function", fun_usage };
+
+static struct ast_cli_entry cli_cmd =
+ { { "rpt", "cmd" }, rpt_do_cmd,
+ "Execute a DTMF function", cmd_usage };
+
+#endif
/*
* Telemetry defaults
@@ -709,25 +1277,30 @@
static struct telem_defaults tele_defs[] = {
- {"ct1", "|t(350,0,100,3072)(500,0,100,3072)(660,0,100,3072)"},
- {"ct2", "|t(660,880,150,3072)"},
- {"ct3", "|t(440,0,150,3072)"},
- {"ct4", "|t(550,0,150,3072)"},
- {"ct5", "|t(660,0,150,3072)"},
- {"ct6", "|t(880,0,150,3072)"},
- {"ct7", "|t(660,440,150,3072)"},
- {"ct8", "|t(700,1100,150,3072)"},
- {"remotemon", "|t(1600,0,75,2048)"},
- {"remotetx", "|t(2000,0,75,2048)(0,0,75,0)(1600,0,75,2048)"},
- {"cmdmode", "|t(900,904,200,2048)"},
- {"functcomplete", "|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048)"}
+ {"ct1","|t(350,0,100,3072)(500,0,100,3072)(660,0,100,3072)"},
+ {"ct2","|t(660,880,150,3072)"},
+ {"ct3","|t(440,0,150,3072)"},
+ {"ct4","|t(550,0,150,3072)"},
+ {"ct5","|t(660,0,150,3072)"},
+ {"ct6","|t(880,0,150,3072)"},
+ {"ct7","|t(660,440,150,3072)"},
+ {"ct8","|t(700,1100,150,3072)"},
+ {"remotemon","|t(1600,0,75,2048)"},
+ {"remotetx","|t(2000,0,75,2048)(0,0,75,0)(1600,0,75,2048)"},
+ {"cmdmode","|t(900,904,200,2048)"},
+ {"functcomplete","|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048)"}
} ;
/*
-* Forward decl's - these suppress compiler warnings when funcs coded further down the file than their invocation
+* Forward decl's - these suppress compiler warnings when funcs coded further down the file than thier invokation
*/
static int setrbi(struct rpt *myrpt);
+static int set_ft897(struct rpt *myrpt);
+static int set_ic706(struct rpt *myrpt);
+static int setkenwood(struct rpt *myrpt);
+static int set_tm271(struct rpt *myrpt);
+static int setrbi_check(struct rpt *myrpt);
@@ -742,7 +1315,7 @@
static int function_cop(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
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_gosub(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);
/*
* Function table
*/
@@ -755,30 +1328,747 @@
{"status", function_status},
{"remote", function_remote},
{"macro", function_macro},
- {"gosub", function_gosub},
+ {"playback", function_playback}
} ;
+static long diskavail(struct rpt *myrpt)
+{
+struct statfs statfsbuf;
+
+ if (!myrpt->p.archivedir) return(0);
+ if (statfs(myrpt->p.archivedir,&statfsbuf) == -1)
+ {
+ ast_log(LOG_WARNING,"Cannot get filesystem size for %s node %s\n",
+ myrpt->p.archivedir,myrpt->name);
+ return(-1);
+ }
+ return(statfsbuf.f_bavail);
+}
+
+static void flush_telem(struct rpt *myrpt)
+{
+ struct rpt_tele *telem;
+ if(debug > 2)
+ ast_log(LOG_NOTICE, "flush_telem()!!");
+ rpt_mutex_lock(&myrpt->lock);
+ telem = myrpt->tele.next;
+ while(telem != &myrpt->tele)
+ {
+ if (telem->mode != SETREMOTE) ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV);
+ telem = telem->next;
+ }
+ rpt_mutex_unlock(&myrpt->lock);
+}
/*
-* Match a keyword in a list, and return index of string plus 1 if there was a match,
[... 27060 lines stripped ...]
More information about the asterisk-commits
mailing list