summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2012-03-13 23:42:24 +0000
committerRussell Bryant <russell@russellbryant.com>2012-03-13 23:42:24 +0000
commit4585000039a1d94af44c1fa2ccb3b4490cdb869b (patch)
tree7f912ff0febde8c726535a757cd1765b94c5f00b
parent128c9109b027d833ee8f53f79b95b75b27613f44 (diff)
Remove chan_usbradio and app_rpt.
These modules are being maintained outside of the tree and have been for a long time now, so it doesn't make sense to keep them here. Review: https://reviewboard.asterisk.org/r/1764/ ........ Merged revisions 359050 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 359051 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--apps/app_rpt.c15220
-rw-r--r--build_tools/menuselect-deps.in1
-rw-r--r--channels/chan_usbradio.c4035
-rwxr-xr-xchannels/xpmr/sinetabx.h300
-rwxr-xr-xchannels/xpmr/xpmr.c3325
-rwxr-xr-xchannels/xpmr/xpmr.h951
-rwxr-xr-xchannels/xpmr/xpmr_coef.h667
-rwxr-xr-xconfigure1812
-rw-r--r--configure.ac3
-rw-r--r--include/asterisk/autoconfig.h.in16
-rw-r--r--makeopts.in3
11 files changed, 810 insertions, 25523 deletions
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
deleted file mode 100644
index 6b01c83e1..000000000
--- a/apps/app_rpt.c
+++ /dev/null
@@ -1,15220 +0,0 @@
-#define NEW_ASTERISK
-/* #define OLD_ASTERISK */
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2002-2008, Jim Dixon, WB6NIL
- *
- * Jim Dixon, WB6NIL <jim@lambdatel.com>
- * Serious contributions by Steve RoDgers, WA6ZFT <hwstar@rodgers.sdcoxmail.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * 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.115 5/12/08 2055 EDT
- *
- * \author Jim Dixon, WB6NIL <jim@lambdatel.com>
- *
- * \note Serious contributions by Steve RoDgers, WA6ZFT <hwstar@rodgers.sdcoxmail.com>
- * \note Steven Henke, W9SH, <w9sh@arrl.net> added a few features here and there.
- *
- * See http://www.zapatatelephony.org/app_rpt.html
- *
- *
- * Repeater / Remote Functions:
- * "Simple" Mode: * - autopatch access, # - autopatch hangup
- * Normal mode:
- * See the function list in rpt.conf (autopatchup, autopatchdn)
- * autopatchup can optionally take comma delimited setting=value pairs:
- *
- *
- * context=string : Override default context with "string"
- * dialtime=ms : Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second)
- * farenddisconnect=1 : Automatically disconnect when called party hangs up
- * noct=1 : Don't send repeater courtesy tone during autopatch calls
- * quiet=1 : Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up
- *
- *
- * Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1
- *
- * To send an asterisk (*) while dialing or talking on phone,
- * use the autopatch acess code.
- *
- *
- * status cmds:
- *
- * 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/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:
- *
- * 1 - Disconnect specified link
- * 2 - Connect specified link -- monitor only
- * 3 - Connect specified link -- tranceive
- * 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:
- *
- * 1 - Recall Memory MM (*000-*099) (Gets memory from rpt.conf)
- * 2 - Set VFO MMMMM*KKK*O (Mhz digits, Khz digits, Offset)
- * 3 - Set Rx PL Tone HHH*D*
- * 4 - Set Tx PL Tone HHH*D* (Not currently implemented with DHE RBI-1)
- * 5 - Link Status (long)
- * 6 - Set operating mode M (FM, USB, LSB, AM, etc)
- * 100 - RX PL off (Default)
- * 101 - RX PL On
- * 102 - TX PL Off (Default)
- * 103 - TX PL On
- * 104 - Low Power
- * 105 - Med Power
- * 106 - Hi Power
- * 107 - Bump Down 20 Hz
- * 108 - Bump Down 100 Hz
- * 109 - Bump Down 500 Hz
- * 110 - Bump Up 20 Hz
- * 111 - Bump Up 100 Hz
- * 112 - Bump Up 500 Hz
- * 113 - Scan Down Slow
- * 114 - Scan Down Medium
- * 115 - Scan Down Fast
- * 116 - Scan Up Slow
- * 117 - Scan Up Medium
- * 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)
- *
- * 0 - Only remote links key Tx and no main repeat audio.
- * 1 - Everything other then main Rx keys Tx, no main repeat audio.
- * 2 - Normal mode
- * 3 - Normal except no main repeat audio.
- * 4 - Normal except no main repeat audio during autopatch only
- *
-*/
-
-/*** MODULEINFO
- <depend>dahdi</depend>
- <depend>tonezone</depend>
- <defaultenabled>no</defaultenabled>
- <support_level>extended</support_level>
- ***/
-
-/* Un-comment the following to include support for MDC-1200 digital tone
- signalling protocol (using KA6SQG's GPL'ed implementation) */
-/* #include "mdc_decode.c" */
-
-/* Un-comment the following to include support for notch filters in the
- rx audio stream (using Tony Fisher's mknotch (mkfilter) implementation) */
-/* #include "rpt_notch.c" */
-
-/* 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 MAXLINKLIST 512
-#define LINKLISTTIME 10000
-#define LINKLISTSHORTTIME 200
-#define LINKPOSTTIME 30000
-#define LINKPOSTSHORTTIME 200
-#define KEYPOSTTIME 30000
-#define KEYPOSTSHORTTIME 200
-#define MACROTIME 100
-#define MACROPTIME 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
-#endif
-
-#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
-
-#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 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
-
-#define TELEPARAMSIZE 256
-
-#define REM_SCANTIME 100
-
-#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, 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 <stdint.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>
-#ifdef HAVE_SYS_IO_H
-#include <sys/io.h>
-#endif
-#include <sys/vfs.h>
-#include <math.h>
-#include <dahdi/user.h>
-#include <dahdi/tonezone.h>
-#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/cdr.h"
-#include "asterisk/options.h"
-#include "asterisk/manager.h"
-#include "asterisk/app.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][|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"
-"\n"
-" Options are as follows:\n"
-"\n"
-" X - Normal endpoint mode WITHOUT security check. Only specify\n"
-" 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"
-" 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"
-" code, and pick up call. Announce-string is list of names of\n"
-" recordings, or \"PARKED\" to substitute code for un-parking,\n"
-" or \"NODE\" to substitute node number.\n"
-"\n"
-" P - Phone Control mode. This allows a regular phone user to have\n"
-" full control and audio access to the radio system. For the\n"
-" user to have DTMF control, the 'phone_functions' parameter\n"
-" must be specified for the node in 'rpt.conf'. An additional\n"
-" function (cop,6) must be listed so that PTT control is available.\n"
-"\n"
-" D - Dumb Phone Control mode. This allows a regular phone user to\n"
-" have full control and audio access to the radio system. In this\n"
-" mode, the PTT is activated for the entire length of the call.\n"
-" For the user to have DTMF control (not generally recomended in\n"
-" 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 int debug = 0; /* Set this >0 for extra debug output */
-static int nrpts = 0;
-
-static const 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!!";
-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
-#define TOTIME 180000
-#define IDTIME 300000
-#define MAXRPTS 20
-#define MAX_STAT_LINKS 32
-#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 rpt;
-
-struct rpt_link
-{
- struct rpt_link *next;
- struct rpt_link *prev;
- 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;
- long elaptime;
- 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
-{
- struct rpt_lstat *next;
- struct rpt_lstat *prev;
- char peer[MAXPEERSTR];
- char name[MAXNODESTR];
- char mode;
- char outbound;
- char reconnects;
- char thisconnected;
- long long connecttime;
- struct rpt_chan_stat chan_stat[NRPTSTAT];
-} ;
-
-struct rpt_tele
-{
- struct rpt_tele *next;
- struct rpt_tele *prev;
- struct rpt *rpt;
- struct ast_channel *chan;
- int mode;
- struct rpt_link mylink;
- char param[TELEPARAMSIZE];
- intptr_t submode;
- uintptr_t parrot;
- pthread_t threadid;
-} ;
-
-struct function_table_tag
-{
- char action[ACTIONSIZE];
- int (*function)(struct rpt *myrpt, char *param, char *digitbuf,
- int command_source, struct rpt_link *mylink);
-} ;
-
-/* Used to store the morse code patterns */
-
-struct morse_bits
-{
- int len;
- int ddcomb;
-} ;
-
-struct telem_defaults
-{
- char name[20];
- char value[80];
-} ;
-
-
-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 *remoterig;
- struct rpt_chan_stat chan_stat[NRPTSTAT];
- unsigned int scram;
-
- struct {
- char *ourcontext;
- char *ourcallerid;
- char *acctcode;
- char *ident;
- char *tonezone;
- char simple;
- 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 *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 dtmfbuf[MAXDTMF];
- char macrobuf[MAXMACRO];
- char rem_dtmfbuf[MAXDTMF];
- char lastdtmfcommand[MAXDTMF];
- char cmdnode[50];
- 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, *dahdirxchannel, *dahditxchannel;
- 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 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 totalexecdcommands, dailyexecdcommands;
- long retxtimer;
- long rerxtimer;
- long long totaltxtime;
- char mydtmf;
- char exten[AST_MAX_EXTENSION];
- char freq[MAXREMSTR],rxpl[MAXREMSTR],txpl[MAXREMSTR];
- char offset;
- char powerlevel;
- char txplon;
- char rxplon;
- char remmode;
- char tunerequest;
- char hfscanmode;
- int hfscanstatus;
- char hfscanstop;
- char lastlinknode[MAXNODESTR];
- char savednodes[MAXNODESTR];
- int stopgen;
- char patchfarenddisconnect;
- char patchnoct;
- char patchquiet;
- char patchcontext[MAXPATCHCONTEXT];
- int patchdialtime;
- int macro_longest;
- int phone_longestfunc;
- int alt_longestfunc;
- int dphone_longestfunc;
- int link_longestfunc;
- int longestfunc;
- int longestnode;
- int threadrestarts;
- int tailmessagen;
- time_t disgorgetime;
- time_t lastthreadrestarttime;
- 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;
- } 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);
-static struct ast_format_cap *get_slin_cap(struct ast_format_cap *cap);
-
-AST_MUTEX_DEFINE_STATIC(nodeloglock);
-
-AST_MUTEX_DEFINE_STATIC(nodelookuplock);
-
-#ifdef APP_RPT_LOCK_DEBUG
-
-#warning COMPILING WITH LOCK-DEBUGGING ENABLED!!
-
-#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__)
-
-struct lockthread
-{
- pthread_t id;
- int lockcount;
- int lastlock;
- int lastunlock;
-} lockthreads[MAXLOCKTHREAD];
-
-
-struct by_lightning
-{
- int line;
- struct timeval tv;
- struct rpt *rpt;
- 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++)
- {
- 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)
- {
- lockthreads[i].lockcount = 0;
- lockthreads[i].lastlock = 0;
- lockthreads[i].lastunlock = 0;
- lockthreads[i].id = id;
- return(&lockthreads[i]);
- }
- }
- return(NULL);
-}
-
-static void rpt_mutex_spew(void)
-{
- struct by_lightning lock_ring_copy[32];
- int lock_ring_index_copy;
- int i,j;
- long long diff;
- char a[100];
- struct timeval lasttv;
-
- ast_mutex_lock(&locklock);
- memcpy(&lock_ring_copy, &lock_ring, sizeof(lock_ring_copy));
- lock_ring_index_copy = lock_ring_index;
- ast_mutex_unlock(&locklock);
-
- lasttv.tv_sec = lasttv.tv_usec = 0;
- for(i = 0 ; i < 32 ; i++)
- {
- j = (i + lock_ring_index_copy) % 32;
- 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;
- 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);
- }
- }
-}
-
-
-static void _rpt_mutex_lock(ast_mutex_t *lockp, struct rpt *myrpt, int line)
-{
-struct lockthread *t;
-pthread_t id;
-
- id = pthread_self();
- ast_mutex_lock(&locklock);
- t = put_lockthread(id);
- if (!t)
- {
- ast_mutex_unlock(&locklock);
- return;
- }
- 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);
- rpt_mutex_spew();
- return;
- }
- t->lastlock = line;
- 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));
- lock_ring[lock_ring_index++].line = line;
- if(lock_ring_index == 32)
- lock_ring_index = 0;
- ast_mutex_unlock(&locklock);
- ast_mutex_lock(lockp);
-}
-
-
-static void _rpt_mutex_unlock(ast_mutex_t *lockp, struct rpt *myrpt, int line)
-{
-struct lockthread *t;
-pthread_t id;
-
- id = pthread_self();
- ast_mutex_lock(&locklock);
- t = put_lockthread(id);
- if (!t)
- {
- ast_mutex_unlock(&locklock);
- return;
- }
- 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);
- rpt_mutex_spew();
- return;
- }
- t->lastunlock = line;
- 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));
- lock_ring[lock_ring_index++].line = -line;
- if(lock_ring_index == 32)
- lock_ring_index = 0;
- ast_mutex_unlock(&locklock);
- ast_mutex_unlock(lockp);
-}
-
-#else /* APP_RPT_LOCK_DEBUG */
-
-#define rpt_mutex_lock(x) ast_mutex_lock(x)
-#define rpt_mutex_unlock(x) ast_mutex_unlock(x)
-
-#endif /* APP_RPT_LOCK_DEBUG */
-
-static struct ast_format_cap *get_slin_cap(struct ast_format_cap *cap)
-{
- struct ast_format tmp;
- cap = ast_format_cap_alloc_nolock();
- if (!cap) {
- return NULL;
- }
- ast_format_cap_add(cap, ast_format_set(&tmp, AST_FORMAT_SLINEAR, 0));
-
- return cap;
-}
-
-/*
-* 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 int rpt_do_debug(int fd, int argc, const char * const *argv);
-static int rpt_do_dump(int fd, int argc, const char * const *argv);
-static int rpt_do_stats(int fd, int argc, const char * const *argv);
-static int rpt_do_lstats(int fd, int argc, const char * const *argv);
-static int rpt_do_nodes(int fd, int argc, const char * const *argv);
-static int rpt_do_local_nodes(int fd, int argc, const char * const *argv);
-static int rpt_do_reload(int fd, int argc, const char * const *argv);
-static int rpt_do_restart(int fd, int argc, const char * const *argv);
-static int rpt_do_fun(int fd, int argc, const char * const *argv);
-static int rpt_do_fun1(int fd, int argc, const char * const *argv);
-static int rpt_do_cmd(int fd, int argc, const char * const *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
-*/
-
-
-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)"}
-} ;
-
-/*
-* 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);
-
-
-
-/*
-* Define function protos for function table here
-*/
-
-static int function_ilink(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_autopatchup(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_autopatchdn(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_status(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-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_playback(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-/*
-* Function table
-*/
-
-static struct function_table_tag function_table[] = {
- {"cop", function_cop},
- {"autopatchup", function_autopatchup},
- {"autopatchdn", function_autopatchdn},
- {"ilink", function_ilink},
- {"status", function_status},
- {"remote", function_remote},
- {"macro", function_macro},
- {"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);
-}
-/*
- return via error priority
-*/
-static int priority_jump(struct rpt *myrpt, struct ast_channel *chan)
-{
- int res=0;
-
- // if (ast_test_flag(&flags,OPT_JUMP) && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0){
- if (ast_goto_if_exists(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan) + 101) == 0){
- res = 0;
- } else {
- res = -1;
- }
- return res;
-}
-/*
-*/
-static int linkcount(struct rpt *myrpt)
-{
- struct rpt_link *l;
- int numoflinks;
-
- numoflinks = 0;
- l = myrpt->links.next;
- while(l && (l != &myrpt->links)){
- if(numoflinks >= MAX_STAT_LINKS){
- ast_log(LOG_WARNING,
- "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
- break;
- }
- numoflinks++;
-
- l = l->next;
- }
- ast_log(LOG_NOTICE, "numoflinks=%i\n",numoflinks);
- return numoflinks;
-}
-/*
- * Retrieve a memory channel
- * Return 0 if sucessful,
- * -1 if channel not found,
- * 1 if parse error
- */
-static int retreive_memory(struct rpt *myrpt, char *memory)
-{
- char tmp[30], *s, *s1, *val;
-
- if (debug)ast_log(LOG_NOTICE, "memory=%s block=%s\n",memory,myrpt->p.memory);
-
- val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.memory, memory);
- if (!val){
- return -1;
- }
- strncpy(tmp,val,sizeof(tmp) - 1);
- tmp[sizeof(tmp)-1] = 0;
-
- s = strchr(tmp,',');
- if (!s)
- return 1;
- *s++ = 0;
- s1 = strchr(s,',');
- if (!s1)
- return 1;
- *s1++ = 0;
- strncpy(myrpt->freq, tmp, sizeof(myrpt->freq) - 1);
- strncpy(myrpt->rxpl, s, sizeof(myrpt->rxpl) - 1);
- strncpy(myrpt->txpl, s, sizeof(myrpt->rxpl) - 1);
- myrpt->remmode = REM_MODE_FM;
- myrpt->offset = REM_SIMPLEX;
- myrpt->powerlevel = REM_MEDPWR;
- myrpt->txplon = myrpt->rxplon = 0;
- while(*s1){
- switch(*s1++){
- case 'A':
- case 'a':
- strcpy(myrpt->rxpl, "100.0");
- strcpy(myrpt->txpl, "100.0");
- myrpt->remmode = REM_MODE_AM;
- break;
- case 'B':
- case 'b':
- strcpy(myrpt->rxpl, "100.0");
- strcpy(myrpt->txpl, "100.0");
- myrpt->remmode = REM_MODE_LSB;
- break;
- case 'F':
- myrpt->remmode = REM_MODE_FM;
- break;
- case 'L':
- case 'l':
- myrpt->powerlevel = REM_LOWPWR;
- break;
- case 'H':
- case 'h':
- myrpt->powerlevel = REM_HIPWR;
- break;
-
- case 'M':
- case 'm':
- myrpt->powerlevel = REM_MEDPWR;
- break;
-
- case '-':
- myrpt->offset = REM_MINUS;
- break;
-
- case '+':
- myrpt->offset = REM_PLUS;
- break;
-
- case 'S':
- case 's':
- myrpt->offset = REM_SIMPLEX;
- break;
-
- case 'T':
- case 't':
- myrpt->txplon = 1;
- break;
-
- case 'R':
- case 'r':
- myrpt->rxplon = 1;
- break;
-
- case 'U':
- case 'u':
- strcpy(myrpt->rxpl, "100.0");
- strcpy(myrpt->txpl, "100.0");
- myrpt->remmode = REM_MODE_USB;
- break;
- default:
- return 1;
- }
- }
- return 0;
-}
-/*
-
-*/
-static void birdbath(struct rpt *myrpt)
-{
- struct rpt_tele *telem;
- if(debug > 2)
- ast_log(LOG_NOTICE, "birdbath!!");
- rpt_mutex_lock(&myrpt->lock);
- telem = myrpt->tele.next;
- while(telem != &myrpt->tele)
- {
- if (telem->mode == PARROT) ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV);
- telem = telem->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
-}
-
-static void do_dtmf_phone(struct rpt *myrpt, struct rpt_link *mylink, char c)
-{
-struct rpt_link *l;
-
- l = myrpt->links.next;
- /* go thru all the links */
- while(l != &myrpt->links)
- {
- if (!l->phonemode)
- {
- l = l->next;
- continue;
- }
- /* don't send to self */
- if (mylink && (l == mylink))
- {
- l = l->next;
- continue;
- }
-#ifdef NEW_ASTERISK
- if (l->chan) ast_senddigit(l->chan,c,0);
-#else
- if (l->chan) ast_senddigit(l->chan,c);
-#endif
- l = l->next;
- }
- return;
-}
-
-/* node logging function */
-static void donodelog(struct rpt *myrpt,char *str)
-{
-struct nodelog *nodep;
-char datestr[100];
-
- if (!myrpt->p.archivedir) return;
- nodep = (struct nodelog *)ast_malloc(sizeof(struct nodelog));
- if (nodep == NULL)
- {
- ast_log(LOG_ERROR,"Cannot get memory for node log");
- return;
- }
- time(&nodep->timestamp);
- strncpy(nodep->archivedir,myrpt->p.archivedir,
- sizeof(nodep->archivedir) - 1);
- strftime(datestr,sizeof(datestr) - 1,"%Y%m%d%H%M%S",
- localtime(&nodep->timestamp));
- snprintf(nodep->str,sizeof(nodep->str) - 1,"%s %s,%s\n",
- myrpt->name,datestr,str);
- ast_mutex_lock(&nodeloglock);
- insque((struct qelem *) nodep, (struct qelem *) nodelog.prev);
- ast_mutex_unlock(&nodeloglock);
-}
-
-/* must be called locked */
-static void do_dtmf_local(struct rpt *myrpt, char c)
-{
-int i;
-char digit;
-static const char* dtmf_tones[] = {
- "!941+1336/200,!0/200", /* 0 */
- "!697+1209/200,!0/200", /* 1 */
- "!697+1336/200,!0/200", /* 2 */
- "!697+1477/200,!0/200", /* 3 */
- "!770+1209/200,!0/200", /* 4 */
- "!770+1336/200,!0/200", /* 5 */
- "!770+1477/200,!0/200", /* 6 */
- "!852+1209/200,!0/200", /* 7 */
- "!852+1336/200,!0/200", /* 8 */
- "!852+1477/200,!0/200", /* 9 */
- "!697+1633/200,!0/200", /* A */
- "!770+1633/200,!0/200", /* B */
- "!852+1633/200,!0/200", /* C */
- "!941+1633/200,!0/200", /* D */
- "!941+1209/200,!0/200", /* * */
- "!941+1477/200,!0/200" }; /* # */
-
-
- if (c)
- {
- snprintf(myrpt->dtmf_local_str + strlen(myrpt->dtmf_local_str),sizeof(myrpt->dtmf_local_str) - 1,"%c",c);
- if (!myrpt->dtmf_local_timer)
- myrpt->dtmf_local_timer = DTMF_LOCAL_STARTTIME;
- }
- /* if at timeout */
- if (myrpt->dtmf_local_timer == 1)
- {
- if(debug > 6)
- ast_log(LOG_NOTICE,"time out dtmf_local_timer=%i\n",myrpt->dtmf_local_timer);
-
- /* if anything in the string */
- if (myrpt->dtmf_local_str[0])
- {
- digit = myrpt->dtmf_local_str[0];
- myrpt->dtmf_local_str[0] = 0;
- for(i = 1; myrpt->dtmf_local_str[i]; i++)
- {
- myrpt->dtmf_local_str[i - 1] =
- myrpt->dtmf_local_str[i];
- }
- myrpt->dtmf_local_str[i - 1] = 0;
- myrpt->dtmf_local_timer = DTMF_LOCAL_TIME;
- rpt_mutex_unlock(&myrpt->lock);
- if (digit >= '0' && digit <='9')
- ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[digit-'0'], 0);
- else if (digit >= 'A' && digit <= 'D')
- ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[digit-'A'+10], 0);
- else if (digit == '*')
- ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[14], 0);
- else if (digit == '#')
- ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0);
- else {
- /* not handled */
- ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, ast_channel_name(myrpt->txchannel));
- }
- rpt_mutex_lock(&myrpt->lock);
- }
- else
- {
- myrpt->dtmf_local_timer = 0;
- }
- }
-}
-
-static int setdtr(int fd, int enable)
-{
-struct termios mode;
-
- if (fd < 0) return -1;
- if (tcgetattr(fd, &mode)) {
- ast_log(LOG_WARNING, "Unable to get serial parameters for dtr: %s\n", strerror(errno));
- return -1;
- }
- if (enable)
- {
- cfsetspeed(&mode, B9600);
- }
- else
- {
- cfsetspeed(&mode, B0);
- usleep(100000);
- }
- if (tcsetattr(fd, TCSADRAIN, &mode)) {
- ast_log(LOG_WARNING, "Unable to set serial parameters for dtr: %s\n", strerror(errno));
- return -1;
- }
- if (enable) usleep(100000);
- return 0;
-}
-
-static int openserial(struct rpt *myrpt,char *fname)
-{
- struct termios mode;
- int fd;
-
- fd = open(fname,O_RDWR);
- if (fd == -1)
- {
- ast_log(LOG_WARNING,"Cannot open serial port %s\n",fname);
- return -1;
- }
- memset(&mode, 0, sizeof(mode));
- if (tcgetattr(fd, &mode)) {
- ast_log(LOG_WARNING, "Unable to get serial parameters on %s: %s\n", fname, strerror(errno));
- return -1;
- }
-#ifndef SOLARIS
- cfmakeraw(&mode);
-#else
- mode.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
- |INLCR|IGNCR|ICRNL|IXON);
- mode.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
- mode.c_cflag &= ~(CSIZE|PARENB|CRTSCTS);
- mode.c_cflag |= CS8;
- mode.c_cc[VTIME] = 3;
- mode.c_cc[VMIN] = 1;
-#endif
-
- cfsetispeed(&mode, B9600);
- cfsetospeed(&mode, B9600);
- if (tcsetattr(fd, TCSANOW, &mode))
- ast_log(LOG_WARNING, "Unable to set serial parameters on %s: %s\n", fname, strerror(errno));
- if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) setdtr(fd,0);
- usleep(100000);
- if (debug)ast_log(LOG_NOTICE,"Opened serial port %s\n",fname);
- return(fd);
-}
-
-static void mdc1200_notify(struct rpt *myrpt,char *fromnode, unsigned int unit)
-{
- if (!fromnode)
- {
- ast_verbose("Got MDC-1200 ID %04X from local system (%s)\n",
- unit,myrpt->name);
- }
- else
- {
- ast_verbose("Got MDC-1200 ID %04X from node %s (%s)\n",
- unit,fromnode,myrpt->name);
- }
-}
-
-#ifdef _MDC_DECODE_H_
-
-static void mdc1200_send(struct rpt *myrpt, unsigned int unit)
-{
-struct rpt_link *l;
-struct ast_frame wf;
-char str[200];
-
-
- sprintf(str,"I %s %04X",myrpt->name,unit);
-
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(str) + 1;
- wf.samples = 0;
-
-
- l = myrpt->links.next;
- /* otherwise, send it to all of em */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- wf.data = str;
- if (l->chan) ast_write(l->chan,&wf);
- l = l->next;
- }
- return;
-}
-
-#endif
-
-static char func_xlat(struct rpt *myrpt,char c,struct rpt_xlat *xlat)
-{
-time_t now;
-int gotone;
-
- time(&now);
- gotone = 0;
- /* if too much time, reset the skate machine */
- if ((now - xlat->lastone) > MAXXLATTIME)
- {
- xlat->funcindex = xlat->endindex = 0;
- }
- if (xlat->funccharseq[0] && (c == xlat->funccharseq[xlat->funcindex++]))
- {
- time(&xlat->lastone);
- gotone = 1;
- if (!xlat->funccharseq[xlat->funcindex])
- {
- xlat->funcindex = xlat->endindex = 0;
- return(myrpt->p.funcchar);
- }
- } else xlat->funcindex = 0;
- if (xlat->endcharseq[0] && (c == xlat->endcharseq[xlat->endindex++]))
- {
- time(&xlat->lastone);
- gotone = 1;
- if (!xlat->endcharseq[xlat->endindex])
- {
- xlat->funcindex = xlat->endindex = 0;
- return(myrpt->p.endchar);
- }
- } else xlat->endindex = 0;
- /* if in middle of decode seq, send nothing back */
- if (gotone) return(0);
- /* if no pass chars specified, return em all */
- if (!xlat->passchars[0]) return(c);
- /* if a "pass char", pass it */
- if (strchr(xlat->passchars,c)) return(c);
- return(0);
-}
-
-/*
- * Return a pointer to the first non-whitespace character
- */
-
-static char *eatwhite(char *s)
-{
- while((*s == ' ') || (*s == 0x09)){ /* get rid of any leading white space */
- if(!*s)
- break;
- s++;
- }
- return s;
-}
-
-/*
-* Break up a delimited string into a table of substrings
-*
-* str - delimited string ( will be modified )
-* strp- list of pointers to substrings (this is built by this function), NULL will be placed at end of list
-* limit- maximum number of substrings to process
-*/
-
-
-
-static int finddelim(char *str, char *strp[], int limit)
-{
-int i,l,inquo;
-
- inquo = 0;
- i = 0;
- strp[i++] = str;
- if (!*str)
- {
- strp[0] = 0;
- return(0);
- }
- for(l = 0; *str && (l < limit) ; str++)
- {
- if (*str == QUOTECHR)
- {
- if (inquo)
- {
- *str = 0;
- inquo = 0;
- }
- else
- {
- strp[i - 1] = str + 1;
- inquo = 1;
- }
- }
- if ((*str == DELIMCHR) && (!inquo))
- {
- *str = 0;
- l++;
- strp[i++] = str + 1;
- }
- }
- strp[i] = 0;
- return(i);
-
-}
-/*
- send asterisk frame text message on the current tx channel
-*/
-static int send_usb_txt(struct rpt *myrpt, char *txt)
-{
- struct ast_frame wf;
-
- if (debug)ast_log(LOG_NOTICE, "send_usb_txt %s\n",txt);
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(txt) + 1;
- wf.data.ptr = txt;
- wf.samples = 0;
- ast_write(myrpt->txchannel,&wf);
- return 0;
-}
-/* must be called locked */
-static void __mklinklist(struct rpt *myrpt, struct rpt_link *mylink, char *buf)
-{
-struct rpt_link *l;
-char mode;
-int i,spos;
-
- buf[0] = 0; /* clear output buffer */
- if (myrpt->remote) return;
- /* go thru all links */
- for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
- {
- /* if is not a real link, ignore it */
- if (l->name[0] == '0') continue;
- /* don't count our stuff */
- if (l == mylink) continue;
- if (mylink && (!strcmp(l->name,mylink->name))) continue;
- /* figure out mode to report */
- mode = 'T'; /* use Tranceive by default */
- if (!l->mode) mode = 'R'; /* indicate RX for our mode */
- if (!l->thisconnected) mode = 'C'; /* indicate connecting */
- spos = strlen(buf); /* current buf size (b4 we add our stuff) */
- if (spos)
- {
- strcat(buf,",");
- spos++;
- }
- /* add nodes into buffer */
- if (l->linklist[0])
- {
- snprintf(buf + spos,MAXLINKLIST - spos,
- "%c%s,%s",mode,l->name,l->linklist);
- }
- else /* if no nodes, add this node into buffer */
- {
- snprintf(buf + spos,MAXLINKLIST - spos,
- "%c%s",mode,l->name);
- }
- /* if we are in tranceive mode, let all modes stand */
- if (mode == 'T') continue;
- /* downgrade everyone on this node if appropriate */
- for(i = spos; buf[i]; i++)
- {
- if (buf[i] == 'T') buf[i] = mode;
- if ((buf[i] == 'R') && (mode == 'C')) buf[i] = mode;
- }
- }
- return;
-}
-
-/* must be called locked */
-static void __kickshort(struct rpt *myrpt)
-{
-struct rpt_link *l;
-
- for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
- {
- /* if is not a real link, ignore it */
- if (l->name[0] == '0') continue;
- l->linklisttimer = LINKLISTSHORTTIME;
- }
- myrpt->linkposttimer = LINKPOSTSHORTTIME;
- return;
-}
-
-static void statpost(struct rpt *myrpt,char *pairs)
-{
-char *str,*astr;
-char *astrs[100];
-int n,pid;
-time_t now;
-unsigned int seq;
-
- if (!myrpt->p.statpost_url) return;
- str = ast_malloc(strlen(pairs) + strlen(myrpt->p.statpost_url) + 200);
- astr = ast_strdup(myrpt->p.statpost_program);
- if ((!str) || (!astr)) {
- ast_free(str);
- ast_free(astr);
- return;
- }
- n = finddelim(astr,astrs,100);
- if (n < 1) {
- ast_free(str);
- ast_free(astr);
- return;
- }
- ast_mutex_lock(&myrpt->statpost_lock);
- seq = ++myrpt->statpost_seqno;
- ast_mutex_unlock(&myrpt->statpost_lock);
- astrs[n++] = str;
- astrs[n] = NULL;
- time(&now);
- sprintf(str,"%s?node=%s&time=%u&seqno=%u",myrpt->p.statpost_url,
- myrpt->name,(unsigned int) now,seq);
- if (pairs) sprintf(str + strlen(str),"&%s",pairs);
- if (!(pid = ast_safe_fork(0)))
- {
- execv(astrs[0],astrs);
- ast_log(LOG_ERROR, "exec of %s failed.\n", astrs[0]);
- perror("asterisk");
- exit(0);
- }
- ast_free(astr);
- ast_free(str);
- return;
-}
-
-static char *node_lookup(struct rpt *myrpt,char *digitbuf)
-{
-
-char *val;
-int longestnode,j;
-struct stat mystat;
-static time_t last = 0;
-static struct ast_config *ourcfg = NULL;
-struct ast_variable *vp;
-
- /* try to look it up locally first */
- val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.nodes, digitbuf);
- if (val) return(val);
- ast_mutex_lock(&nodelookuplock);
- /* if file does not exist */
- if (stat(myrpt->p.extnodefile,&mystat) == -1)
- {
- if (ourcfg) ast_config_destroy(ourcfg);
- ourcfg = NULL;
- ast_mutex_unlock(&nodelookuplock);
- return(NULL);
- }
- /* if we need to reload */
- if (mystat.st_mtime > last)
- {
- if (ourcfg) ast_config_destroy(ourcfg);
-#ifdef NEW_ASTERISK
- ourcfg = ast_config_load(myrpt->p.extnodefile,config_flags);
-#else
- ourcfg = ast_config_load(myrpt->p.extnodefile);
-#endif
- /* if file not there, just bail */
- if (!ourcfg || ourcfg == CONFIG_STATUS_FILEINVALID)
- {
- ast_mutex_unlock(&nodelookuplock);
- return(NULL);
- }
- /* reset "last" time */
- last = mystat.st_mtime;
-
- /* determine longest node length again */
- longestnode = 0;
- vp = ast_variable_browse(myrpt->cfg, myrpt->p.nodes);
- while(vp){
- j = strlen(vp->name);
- if (j > longestnode)
- longestnode = j;
- vp = vp->next;
- }
-
- vp = ast_variable_browse(ourcfg, myrpt->p.extnodes);
- while(vp){
- j = strlen(vp->name);
- if (j > longestnode)
- longestnode = j;
- vp = vp->next;
- }
-
- myrpt->longestnode = longestnode;
- }
- val = NULL;
- if (ourcfg)
- val = (char *) ast_variable_retrieve(ourcfg, myrpt->p.extnodes, digitbuf);
- ast_mutex_unlock(&nodelookuplock);
- return(val);
-}
-
-/*
-* Match a keyword in a list, and return index of string plus 1 if there was a match,* else return 0.
-* If param is passed in non-null, then it will be set to the first character past the match
-*/
-
-static int matchkeyword(char *string, char **param, char *keywords[])
-{
-int i,ls;
- for( i = 0 ; keywords[i] ; i++){
- ls = strlen(keywords[i]);
- if(!ls){
- *param = NULL;
- return 0;
- }
- if(!strncmp(string, keywords[i], ls)){
- if(param)
- *param = string + ls;
- return i + 1;
- }
- }
- *param = NULL;
- return 0;
-}
-
-/*
-* Skip characters in string which are in charlist, and return a pointer to the
-* first non-matching character
-*/
-
-static char *skipchars(char *string, char *charlist)
-{
-int i;
- while(*string){
- for(i = 0; charlist[i] ; i++){
- if(*string == charlist[i]){
- string++;
- break;
- }
- }
- if(!charlist[i])
- return string;
- }
- return string;
-}
-
-static int myatoi(const char *str)
-{
- int ret;
-
- if (!str) {
- return -1;
- }
-
- /* leave this %i alone, non-base-10 input is useful here */
- if (sscanf(str, "%30i", &ret) != 1) {
- return -1;
- }
-
- return ret;
-}
-
-static int mycompar(const void *a, const void *b)
-{
-char **x = (char **) a;
-char **y = (char **) b;
-int xoff,yoff;
-
- if ((**x < '0') || (**x > '9')) xoff = 1; else xoff = 0;
- if ((**y < '0') || (**y > '9')) yoff = 1; else yoff = 0;
- return(strcmp((*x) + xoff,(*y) + yoff));
-}
-
-static int topcompar(const void *a, const void *b)
-{
-struct rpt_topkey *x = (struct rpt_topkey *) a;
-struct rpt_topkey *y = (struct rpt_topkey *) b;
-
- return(x->timesince - y->timesince);
-}
-
-#ifdef __RPT_NOTCH
-
-/* rpt filter routine */
-static void rpt_filter(struct rpt *myrpt, volatile short *buf, int len)
-{
-int i,j;
-struct rptfilter *f;
-
- for(i = 0; i < len; i++)
- {
- for(j = 0; j < MAXFILTERS; j++)
- {
- f = &myrpt->filters[j];
- if (!*f->desc) continue;
- f->x0 = f->x1; f->x1 = f->x2;
- f->x2 = ((float)buf[i]) / f->gain;
- f->y0 = f->y1; f->y1 = f->y2;
- f->y2 = (f->x0 + f->x2) + f->const0 * f->x1
- + (f->const1 * f->y0) + (f->const2 * f->y1);
- buf[i] = (short)f->y2;
- }
- }
-}
-
-#endif
-
-
-/*
- Get the time for the machine's time zone
- Note: Asterisk requires a copy of localtime
- in the /etc directory for this to work properly.
- If /etc/localtime is not present, you will get
- GMT time! This is especially important on systems
- running embedded linux distributions as they don't usually
- have support for locales.
-
- If OLD_ASTERISK is defined, then the older localtime_r
- function will be used. The /etc/localtime file is not
- required in this case. This provides backward compatibility
- with Asterisk 1.2 systems.
-
-*/
-
-#ifdef NEW_ASTERISK
-static void rpt_localtime( time_t * t, struct ast_tm *lt)
-{
- struct timeval when;
-
- when.tv_sec = *t;
- when.tv_usec = 0;
- ast_localtime(&when, lt, NULL);
-}
-
-#else
-static void rpt_localtime( time_t * t, struct tm *lt)
-{
-#ifdef OLD_ASTERISK
- localtime_r(t, lt);
-#else
- ast_localtime(t, lt, NULL);
-#endif
-}
-#endif
-
-
-/* Retrieve an int from a config file */
-
-static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int min, int max, int defl)
-{
- char *var;
- int ret;
- char include_zero = 0;
-
- if(min < 0){ /* If min is negative, this means include 0 as a valid entry */
- min = -min;
- include_zero = 1;
- }
-
- var = (char *) ast_variable_retrieve(myrpt->cfg, category, name);
- if(var){
- ret = myatoi(var);
- if(include_zero && !ret)
- return 0;
- if(ret < min)
- ret = min;
- if(ret > max)
- ret = max;
- }
- else
- ret = defl;
- return ret;
-}
-
-
-static void load_rpt_vars(int n,int init)
-{
-char *this,*val;
-int i,j,longestnode;
-struct ast_variable *vp;
-struct ast_config *cfg;
-char *strs[100];
-char s1[256];
-static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis","totena","totdis","skena","skdis",
- "ufena","ufdis","atena","atdis",NULL};
-
- ast_verb(3, "%s config for repeater %s\n",
- (init) ? "Loading initial" : "Re-Loading",rpt_vars[n].name);
- ast_mutex_lock(&rpt_vars[n].lock);
- if (rpt_vars[n].cfg) ast_config_destroy(rpt_vars[n].cfg);
-#ifdef NEW_ASTERISK
- cfg = ast_config_load("rpt.conf",config_flags);
-#else
- cfg = ast_config_load("rpt.conf");
-#endif
- if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
- ast_mutex_unlock(&rpt_vars[n].lock);
- ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n");
- pthread_exit(NULL);
- }
- rpt_vars[n].cfg = cfg;
- this = rpt_vars[n].name;
- memset(&rpt_vars[n].p,0,sizeof(rpt_vars[n].p));
- if (init)
- {
- char *cp;
- int savearea = (char *)&rpt_vars[n].p - (char *)&rpt_vars[n];
-
- cp = (char *) &rpt_vars[n].p;
- memset(cp + sizeof(rpt_vars[n].p),0,
- sizeof(rpt_vars[n]) - (sizeof(rpt_vars[n].p) + savearea));
- rpt_vars[n].tele.next = &rpt_vars[n].tele;
- rpt_vars[n].tele.prev = &rpt_vars[n].tele;
- rpt_vars[n].rpt_thread = AST_PTHREADT_NULL;
- rpt_vars[n].tailmessagen = 0;
- }
-#ifdef __RPT_NOTCH
- /* zot out filters stuff */
- memset(&rpt_vars[n].filters,0,sizeof(rpt_vars[n].filters));
-#endif
- val = (char *) ast_variable_retrieve(cfg,this,"context");
- if (val) rpt_vars[n].p.ourcontext = val;
- else rpt_vars[n].p.ourcontext = this;
- val = (char *) ast_variable_retrieve(cfg,this,"callerid");
- if (val) rpt_vars[n].p.ourcallerid = val;
- val = (char *) ast_variable_retrieve(cfg,this,"accountcode");
- if (val) rpt_vars[n].p.acctcode = val;
- val = (char *) ast_variable_retrieve(cfg,this,"idrecording");
- if (val) rpt_vars[n].p.ident = val;
- val = (char *) ast_variable_retrieve(cfg,this,"hangtime");
- if (val) rpt_vars[n].p.hangtime = atoi(val);
- else rpt_vars[n].p.hangtime = HANGTIME;
- val = (char *) ast_variable_retrieve(cfg,this,"althangtime");
- if (val) rpt_vars[n].p.althangtime = atoi(val);
- else rpt_vars[n].p.althangtime = HANGTIME;
- val = (char *) ast_variable_retrieve(cfg,this,"totime");
- if (val) rpt_vars[n].p.totime = atoi(val);
- else rpt_vars[n].p.totime = TOTIME;
- val = (char *) ast_variable_retrieve(cfg,this,"voxtimeout");
- if (val) rpt_vars[n].p.voxtimeout_ms = atoi(val);
- else rpt_vars[n].p.voxtimeout_ms = VOX_TIMEOUT_MS;
- val = (char *) ast_variable_retrieve(cfg,this,"voxrecover");
- if (val) rpt_vars[n].p.voxrecover_ms = atoi(val);
- else rpt_vars[n].p.voxrecover_ms = VOX_RECOVER_MS;
- val = (char *) ast_variable_retrieve(cfg,this,"simplexpatchdelay");
- if (val) rpt_vars[n].p.simplexpatchdelay = atoi(val);
- else rpt_vars[n].p.simplexpatchdelay = SIMPLEX_PATCH_DELAY;
- val = (char *) ast_variable_retrieve(cfg,this,"simplexphonedelay");
- if (val) rpt_vars[n].p.simplexphonedelay = atoi(val);
- else rpt_vars[n].p.simplexphonedelay = SIMPLEX_PHONE_DELAY;
- val = (char *) ast_variable_retrieve(cfg,this,"statpost_program");
- if (val) rpt_vars[n].p.statpost_program = val;
- else rpt_vars[n].p.statpost_program = STATPOST_PROGRAM;
- rpt_vars[n].p.statpost_url =
- (char *) ast_variable_retrieve(cfg,this,"statpost_url");
- rpt_vars[n].p.tailmessagetime = retrieve_astcfgint(&rpt_vars[n],this, "tailmessagetime", 0, 2400000, 0);
- rpt_vars[n].p.tailsquashedtime = retrieve_astcfgint(&rpt_vars[n],this, "tailsquashedtime", 0, 2400000, 0);
- rpt_vars[n].p.duplex = retrieve_astcfgint(&rpt_vars[n],this,"duplex",0,4,2);
- rpt_vars[n].p.idtime = retrieve_astcfgint(&rpt_vars[n],this, "idtime", -60000, 2400000, IDTIME); /* Enforce a min max including zero */
- rpt_vars[n].p.politeid = retrieve_astcfgint(&rpt_vars[n],this, "politeid", 30000, 300000, POLITEID); /* Enforce a min max */
- val = (char *) ast_variable_retrieve(cfg,this,"tonezone");
- if (val) rpt_vars[n].p.tonezone = val;
- rpt_vars[n].p.tailmessages[0] = 0;
- rpt_vars[n].p.tailmessagemax = 0;
- val = (char *) ast_variable_retrieve(cfg,this,"tailmessagelist");
- if (val) rpt_vars[n].p.tailmessagemax = finddelim(val, rpt_vars[n].p.tailmessages, 500);
- val = (char *) ast_variable_retrieve(cfg,this,"memory");
- if (!val) val = MEMORY;
- rpt_vars[n].p.memory = val;
- val = (char *) ast_variable_retrieve(cfg,this,"macro");
- if (!val) val = MACRO;
- rpt_vars[n].p.macro = val;
- val = (char *) ast_variable_retrieve(cfg,this,"tonemacro");
- if (!val) val = TONEMACRO;
- rpt_vars[n].p.tonemacro = val;
- val = (char *) ast_variable_retrieve(cfg,this,"startup_macro");
- if (val) rpt_vars[n].p.startupmacro = val;
- val = (char *) ast_variable_retrieve(cfg,this,"iobase");
- /* do not use atoi() here, we need to be able to have
- the input specified in hex or decimal so we use
- sscanf with a %i */
- if ((!val) || (sscanf(val,"%30i",&rpt_vars[n].p.iobase) != 1))
- rpt_vars[n].p.iobase = DEFAULT_IOBASE;
- val = (char *) ast_variable_retrieve(cfg,this,"ioport");
- rpt_vars[n].p.ioport = val;
- val = (char *) ast_variable_retrieve(cfg,this,"functions");
- if (!val)
- {
- val = FUNCTIONS;
- rpt_vars[n].p.simple = 1;
- }
- rpt_vars[n].p.functions = val;
- val = (char *) ast_variable_retrieve(cfg,this,"link_functions");
- if (val) rpt_vars[n].p.link_functions = val;
- else
- rpt_vars[n].p.link_functions = rpt_vars[n].p.functions;
- val = (char *) ast_variable_retrieve(cfg,this,"phone_functions");
- if (val) rpt_vars[n].p.phone_functions = val;
- val = (char *) ast_variable_retrieve(cfg,this,"dphone_functions");
- if (val) rpt_vars[n].p.dphone_functions = val;
- val = (char *) ast_variable_retrieve(cfg,this,"alt_functions");
- if (val) rpt_vars[n].p.alt_functions = val;
- val = (char *) ast_variable_retrieve(cfg,this,"funcchar");
- if (!val) rpt_vars[n].p.funcchar = FUNCCHAR; else
- rpt_vars[n].p.funcchar = *val;
- val = (char *) ast_variable_retrieve(cfg,this,"endchar");
- if (!val) rpt_vars[n].p.endchar = ENDCHAR; else
- rpt_vars[n].p.endchar = *val;
- val = (char *) ast_variable_retrieve(cfg,this,"nobusyout");
- if (val) rpt_vars[n].p.nobusyout = ast_true(val);
- val = (char *) ast_variable_retrieve(cfg,this,"notelemtx");
- if (val) rpt_vars[n].p.notelemtx = ast_true(val);
- val = (char *) ast_variable_retrieve(cfg,this,"propagate_dtmf");
- if (val) rpt_vars[n].p.propagate_dtmf = ast_true(val);
- val = (char *) ast_variable_retrieve(cfg,this,"propagate_phonedtmf");
- if (val) rpt_vars[n].p.propagate_phonedtmf = ast_true(val);
- val = (char *) ast_variable_retrieve(cfg,this,"linktolink");
- if (val) rpt_vars[n].p.linktolink = ast_true(val);
- val = (char *) ast_variable_retrieve(cfg,this,"nodes");
- if (!val) val = NODES;
- rpt_vars[n].p.nodes = val;
- val = (char *) ast_variable_retrieve(cfg,this,"extnodes");
- if (!val) val = EXTNODES;
- rpt_vars[n].p.extnodes = val;
- val = (char *) ast_variable_retrieve(cfg,this,"extnodefile");
- if (!val) val = EXTNODEFILE;
- rpt_vars[n].p.extnodefile = val;
- val = (char *) ast_variable_retrieve(cfg,this,"archivedir");
- if (val) rpt_vars[n].p.archivedir = val;
- val = (char *) ast_variable_retrieve(cfg,this,"authlevel");
- if (val) rpt_vars[n].p.authlevel = atoi(val);
- else rpt_vars[n].p.authlevel = 0;
- val = (char *) ast_variable_retrieve(cfg,this,"parrot");
- if (val) rpt_vars[n].p.parrotmode = ast_true(val) * 2;
- else rpt_vars[n].p.parrotmode = 0;
- val = (char *) ast_variable_retrieve(cfg,this,"parrottime");
- if (val) rpt_vars[n].p.parrottime = atoi(val);
- else rpt_vars[n].p.parrottime = PARROTTIME;
- val = (char *) ast_variable_retrieve(cfg,this,"rptnode");
- rpt_vars[n].p.rptnode = val;
- val = (char *) ast_variable_retrieve(cfg,this,"mars");
- if (val) rpt_vars[n].p.remote_mars = atoi(val);
- else rpt_vars[n].p.remote_mars = 0;
- val = (char *) ast_variable_retrieve(cfg,this,"monminblocks");
- if (val) rpt_vars[n].p.monminblocks = atol(val);
- else rpt_vars[n].p.monminblocks = DEFAULT_MONITOR_MIN_DISK_BLOCKS;
- val = (char *) ast_variable_retrieve(cfg,this,"remote_inact_timeout");
- if (val) rpt_vars[n].p.remoteinacttimeout = atoi(val);
- else rpt_vars[n].p.remoteinacttimeout = DEFAULT_REMOTE_INACT_TIMEOUT;
- val = (char *) ast_variable_retrieve(cfg,this,"civaddr");
- if (val) rpt_vars[n].p.civaddr = atoi(val);
- else rpt_vars[n].p.civaddr = DEFAULT_CIV_ADDR;
- val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout");
- if (val) rpt_vars[n].p.remotetimeout = atoi(val);
- else rpt_vars[n].p.remotetimeout = DEFAULT_REMOTE_TIMEOUT;
- val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning");
- if (val) rpt_vars[n].p.remotetimeoutwarning = atoi(val);
- else rpt_vars[n].p.remotetimeoutwarning = DEFAULT_REMOTE_TIMEOUT_WARNING;
- val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning_freq");
- if (val) rpt_vars[n].p.remotetimeoutwarningfreq = atoi(val);
- else rpt_vars[n].p.remotetimeoutwarningfreq = DEFAULT_REMOTE_TIMEOUT_WARNING_FREQ;
-#ifdef __RPT_NOTCH
- val = (char *) ast_variable_retrieve(cfg,this,"rxnotch");
- if (val) {
- i = finddelim(val,strs,MAXFILTERS * 2);
- i &= ~1; /* force an even number, rounded down */
- if (i >= 2) for(j = 0; j < i; j += 2)
- {
- rpt_mknotch(atof(strs[j]),atof(strs[j + 1]),
- &rpt_vars[n].filters[j >> 1].gain,
- &rpt_vars[n].filters[j >> 1].const0,
- &rpt_vars[n].filters[j >> 1].const1,
- &rpt_vars[n].filters[j >> 1].const2);
- sprintf(rpt_vars[n].filters[j >> 1].desc,"%s Hz, BW = %s",
- strs[j],strs[j + 1]);
- }
-
- }
-#endif
- val = (char *) ast_variable_retrieve(cfg,this,"inxlat");
- if (val) {
- memset(&rpt_vars[n].p.inxlat,0,sizeof(struct rpt_xlat));
- i = finddelim(val,strs,3);
- if (i) strncpy(rpt_vars[n].p.inxlat.funccharseq,strs[0],MAXXLAT - 1);
- if (i > 1) strncpy(rpt_vars[n].p.inxlat.endcharseq,strs[1],MAXXLAT - 1);
- if (i > 2) strncpy(rpt_vars[n].p.inxlat.passchars,strs[2],MAXXLAT - 1);
- }
- val = (char *) ast_variable_retrieve(cfg,this,"outxlat");
- if (val) {
- memset(&rpt_vars[n].p.outxlat,0,sizeof(struct rpt_xlat));
- i = finddelim(val,strs,3);
- if (i) strncpy(rpt_vars[n].p.outxlat.funccharseq,strs[0],MAXXLAT - 1);
- if (i > 1) strncpy(rpt_vars[n].p.outxlat.endcharseq,strs[1],MAXXLAT - 1);
- if (i > 2) strncpy(rpt_vars[n].p.outxlat.passchars,strs[2],MAXXLAT - 1);
- }
- /* retreive the stanza name for the control states if there is one */
- val = (char *) ast_variable_retrieve(cfg,this,"controlstates");
- rpt_vars[n].p.csstanzaname = val;
-
- /* retreive the stanza name for the scheduler if there is one */
- val = (char *) ast_variable_retrieve(cfg,this,"scheduler");
- rpt_vars[n].p.skedstanzaname = val;
-
- /* retreive the stanza name for the txlimits */
- val = (char *) ast_variable_retrieve(cfg,this,"txlimits");
- rpt_vars[n].p.txlimitsstanzaname = val;
-
- longestnode = 0;
-
- vp = ast_variable_browse(cfg, rpt_vars[n].p.nodes);
-
- while(vp){
- j = strlen(vp->name);
- if (j > longestnode)
- longestnode = j;
- vp = vp->next;
- }
-
- rpt_vars[n].longestnode = longestnode;
-
- /*
- * For this repeater, Determine the length of the longest function
- */
- rpt_vars[n].longestfunc = 0;
- vp = ast_variable_browse(cfg, rpt_vars[n].p.functions);
- while(vp){
- j = strlen(vp->name);
- if (j > rpt_vars[n].longestfunc)
- rpt_vars[n].longestfunc = j;
- vp = vp->next;
- }
- /*
- * For this repeater, Determine the length of the longest function
- */
- rpt_vars[n].link_longestfunc = 0;
- vp = ast_variable_browse(cfg, rpt_vars[n].p.link_functions);
- while(vp){
- j = strlen(vp->name);
- if (j > rpt_vars[n].link_longestfunc)
- rpt_vars[n].link_longestfunc = j;
- vp = vp->next;
- }
- rpt_vars[n].phone_longestfunc = 0;
- if (rpt_vars[n].p.phone_functions)
- {
- vp = ast_variable_browse(cfg, rpt_vars[n].p.phone_functions);
- while(vp){
- j = strlen(vp->name);
- if (j > rpt_vars[n].phone_longestfunc)
- rpt_vars[n].phone_longestfunc = j;
- vp = vp->next;
- }
- }
- rpt_vars[n].dphone_longestfunc = 0;
- if (rpt_vars[n].p.dphone_functions)
- {
- vp = ast_variable_browse(cfg, rpt_vars[n].p.dphone_functions);
- while(vp){
- j = strlen(vp->name);
- if (j > rpt_vars[n].dphone_longestfunc)
- rpt_vars[n].dphone_longestfunc = j;
- vp = vp->next;
- }
- }
- rpt_vars[n].alt_longestfunc = 0;
- if (rpt_vars[n].p.alt_functions)
- {
- vp = ast_variable_browse(cfg, rpt_vars[n].p.alt_functions);
- while(vp){
- j = strlen(vp->name);
- if (j > rpt_vars[n].alt_longestfunc)
- rpt_vars[n].alt_longestfunc = j;
- vp = vp->next;
- }
- }
- rpt_vars[n].macro_longest = 1;
- vp = ast_variable_browse(cfg, rpt_vars[n].p.macro);
- while(vp){
- j = strlen(vp->name);
- if (j > rpt_vars[n].macro_longest)
- rpt_vars[n].macro_longest = j;
- vp = vp->next;
- }
-
- /* Browse for control states */
- if(rpt_vars[n].p.csstanzaname)
- vp = ast_variable_browse(cfg, rpt_vars[n].p.csstanzaname);
- else
- vp = NULL;
- for( i = 0 ; vp && (i < MAX_SYSSTATES) ; i++){ /* Iterate over the number of control state lines in the stanza */
- int k,nukw,statenum;
- statenum=atoi(vp->name);
- strncpy(s1, vp->value, 255);
- s1[255] = 0;
- nukw = finddelim(s1,strs,32);
-
- for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */
- for(j = 0 ; cs_keywords[j] != NULL ; j++){ /* try to match to one in our internal table */
- if(!strcmp(strs[k],cs_keywords[j])){
- switch(j){
- case 0: /* rptena */
- rpt_vars[n].p.s[statenum].txdisable = 0;
- break;
- case 1: /* rptdis */
- rpt_vars[n].p.s[statenum].txdisable = 1;
- break;
-
- case 2: /* apena */
- rpt_vars[n].p.s[statenum].autopatchdisable = 0;
- break;
-
- case 3: /* apdis */
- rpt_vars[n].p.s[statenum].autopatchdisable = 1;
- break;
-
- case 4: /* lnkena */
- rpt_vars[n].p.s[statenum].linkfundisable = 0;
- break;
-
- case 5: /* lnkdis */
- rpt_vars[n].p.s[statenum].linkfundisable = 1;
- break;
-
- case 6: /* totena */
- rpt_vars[n].p.s[statenum].totdisable = 0;
- break;
-
- case 7: /* totdis */
- rpt_vars[n].p.s[statenum].totdisable = 1;
- break;
-
- case 8: /* skena */
- rpt_vars[n].p.s[statenum].schedulerdisable = 0;
- break;
-
- case 9: /* skdis */
- rpt_vars[n].p.s[statenum].schedulerdisable = 1;
- break;
-
- case 10: /* ufena */
- rpt_vars[n].p.s[statenum].userfundisable = 0;
- break;
-
- case 11: /* ufdis */
- rpt_vars[n].p.s[statenum].userfundisable = 1;
- break;
-
- case 12: /* atena */
- rpt_vars[n].p.s[statenum].alternatetail = 1;
- break;
-
- case 13: /* atdis */
- rpt_vars[n].p.s[statenum].alternatetail = 0;
- break;
-
- default:
- ast_log(LOG_WARNING,
- "Unhandled control state keyword %s", cs_keywords[i]);
- break;
- }
- }
- }
- }
- vp = vp->next;
- }
- ast_mutex_unlock(&rpt_vars[n].lock);
-}
-
-/*
-* Enable or disable debug output at a given level at the console
-*/
-static int rpt_do_debug(int fd, int argc, const char * const *argv)
-{
- int newlevel;
-
- if (argc != 4) {
- return RESULT_SHOWUSAGE;
- }
-
- newlevel = myatoi(argv[3]);
-
- if (newlevel < 0 || newlevel > 7) {
- return RESULT_SHOWUSAGE;
- }
-
- if (newlevel) {
- ast_cli(fd, "app_rpt Debugging enabled, previous level: %d, new level: %d\n", debug, newlevel);
- } else {
- ast_cli(fd, "app_rpt Debugging disabled\n");
- }
-
- debug = newlevel;
-
- return RESULT_SUCCESS;
-}
-
-/*
-* Dump rpt struct debugging onto console
-*/
-
-static int rpt_do_dump(int fd, int argc, const char * const *argv)
-{
- int i;
-
- if (argc != 3)
- return RESULT_SHOWUSAGE;
-
- for(i = 0; i < nrpts; i++)
- {
- if (!strcmp(argv[2],rpt_vars[i].name))
- {
- rpt_vars[i].disgorgetime = time(NULL) + 10; /* Do it 10 seconds later */
- ast_cli(fd, "app_rpt struct dump requested for node %s\n",argv[2]);
- return RESULT_SUCCESS;
- }
- }
- return RESULT_FAILURE;
-}
-
-/*
-* Dump statistics onto console
-*/
-
-static int rpt_do_stats(int fd, int argc, const char * const *argv)
-{
- int i,j,numoflinks;
- int dailytxtime, dailykerchunks;
- time_t now;
- int totalkerchunks, dailykeyups, totalkeyups, timeouts;
- int totalexecdcommands, dailyexecdcommands, hours, minutes, seconds;
- int uptime;
- long long totaltxtime;
- struct rpt_link *l;
- char *listoflinks[MAX_STAT_LINKS];
- char *lastdtmfcommand,*parrot_ena;
- char *tot_state, *ider_state, *patch_state;
- char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena;
- char *sch_ena, *input_signal, *called_number, *user_funs, *tail_type;
- struct rpt *myrpt;
-
- static char *not_applicable = "N/A";
-
- if(argc != 3)
- return RESULT_SHOWUSAGE;
-
- tot_state = ider_state =
- patch_state = reverse_patch_state =
- input_signal = not_applicable;
- called_number = lastdtmfcommand = NULL;
-
- time(&now);
- for(i = 0; i < nrpts; i++)
- {
- if (!strcmp(argv[2],rpt_vars[i].name)){
- /* Make a copy of all stat variables while locked */
- myrpt = &rpt_vars[i];
- rpt_mutex_lock(&myrpt->lock); /* LOCK */
- uptime = (int)(now - starttime);
- dailytxtime = myrpt->dailytxtime;
- totaltxtime = myrpt->totaltxtime;
- dailykeyups = myrpt->dailykeyups;
- totalkeyups = myrpt->totalkeyups;
- dailykerchunks = myrpt->dailykerchunks;
- totalkerchunks = myrpt->totalkerchunks;
- dailyexecdcommands = myrpt->dailyexecdcommands;
- totalexecdcommands = myrpt->totalexecdcommands;
- timeouts = myrpt->timeouts;
-
- /* Traverse the list of connected nodes */
- reverse_patch_state = "DOWN";
- numoflinks = 0;
- l = myrpt->links.next;
- while(l && (l != &myrpt->links)){
- if(numoflinks >= MAX_STAT_LINKS){
- ast_log(LOG_NOTICE,
- "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
- break;
- }
- if (l->name[0] == '0'){ /* Skip '0' nodes */
- reverse_patch_state = "UP";
- l = l->next;
- continue;
- }
- listoflinks[numoflinks] = ast_strdup(l->name);
- if(listoflinks[numoflinks] == NULL){
- break;
- }
- else{
- numoflinks++;
- }
- l = l->next;
- }
-
- if(myrpt->keyed)
- input_signal = "YES";
- else
- input_signal = "NO";
-
- if(myrpt->p.parrotmode)
- parrot_ena = "ENABLED";
- else
- parrot_ena = "DISABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable)
- sys_ena = "DISABLED";
- else
- sys_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable)
- tot_ena = "DISABLED";
- else
- tot_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable)
- link_ena = "DISABLED";
- else
- link_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
- patch_ena = "DISABLED";
- else
- patch_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable)
- sch_ena = "DISABLED";
- else
- sch_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable)
- user_funs = "DISABLED";
- else
- user_funs = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail)
- tail_type = "ALTERNATE";
- else
- tail_type = "STANDARD";
-
- if(!myrpt->totimer)
- tot_state = "TIMED OUT!";
- else if(myrpt->totimer != myrpt->p.totime)
- tot_state = "ARMED";
- else
- tot_state = "RESET";
-
- if(myrpt->tailid)
- ider_state = "QUEUED IN TAIL";
- else if(myrpt->mustid)
- ider_state = "QUEUED FOR CLEANUP";
- else
- ider_state = "CLEAN";
-
- switch(myrpt->callmode){
- case 1:
- patch_state = "DIALING";
- break;
- case 2:
- patch_state = "CONNECTING";
- break;
- case 3:
- patch_state = "UP";
- break;
-
- case 4:
- patch_state = "CALL FAILED";
- break;
-
- default:
- patch_state = "DOWN";
- }
-
- if(strlen(myrpt->exten)){
- called_number = ast_strdup(myrpt->exten);
- }
-
- if(strlen(myrpt->lastdtmfcommand)){
- lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand);
- }
- rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-
- ast_cli(fd, "************************ NODE %s STATISTICS *************************\n\n", myrpt->name);
- ast_cli(fd, "Selected system state............................: %d\n", myrpt->p.sysstate_cur);
- ast_cli(fd, "Signal on input..................................: %s\n", input_signal);
- ast_cli(fd, "System...........................................: %s\n", sys_ena);
- ast_cli(fd, "Parrot Mode......................................: %s\n", parrot_ena);
- ast_cli(fd, "Scheduler........................................: %s\n", sch_ena);
- ast_cli(fd, "Tail Time........................................: %s\n", tail_type);
- ast_cli(fd, "Time out timer...................................: %s\n", tot_ena);
- ast_cli(fd, "Time out timer state.............................: %s\n", tot_state);
- ast_cli(fd, "Time outs since system initialization............: %d\n", timeouts);
- ast_cli(fd, "Identifier state.................................: %s\n", ider_state);
- ast_cli(fd, "Kerchunks today..................................: %d\n", dailykerchunks);
- ast_cli(fd, "Kerchunks since system initialization............: %d\n", totalkerchunks);
- ast_cli(fd, "Keyups today.....................................: %d\n", dailykeyups);
- ast_cli(fd, "Keyups since system initialization...............: %d\n", totalkeyups);
- ast_cli(fd, "DTMF commands today..............................: %d\n", dailyexecdcommands);
- ast_cli(fd, "DTMF commands since system initialization........: %d\n", totalexecdcommands);
- ast_cli(fd, "Last DTMF command executed.......................: %s\n",
- (lastdtmfcommand && strlen(lastdtmfcommand)) ? lastdtmfcommand : not_applicable);
- hours = dailytxtime/3600000;
- dailytxtime %= 3600000;
- minutes = dailytxtime/60000;
- dailytxtime %= 60000;
- seconds = dailytxtime/1000;
- dailytxtime %= 1000;
-
- ast_cli(fd, "TX time today....................................: %02d:%02d:%02d.%d\n",
- hours, minutes, seconds, dailytxtime);
-
- hours = (int) totaltxtime/3600000;
- totaltxtime %= 3600000;
- minutes = (int) totaltxtime/60000;
- totaltxtime %= 60000;
- seconds = (int) totaltxtime/1000;
- totaltxtime %= 1000;
-
- ast_cli(fd, "TX time since system initialization..............: %02d:%02d:%02d.%d\n",
- hours, minutes, seconds, (int) totaltxtime);
-
- hours = uptime/3600;
- uptime %= 3600;
- minutes = uptime/60;
- uptime %= 60;
-
- ast_cli(fd, "Uptime...........................................: %02d:%02d:%02d\n",
- hours, minutes, uptime);
-
- ast_cli(fd, "Nodes currently connected to us..................: ");
- if(!numoflinks){
- ast_cli(fd,"<NONE>");
- }
- else{
- for(j = 0 ;j < numoflinks; j++){
- ast_cli(fd, "%s", listoflinks[j]);
- if(j % 4 == 3){
- ast_cli(fd, "\n");
- ast_cli(fd, " : ");
- }
- else{
- if((numoflinks - 1) - j > 0)
- ast_cli(fd, ", ");
- }
- }
- }
- ast_cli(fd,"\n");
-
- ast_cli(fd, "Autopatch........................................: %s\n", patch_ena);
- ast_cli(fd, "Autopatch state..................................: %s\n", patch_state);
- ast_cli(fd, "Autopatch called number..........................: %s\n",
- (called_number && strlen(called_number)) ? called_number : not_applicable);
- ast_cli(fd, "Reverse patch/IAXRPT connected...................: %s\n", reverse_patch_state);
- ast_cli(fd, "User linking commands............................: %s\n", link_ena);
- ast_cli(fd, "User functions...................................: %s\n\n", user_funs);
-
- for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */
- ast_free(listoflinks[j]);
- }
- ast_free(called_number);
- ast_free(lastdtmfcommand);
- return RESULT_SUCCESS;
- }
- }
- return RESULT_FAILURE;
-}
-
-/*
-* Link stats function
-*/
-
-static int rpt_do_lstats(int fd, int argc, const char * const *argv)
-{
- int i;
- char *connstate;
- struct rpt *myrpt;
- struct rpt_link *l;
- struct rpt_lstat *s,*t;
- struct rpt_lstat s_head;
- if(argc != 3)
- return RESULT_SHOWUSAGE;
-
- s = NULL;
- s_head.next = &s_head;
- s_head.prev = &s_head;
-
- for(i = 0; i < nrpts; i++)
- {
- if (!strcmp(argv[2],rpt_vars[i].name)){
- /* Make a copy of all stat variables while locked */
- myrpt = &rpt_vars[i];
- rpt_mutex_lock(&myrpt->lock); /* LOCK */
- /* Traverse the list of connected nodes */
- l = myrpt->links.next;
- while(l && (l != &myrpt->links)){
- if (l->name[0] == '0'){ /* Skip '0' nodes */
- l = l->next;
- continue;
- }
- if((s = (struct rpt_lstat *) ast_malloc(sizeof(struct rpt_lstat))) == NULL){
- ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n");
- rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
- return RESULT_FAILURE;
- }
- memset(s, 0, sizeof(struct rpt_lstat));
- strncpy(s->name, l->name, MAXREMSTR - 1);
- if (l->chan) pbx_substitute_variables_helper(l->chan, "${IAXPEER(CURRENTCHANNEL)}", s->peer, MAXPEERSTR - 1);
- else strcpy(s->peer,"(none)");
- s->mode = l->mode;
- s->outbound = l->outbound;
- s->reconnects = l->reconnects;
- s->connecttime = l->connecttime;
- s->thisconnected = l->thisconnected;
- memcpy(s->chan_stat,l->chan_stat,NRPTSTAT * sizeof(struct rpt_chan_stat));
- insque((struct qelem *) s, (struct qelem *) s_head.next);
- memset(l->chan_stat,0,NRPTSTAT * sizeof(struct rpt_chan_stat));
- l = l->next;
- }
- rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
- ast_cli(fd, "NODE PEER RECONNECTS DIRECTION CONNECT TIME CONNECT STATE\n");
- ast_cli(fd, "---- ---- ---------- --------- ------------ -------------\n");
-
- for(s = s_head.next; s != &s_head; s = s->next){
- int hours, minutes, seconds;
- long long connecttime = s->connecttime;
- char conntime[21];
- hours = (int) connecttime/3600000;
- connecttime %= 3600000;
- minutes = (int) connecttime/60000;
- connecttime %= 60000;
- seconds = (int) connecttime/1000;
- connecttime %= 1000;
- snprintf(conntime, 20, "%02d:%02d:%02d.%d",
- hours, minutes, seconds, (int) connecttime);
- conntime[20] = 0;
- if(s->thisconnected)
- connstate = "ESTABLISHED";
- else
- connstate = "CONNECTING";
- ast_cli(fd, "%-10s%-20s%-12d%-11s%-20s%-20s\n",
- s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime, connstate);
- }
- /* destroy our local link queue */
- s = s_head.next;
- while(s != &s_head){
- t = s;
- s = s->next;
- remque((struct qelem *)t);
- ast_free(t);
- }
- return RESULT_SUCCESS;
- }
- }
- return RESULT_FAILURE;
-}
-
-/*
-* List all nodes connected, directly or indirectly
-*/
-
-static int rpt_do_nodes(int fd, int argc, const char * const *argv)
-{
- int i,j;
- char ns;
- char lbuf[MAXLINKLIST],*strs[MAXLINKLIST];
- struct rpt *myrpt;
- if(argc != 3)
- return RESULT_SHOWUSAGE;
-
- for(i = 0; i < nrpts; i++)
- {
- if (!strcmp(argv[2],rpt_vars[i].name)){
- /* Make a copy of all stat variables while locked */
- myrpt = &rpt_vars[i];
- rpt_mutex_lock(&myrpt->lock); /* LOCK */
- __mklinklist(myrpt,NULL,lbuf);
- rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
- /* parse em */
- ns = finddelim(lbuf,strs,MAXLINKLIST);
- /* sort em */
- if (ns) qsort((void *)strs,ns,sizeof(char *),mycompar);
- ast_cli(fd,"\n");
- ast_cli(fd, "************************* CONNECTED NODES *************************\n\n");
- for(j = 0 ;; j++){
- if(!strs[j]){
- if(!j){
- ast_cli(fd,"<NONE>");
- }
- break;
- }
- ast_cli(fd, "%s", strs[j]);
- if(j % 8 == 7){
- ast_cli(fd, "\n");
- }
- else{
- if(strs[j + 1])
- ast_cli(fd, ", ");
- }
- }
- ast_cli(fd,"\n\n");
- return RESULT_SUCCESS;
- }
- }
- return RESULT_FAILURE;
-}
-
-/*
-* List all locally configured nodes
-*/
-
-static int rpt_do_local_nodes(int fd, int argc, const char * const *argv)
-{
-
- int i;
- ast_cli(fd, "\nNode\n----\n");
- for (i=0; i< nrpts; i++)
- {
- ast_cli(fd, "%s\n", rpt_vars[i].name);
- } /* for i */
- ast_cli(fd,"\n");
- return RESULT_SUCCESS;
-}
-
-
-/*
-* reload vars
-*/
-
-static int rpt_do_reload(int fd, int argc, const char * const *argv)
-{
-int n;
-
- if (argc > 2) return RESULT_SHOWUSAGE;
-
- for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1;
-
- return RESULT_FAILURE;
-}
-
-/*
-* restart app_rpt
-*/
-
-static int rpt_do_restart(int fd, int argc, const char * const *argv)
-{
-int i;
-
- if (argc > 2) return RESULT_SHOWUSAGE;
- for(i = 0; i < nrpts; i++)
- {
- if (rpt_vars[i].rxchannel) ast_softhangup(rpt_vars[i].rxchannel,AST_SOFTHANGUP_DEV);
- }
- return RESULT_FAILURE;
-}
-
-
-/*
-* send an app_rpt DTMF function from the CLI
-*/
-
-static int rpt_do_fun(int fd, int argc, const char * const *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_mutex_lock(&myrpt->lock);
- if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(argv[3])){
- rpt_mutex_unlock(&myrpt->lock);
- busy=1;
- }
- if(!busy){
- myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,argv[3],MAXMACRO - 1);
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- }
- 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 *
- when put into the macro buffer, the characters have their high bit
- set so the macro processor knows they came from the application data
- and to use the alt-functions table.
- sph:
-*/
-static int rpt_push_alt_macro(struct rpt *myrpt, char *sptr)
-{
- int busy=0;
-
- rpt_mutex_lock(&myrpt->lock);
- if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(sptr)){
- rpt_mutex_unlock(&myrpt->lock);
- busy=1;
- }
- if(!busy){
- int x;
- if (debug)ast_log(LOG_NOTICE, "rpt_push_alt_macro %s\n",sptr);
- myrpt->macrotimer = MACROTIME;
- for(x = 0; *(sptr + x); x++)
- myrpt->macrobuf[x] = *(sptr + x) | 0x80;
- *(sptr + x) = 0;
- }
- rpt_mutex_unlock(&myrpt->lock);
-
- if(busy)ast_log(LOG_WARNING, "Function decoder busy on app_rpt command macro.\n");
-
- return busy;
-}
-/*
- allows us to test rpt() application data commands
-*/
-static int rpt_do_fun1(int fd, int argc, const char * const *argv)
-{
- int i;
-
- 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_push_alt_macro(myrpt, (char *) argv[3]);
- }
- }
- return RESULT_FAILURE;
-}
-/*
-* send an app_rpt **command** from the CLI
-*/
-
-static int rpt_do_cmd(int fd, int argc, const char * const *argv)
-{
- int i, l;
- int busy=0;
- int maxActions = sizeof(function_table)/sizeof(struct function_table_tag);
-
- int thisRpt = -1;
- int thisAction = -1;
- struct rpt *myrpt = NULL;
- if (argc != 6) return RESULT_SHOWUSAGE;
-
- for(i = 0; i < nrpts; i++)
- {
- if(!strcmp(argv[2], rpt_vars[i].name))
- {
- thisRpt = i;
- myrpt = &rpt_vars[i];
- break;
- } /* if !strcmp... */
- } /* for i */
-
- if (thisRpt < 0)
- {
- ast_cli(fd, "Unknown node number %s.\n", argv[2]);
- return RESULT_FAILURE;
- } /* if thisRpt < 0 */
-
- /* Look up the action */
- l = strlen(argv[3]);
- for(i = 0 ; i < maxActions; i++)
- {
- if(!strncasecmp(argv[3], function_table[i].action, l))
- {
- thisAction = i;
- break;
- } /* if !strncasecmp... */
- } /* for i */
-
- if (thisAction < 0)
- {
- ast_cli(fd, "Unknown action name %s.\n", argv[3]);
- return RESULT_FAILURE;
- } /* if thisAction < 0 */
-
- /* at this point, it looks like all the arguments make sense... */
-
- rpt_mutex_lock(&myrpt->lock);
-
- if (rpt_vars[thisRpt].cmdAction.state == CMD_STATE_IDLE)
- {
- rpt_vars[thisRpt].cmdAction.state = CMD_STATE_BUSY;
- rpt_vars[thisRpt].cmdAction.functionNumber = thisAction;
- strncpy(rpt_vars[thisRpt].cmdAction.param, argv[4], MAXDTMF);
- strncpy(rpt_vars[thisRpt].cmdAction.digits, argv[5], MAXDTMF);
- rpt_vars[thisRpt].cmdAction.command_source = SOURCE_RPT;
- rpt_vars[thisRpt].cmdAction.state = CMD_STATE_READY;
- } /* if (rpt_vars[thisRpt].cmdAction.state == CMD_STATE_IDLE */
- else
- {
- busy = 1;
- } /* if (rpt_vars[thisRpt].cmdAction.state == CMD_STATE_IDLE */
- rpt_mutex_unlock(&myrpt->lock);
-
- return (busy ? RESULT_FAILURE : RESULT_SUCCESS);
-} /* rpt_do_cmd() */
-
-static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration, int amplitude)
-{
- int res;
-
- if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude)))
- return res;
-
- while(ast_channel_generatordata(chan)) {
- if (ast_safe_sleep(chan,1)) return -1;
- }
-
- return 0;
-}
-
-static int play_tone(struct ast_channel *chan, int freq, int duration, int amplitude)
-{
- return play_tone_pair(chan, freq, 0, duration, amplitude);
-}
-
-static int play_silence(struct ast_channel *chan, int duration)
-{
- return play_tone_pair(chan, 0, 0, duration, 0);
-}
-
-#ifdef NEW_ASTERISK
-
-static char *res2cli(int r)
-
-{
- switch (r)
- {
- case RESULT_SUCCESS:
- return(CLI_SUCCESS);
- case RESULT_SHOWUSAGE:
- return(CLI_SHOWUSAGE);
- default:
- return(CLI_FAILURE);
- }
-}
-
-static char *handle_cli_debug(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt debug level";
- e->usage = debug_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_debug(a->fd, a->argc, a->argv));
-}
-
-static char *handle_cli_dump(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt dump level";
- e->usage = dump_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_dump(a->fd,a->argc,a->argv));
-}
-
-
-static char *handle_cli_stats(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt stats";
- e->usage = dump_stats;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_stats(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_nodes(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt nodes";
- e->usage = dump_nodes;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_nodes(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_local_nodes(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt localnodes";
- e->usage = usage_local_nodes;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_local_nodes(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_lstats(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt lstats";
- e->usage = dump_lstats;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_lstats(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_reload(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt reload";
- e->usage = reload_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_reload(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_restart(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt restart";
- e->usage = restart_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_restart(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_fun(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt fun";
- e->usage = fun_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_fun(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_fun1(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt fun1";
- e->usage = fun_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_fun1(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_cmd(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "rpt cmd";
- e->usage = cmd_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(rpt_do_cmd(a->fd,a->argc,a->argv));
-}
-
-static struct ast_cli_entry rpt_cli[] = {
- AST_CLI_DEFINE(handle_cli_debug,"Enable app_rpt debugging"),
- AST_CLI_DEFINE(handle_cli_dump,"Dump app_rpt structs for debugging"),
- AST_CLI_DEFINE(handle_cli_stats,"Dump node statistics"),
- AST_CLI_DEFINE(handle_cli_nodes,"Dump node list"),
- AST_CLI_DEFINE(handle_cli_local_nodes, "Dump list of local node numbers"),
- AST_CLI_DEFINE(handle_cli_lstats,"Dump link statistics"),
- AST_CLI_DEFINE(handle_cli_reload,"Reload app_rpt config"),
- AST_CLI_DEFINE(handle_cli_restart,"Restart app_rpt"),
- AST_CLI_DEFINE(handle_cli_fun,"Execute a DTMF function"),
- AST_CLI_DEFINE(handle_cli_fun1,"Execute a DTMF function"),
- AST_CLI_DEFINE(handle_cli_cmd,"Execute a DTMF function")
-};
-
-#endif
-
-static int send_morse(struct ast_channel *chan, char *string, int speed, int freq, int amplitude)
-{
-
-static struct morse_bits mbits[] = {
- {0, 0}, /* SPACE */
- {0, 0},
- {6, 18},/* " */
- {0, 0},
- {7, 72},/* $ */
- {0, 0},
- {0, 0},
- {6, 30},/* ' */
- {5, 13},/* ( */
- {6, 29},/* ) */
- {0, 0},
- {5, 10},/* + */
- {6, 51},/* , */
- {6, 33},/* - */
- {6, 42},/* . */
- {5, 9}, /* / */
- {5, 31},/* 0 */
- {5, 30},/* 1 */
- {5, 28},/* 2 */
- {5, 24},/* 3 */
- {5, 16},/* 4 */
- {5, 0}, /* 5 */
- {5, 1}, /* 6 */
- {5, 3}, /* 7 */
- {5, 7}, /* 8 */
- {5, 15},/* 9 */
- {6, 7}, /* : */
- {6, 21},/* ; */
- {0, 0},
- {5, 33},/* = */
- {0, 0},
- {6, 12},/* ? */
- {0, 0},
- {2, 2}, /* A */
- {4, 1}, /* B */
- {4, 5}, /* C */
- {3, 1}, /* D */
- {1, 0}, /* E */
- {4, 4}, /* F */
- {3, 3}, /* G */
- {4, 0}, /* H */
- {2, 0}, /* I */
- {4, 14},/* J */
- {3, 5}, /* K */
- {4, 2}, /* L */
- {2, 3}, /* M */
- {2, 1}, /* N */
- {3, 7}, /* O */
- {4, 6}, /* P */
- {4, 11},/* Q */
- {3, 2}, /* R */
- {3, 0}, /* S */
- {1, 1}, /* T */
- {3, 4}, /* U */
- {4, 8}, /* V */
- {3, 6}, /* W */
- {4, 9}, /* X */
- {4, 13},/* Y */
- {4, 3} /* Z */
- };
-
-
- int dottime;
- int dashtime;
- int intralettertime;
- int interlettertime;
- int interwordtime;
- int len, ddcomb;
- int res;
- int c;
- int i;
- int flags;
-
- res = 0;
-
- /* Approximate the dot time from the speed arg. */
-
- dottime = 900/speed;
-
- /* Establish timing releationships */
-
- dashtime = 3 * dottime;
- intralettertime = dottime;
- interlettertime = dottime * 4 ;
- interwordtime = dottime * 7;
-
- for(;(*string) && (!res); string++){
-
- c = *string;
-
- /* Convert lower case to upper case */
-
- if((c >= 'a') && (c <= 'z'))
- c -= 0x20;
-
- /* Can't deal with any char code greater than Z, skip it */
-
- if(c > 'Z')
- continue;
-
- /* If space char, wait the inter word time */
-
- if(c == ' '){
- if(!res)
- res = play_silence(chan, interwordtime);
- continue;
- }
-
- /* Subtract out control char offset to match our table */
-
- c -= 0x20;
-
- /* Get the character data */
-
- len = mbits[c].len;
- ddcomb = mbits[c].ddcomb;
-
- /* Send the character */
-
- for(; len ; len--){
- if(!res)
- res = play_tone(chan, freq, (ddcomb & 1) ? dashtime : dottime, amplitude);
- if(!res)
- res = play_silence(chan, intralettertime);
- ddcomb >>= 1;
- }
-
- /* Wait the interletter time */
-
- if(!res)
- res = play_silence(chan, interlettertime - intralettertime);
- }
-
- /* Wait for all the frames to be sent */
-
- if (!res)
- res = ast_waitstream(chan, "");
- ast_stopstream(chan);
-
- /*
- * Wait for the DAHDI driver to physically write the tone blocks to the hardware
- */
-
- for(i = 0; i < 20 ; i++){
- flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT;
- res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
- if(flags & DAHDI_IOMUX_WRITEEMPTY)
- break;
- if( ast_safe_sleep(chan, 50)){
- res = -1;
- break;
- }
- }
-
-
- return res;
-}
-
-static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
-{
- char *p,*stringp;
- char *tonesubset;
- int f1,f2;
- int duration;
- int amplitude;
- int res;
- int i;
- int flags;
-
- res = 0;
-
- if(!tonestring)
- return res;
-
- p = stringp = ast_strdup(tonestring);
-
- for(;tonestring;){
- tonesubset = strsep(&stringp,")");
- if(!tonesubset)
- break;
- if(sscanf(tonesubset,"(%30d,%30d,%30d,%30d", &f1, &f2, &duration, &amplitude) != 4)
- break;
- res = play_tone_pair(chan, f1, f2, duration, amplitude);
- if(res)
- break;
- }
- ast_free(p);
- if(!res)
- res = play_tone_pair(chan, 0, 0, 100, 0); /* This is needed to ensure the last tone segment is timed correctly */
-
- if (!res)
- res = ast_waitstream(chan, "");
-
- ast_stopstream(chan);
-
- /*
- * Wait for the DAHDI driver to physically write the tone blocks to the hardware
- */
-
- for(i = 0; i < 20 ; i++){
- flags = DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT;
- res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
- if(flags & DAHDI_IOMUX_WRITEEMPTY)
- break;
- if( ast_safe_sleep(chan, 50)){
- res = -1;
- break;
- }
- }
-
- return res;
-
-}
-
-static int sayfile(struct ast_channel *mychannel,char *fname)
-{
-int res;
-
- res = ast_streamfile(mychannel, fname, ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- return res;
-}
-
-static int saycharstr(struct ast_channel *mychannel,char *str)
-{
-int res;
-
- res = ast_say_character_str(mychannel,str,NULL,ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- return res;
-}
-
-static int saynum(struct ast_channel *mychannel, int num)
-{
- int res;
- res = ast_say_number(mychannel, num, NULL, ast_channel_language(mychannel), NULL);
- if(!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- return res;
-}
-
-/* say a node and nodename. Try to look in dir referred to by nodenames in
-config, and see if there's a custom node file to play, and if so, play it */
-
-static int saynode(struct rpt *myrpt, struct ast_channel *mychannel, char *name)
-{
-int res;
-char *val,fname[300];
-
- val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "nodenames");
- if (!val) val = NODENAMES;
- snprintf(fname,sizeof(fname) - 1,"%s/%s",val,name);
- if (ast_fileexists(fname,NULL,ast_channel_language(mychannel)) > 0)
- return(sayfile(mychannel,fname));
- res = sayfile(mychannel,"rpt/node");
- if (!res)
- res = ast_say_character_str(mychannel,name,NULL,ast_channel_language(mychannel));
- return res;
-}
-
-static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry)
-{
- int res;
- char c;
-
- static int morsespeed;
- static int morsefreq;
- static int morseampl;
- static int morseidfreq = 0;
- static int morseidampl;
- static char mcat[] = MORSE;
-
- res = 0;
-
- if(!morseidfreq){ /* Get the morse parameters if not already loaded */
- morsespeed = retrieve_astcfgint(myrpt, mcat, "speed", 5, 20, 20);
- morsefreq = retrieve_astcfgint(myrpt, mcat, "frequency", 300, 3000, 800);
- morseampl = retrieve_astcfgint(myrpt, mcat, "amplitude", 200, 8192, 4096);
- morseidampl = retrieve_astcfgint(myrpt, mcat, "idamplitude", 200, 8192, 2048);
- morseidfreq = retrieve_astcfgint(myrpt, mcat, "idfrequency", 300, 3000, 330);
- }
-
- /* Is it a file, or a tone sequence? */
-
- if(entry[0] == '|'){
- c = entry[1];
- if((c >= 'a')&&(c <= 'z'))
- c -= 0x20;
-
- switch(c){
- case 'I': /* Morse ID */
- res = send_morse(chan, entry + 2, morsespeed, morseidfreq, morseidampl);
- break;
-
- case 'M': /* Morse Message */
- res = send_morse(chan, entry + 2, morsespeed, morsefreq, morseampl);
- break;
-
- case 'T': /* Tone sequence */
- res = send_tone_telemetry(chan, entry + 2);
- break;
- default:
- res = -1;
- }
- }
- else
- res = sayfile(chan, entry); /* File */
- return res;
-}
-
-/*
-* This function looks up a telemetry name in the config file, and does a telemetry response as configured.
-*
-* 4 types of telemtry are handled: Morse ID, Morse Message, Tone Sequence, and a File containing a recording.
-*/
-
-static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, char *name)
-{
-
- int res;
- int i;
- char *entry;
- char *telemetry;
- char *telemetry_save;
-
- res = 0;
- telemetry_save = NULL;
- entry = NULL;
-
- /* Retrieve the section name for telemetry from the node section */
- telemetry = (char *) ast_variable_retrieve(myrpt->cfg, node, TELEMETRY);
- if(telemetry ){
- telemetry_save = ast_strdup(telemetry);
- if(!telemetry_save){
- ast_log(LOG_WARNING,"ast_strdup() failed in telem_lookup()\n");
- return res;
- }
- entry = (char *) ast_variable_retrieve(myrpt->cfg, telemetry_save, name);
- }
-
- /* Try to look up the telemetry name */
-
- if(!entry){
- /* Telemetry name wasn't found in the config file, use the default */
- for(i = 0; i < sizeof(tele_defs)/sizeof(struct telem_defaults) ; i++){
- if(!strcasecmp(tele_defs[i].name, name))
- entry = tele_defs[i].value;
- }
- }
- if(entry){
- if(strlen(entry))
- if (chan) telem_any(myrpt,chan, entry);
- }
- else{
- res = -1;
- }
- ast_free(telemetry_save);
- return res;
-}
-
-/*
-* Retrieve a wait interval
-*/
-
-static int get_wait_interval(struct rpt *myrpt, int type)
-{
- int interval;
- char *wait_times;
- char *wait_times_save;
-
- wait_times_save = NULL;
- wait_times = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "wait_times");
-
- if(wait_times){
- wait_times_save = ast_strdup(wait_times);
- if(!wait_times_save)
- return 0;
-
- }
-
- switch(type){
- case DLY_TELEM:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "telemwait", 500, 5000, 1000);
- else
- interval = 1000;
- break;
-
- case DLY_ID:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "idwait",250,5000,500);
- else
- interval = 500;
- break;
-
- case DLY_UNKEY:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "unkeywait",50,5000,1000);
- else
- interval = 1000;
- break;
-
- case DLY_LINKUNKEY:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "linkunkeywait",500,5000,1000);
- else
- interval = 1000;
- break;
-
- case DLY_CALLTERM:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "calltermwait",500,5000,1500);
- else
- interval = 1500;
- break;
-
- case DLY_COMP:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "compwait",500,5000,200);
- else
- interval = 200;
- break;
-
- case DLY_PARROT:
- if(wait_times)
- interval = retrieve_astcfgint(myrpt,wait_times_save, "parrotwait",500,5000,200);
- else
- interval = 200;
- break;
-
- default:
- interval = 0;
- break;
- }
- ast_free(wait_times_save);
- return interval;
-}
-
-
-/*
-* Wait a configurable interval of time
-*/
-static void wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan)
-{
- int interval;
- interval = get_wait_interval(myrpt, type);
- if(debug)
- ast_log(LOG_NOTICE,"Delay interval = %d\n", interval);
- if(interval)
- ast_safe_sleep(chan,interval);
- if(debug)
- ast_log(LOG_NOTICE,"Delay complete\n");
- return;
-}
-
-static int split_freq(char *mhz, char *decimals, char *freq);
-
-static void *rpt_tele_thread(void *this)
-{
-struct dahdi_confinfo ci; /* conference info */
-int res = 0,haslink,hastx,hasremote,imdone = 0, unkeys_queued, x;
-struct rpt_tele *mytele = (struct rpt_tele *)this;
-struct rpt_tele *tlist;
-struct rpt *myrpt;
-struct rpt_link *l,*l1,linkbase;
-struct ast_channel *mychannel;
-int vmajor, vminor, m;
-char *p,*ct,*ct_copy,*ident, *nodename;
-time_t t;
-#ifdef NEW_ASTERISK
-struct ast_tm localtm;
-#else
-struct tm localtm;
-#endif
-char lbuf[MAXLINKLIST],*strs[MAXLINKLIST];
-int i,ns,rbimode;
-char mhz[MAXREMSTR];
-char decimals[MAXREMSTR];
-char mystr[200];
-struct dahdi_params par;
-struct ast_format_cap *cap = NULL;
-
- /* get a pointer to myrpt */
- myrpt = mytele->rpt;
-
- /* Snag copies of a few key myrpt variables */
- rpt_mutex_lock(&myrpt->lock);
- nodename = ast_strdup(myrpt->name);
- if(!nodename)
- {
- fprintf(stderr,"rpt:Sorry unable strdup nodename\n");
- rpt_mutex_lock(&myrpt->lock);
- remque((struct qelem *)mytele);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
- rpt_mutex_unlock(&myrpt->lock);
- ast_free(mytele);
- pthread_exit(NULL);
- }
-
- if (myrpt->p.ident){
- ident = ast_strdup(myrpt->p.ident);
- if(!ident)
- {
- fprintf(stderr,"rpt:Sorry unable strdup ident\n");
- rpt_mutex_lock(&myrpt->lock);
- remque((struct qelem *)mytele);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",
- __LINE__, mytele->mode); /*@@@@@@@@@@@*/
- rpt_mutex_unlock(&myrpt->lock);
- ast_free(nodename);
- ast_free(mytele);
- pthread_exit(NULL);
- }
- }
- else
- {
- ident = "";
- }
- rpt_mutex_unlock(&myrpt->lock);
-
-
-
- /* allocate a pseudo-channel thru asterisk */
- mychannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!mychannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_lock(&myrpt->lock);
- remque((struct qelem *)mytele);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
- rpt_mutex_unlock(&myrpt->lock);
- ast_free(nodename);
- ast_free(ident);
- ast_free(mytele);
- pthread_exit(NULL);
- }
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(mychannel))
- ast_set_flag(ast_channel_cdr(mychannel),AST_CDR_FLAG_POST_DISABLED);
-#endif
- rpt_mutex_lock(&myrpt->lock);
- mytele->chan = mychannel;
- rpt_mutex_unlock(&myrpt->lock);
-
- while((mytele->mode != SETREMOTE) && (mytele->mode != UNKEY) &&
- (mytele->mode != LINKUNKEY))
- {
- rpt_mutex_lock(&myrpt->lock);
- if (!myrpt->active_telem)
- {
- myrpt->active_telem = mytele;
- rpt_mutex_unlock(&myrpt->lock);
- break;
- }
- rpt_mutex_unlock(&myrpt->lock);
- usleep(100000);
- }
-
- /* make a conference for the tx */
- ci.chan = 0;
- /* If the telemetry is only intended for a local audience, */
- /* only connect the ID audio to the local tx conference so */
- /* 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)) ?
- myrpt->txconf : myrpt->conf);
- ci.confmode = DAHDI_CONF_CONFANN;
- /* first put the channel on the conference in announce mode */
- if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_lock(&myrpt->lock);
- myrpt->active_telem = NULL;
- remque((struct qelem *)mytele);
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
- ast_free(nodename);
- ast_free(ident);
- ast_free(mytele);
- ast_hangup(mychannel);
- pthread_exit(NULL);
- }
- ast_stopstream(mychannel);
- switch(mytele->mode)
- {
- case ID:
- case ID1:
- /* wait a bit */
- wait_interval(myrpt, (mytele->mode == ID) ? DLY_ID : DLY_TELEM,mychannel);
- res = telem_any(myrpt,mychannel, ident);
- imdone=1;
- break;
-
- case TAILMSG:
- res = ast_streamfile(mychannel, myrpt->p.tailmessages[myrpt->tailmessagen], ast_channel_language(mychannel));
- break;
-
- case IDTALKOVER:
- p = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "idtalkover");
- if(p)
- res = telem_any(myrpt,mychannel, p);
- imdone=1;
- break;
-
- case PROC:
- /* wait a little bit longer */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = telem_lookup(myrpt, mychannel, myrpt->name, "patchup");
- if(res < 0){ /* Then default message */
- res = ast_streamfile(mychannel, "rpt/callproceeding", ast_channel_language(mychannel));
- }
- break;
- case TERM:
- /* wait a little bit longer */
- wait_interval(myrpt, DLY_CALLTERM, mychannel);
- res = telem_lookup(myrpt, mychannel, myrpt->name, "patchdown");
- if(res < 0){ /* Then default message */
- res = ast_streamfile(mychannel, "rpt/callterminated", ast_channel_language(mychannel));
- }
- break;
- case COMPLETE:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
- break;
- case MACRO_NOTFOUND:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/macro_notfound", ast_channel_language(mychannel));
- break;
- case MACRO_BUSY:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/macro_busy", ast_channel_language(mychannel));
- break;
- case UNKEY:
- if(myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */
- imdone = 1;
- break;
- }
-
- /*
- * Reset the Unkey to CT timer
- */
-
- x = get_wait_interval(myrpt, DLY_UNKEY);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->unkeytocttimer = x; /* Must be protected as it is changed below */
- rpt_mutex_unlock(&myrpt->lock);
-
- /*
- * If there's one already queued, don't do another
- */
-
- tlist = myrpt->tele.next;
- unkeys_queued = 0;
- if (tlist != &myrpt->tele)
- {
- rpt_mutex_lock(&myrpt->lock);
- while(tlist != &myrpt->tele){
- if (tlist->mode == UNKEY) unkeys_queued++;
- tlist = tlist->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- if( unkeys_queued > 1){
- imdone = 1;
- break;
- }
-
- /* Wait for the telemetry timer to expire */
- /* Periodically check the timer since it can be re-initialized above */
- while(myrpt->unkeytocttimer)
- {
- int ctint;
- if(myrpt->unkeytocttimer > 100)
- ctint = 100;
- else
- ctint = myrpt->unkeytocttimer;
- ast_safe_sleep(mychannel, ctint);
- rpt_mutex_lock(&myrpt->lock);
- if(myrpt->unkeytocttimer < ctint)
- myrpt->unkeytocttimer = 0;
- else
- myrpt->unkeytocttimer -= ctint;
- rpt_mutex_unlock(&myrpt->lock);
- }
-
- /*
- * Now, the carrier on the rptr rx should be gone.
- * If it re-appeared, then forget about sending the CT
- */
- if(myrpt->keyed){
- imdone = 1;
- break;
- }
-
- rpt_mutex_lock(&myrpt->lock); /* Update the kerchunk counters */
- myrpt->dailykerchunks++;
- myrpt->totalkerchunks++;
- rpt_mutex_unlock(&myrpt->lock);
-
- haslink = 0;
- hastx = 0;
- hasremote = 0;
- l = myrpt->links.next;
- if (l != &myrpt->links)
- {
- rpt_mutex_lock(&myrpt->lock);
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- haslink = 1;
- if (l->mode) {
- hastx++;
- if (l->isremote) hasremote++;
- }
- l = l->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- if (haslink)
- {
-
- res = telem_lookup(myrpt,mychannel, myrpt->name, (!hastx) ? "remotemon" : "remotetx");
- if(res)
- ast_log(LOG_WARNING, "telem_lookup:remotexx failed on %s\n", ast_channel_name(mychannel));
-
-
- /* if in remote cmd mode, indicate it */
- if (myrpt->cmdnode[0])
- {
- ast_safe_sleep(mychannel,200);
- res = telem_lookup(myrpt,mychannel, myrpt->name, "cmdmode");
- if(res)
- ast_log(LOG_WARNING, "telem_lookup:cmdmode failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- }
- }
- else if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "unlinkedct"))){ /* Unlinked Courtesy Tone */
- ct_copy = ast_strdup(ct);
- if(ct_copy)
- {
- res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy);
- ast_free(ct_copy);
- }
- else
- res = -1;
- if(res)
- ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", ast_channel_name(mychannel));
- }
- if (hasremote && (!myrpt->cmdnode[0]))
- {
- /* set for all to hear */
- ci.chan = 0;
- ci.confno = myrpt->conf;
- ci.confmode = DAHDI_CONF_CONFANN;
- /* first put the channel on the conference in announce mode */
- if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_lock(&myrpt->lock);
- myrpt->active_telem = NULL;
- remque((struct qelem *)mytele);
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
- ast_free(nodename);
- ast_free(ident);
- ast_free(mytele);
- ast_hangup(mychannel);
- pthread_exit(NULL);
- }
- if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "remotect"))){ /* Unlinked Courtesy Tone */
- ast_safe_sleep(mychannel,200);
- ct_copy = ast_strdup(ct);
- if(ct_copy)
- {
- res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy);
- ast_free(ct_copy);
- }
- else
- res = -1;
-
- if(res)
- ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", ast_channel_name(mychannel));
- }
- }
-#if defined(_MDC_DECODE_H_) && defined(MDC_SAY_WHEN_DOING_CT)
- if (myrpt->lastunit)
- {
- char mystr[10];
-
- ast_safe_sleep(mychannel,200);
- /* set for all to hear */
- ci.chan = 0;
- ci.confno = myrpt->txconf;
- ci.confmode = DAHDI_CONF_CONFANN;
- /* first put the channel on the conference in announce mode */
- if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_lock(&myrpt->lock);
- myrpt->active_telem = NULL;
- remque((struct qelem *)mytele);
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
- ast_free(nodename);
- ast_free(ident);
- ast_free(mytele);
- ast_hangup(mychannel);
- pthread_exit(NULL);
- }
- sprintf(mystr,"%04x",myrpt->lastunit);
- myrpt->lastunit = 0;
- ast_say_character_str(mychannel,mystr,NULL,ast_channel_language(mychannel));
- break;
- }
-#endif
- imdone = 1;
- break;
- case LINKUNKEY:
- if(myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */
- imdone = 1;
- break;
- }
-
- /*
- * Reset the Unkey to CT timer
- */
-
- x = get_wait_interval(myrpt, DLY_LINKUNKEY);
- mytele->mylink.linkunkeytocttimer = x; /* Must be protected as it is changed below */
-
- /*
- * If there's one already queued, don't do another
- */
-
- tlist = myrpt->tele.next;
- unkeys_queued = 0;
- if (tlist != &myrpt->tele)
- {
- rpt_mutex_lock(&myrpt->lock);
- while(tlist != &myrpt->tele){
- if (tlist->mode == LINKUNKEY) unkeys_queued++;
- tlist = tlist->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- if( unkeys_queued > 1){
- imdone = 1;
- break;
- }
-
- /* Wait for the telemetry timer to expire */
- /* Periodically check the timer since it can be re-initialized above */
- while(mytele->mylink.linkunkeytocttimer)
- {
- int ctint;
- if(mytele->mylink.linkunkeytocttimer > 100)
- ctint = 100;
- else
- ctint = mytele->mylink.linkunkeytocttimer;
- ast_safe_sleep(mychannel, ctint);
- rpt_mutex_lock(&myrpt->lock);
- if(mytele->mylink.linkunkeytocttimer < ctint)
- mytele->mylink.linkunkeytocttimer = 0;
- else
- mytele->mylink.linkunkeytocttimer -= ctint;
- rpt_mutex_unlock(&myrpt->lock);
- }
-
- if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "linkunkeyct"))){ /* Unlinked Courtesy Tone */
- ct_copy = ast_strdup(ct);
- if(ct_copy){
- res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy);
- ast_free(ct_copy);
- }
- else
- res = -1;
- if(res)
- ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", ast_channel_name(mychannel));
- }
- imdone = 1;
- break;
- case REMDISC:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- l = myrpt->links.next;
- haslink = 0;
- /* don't report if a link for this one still on system */
- if (l != &myrpt->links)
- {
- rpt_mutex_lock(&myrpt->lock);
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- if (!strcmp(l->name,mytele->mylink.name))
- {
- haslink = 1;
- break;
- }
- l = l->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- if (haslink)
- {
- imdone = 1;
- break;
- }
- res = saynode(myrpt,mychannel,mytele->mylink.name);
- if (!res)
- res = ast_streamfile(mychannel, ((mytele->mylink.hasconnected) ?
- "rpt/remote_disc" : "rpt/remote_busy"), ast_channel_language(mychannel));
- break;
- case REMALREADY:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/remote_already", ast_channel_language(mychannel));
- break;
- case REMNOTFOUND:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/remote_notfound", ast_channel_language(mychannel));
- break;
- case REMGO:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/remote_go", ast_channel_language(mychannel));
- break;
- case CONNECTED:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = saynode(myrpt,mychannel,mytele->mylink.name);
- if (!res)
- res = ast_streamfile(mychannel, "rpt/connected", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- res = ast_streamfile(mychannel, "digits/2", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- res = saynode(myrpt,mychannel,myrpt->name);
- imdone = 1;
- break;
- case CONNFAIL:
- res = saynode(myrpt,mychannel,mytele->mylink.name);
- if (!res)
- res = ast_streamfile(mychannel, "rpt/connection_failed", ast_channel_language(mychannel));
- break;
- case MEMNOTFOUND:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/memory_notfound", ast_channel_language(mychannel));
- break;
- case PLAYBACK:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, mytele->param, ast_channel_language(mychannel));
- break;
- case TOPKEY:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- for(i = 0; i < TOPKEYN; i++)
- {
- if (!myrpt->topkey[i].node[0]) continue;
- if ((!myrpt->topkeylong) && (myrpt->topkey[i].keyed)) continue;
- res = saynode(myrpt, mychannel, myrpt->topkey[i].node);
- if (!res) res = sayfile(mychannel,(myrpt->topkey[i].keyed) ?
- "rpt/keyedfor" : "rpt/unkeyedfor");
- if (!res) res = saynum(mychannel,
- myrpt->topkey[i].timesince);
- if (!res) res = sayfile(mychannel,"rpt/seconds");
- if (!myrpt->topkeylong) break;
- }
- imdone = 1;
- break;
- case SETREMOTE:
- ast_mutex_lock(&myrpt->remlock);
- res = 0;
- if(!strcmp(myrpt->remoterig, remote_rig_ft897))
- {
- res = set_ft897(myrpt);
- }
- else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
- {
- res = set_tm271(myrpt);
- }
- else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- {
- res = set_ic706(myrpt);
- }
-#ifdef HAVE_IOPERM
- else if(!strcmp(myrpt->remoterig, remote_rig_rbi)||!strcmp(myrpt->remoterig, remote_rig_ppp16))
- {
- if (ioperm(myrpt->p.iobase,1,1) == -1)
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n",myrpt->p.iobase);
- res = -1;
- }
- else res = setrbi(myrpt);
- }
-#endif
- else if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
- {
- if (myrpt->iofd >= 0) setdtr(myrpt->iofd,1);
- res = setkenwood(myrpt);
- if (myrpt->iofd >= 0) setdtr(myrpt->iofd,0);
- if (ast_safe_sleep(mychannel,200) == -1)
- {
- ast_mutex_unlock(&myrpt->remlock);
- res = -1;
- break;
- }
- if (myrpt->iofd < 0)
- {
- i = DAHDI_FLUSH_EVENT;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_FLUSH,&i) == -1)
- {
- ast_mutex_unlock(&myrpt->remlock);
- ast_log(LOG_ERROR,"Cant flush events");
- res = -1;
- break;
- }
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_GET_PARAMS,&par) == -1)
- {
- ast_mutex_unlock(&myrpt->remlock);
- ast_log(LOG_ERROR,"Cant get params");
- res = -1;
- break;
- }
- myrpt->remoterx =
- (par.rxisoffhook || (myrpt->tele.next != &myrpt->tele));
- }
- }
-
- ast_mutex_unlock(&myrpt->remlock);
- if (!res)
- {
- imdone = 1;
- break;
- }
- /* fall thru to invalid freq */
- case INVFREQ:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/invalid-freq", ast_channel_language(mychannel));
- break;
- case REMMODE:
- wait_interval(myrpt, DLY_TELEM, mychannel);
- switch(myrpt->remmode)
- {
- case REM_MODE_FM:
- saycharstr(mychannel,"FM");
- break;
- case REM_MODE_USB:
- saycharstr(mychannel,"USB");
- break;
- case REM_MODE_LSB:
- saycharstr(mychannel,"LSB");
- break;
- case REM_MODE_AM:
- saycharstr(mychannel,"AM");
- break;
- }
- wait_interval(myrpt, DLY_COMP, mychannel);
- if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
- break;
- case LOGINREQ:
- wait_interval(myrpt, DLY_TELEM, mychannel);
- sayfile(mychannel,"rpt/login");
- saycharstr(mychannel,myrpt->name);
- break;
- case REMLOGIN:
- wait_interval(myrpt, DLY_TELEM, mychannel);
- saycharstr(mychannel,myrpt->loginuser);
- saynode(myrpt,mychannel,myrpt->name);
- wait_interval(myrpt, DLY_COMP, mychannel);
- if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
- break;
- case REMXXX:
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = 0;
- switch(mytele->submode)
- {
- case 100: /* RX PL Off */
- sayfile(mychannel, "rpt/rxpl");
- sayfile(mychannel, "rpt/off");
- break;
- case 101: /* RX PL On */
- sayfile(mychannel, "rpt/rxpl");
- sayfile(mychannel, "rpt/on");
- break;
- case 102: /* TX PL Off */
- sayfile(mychannel, "rpt/txpl");
- sayfile(mychannel, "rpt/off");
- break;
- case 103: /* TX PL On */
- sayfile(mychannel, "rpt/txpl");
- sayfile(mychannel, "rpt/on");
- break;
- case 104: /* Low Power */
- sayfile(mychannel, "rpt/lopwr");
- break;
- case 105: /* Medium Power */
- sayfile(mychannel, "rpt/medpwr");
- break;
- case 106: /* Hi Power */
- sayfile(mychannel, "rpt/hipwr");
- break;
- case 113: /* Scan down slow */
- sayfile(mychannel,"rpt/down");
- sayfile(mychannel, "rpt/slow");
- break;
- case 114: /* Scan down quick */
- sayfile(mychannel,"rpt/down");
- sayfile(mychannel, "rpt/quick");
- break;
- case 115: /* Scan down fast */
- sayfile(mychannel,"rpt/down");
- sayfile(mychannel, "rpt/fast");
- break;
- case 116: /* Scan up slow */
- sayfile(mychannel,"rpt/up");
- sayfile(mychannel, "rpt/slow");
- break;
- case 117: /* Scan up quick */
- sayfile(mychannel,"rpt/up");
- sayfile(mychannel, "rpt/quick");
- break;
- case 118: /* Scan up fast */
- sayfile(mychannel,"rpt/up");
- sayfile(mychannel, "rpt/fast");
- break;
- default:
- res = -1;
- }
- wait_interval(myrpt, DLY_COMP, mychannel);
- if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
- break;
- case SCAN:
- ast_mutex_lock(&myrpt->remlock);
- if (myrpt->hfscanstop)
- {
- myrpt->hfscanstatus = 0;
- myrpt->hfscanmode = 0;
- myrpt->hfscanstop = 0;
- mytele->mode = SCANSTAT;
- ast_mutex_unlock(&myrpt->remlock);
- if (ast_safe_sleep(mychannel,1000) == -1) break;
- sayfile(mychannel, "rpt/stop");
- imdone = 1;
- break;
- }
- if (myrpt->hfscanstatus > -2) service_scan(myrpt);
- i = myrpt->hfscanstatus;
- myrpt->hfscanstatus = 0;
- if (i) mytele->mode = SCANSTAT;
- ast_mutex_unlock(&myrpt->remlock);
- if (i < 0) sayfile(mychannel, "rpt/stop");
- else if (i > 0) saynum(mychannel,i);
- imdone = 1;
- break;
- case TUNE:
- ast_mutex_lock(&myrpt->remlock);
- if (!strcmp(myrpt->remoterig,remote_rig_ic706))
- {
- set_mode_ic706(myrpt, REM_MODE_AM);
- if(play_tone(mychannel, 800, 6000, 8192) == -1) break;
- ast_safe_sleep(mychannel,500);
- set_mode_ic706(myrpt, myrpt->remmode);
- myrpt->tunerequest = 0;
- ast_mutex_unlock(&myrpt->remlock);
- imdone = 1;
- break;
- }
- set_mode_ft897(myrpt, REM_MODE_AM);
- simple_command_ft897(myrpt, 8);
- if(play_tone(mychannel, 800, 6000, 8192) == -1) break;
- simple_command_ft897(myrpt, 0x88);
- ast_safe_sleep(mychannel,500);
- set_mode_ft897(myrpt, myrpt->remmode);
- myrpt->tunerequest = 0;
- ast_mutex_unlock(&myrpt->remlock);
- imdone = 1;
- break;
- case REMSHORTSTATUS:
- case REMLONGSTATUS:
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = saynode(myrpt,mychannel,myrpt->name);
- if(!res)
- res = sayfile(mychannel,"rpt/frequency");
- if(!res)
- res = split_freq(mhz, decimals, myrpt->freq);
- if (!multimode_capable(myrpt)) decimals[3] = 0;
- if(!res){
- m = atoi(mhz);
- if(m < 100)
- res = saynum(mychannel, m);
- else
- res = saycharstr(mychannel, mhz);
- }
- if(!res)
- res = sayfile(mychannel, "letters/dot");
- if(!res)
- res = saycharstr(mychannel, decimals);
-
- if(res) break;
- if(myrpt->remmode == REM_MODE_FM){ /* Mode FM? */
- switch(myrpt->offset){
-
- case REM_MINUS:
- res = sayfile(mychannel,"rpt/minus");
- break;
-
- case REM_SIMPLEX:
- res = sayfile(mychannel,"rpt/simplex");
- break;
-
- case REM_PLUS:
- res = sayfile(mychannel,"rpt/plus");
- break;
-
- default:
- break;
- }
- }
- else{ /* Must be USB, LSB, or AM */
- switch(myrpt->remmode){
-
- case REM_MODE_USB:
- res = saycharstr(mychannel, "USB");
- break;
-
- case REM_MODE_LSB:
- res = saycharstr(mychannel, "LSB");
- break;
-
- case REM_MODE_AM:
- res = saycharstr(mychannel, "AM");
- break;
-
-
- default:
- break;
- }
- }
-
- if (res == -1) break;
-
- if(mytele->mode == REMSHORTSTATUS){ /* Short status? */
- wait_interval(myrpt, DLY_COMP, mychannel);
- if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
- break;
- }
-
- if (strcmp(myrpt->remoterig,remote_rig_ic706))
- {
- switch(myrpt->powerlevel){
-
- case REM_LOWPWR:
- res = sayfile(mychannel,"rpt/lopwr") ;
- break;
- case REM_MEDPWR:
- res = sayfile(mychannel,"rpt/medpwr");
- break;
- case REM_HIPWR:
- res = sayfile(mychannel,"rpt/hipwr");
- break;
- }
- }
-
- rbimode = ((!strncmp(myrpt->remoterig,remote_rig_rbi,3))
- || (!strncmp(myrpt->remoterig,remote_rig_ic706,3)));
- if (res || (sayfile(mychannel,"rpt/rxpl") == -1)) break;
- if (rbimode && (sayfile(mychannel,"rpt/txpl") == -1)) break;
- if ((sayfile(mychannel,"rpt/frequency") == -1) ||
- (saycharstr(mychannel,myrpt->rxpl) == -1)) break;
- if ((!rbimode) && ((sayfile(mychannel,"rpt/txpl") == -1) ||
- (sayfile(mychannel,"rpt/frequency") == -1) ||
- (saycharstr(mychannel,myrpt->txpl) == -1))) break;
- if(myrpt->remmode == REM_MODE_FM){ /* Mode FM? */
- if ((sayfile(mychannel,"rpt/rxpl") == -1) ||
- (sayfile(mychannel,((myrpt->rxplon) ? "rpt/on" : "rpt/off")) == -1) ||
- (sayfile(mychannel,"rpt/txpl") == -1) ||
- (sayfile(mychannel,((myrpt->txplon) ? "rpt/on" : "rpt/off")) == -1))
- {
- break;
- }
- }
- wait_interval(myrpt, DLY_COMP, mychannel);
- if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
- break;
- case STATUS:
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- hastx = 0;
- linkbase.next = &linkbase;
- linkbase.prev = &linkbase;
- rpt_mutex_lock(&myrpt->lock);
- /* make our own list of links */
- l = myrpt->links.next;
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- l1 = ast_malloc(sizeof(struct rpt_link));
- if (!l1)
- {
- ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", ast_channel_name(mychannel));
- remque((struct qelem *)mytele);
- myrpt->active_telem = NULL;
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
- ast_free(nodename);
- ast_free(ident);
- ast_free(mytele);
- ast_hangup(mychannel);
- pthread_exit(NULL);
- }
- memcpy(l1,l,sizeof(struct rpt_link));
- l1->next = l1->prev = NULL;
- insque((struct qelem *)l1,(struct qelem *)linkbase.next);
- l = l->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- res = saynode(myrpt,mychannel,myrpt->name);
- if (myrpt->callmode)
- {
- hastx = 1;
- res = ast_streamfile(mychannel, "rpt/autopatch_on", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- }
- l = linkbase.next;
- while(l != &linkbase)
- {
- char *s;
-
- hastx = 1;
- res = saynode(myrpt,mychannel,l->name);
- s = "rpt/tranceive";
- if (!l->mode) s = "rpt/monitor";
- if (!l->thisconnected) s = "rpt/connecting";
- res = ast_streamfile(mychannel, s, ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- l = l->next;
- }
- if (!hastx)
- {
- res = ast_streamfile(mychannel, "rpt/repeat_only", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- }
- /* destroy our local link queue */
- l = linkbase.next;
- while(l != &linkbase)
- {
- l1 = l;
- l = l->next;
- remque((struct qelem *)l1);
- ast_free(l1);
- }
- imdone = 1;
- break;
- case FULLSTATUS:
- rpt_mutex_lock(&myrpt->lock);
- /* get all the nodes */
- __mklinklist(myrpt,NULL,lbuf);
- rpt_mutex_unlock(&myrpt->lock);
- /* parse em */
- ns = finddelim(lbuf,strs,MAXLINKLIST);
- /* sort em */
- if (ns) qsort((void *)strs,ns,sizeof(char *),mycompar);
- /* wait a little bit */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- hastx = 0;
- res = saynode(myrpt,mychannel,myrpt->name);
- if (myrpt->callmode)
- {
- hastx = 1;
- res = ast_streamfile(mychannel, "rpt/autopatch_on", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- }
- /* go thru all the nodes in list */
- for(i = 0; i < ns; i++)
- {
- char *s,mode = 'T';
-
- /* if a mode spec at first, handle it */
- if ((*strs[i] < '0') || (*strs[i] > '9'))
- {
- mode = *strs[i];
- strs[i]++;
- }
-
- hastx = 1;
- res = saynode(myrpt,mychannel,strs[i]);
- s = "rpt/tranceive";
- if (mode == 'R') s = "rpt/monitor";
- if (mode == 'C') s = "rpt/connecting";
- res = ast_streamfile(mychannel, s, ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- }
- if (!hastx)
- {
- res = ast_streamfile(mychannel, "rpt/repeat_only", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- }
- imdone = 1;
- break;
-
- case LASTNODEKEY: /* Identify last node which keyed us up */
- rpt_mutex_lock(&myrpt->lock);
- if(myrpt->lastnodewhichkeyedusup){
- p = ast_strdup(myrpt->lastnodewhichkeyedusup); /* Make a local copy of the node name */
- if(!p){
- ast_log(LOG_WARNING, "ast_strdup failed in telemetery LASTNODEKEY");
- imdone = 1;
- break;
- }
- }
- else
- p = NULL;
- rpt_mutex_unlock(&myrpt->lock);
- if(!p){
- imdone = 1; /* no node previously keyed us up, or the node which did has been disconnected */
- break;
- }
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = saynode(myrpt,mychannel,p);
- ast_free(p);
- imdone = 1;
- break;
-
- case UNAUTHTX: /* Say unauthorized transmit frequency */
- wait_interval(myrpt, DLY_TELEM, mychannel);
- res = ast_streamfile(mychannel, "rpt/unauthtx", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- imdone = 1;
- break;
-
- case PARROT: /* Repeat stuff */
-
- sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
- if (ast_fileexists(mystr,NULL,ast_channel_language(mychannel)) <= 0)
- {
- imdone = 1;
- myrpt->parrotstate = 0;
- break;
- }
- wait_interval(myrpt, DLY_PARROT, mychannel);
- sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
- res = ast_streamfile(mychannel, mystr, ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
- strcat(mystr,".wav");
- unlink(mystr);
- imdone = 1;
- myrpt->parrotstate = 0;
- break;
-
- case TIMEOUT:
- res = saynode(myrpt,mychannel,myrpt->name);
- if (!res)
- res = ast_streamfile(mychannel, "rpt/timeout", ast_channel_language(mychannel));
- break;
-
- case TIMEOUT_WARNING:
- time(&t);
- res = saynode(myrpt,mychannel,myrpt->name);
- if (!res)
- res = ast_streamfile(mychannel, "rpt/timeout-warning", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- if(!res) /* Say number of seconds */
- ast_say_number(mychannel, myrpt->p.remotetimeout -
- (t - myrpt->last_activity_time),
- "", ast_channel_language(mychannel), (char *) NULL);
- if (!res)
- res = ast_waitstream(mychannel, "");
- ast_stopstream(mychannel);
- res = ast_streamfile(mychannel, "queue-seconds", ast_channel_language(mychannel));
- break;
-
- case ACT_TIMEOUT_WARNING:
- time(&t);
- res = saynode(myrpt,mychannel,myrpt->name);
- if (!res)
- res = ast_streamfile(mychannel, "rpt/act-timeout-warning", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- ast_stopstream(mychannel);
- if(!res) /* Say number of seconds */
- ast_say_number(mychannel, myrpt->p.remoteinacttimeout -
- (t - myrpt->last_activity_time),
- "", ast_channel_language(mychannel), (char *) NULL);
- if (!res)
- res = ast_waitstream(mychannel, "");
- ast_stopstream(mychannel);
- res = ast_streamfile(mychannel, "queue-seconds", ast_channel_language(mychannel));
- break;
-
- case STATS_TIME:
- case STATS_TIME_LOCAL:
- wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
- t = time(NULL);
- rpt_localtime(&t, &localtm);
- /* Say the phase of the day is before the time */
- if((localtm.tm_hour >= 0) && (localtm.tm_hour < 12))
- p = "rpt/goodmorning";
- else if((localtm.tm_hour >= 12) && (localtm.tm_hour < 18))
- p = "rpt/goodafternoon";
- else
- p = "rpt/goodevening";
- if (sayfile(mychannel,p) == -1)
- {
- imdone = 1;
- break;
- }
- /* Say the time is ... */
- if (sayfile(mychannel,"rpt/thetimeis") == -1)
- {
- imdone = 1;
- break;
- }
- /* Say the time */
- res = ast_say_time(mychannel, t, "", ast_channel_language(mychannel));
- if (!res)
- res = ast_waitstream(mychannel, "");
- ast_stopstream(mychannel);
- imdone = 1;
- break;
- case STATS_VERSION:
- p = strstr(tdesc, "version");
- if(!p)
- break;
- if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) != 2)
- break;
- wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
- /* Say "version" */
- if (sayfile(mychannel,"rpt/version") == -1)
- {
- imdone = 1;
- break;
- }
- if(!res) /* Say "X" */
- ast_say_number(mychannel, vmajor, "", ast_channel_language(mychannel), (char *) NULL);
- if (!res)
- res = ast_waitstream(mychannel, "");
- ast_stopstream(mychannel);
- if (saycharstr(mychannel,".") == -1)
- {
- imdone = 1;
- break;
- }
- if(!res) /* Say "Y" */
- ast_say_number(mychannel, vminor, "", ast_channel_language(mychannel), (char *) NULL);
- if (!res){
- res = ast_waitstream(mychannel, "");
- ast_stopstream(mychannel);
- }
- else
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- imdone = 1;
- break;
- case ARB_ALPHA:
- wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
- if(mytele->param)
- saycharstr(mychannel, mytele->param);
- imdone = 1;
- break;
- case REV_PATCH:
- wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
- if(mytele->param) {
-
- /* Parts of this section taken from app_parkandannounce */
- char *tpl_working, *tpl_current;
- char *tmp[100], *myparm;
- int looptemp=0,idx=0, dres = 0;
-
-
- tpl_working = ast_strdup(mytele->param);
- myparm = strsep(&tpl_working,",");
- tpl_current=strsep(&tpl_working, ":");
-
- while(tpl_current && looptemp < sizeof(tmp)) {
- tmp[looptemp]=tpl_current;
- looptemp++;
- tpl_current=strsep(&tpl_working,":");
- }
-
- for(idx=0; idx<looptemp; idx++) {
- if(!strcmp(tmp[idx], "PARKED")) {
- ast_say_digits(mychannel, atoi(myparm), "", ast_channel_language(mychannel));
- } else if(!strcmp(tmp[idx], "NODE")) {
- ast_say_digits(mychannel, atoi(myrpt->name), "", ast_channel_language(mychannel));
- } else {
- dres = ast_streamfile(mychannel, tmp[idx], ast_channel_language(mychannel));
- if(!dres) {
- dres = ast_waitstream(mychannel, "");
- } else {
- ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[idx], ast_channel_name(mychannel));
- dres = 0;
- }
- }
- }
- ast_free(tpl_working);
- }
- imdone = 1;
- break;
- case TEST_TONE:
- imdone = 1;
- if (myrpt->stopgen) break;
- myrpt->stopgen = -1;
- if ((res = ast_tonepair_start(mychannel, 1004.0, 0, 99999999, 7200.0)))
- {
- myrpt->stopgen = 0;
- break;
- }
- while(ast_channel_generatordata(mychannel) && (myrpt->stopgen <= 0)) {
- if (ast_safe_sleep(mychannel,1)) break;
- imdone = 1;
- }
- myrpt->stopgen = 0;
- break;
- default:
- break;
- }
- if (!imdone)
- {
- if (!res)
- res = ast_waitstream(mychannel, "");
- else {
- ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", ast_channel_name(mychannel));
- res = 0;
- }
- }
- ast_stopstream(mychannel);
- rpt_mutex_lock(&myrpt->lock);
- if (mytele->mode == TAILMSG)
- {
- if (!res)
- {
- myrpt->tailmessagen++;
- if(myrpt->tailmessagen >= myrpt->p.tailmessagemax) myrpt->tailmessagen = 0;
- }
- else
- {
- myrpt->tmsgtimer = myrpt->p.tailsquashedtime;
- }
- }
- remque((struct qelem *)mytele);
- myrpt->active_telem = NULL;
- rpt_mutex_unlock(&myrpt->lock);
- ast_free(nodename);
- ast_free(ident);
- ast_free(mytele);
- ast_hangup(mychannel);
-#ifdef APP_RPT_LOCK_DEBUG
- {
- struct lockthread *t;
-
- sleep(5);
- ast_mutex_lock(&locklock);
- t = get_lockthread(pthread_self());
- if (t) memset(t,0,sizeof(struct lockthread));
- ast_mutex_unlock(&locklock);
- }
-#endif
- pthread_exit(NULL);
-}
-
-static void rpt_telemetry(struct rpt *myrpt,int mode, void *data)
-{
-struct rpt_tele *tele;
-struct rpt_link *mylink = NULL;
-int res;
-pthread_attr_t attr;
-char *v1, *v2;
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"mode=%i data=%s\n",mode, (char *)data);
-
- switch(mode)
- {
- case UNKEY:
- /* if any of the following are defined, go ahead and do it,
- otherwise, don't bother */
- v1 = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name,
- "unlinkedct");
- v2 = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name,
- "remotect");
- if (telem_lookup(myrpt,NULL, myrpt->name, "remotemon") &&
- telem_lookup(myrpt,NULL, myrpt->name, "remotetx") &&
- telem_lookup(myrpt,NULL, myrpt->name, "cmdmode") &&
- (!(v1 && telem_lookup(myrpt,NULL, myrpt->name, v1))) &&
- (!(v2 && telem_lookup(myrpt,NULL, myrpt->name, v2)))) return;
- break;
- case LINKUNKEY:
- if (!ast_variable_retrieve(myrpt->cfg, myrpt->name, "linkunkeyct"))
- return;
- break;
- default:
- break;
- }
- tele = ast_malloc(sizeof(struct rpt_tele));
- if (!tele)
- {
- ast_log(LOG_WARNING, "Unable to allocate memory\n");
- pthread_exit(NULL);
- return;
- }
- /* zero it out */
- memset((char *)tele,0,sizeof(struct rpt_tele));
- tele->rpt = myrpt;
- tele->mode = mode;
- if (mode == PARROT) tele->parrot = (uintptr_t) data;
- else mylink = (struct rpt_link *) data;
- rpt_mutex_lock(&myrpt->lock);
- if((mode == CONNFAIL) || (mode == REMDISC) || (mode == CONNECTED) ||
- (mode == LINKUNKEY)){
- memset(&tele->mylink,0,sizeof(struct rpt_link));
- if (mylink){
- memcpy(&tele->mylink,mylink,sizeof(struct rpt_link));
- }
- }
- else if ((mode == ARB_ALPHA) || (mode == REV_PATCH) || (mode == PLAYBACK)) {
- strncpy(tele->param, (char *) data, TELEPARAMSIZE - 1);
- tele->param[TELEPARAMSIZE - 1] = 0;
- }
- if (mode == REMXXX) tele->submode = (intptr_t) data;
- insque((struct qelem *)tele, (struct qelem *)myrpt->tele.next);
- rpt_mutex_unlock(&myrpt->lock);
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- res = ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
- if(res < 0){
- rpt_mutex_lock(&myrpt->lock);
- remque((struct qlem *) tele); /* We don't like stuck transmitters, remove it from the queue */
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_WARNING, "Could not create telemetry thread: %s",strerror(res));
- }
- return;
-}
-
-static void *rpt_call(void *this)
-{
-struct dahdi_confinfo ci; /* conference info */
-struct rpt *myrpt = (struct rpt *)this;
-int res;
-int stopped,congstarted,dialtimer,lastcidx,aborted;
-struct ast_channel *mychannel,*genchannel;
-struct ast_format_cap *cap = NULL;
-
- myrpt->mydtmf = 0;
- /* allocate a pseudo-channel thru asterisk */
- mychannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!mychannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- pthread_exit(NULL);
- }
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(mychannel))
- ast_set_flag(ast_channel_cdr(mychannel),AST_CDR_FLAG_POST_DISABLED);
-#endif
- ci.chan = 0;
- ci.confno = myrpt->conf; /* use the pseudo conference */
-#if 0
- ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER
- | DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
-#endif
- ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
- /* first put the channel on the conference */
- if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_hangup(mychannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- /* allocate a pseudo-channel thru asterisk */
- genchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!genchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- ast_hangup(mychannel);
- pthread_exit(NULL);
- }
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(genchannel))
- ast_set_flag(ast_channel_cdr(genchannel),AST_CDR_FLAG_POST_DISABLED);
-#endif
- ci.chan = 0;
- ci.confno = myrpt->conf;
- ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER
- | DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER;
- /* first put the channel on the conference */
- if (ioctl(genchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- if (myrpt->p.tonezone && (tone_zone_set_zone(mychannel->fds[0],myrpt->p.tonezone) == -1))
- {
- ast_log(LOG_WARNING, "Unable to set tone zone %s\n",myrpt->p.tonezone);
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- if (myrpt->p.tonezone && (tone_zone_set_zone(genchannel->fds[0],myrpt->p.tonezone) == -1))
- {
- ast_log(LOG_WARNING, "Unable to set tone zone %s\n",myrpt->p.tonezone);
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- /* start dialtone if patchquiet is 0. Special patch modes don't send dial tone */
- if ((!myrpt->patchquiet) && (tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_DIALTONE) < 0))
- {
- ast_log(LOG_WARNING, "Cannot start dialtone\n");
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- stopped = 0;
- congstarted = 0;
- dialtimer = 0;
- lastcidx = 0;
- myrpt->calldigittimer = 0;
- aborted = 0;
-
- while ((myrpt->callmode == 1) || (myrpt->callmode == 4))
- {
- if((myrpt->patchdialtime)&&(myrpt->callmode == 1)&&(myrpt->cidx != lastcidx)){
- dialtimer = 0;
- lastcidx = myrpt->cidx;
- }
-
- if((myrpt->patchdialtime)&&(dialtimer >= myrpt->patchdialtime)){
- if(debug)
- ast_log(LOG_NOTICE, "dialtimer %i > patchdialtime %i\n", dialtimer,myrpt->patchdialtime);
- rpt_mutex_lock(&myrpt->lock);
- aborted = 1;
- myrpt->callmode = 0;
- rpt_mutex_unlock(&myrpt->lock);
- break;
- }
-
- if ((!myrpt->patchquiet) && (!stopped) && (myrpt->callmode == 1) && (myrpt->cidx > 0))
- {
- stopped = 1;
- /* stop dial tone */
- tone_zone_play_tone(genchannel->fds[0],-1);
- }
- if (myrpt->callmode == 1)
- {
- if(myrpt->calldigittimer > PATCH_DIALPLAN_TIMEOUT)
- {
- myrpt->callmode = 2;
- break;
- }
- /* bump timer if active */
- if (myrpt->calldigittimer)
- myrpt->calldigittimer += MSWAIT;
- }
- if (myrpt->callmode == 4)
- {
- if(!congstarted){
- congstarted = 1;
- /* start congestion tone */
- tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION);
- }
- }
- res = ast_safe_sleep(mychannel, MSWAIT);
- if (res < 0)
- {
- if(debug)
- ast_log(LOG_NOTICE, "ast_safe_sleep=%i\n", res);
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->callmode = 0;
- rpt_mutex_unlock(&myrpt->lock);
- pthread_exit(NULL);
- }
- dialtimer += MSWAIT;
- }
- /* stop any tone generation */
- tone_zone_play_tone(genchannel->fds[0],-1);
- /* end if done */
- if (!myrpt->callmode)
- {
- if(debug)
- ast_log(LOG_NOTICE, "callmode==0\n");
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->callmode = 0;
- myrpt->macropatch=0;
- channel_revert(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if((!myrpt->patchquiet) && aborted)
- rpt_telemetry(myrpt, TERM, NULL);
- pthread_exit(NULL);
- }
-
- if (myrpt->p.ourcallerid && *myrpt->p.ourcallerid){
- char *name, *loc, *instr;
- instr = ast_strdup(myrpt->p.ourcallerid);
- if(instr){
- ast_callerid_parse(instr, &name, &loc);
- if(loc){
- ast_channel_caller(mychannel)->id.number.valid = 1;
- ast_free(ast_channel_caller(mychannel)->id.number.str);
- ast_channel_caller(mychannel)->id.number.str = ast_strdup(loc);
- }
- if(name){
- ast_channel_caller(mychannel)->id.name.valid = 1;
- ast_free(ast_channel_caller(mychannel)->id.name.str);
- ast_channel_caller(mychannel)->id.name.str = ast_strdup(name);
- }
- ast_free(instr);
- }
- }
-
- ast_channel_exten_set(mychannel, myrpt->exten);
- ast_channel_context_set(mychannel, myrpt->patchcontext);
-
- if (myrpt->p.acctcode)
- ast_cdr_setaccount(mychannel,myrpt->p.acctcode);
- ast_channel_priority_set(mychannel, 1);
- ast_channel_undefer_dtmf(mychannel);
- if (ast_pbx_start(mychannel) < 0)
- {
- ast_log(LOG_WARNING, "Unable to start PBX!!\n");
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->callmode = 0;
- rpt_mutex_unlock(&myrpt->lock);
- pthread_exit(NULL);
- }
- usleep(10000);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->callmode = 3;
- /* set appropriate conference for the pseudo */
- ci.chan = 0;
- ci.confno = myrpt->conf;
- ci.confmode = (myrpt->p.duplex == 2) ? DAHDI_CONF_CONFANNMON :
- (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
- /* first put the channel on the conference in announce mode */
- if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_hangup(mychannel);
- ast_hangup(genchannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- /* get its channel number */
- if (ioctl(mychannel->fds[0],DAHDI_CHANNO,&res) == -1)
- {
- ast_log(LOG_WARNING, "Unable to get autopatch channel number\n");
- ast_hangup(mychannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- ci.chan = 0;
- ci.confno = res;
- ci.confmode = DAHDI_CONF_MONITOR;
- /* put vox channel monitoring on the channel */
- if (ioctl(myrpt->voxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_hangup(mychannel);
- myrpt->callmode = 0;
- pthread_exit(NULL);
- }
- while(myrpt->callmode)
- {
- if ((!ast_channel_pbx(mychannel)) && (myrpt->callmode != 4))
- {
- /* If patch is setup for far end disconnect */
- if(myrpt->patchfarenddisconnect || (myrpt->p.duplex < 2)){
- if(debug)ast_log(LOG_NOTICE,"callmode=%i, patchfarenddisconnect=%i, duplex=%i\n",\
- myrpt->callmode,myrpt->patchfarenddisconnect,myrpt->p.duplex);
- myrpt->callmode = 0;
- myrpt->macropatch=0;
- if(!myrpt->patchquiet){
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt, TERM, NULL);
- rpt_mutex_lock(&myrpt->lock);
- }
- }
- else{ /* Send congestion until patch is downed by command */
- myrpt->callmode = 4;
- rpt_mutex_unlock(&myrpt->lock);
- /* start congestion tone */
- tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION);
- rpt_mutex_lock(&myrpt->lock);
- }
- }
- if (myrpt->mydtmf)
- {
- struct ast_frame wf = {AST_FRAME_DTMF, } ;
- wf.subclass.integer = myrpt->mydtmf;
- rpt_mutex_unlock(&myrpt->lock);
- ast_queue_frame(mychannel,&wf);
-#ifdef NEW_ASTERISK
- ast_senddigit(genchannel,myrpt->mydtmf,0);
-#else
- ast_senddigit(genchannel,myrpt->mydtmf);
-#endif
- rpt_mutex_lock(&myrpt->lock);
- myrpt->mydtmf = 0;
- }
- rpt_mutex_unlock(&myrpt->lock);
- usleep(MSWAIT * 1000);
- rpt_mutex_lock(&myrpt->lock);
- }
- if(debug)
- ast_log(LOG_NOTICE, "exit channel loop\n");
- rpt_mutex_unlock(&myrpt->lock);
- tone_zone_play_tone(genchannel->fds[0],-1);
- if (ast_channel_pbx(mychannel)) ast_softhangup(mychannel,AST_SOFTHANGUP_DEV);
- ast_hangup(genchannel);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->callmode = 0;
- myrpt->macropatch=0;
- channel_revert(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- /* set appropriate conference for the pseudo */
- ci.chan = 0;
- ci.confno = myrpt->conf;
- ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON :
- (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
- /* first put the channel on the conference in announce mode */
- if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- }
- pthread_exit(NULL);
-}
-
-static void send_link_dtmf(struct rpt *myrpt,char c)
-{
-char str[300];
-struct ast_frame wf;
-struct rpt_link *l;
-
- snprintf(str, sizeof(str), "D %s %s %d %c", myrpt->cmdnode, myrpt->name, ++(myrpt->dtmfidx), c);
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(str) + 1;
- wf.samples = 0;
- l = myrpt->links.next;
- /* first, see if our dude is there */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* if we found it, write it and were done */
- if (!strcmp(l->name,myrpt->cmdnode))
- {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- return;
- }
- l = l->next;
- }
- l = myrpt->links.next;
- /* if not, give it to everyone */
- while(l != &myrpt->links)
- {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- l = l->next;
- }
- return;
-}
-
-static void send_link_keyquery(struct rpt *myrpt)
-{
-char str[300];
-struct ast_frame wf;
-struct rpt_link *l;
-
- rpt_mutex_lock(&myrpt->lock);
- memset(myrpt->topkey,0,sizeof(myrpt->topkey));
- myrpt->topkeystate = 1;
- time(&myrpt->topkeytime);
- rpt_mutex_unlock(&myrpt->lock);
- snprintf(str, sizeof(str), "K? * %s 0 0", myrpt->name);
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(str) + 1;
- wf.samples = 0;
- l = myrpt->links.next;
- /* give it to everyone */
- while(l != &myrpt->links)
- {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- l = l->next;
- }
- return;
-}
-
-/* send newkey request */
-
-static void send_newkey(struct ast_channel *chan)
-{
-
- /* ast_safe_sleep(chan,10); */
- ast_sendtext(chan,newkeystr);
- return;
-}
-
-
-/*
- * Connect a link
- *
- * Return values:
- * -2: Attempt to connect to self
- * -1: No such node
- * 0: Success
- * 1: No match yet
- * 2: Already connected to this node
- */
-
-static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
-{
- char *val, *s, *s1, *tele;
- char lstr[MAXLINKLIST],*strs[MAXLINKLIST];
- char tmp[300], deststr[300] = "",modechange = 0;
- char sx[320],*sy;
- struct rpt_link *l;
- int reconnects = 0;
- int i,n;
- struct dahdi_confinfo ci; /* conference info */
- struct ast_format_cap *cap = NULL;
-
- val = node_lookup(myrpt,node);
- if (!val){
- if(strlen(node) >= myrpt->longestnode)
- return -1; /* No such node */
- return 1; /* No match yet */
- }
-
- if(!strcmp(myrpt->name,node)) /* Do not allow connections to self */
- return -2;
-
- if(debug > 3){
- ast_log(LOG_NOTICE,"Connect attempt to node %s\n", node);
- ast_log(LOG_NOTICE,"Mode: %s\n",(mode)?"Transceive":"Monitor");
- ast_log(LOG_NOTICE,"Connection type: %s\n",(perma)?"Permalink":"Normal");
- }
-
- strncpy(tmp,val,sizeof(tmp) - 1);
- s = tmp;
- s1 = strsep(&s,",");
- if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
- {
- sy = strchr(s1,'/');
- *sy = 0;
- sprintf(sx,"%s:4569/%s",s1,sy + 1);
- s1 = sx;
- }
- strsep(&s,",");
- rpt_mutex_lock(&myrpt->lock);
- l = myrpt->links.next;
- /* try to find this one in queue */
- while(l != &myrpt->links){
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* if found matching string */
- if (!strcmp(l->name, node))
- break;
- l = l->next;
- }
- /* if found */
- if (l != &myrpt->links){
- /* if already in this mode, just ignore */
- if ((l->mode) || (!l->chan)) {
- rpt_mutex_unlock(&myrpt->lock);
- return 2; /* Already linked */
- }
- reconnects = l->reconnects;
- rpt_mutex_unlock(&myrpt->lock);
- if (l->chan) ast_softhangup(l->chan, AST_SOFTHANGUP_DEV);
- l->retries = l->max_retries + 1;
- l->disced = 2;
- modechange = 1;
- } else
- {
- __mklinklist(myrpt,NULL,lstr);
- rpt_mutex_unlock(&myrpt->lock);
- n = finddelim(lstr,strs,MAXLINKLIST);
- for(i = 0; i < n; i++)
- {
- if ((*strs[i] < '0') ||
- (*strs[i] > '9')) strs[i]++;
- if (!strcmp(strs[i],node))
- {
- return 2; /* Already linked */
- }
- }
- }
- strncpy(myrpt->lastlinknode,node,MAXNODESTR - 1);
- /* establish call */
- l = ast_malloc(sizeof(struct rpt_link));
- if (!l)
- {
- ast_log(LOG_WARNING, "Unable to malloc\n");
- return -1;
- }
- /* zero the silly thing */
- memset((char *)l,0,sizeof(struct rpt_link));
- l->mode = mode;
- l->outbound = 1;
- l->thisconnected = 0;
- voxinit_link(l,1);
- strncpy(l->name, node, MAXNODESTR - 1);
- l->isremote = (s && ast_true(s));
- if (modechange) l->connected = 1;
- l->hasconnected = l->perma = perma;
-#ifdef ALLOW_LOCAL_CHANNELS
- if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1, "local/", 6) == 0))
- strncpy(deststr, s1, sizeof(deststr));
- else
- snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
-#else
- snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
-#endif
- tele = strchr(deststr, '/');
- if (!tele){
- ast_log(LOG_WARNING,"link3:Dial number (%s) must be in format tech/number\n",deststr);
- ast_free(l);
- return -1;
- }
- *tele++ = 0;
- l->chan = ast_request(deststr, get_slin_cap(cap), NULL, tele, NULL);
- cap = ast_format_cap_destroy(cap);
- if (l->chan){
- ast_set_read_format_by_id(l->chan, AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(l->chan, AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(l->chan))
- ast_set_flag(ast_channel_cdr(l->chan),AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef NEW_ASTERISK
- l->chan->whentohangup = 0;
-#endif
- ast_channel_appl_set(l->chan, "Apprpt");
- ast_channel_data_set(l->chan, "(Remote Rx)");
- if (debug > 3)
- ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n",
- deststr, tele, ast_channel_name(l->chan));
- ast_channel_caller(l->chan)->id.number.valid = 1;
- ast_free(ast_channel_caller(l->chan)->id.number.str);
- ast_channel_caller(l->chan)->id.number.str = ast_strdup(myrpt->name);
- ast_call(l->chan,tele,999);
- }
- else {
- if(debug > 3)
- ast_log(LOG_NOTICE, "Unable to place call to %s/%s on %s\n",
- deststr,tele,ast_channel_name(l->chan));
- if (myrpt->p.archivedir)
- {
- char str[100];
- sprintf(str,"LINKFAIL,%s",l->name);
- donodelog(myrpt,str);
- }
- ast_free(l);
- return -1;
- }
- /* allocate a pseudo-channel thru asterisk */
- l->pchan = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!l->pchan){
- ast_log(LOG_WARNING,"rpt connect: Sorry unable to obtain pseudo channel\n");
- ast_hangup(l->chan);
- ast_free(l);
- return -1;
- }
- ast_set_read_format_by_id(l->pchan, AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(l->pchan, AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(l->pchan))
- ast_set_flag(ast_channel_cdr(l->pchan),AST_CDR_FLAG_POST_DISABLED);
-#endif
- /* make a conference for the tx */
- ci.chan = 0;
- ci.confno = myrpt->conf;
- ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER;
- /* first put the channel on the conference in proper mode */
- if (ioctl(l->pchan->fds[0], DAHDI_SETCONF, &ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_hangup(l->chan);
- ast_hangup(l->pchan);
- ast_free(l);
- return -1;
- }
- rpt_mutex_lock(&myrpt->lock);
- l->reconnects = reconnects;
- /* insert at end of queue */
- l->max_retries = MAX_RETRIES;
- if (perma)
- l->max_retries = MAX_RETRIES_PERM;
- if (l->isremote) l->retries = l->max_retries + 1;
- insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
- __kickshort(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if (!l->phonemode) send_newkey(l->chan);
- return 0;
-}
-
-
-
-/*
-* Internet linking function
-*/
-
-static int function_ilink(struct rpt *myrpt, char *param, char *digits, int command_source, struct rpt_link *mylink)
-{
-
- char *val, *s, *s1;
- char tmp[300];
- char digitbuf[MAXNODESTR],*strs[MAXLINKLIST];
- char mode,perma;
- char sx[320],*sy;
- struct rpt_link *l;
- int i,r;
-
- if(!param)
- return DC_ERROR;
-
-
- if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable )
- return DC_ERROR;
-
- strncpy(digitbuf,digits,MAXNODESTR - 1);
-
- if(debug > 6)
- printf("@@@@ ilink param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-
- switch(myatoi(param)){
- case 11: /* Perm Link off */
- case 1: /* Link off */
- if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
- strcpy(digitbuf,myrpt->lastlinknode);
- val = node_lookup(myrpt,digitbuf);
- if (!val){
- if(strlen(digitbuf) >= myrpt->longestnode)
- return DC_ERROR;
- break;
- }
- strncpy(tmp,val,sizeof(tmp) - 1);
- s = tmp;
- s1 = strsep(&s,",");
- if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
- {
- sy = strchr(s1,'/');
- *sy = 0;
- sprintf(sx,"%s:4569/%s",s1,sy + 1);
- s1 = sx;
- }
- strsep(&s,",");
- rpt_mutex_lock(&myrpt->lock);
- l = myrpt->links.next;
- /* try to find this one in queue */
- while(l != &myrpt->links){
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* if found matching string */
- if (!strcmp(l->name, digitbuf))
- break;
- l = l->next;
- }
- if (l != &myrpt->links){ /* if found */
- struct ast_frame wf;
-
- /* must use perm command on perm link */
- if ((myatoi(param) < 10) &&
- (l->max_retries > MAX_RETRIES))
- {
- rpt_mutex_unlock(&myrpt->lock);
- return DC_COMPLETE;
- }
- strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
- l->retries = l->max_retries + 1;
- l->disced = 1;
- rpt_mutex_unlock(&myrpt->lock);
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(discstr) + 1;
- wf.samples = 0;
- wf.data.ptr = discstr;
- if (l->chan)
- {
- ast_write(l->chan,&wf);
- if (ast_safe_sleep(l->chan,250) == -1) return DC_ERROR;
- ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
- }
- rpt_telemetry(myrpt, COMPLETE, NULL);
- return DC_COMPLETE;
- }
- rpt_mutex_unlock(&myrpt->lock);
- return DC_COMPLETE;
- case 2: /* Link Monitor */
- case 3: /* Link transceive */
- case 12: /* Link Monitor permanent */
- case 13: /* Link transceive permanent */
- if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
- strcpy(digitbuf,myrpt->lastlinknode);
- /* Attempt connection */
- perma = (atoi(param) > 10) ? 1 : 0;
- mode = (atoi(param) & 1) ? 1 : 0;
- r = connect_link(myrpt, digitbuf, mode, perma);
- switch(r){
- case -2: /* Attempt to connect to self */
- return DC_COMPLETE; /* Silent error */
-
- case 0:
- rpt_telemetry(myrpt, COMPLETE, NULL);
- return DC_COMPLETE;
-
- case 1:
- break;
-
- case 2:
- rpt_telemetry(myrpt, REMALREADY, NULL);
- return DC_COMPLETE;
-
- default:
- rpt_telemetry(myrpt, CONNFAIL, NULL);
- return DC_COMPLETE;
- }
- break;
-
- case 4: /* Enter Command Mode */
-
- /* if doesnt allow link cmd, or no links active, return */
- if (((command_source != SOURCE_RPT) &&
- (command_source != SOURCE_PHONE) &&
- (command_source != SOURCE_ALT) &&
- (command_source != SOURCE_DPHONE)) ||
- (myrpt->links.next == &myrpt->links))
- return DC_COMPLETE;
-
- /* if already in cmd mode, or selected self, fughetabahtit */
- if ((myrpt->cmdnode[0]) || (!strcmp(myrpt->name, digitbuf))){
-
- rpt_telemetry(myrpt, REMALREADY, NULL);
- return DC_COMPLETE;
- }
- if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
- strcpy(digitbuf,myrpt->lastlinknode);
- /* node must at least exist in list */
- val = node_lookup(myrpt,digitbuf);
- if (!val){
- if(strlen(digitbuf) >= myrpt->longestnode)
- return DC_ERROR;
- break;
-
- }
- rpt_mutex_lock(&myrpt->lock);
- strcpy(myrpt->lastlinknode,digitbuf);
- strncpy(myrpt->cmdnode, digitbuf, sizeof(myrpt->cmdnode) - 1);
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt, REMGO, NULL);
- return DC_COMPLETE;
-
- case 5: /* Status */
- rpt_telemetry(myrpt, STATUS, NULL);
- return DC_COMPLETE;
-
- case 15: /* Full Status */
- rpt_telemetry(myrpt, FULLSTATUS, NULL);
- return DC_COMPLETE;
-
-
- case 6: /* All Links Off, including permalinks */
- rpt_mutex_lock(&myrpt->lock);
- myrpt->savednodes[0] = 0;
- l = myrpt->links.next;
- /* loop through all links */
- while(l != &myrpt->links){
- struct ast_frame wf;
- if (l->name[0] == '0') /* Skip any IAXRPT monitoring */
- {
- l = l->next;
- continue;
- }
- /* Make a string of disconnected nodes for possible restoration */
- sprintf(tmp,"%c%c%s",(l->mode) ? 'X' : 'M',(l->perma) ? 'P':'T',l->name);
- if(strlen(tmp) + strlen(myrpt->savednodes) + 1 < MAXNODESTR){
- if(myrpt->savednodes[0])
- strcat(myrpt->savednodes, ",");
- strcat(myrpt->savednodes, tmp);
- }
- l->retries = l->max_retries + 1;
- l->disced = 2; /* Silently disconnect */
- rpt_mutex_unlock(&myrpt->lock);
- /* ast_log(LOG_NOTICE,"dumping link %s\n",l->name); */
-
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(discstr) + 1;
- wf.samples = 0;
- wf.data.ptr = discstr;
- if (l->chan)
- {
- ast_write(l->chan,&wf);
- ast_safe_sleep(l->chan,250); /* It's dead already, why check the return value? */
- ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
- }
- rpt_mutex_lock(&myrpt->lock);
- l = l->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- if(debug > 3)
- ast_log(LOG_NOTICE,"Nodes disconnected: %s\n",myrpt->savednodes);
- rpt_telemetry(myrpt, COMPLETE, NULL);
- return DC_COMPLETE;
-
- case 7: /* Identify last node which keyed us up */
- rpt_telemetry(myrpt, LASTNODEKEY, NULL);
- break;
-
-
-#ifdef _MDC_DECODE_H_
- case 8:
- myrpt->lastunit = 0xd00d;
- mdc1200_notify(myrpt,NULL,myrpt->lastunit);
- mdc1200_send(myrpt,myrpt->lastunit);
- break;
-#endif
-
- case 16: /* Restore links disconnected with "disconnect all links" command */
- strcpy(tmp, myrpt->savednodes); /* Make a copy */
- finddelim(tmp, strs, MAXLINKLIST); /* convert into substrings */
- for(i = 0; tmp[0] && strs[i] != NULL && i < MAXLINKLIST; i++){
- s1 = strs[i];
- mode = (s1[0] == 'X') ? 1 : 0;
- perma = (s1[1] == 'P') ? 1 : 0;
- connect_link(myrpt, s1 + 2, mode, perma); /* Try to reconnect */
- }
- rpt_telemetry(myrpt, COMPLETE, NULL);
- break;
-
- case 200:
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206:
- case 207:
- case 208:
- case 209:
- case 210:
- case 211:
- case 212:
- case 213:
- case 214:
- case 215:
- if (((myrpt->p.propagate_dtmf) &&
- (command_source == SOURCE_LNK)) ||
- ((myrpt->p.propagate_phonedtmf) &&
- ((command_source == SOURCE_PHONE) ||
- (command_source == SOURCE_ALT) ||
- (command_source == SOURCE_DPHONE))))
- do_dtmf_local(myrpt,
- remdtmfstr[myatoi(param) - 200]);
- default:
- return DC_ERROR;
-
- }
-
- return DC_INDETERMINATE;
-}
-
-/*
-* Autopatch up
-*/
-
-static int function_autopatchup(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
- pthread_attr_t attr;
- int i, idx, paramlength;
- char *lparam;
- char *value = NULL;
- char *paramlist[20];
-
- static char *keywords[] = {
- "context",
- "dialtime",
- "farenddisconnect",
- "noct",
- "quiet",
- NULL
- };
-
- if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
- return DC_ERROR;
-
- if(debug)
- printf("@@@@ Autopatch up\n");
-
- if(!myrpt->callmode){
- /* Set defaults */
- myrpt->patchnoct = 0;
- myrpt->patchdialtime = 0;
- myrpt->patchfarenddisconnect = 0;
- myrpt->patchquiet = 0;
- strncpy(myrpt->patchcontext, myrpt->p.ourcontext, MAXPATCHCONTEXT);
-
- if(param){
- /* Process parameter list */
- lparam = ast_strdup(param);
- if(!lparam){
- ast_log(LOG_ERROR,"App_rpt out of memory on line %d\n",__LINE__);
- return DC_ERROR;
- }
- paramlength = finddelim(lparam, paramlist, 20);
- for(i = 0; i < paramlength; i++){
- idx = matchkeyword(paramlist[i], &value, keywords);
- if(value)
- value = skipchars(value, "= ");
- switch(idx){
-
- case 1: /* context */
- strncpy(myrpt->patchcontext, value, MAXPATCHCONTEXT - 1) ;
- break;
-
- case 2: /* dialtime */
- myrpt->patchdialtime = atoi(value);
- break;
-
- case 3: /* farenddisconnect */
- myrpt->patchfarenddisconnect = atoi(value);
- break;
-
- case 4: /* noct */
- myrpt->patchnoct = atoi(value);
- break;
-
- case 5: /* quiet */
- myrpt->patchquiet = atoi(value);
- break;
-
- default:
- break;
- }
- }
- ast_free(lparam);
- }
- }
-
- rpt_mutex_lock(&myrpt->lock);
-
- /* if on call, force * into current audio stream */
-
- if ((myrpt->callmode == 2) || (myrpt->callmode == 3)){
- myrpt->mydtmf = myrpt->p.endchar;
- }
- if (myrpt->callmode){
- rpt_mutex_unlock(&myrpt->lock);
- return DC_COMPLETE;
- }
- myrpt->callmode = 1;
- myrpt->cidx = 0;
- myrpt->exten[myrpt->cidx] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
- return DC_COMPLETE;
-}
-
-/*
-* Autopatch down
-*/
-
-static int function_autopatchdn(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
- if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
- return DC_ERROR;
-
- if(debug)
- printf("@@@@ Autopatch down\n");
-
- rpt_mutex_lock(&myrpt->lock);
-
- myrpt->macropatch=0;
-
- if (!myrpt->callmode){
- rpt_mutex_unlock(&myrpt->lock);
- return DC_COMPLETE;
- }
-
- myrpt->callmode = 0;
- channel_revert(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt, TERM, NULL);
- return DC_COMPLETE;
-}
-
-/*
-* Status
-*/
-
-static int function_status(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-
- if (!param)
- return DC_ERROR;
-
- if ((myrpt->p.s[myrpt->p.sysstate_cur].txdisable) || (myrpt->p.s[myrpt->p.sysstate_cur].userfundisable))
- return DC_ERROR;
-
- if(debug)
- printf("@@@@ status param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-
- switch(myatoi(param)){
- case 1: /* System ID */
- rpt_telemetry(myrpt, ID1, NULL);
- return DC_COMPLETE;
- case 2: /* System Time */
- rpt_telemetry(myrpt, STATS_TIME, NULL);
- return DC_COMPLETE;
- case 3: /* app_rpt.c version */
- rpt_telemetry(myrpt, STATS_VERSION, NULL);
- return DC_COMPLETE;
- case 11: /* System ID (local only)*/
- rpt_telemetry(myrpt, ID , NULL);
- return DC_COMPLETE;
- case 12: /* System Time (local only)*/
- rpt_telemetry(myrpt, STATS_TIME_LOCAL, NULL);
- return DC_COMPLETE;
- default:
- return DC_ERROR;
- }
- return DC_INDETERMINATE;
-}
-/*
-* Macro-oni (without Salami)
-*/
-static int function_macro(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-char *val;
-int i;
- if (myrpt->remote)
- return DC_ERROR;
-
- if(debug)
- printf("@@@@ macro-oni param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-
- if(strlen(digitbuf) < 1) /* needs 1 digit */
- return DC_INDETERMINATE;
-
- for(i = 0 ; i < digitbuf[i] ; i++) {
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- return DC_ERROR;
- }
-
- if (*digitbuf == '0') val = myrpt->p.startupmacro;
- else val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.macro, digitbuf);
- /* param was 1 for local buf */
- if (!val){
- if (strlen(digitbuf) < myrpt->macro_longest)
- return DC_INDETERMINATE;
- rpt_telemetry(myrpt, MACRO_NOTFOUND, NULL);
- return DC_COMPLETE;
- }
- rpt_mutex_lock(&myrpt->lock);
- if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(val))
- {
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt, MACRO_BUSY, NULL);
- return DC_ERROR;
- }
- myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,val,MAXMACRO - 1);
- rpt_mutex_unlock(&myrpt->lock);
- return DC_COMPLETE;
-}
-
-/*
-* Playback a recording
-*/
-
-static int function_playback(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-
- if (myrpt->remote)
- return DC_ERROR;
-
- if(debug)
- printf("@@@@ playback param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-
- if (ast_fileexists(param,NULL,ast_channel_language(myrpt->rxchannel)) <= 0)
- return DC_ERROR;
-
- rpt_telemetry(myrpt,PLAYBACK,param);
- return DC_COMPLETE;
-}
-
-/*
-* COP - Control operator
-*/
-
-static int function_cop(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
- char string[16];
-
- int i, r;
-
- if(!param)
- return DC_ERROR;
-
- switch(myatoi(param)){
- case 1: /* System reset */
- return system("killall -9 asterisk");
-
- case 2:
- myrpt->p.s[myrpt->p.sysstate_cur].txdisable = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "RPTENA");
- return DC_COMPLETE;
-
- case 3:
- myrpt->p.s[myrpt->p.sysstate_cur].txdisable = 1;
- return DC_COMPLETE;
-
- case 4: /* test tone on */
- if (myrpt->stopgen < 0)
- {
- myrpt->stopgen = 1;
- }
- else
- {
- myrpt->stopgen = 0;
- rpt_telemetry(myrpt, TEST_TONE, NULL);
- }
- return DC_COMPLETE;
-
- case 5: /* Disgorge variables to log for debug purposes */
- myrpt->disgorgetime = time(NULL) + 10; /* Do it 10 seconds later */
- return DC_COMPLETE;
-
- case 6: /* Simulate COR being activated (phone only) */
- if (command_source != SOURCE_PHONE) return DC_INDETERMINATE;
- return DC_DOKEY;
-
-
- case 7: /* Time out timer enable */
- myrpt->p.s[myrpt->p.sysstate_cur].totdisable = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "TOTENA");
- return DC_COMPLETE;
-
- case 8: /* Time out timer disable */
- myrpt->p.s[myrpt->p.sysstate_cur].totdisable = 1;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "TOTDIS");
- return DC_COMPLETE;
-
- case 9: /* Autopatch enable */
- myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "APENA");
- return DC_COMPLETE;
-
- case 10: /* Autopatch disable */
- myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable = 1;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "APDIS");
- return DC_COMPLETE;
-
- case 11: /* Link Enable */
- myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "LNKENA");
- return DC_COMPLETE;
-
- case 12: /* Link Disable */
- myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable = 1;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "LNKDIS");
- return DC_COMPLETE;
-
- case 13: /* Query System State */
- string[0] = string[1] = 'S';
- string[2] = myrpt->p.sysstate_cur + '0';
- string[3] = '\0';
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) string);
- return DC_COMPLETE;
-
- case 14: /* Change System State */
- if(strlen(digitbuf) == 0)
- break;
- if((digitbuf[0] < '0') || (digitbuf[0] > '9'))
- return DC_ERROR;
- myrpt->p.sysstate_cur = digitbuf[0] - '0';
- string[0] = string[1] = 'S';
- string[2] = myrpt->p.sysstate_cur + '0';
- string[3] = '\0';
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) string);
- return DC_COMPLETE;
-
- case 15: /* Scheduler Enable */
- myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "SKENA");
- return DC_COMPLETE;
-
- case 16: /* Scheduler Disable */
- myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable = 1;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "SKDIS");
- return DC_COMPLETE;
-
- case 17: /* User functions Enable */
- myrpt->p.s[myrpt->p.sysstate_cur].userfundisable = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "UFENA");
- return DC_COMPLETE;
-
- case 18: /* User Functions Disable */
- myrpt->p.s[myrpt->p.sysstate_cur].userfundisable = 1;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "UFDIS");
- return DC_COMPLETE;
-
- case 19: /* Alternate Tail Enable */
- myrpt->p.s[myrpt->p.sysstate_cur].alternatetail = 1;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "ATENA");
- return DC_COMPLETE;
-
- case 20: /* Alternate Tail Disable */
- myrpt->p.s[myrpt->p.sysstate_cur].alternatetail = 0;
- rpt_telemetry(myrpt, ARB_ALPHA, (void *) "ATDIS");
- return DC_COMPLETE;
-
- case 21: /* Parrot Mode Disable */
- birdbath(myrpt);
- if (myrpt->p.parrotmode < 2)
- {
- myrpt->p.parrotmode = 0;
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return DC_COMPLETE;
- }
- break;
-
- case 22: /* Parrot Mode Enable */
- birdbath(myrpt);
- if (myrpt->p.parrotmode < 2)
- {
- myrpt->p.parrotmode = 1;
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return DC_COMPLETE;
- }
- break;
- case 23: /* flush parrot in progress */
- birdbath(myrpt);
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return DC_COMPLETE;
- case 24: /* flush all telemetry */
- flush_telem(myrpt);
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return DC_COMPLETE;
- case 25: /* request keying info (brief) */
- send_link_keyquery(myrpt);
- myrpt->topkeylong = 0;
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return DC_COMPLETE;
- case 26: /* request keying info (full) */
- send_link_keyquery(myrpt);
- myrpt->topkeylong = 1;
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return DC_COMPLETE;
-
- case 30: /* recall memory location on programmable radio */
-
- if(strlen(digitbuf) < 2) /* needs 2 digits */
- break;
-
- for(i = 0 ; i < 2 ; i++){
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- return DC_ERROR;
- }
-
- r = retreive_memory(myrpt, digitbuf);
- if (r < 0){
- rpt_telemetry(myrpt,MEMNOTFOUND,NULL);
- return DC_COMPLETE;
- }
- if (r > 0){
- return DC_ERROR;
- }
- if (setrem(myrpt) == -1) return DC_ERROR;
- return DC_COMPLETE;
-
- case 31:
- /* set channel. note that it's going to change channel
- then confirm on the new channel! */
- if(strlen(digitbuf) < 2) /* needs 2 digits */
- break;
-
- for(i = 0 ; i < 2 ; i++){
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- return DC_ERROR;
- }
- channel_steer(myrpt,digitbuf);
- return DC_COMPLETE;
-
- case 32: /* Touch Tone Pad Test */
- i = strlen(digitbuf);
- if(!i){
- if(debug > 3)
- ast_log(LOG_NOTICE,"Padtest entered");
- myrpt->inpadtest = 1;
- }
- else{
- if(debug > 3)
- ast_log(LOG_NOTICE,"Padtest len= %d digits=%s",i,digitbuf);
- if(digitbuf[i-1] != myrpt->p.endchar)
- break;
- rpt_telemetry(myrpt, ARB_ALPHA, digitbuf);
- myrpt->inpadtest = 0;
- if(debug > 3)
- ast_log(LOG_NOTICE,"Padtest exited");
- return DC_COMPLETE;
- }
- }
- return DC_INDETERMINATE;
-}
-/*
-* Collect digits one by one until something matches
-*/
-static int collect_function_digits(struct rpt *myrpt, char *digits,
- int command_source, struct rpt_link *mylink)
-{
- int i,rv;
- char *stringp,*action,*param,*functiondigits;
- char function_table_name[30] = "";
- char workstring[200];
-
- struct ast_variable *vp;
-
- if (debug > 6) ast_log(LOG_NOTICE,"digits=%s source=%d\n",digits, command_source);
-
- //if(debug)
- // printf("@@@@ Digits collected: %s, source: %d\n", digits, command_source);
-
- if (command_source == SOURCE_DPHONE) {
- if (!myrpt->p.dphone_functions) return DC_INDETERMINATE;
- strncpy(function_table_name, myrpt->p.dphone_functions, sizeof(function_table_name) - 1);
- }
- else if (command_source == SOURCE_ALT) {
- if (!myrpt->p.alt_functions) return DC_INDETERMINATE;
- strncpy(function_table_name, myrpt->p.alt_functions, sizeof(function_table_name) - 1);
- }
- else if (command_source == SOURCE_PHONE) {
- if (!myrpt->p.phone_functions) return DC_INDETERMINATE;
- strncpy(function_table_name, myrpt->p.phone_functions, sizeof(function_table_name) - 1);
- }
- else if (command_source == SOURCE_LNK)
- strncpy(function_table_name, myrpt->p.link_functions, sizeof(function_table_name) - 1);
- else
- strncpy(function_table_name, myrpt->p.functions, sizeof(function_table_name) - 1);
- /* find context for function table in rpt.conf file */
- vp = ast_variable_browse(myrpt->cfg, function_table_name);
- while(vp) {
- if(!strncasecmp(vp->name, digits, strlen(vp->name)))
- break;
- vp = vp->next;
- }
- /* if function context not found */
- if(!vp) {
- int n;
-
- n = myrpt->longestfunc;
- if (command_source == SOURCE_LNK) n = myrpt->link_longestfunc;
- else
- if (command_source == SOURCE_PHONE) n = myrpt->phone_longestfunc;
- else
- if (command_source == SOURCE_ALT) n = myrpt->alt_longestfunc;
- else
- if (command_source == SOURCE_DPHONE) n = myrpt->dphone_longestfunc;
-
- if(strlen(digits) >= n)
- return DC_ERROR;
- else
- return DC_INDETERMINATE;
- }
- /* Found a match, retrieve value part and parse */
- strncpy(workstring, vp->value, sizeof(workstring) - 1 );
- stringp = workstring;
- action = strsep(&stringp, ",");
- param = stringp;
- if(debug)
- printf("@@@@ action: %s, param = %s\n",action, (param) ? param : "(null)");
- /* Look up the action */
- for(i = 0 ; i < (sizeof(function_table)/sizeof(struct function_table_tag)); i++){
- if(!strncasecmp(action, function_table[i].action, strlen(action)))
- break;
- }
- if(debug)
- printf("@@@@ table index i = %d\n",i);
- if(i == (sizeof(function_table)/sizeof(struct function_table_tag))){
- /* Error, action not in table */
- return DC_ERROR;
- }
- if(function_table[i].function == NULL){
- /* Error, function undefined */
- if(debug)
- printf("@@@@ NULL for action: %s\n",action);
- return DC_ERROR;
- }
- functiondigits = digits + strlen(vp->name);
- rv=(*function_table[i].function)(myrpt, param, functiondigits, command_source, mylink);
- if (debug > 6) ast_log(LOG_NOTICE,"rv=%i\n",rv);
- return(rv);
-}
-
-
-static void handle_link_data(struct rpt *myrpt, struct rpt_link *mylink,
- char *str)
-{
-/* XXX ATTENTION: if you change the size of these arrays you MUST
- * change the limits in corresponding sscanf() calls below. */
-char tmp[512],tmp1[512],cmd[300] = "",dest[300],src[300],c;
-int i,seq, res, ts;
-struct rpt_link *l;
-struct ast_frame wf;
-
- wf.frametype = AST_FRAME_TEXT;
- wf.subclass.integer = 0;
- wf.offset = 0;
- wf.mallocd = 0;
- wf.datalen = strlen(str) + 1;
- wf.samples = 0;
- /* put string in our buffer */
- strncpy(tmp,str,sizeof(tmp) - 1);
-
- if (!strcmp(tmp,discstr))
- {
- mylink->disced = 1;
- mylink->retries = mylink->max_retries + 1;
- ast_softhangup(mylink->chan,AST_SOFTHANGUP_DEV);
- return;
- }
- if (!strcmp(tmp,newkeystr))
- {
- mylink->newkey = 1;
- return;
- }
- if (tmp[0] == 'L')
- {
- rpt_mutex_lock(&myrpt->lock);
- strcpy(mylink->linklist,tmp + 2);
- time(&mylink->linklistreceived);
- rpt_mutex_unlock(&myrpt->lock);
- if (debug > 6) ast_log(LOG_NOTICE,"@@@@ node %s received node list %s from node %s\n",
- myrpt->name,tmp,mylink->name);
- return;
- }
- if (tmp[0] == 'K')
- {
- if (sscanf(tmp, "%299s %299s %299s %30d %30d", cmd, dest, src, &seq, &ts) != 5)
- {
- ast_log(LOG_WARNING, "Unable to parse keying string %s\n",str);
- return;
- }
- if (dest[0] == '0')
- {
- strcpy(dest,myrpt->name);
- }
- /* if not for me, redistribute to all links */
- if (strcmp(dest,myrpt->name))
- {
- l = myrpt->links.next;
- /* see if this is one in list */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* don't send back from where it came */
- if ((l == mylink) || (!strcmp(l->name,mylink->name)))
- {
- l = l->next;
- continue;
- }
- /* if it is, send it and we're done */
- if (!strcmp(l->name,dest))
- {
- /* send, but not to src */
- if (strcmp(l->name,src)) {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- }
- return;
- }
- l = l->next;
- }
- }
- /* if not for me, or is broadcast, redistribute to all links */
- if ((strcmp(dest,myrpt->name)) || (dest[0] == '*'))
- {
- l = myrpt->links.next;
- /* otherwise, send it to all of em */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* don't send back from where it came */
- if ((l == mylink) || (!strcmp(l->name,mylink->name)))
- {
- l = l->next;
- continue;
- }
- /* send, but not to src */
- if (strcmp(l->name,src)) {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- }
- l = l->next;
- }
- }
- /* if not for me, end here */
- if (strcmp(dest,myrpt->name) && (dest[0] != '*')) return;
- if (cmd[1] == '?')
- {
- time_t now;
- int n = 0;
-
- time(&now);
- if (myrpt->lastkeyedtime)
- {
- n = (int)(now - myrpt->lastkeyedtime);
- }
- sprintf(tmp1,"K %s %s %d %d",src,myrpt->name,myrpt->keyed,n);
- wf.data.ptr = tmp1;
- wf.datalen = strlen(tmp1) + 1;
- if (mylink->chan) ast_write(mylink->chan,&wf);
- return;
- }
- if (myrpt->topkeystate != 1) return;
- rpt_mutex_lock(&myrpt->lock);
- for(i = 0; i < TOPKEYN; i++)
- {
- if (!strcmp(myrpt->topkey[i].node,src)) break;
- }
- if (i >= TOPKEYN)
- {
- for(i = 0; i < TOPKEYN; i++)
- {
- if (!myrpt->topkey[i].node[0]) break;
- }
- }
- if (i < TOPKEYN)
- {
- strncpy(myrpt->topkey[i].node,src,TOPKEYMAXSTR - 1);
- myrpt->topkey[i].timesince = ts;
- myrpt->topkey[i].keyed = seq;
- }
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- if (tmp[0] == 'I')
- {
- /* XXX WARNING: be very careful with the limits on the folowing
- * sscanf() call, make sure they match the values defined above */
- if (sscanf(tmp,"%299s %299s %30x",cmd,src,&seq) != 3)
- {
- ast_log(LOG_WARNING, "Unable to parse ident string %s\n",str);
- return;
- }
- mdc1200_notify(myrpt,src,seq);
- strcpy(dest,"*");
- }
- else
- {
- /* XXX WARNING: be very careful with the limits on the folowing
- * sscanf() call, make sure they match the values defined above */
- if (sscanf(tmp,"%299s %299s %299s %30d %1c",cmd,dest,src,&seq,&c) != 5)
- {
- ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
- return;
- }
- if (strcmp(cmd,"D"))
- {
- ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
- return;
- }
- }
- if (dest[0] == '0')
- {
- strcpy(dest,myrpt->name);
- }
-
- /* if not for me, redistribute to all links */
- if (strcmp(dest,myrpt->name))
- {
- l = myrpt->links.next;
- /* see if this is one in list */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* don't send back from where it came */
- if ((l == mylink) || (!strcmp(l->name,mylink->name)))
- {
- l = l->next;
- continue;
- }
- /* if it is, send it and we're done */
- if (!strcmp(l->name,dest))
- {
- /* send, but not to src */
- if (strcmp(l->name,src)) {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- }
- return;
- }
- l = l->next;
- }
- l = myrpt->links.next;
- /* otherwise, send it to all of em */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* don't send back from where it came */
- if ((l == mylink) || (!strcmp(l->name,mylink->name)))
- {
- l = l->next;
- continue;
- }
- /* send, but not to src */
- if (strcmp(l->name,src)) {
- wf.data.ptr = str;
- if (l->chan) ast_write(l->chan,&wf);
- }
- l = l->next;
- }
- return;
- }
- if (myrpt->p.archivedir)
- {
- char dtmfstr[100];
-
- sprintf(dtmfstr,"DTMF,%s,%c",mylink->name,c);
- donodelog(myrpt,dtmfstr);
- }
- c = func_xlat(myrpt,c,&myrpt->p.outxlat);
- if (!c) return;
- rpt_mutex_lock(&myrpt->lock);
- if (c == myrpt->p.endchar) myrpt->stopgen = 1;
- if (myrpt->callmode == 1)
- {
- myrpt->exten[myrpt->cidx++] = c;
- myrpt->exten[myrpt->cidx] = 0;
- /* if this exists */
- if (ast_exists_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
- {
- /* if this really it, end now */
- if (!ast_matchmore_extension(myrpt->pchannel,myrpt->patchcontext,
- myrpt->exten,1,NULL))
- {
- myrpt->callmode = 2;
- if(!myrpt->patchquiet)
- {
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,PROC,NULL);
- rpt_mutex_lock(&myrpt->lock);
- }
- }
- else /* othewise, reset timer */
- {
- myrpt->calldigittimer = 1;
- }
- }
- /* if can continue, do so */
- if (!ast_canmatch_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
- {
- /* call has failed, inform user */
- myrpt->callmode = 4;
- }
- }
- if ((!myrpt->inpadtest) &&(c == myrpt->p.funcchar))
- {
- myrpt->rem_dtmfidx = 0;
- myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
- time(&myrpt->rem_dtmf_time);
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- else if (myrpt->rem_dtmfidx < 0)
- {
- if ((myrpt->callmode == 2) || (myrpt->callmode == 3))
- {
- myrpt->mydtmf = c;
- }
- if (myrpt->p.propagate_dtmf) do_dtmf_local(myrpt,c);
- if (myrpt->p.propagate_phonedtmf) do_dtmf_phone(myrpt,mylink,c);
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- else if (((myrpt->inpadtest) || (c != myrpt->p.endchar)) && (myrpt->rem_dtmfidx >= 0))
- {
- time(&myrpt->rem_dtmf_time);
- if (myrpt->rem_dtmfidx < MAXDTMF)
- {
- myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx++] = c;
- myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
-
- rpt_mutex_unlock(&myrpt->lock);
- strncpy(cmd, myrpt->rem_dtmfbuf, sizeof(cmd) - 1);
- res = collect_function_digits(myrpt, cmd, SOURCE_LNK, mylink);
- rpt_mutex_lock(&myrpt->lock);
-
- switch(res){
-
- case DC_INDETERMINATE:
- break;
-
- case DC_REQ_FLUSH:
- myrpt->rem_dtmfidx = 0;
- myrpt->rem_dtmfbuf[0] = 0;
- break;
-
-
- case DC_COMPLETE:
- case DC_COMPLETEQUIET:
- myrpt->totalexecdcommands++;
- myrpt->dailyexecdcommands++;
- strncpy(myrpt->lastdtmfcommand, cmd, MAXDTMF-1);
- myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
- myrpt->rem_dtmfbuf[0] = 0;
- myrpt->rem_dtmfidx = -1;
- myrpt->rem_dtmf_time = 0;
- break;
-
- case DC_ERROR:
- default:
- myrpt->rem_dtmfbuf[0] = 0;
- myrpt->rem_dtmfidx = -1;
- myrpt->rem_dtmf_time = 0;
- break;
- }
- }
-
- }
- rpt_mutex_unlock(&myrpt->lock);
- return;
-}
-
-static void handle_link_phone_dtmf(struct rpt *myrpt, struct rpt_link *mylink,
- char c)
-{
-
-char cmd[300];
-int res;
-
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"DTMF(P),%s,%c",mylink->name,c);
- donodelog(myrpt,str);
- }
- rpt_mutex_lock(&myrpt->lock);
-
- if (mylink->phonemode == 3) /*If in simplex dumb phone mode */
- {
- if(c == myrpt->p.endchar) /* If end char */
- {
- mylink->lastrealrx = 0; /* Keying state = off */
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
-
- if(c == myrpt->p.funcchar) /* If lead-in char */
- {
- mylink->lastrealrx = !mylink->lastrealrx; /* Toggle keying state */
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- }
- else
- {
- if (c == myrpt->p.endchar)
- {
- if (mylink->lastrx)
- {
- mylink->lastrealrx = 0;
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- myrpt->stopgen = 1;
- if (myrpt->cmdnode[0])
- {
- myrpt->cmdnode[0] = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmfbuf[0] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return;
- }
- }
- }
- if (myrpt->cmdnode[0])
- {
- rpt_mutex_unlock(&myrpt->lock);
- send_link_dtmf(myrpt,c);
- return;
- }
- if (myrpt->callmode == 1)
- {
- myrpt->exten[myrpt->cidx++] = c;
- myrpt->exten[myrpt->cidx] = 0;
- /* if this exists */
- if (ast_exists_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
- {
- /* if this really it, end now */
- if (!ast_matchmore_extension(myrpt->pchannel,myrpt->patchcontext,
- myrpt->exten,1,NULL))
- {
- myrpt->callmode = 2;
- if(!myrpt->patchquiet)
- {
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,PROC,NULL);
- rpt_mutex_lock(&myrpt->lock);
- }
- }
- else /* othewise, reset timer */
- {
- myrpt->calldigittimer = 1;
- }
- }
- /* if can continue, do so */
- if (!ast_canmatch_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
- {
- /* call has failed, inform user */
- myrpt->callmode = 4;
- }
- }
- if ((myrpt->callmode == 2) || (myrpt->callmode == 3))
- {
- myrpt->mydtmf = c;
- }
- if ((!myrpt->inpadtest) && (c == myrpt->p.funcchar))
- {
- myrpt->rem_dtmfidx = 0;
- myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
- time(&myrpt->rem_dtmf_time);
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- else if (((myrpt->inpadtest) || (c != myrpt->p.endchar)) && (myrpt->rem_dtmfidx >= 0))
- {
- time(&myrpt->rem_dtmf_time);
- if (myrpt->rem_dtmfidx < MAXDTMF)
- {
- myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx++] = c;
- myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
-
- rpt_mutex_unlock(&myrpt->lock);
- strncpy(cmd, myrpt->rem_dtmfbuf, sizeof(cmd) - 1);
- switch(mylink->phonemode)
- {
- case 1:
- res = collect_function_digits(myrpt, cmd,
- SOURCE_PHONE, mylink);
- break;
- case 2:
- res = collect_function_digits(myrpt, cmd,
- SOURCE_DPHONE,mylink);
- break;
- case 4:
- res = collect_function_digits(myrpt, cmd,
- SOURCE_ALT,mylink);
- break;
- default:
- res = collect_function_digits(myrpt, cmd,
- SOURCE_LNK, mylink);
- break;
- }
-
- rpt_mutex_lock(&myrpt->lock);
-
- switch(res){
-
- case DC_INDETERMINATE:
- break;
-
- case DC_DOKEY:
- mylink->lastrealrx = 1;
- break;
-
- case DC_REQ_FLUSH:
- myrpt->rem_dtmfidx = 0;
- myrpt->rem_dtmfbuf[0] = 0;
- break;
-
-
- case DC_COMPLETE:
- case DC_COMPLETEQUIET:
- myrpt->totalexecdcommands++;
- myrpt->dailyexecdcommands++;
- strncpy(myrpt->lastdtmfcommand, cmd, MAXDTMF-1);
- myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
- myrpt->rem_dtmfbuf[0] = 0;
- myrpt->rem_dtmfidx = -1;
- myrpt->rem_dtmf_time = 0;
- break;
-
- case DC_ERROR:
- default:
- myrpt->rem_dtmfbuf[0] = 0;
- myrpt->rem_dtmfidx = -1;
- myrpt->rem_dtmf_time = 0;
- break;
- }
- }
-
- }
- rpt_mutex_unlock(&myrpt->lock);
- return;
-}
-
-/* Doug Hall RBI-1 serial data definitions:
- *
- * Byte 0: Expansion external outputs
- * Byte 1:
- * Bits 0-3 are BAND as follows:
- * Bits 4-5 are POWER bits as follows:
- * 00 - Low Power
- * 01 - Hi Power
- * 02 - Med Power
- * Bits 6-7 are always set
- * Byte 2:
- * Bits 0-3 MHZ in BCD format
- * Bits 4-5 are offset as follows:
- * 00 - minus
- * 01 - plus
- * 02 - simplex
- * 03 - minus minus (whatever that is)
- * Bit 6 is the 0/5 KHZ bit
- * Bit 7 is always set
- * Byte 3:
- * Bits 0-3 are 10 KHZ in BCD format
- * Bits 4-7 are 100 KHZ in BCD format
- * Byte 4: PL Tone code and encode/decode enable bits
- * Bits 0-5 are PL tone code (comspec binary codes)
- * Bit 6 is encode enable/disable
- * Bit 7 is decode enable/disable
- */
-
-/* take the frequency from the 10 mhz digits (and up) and convert it
- to a band number */
-
-static int rbi_mhztoband(char *str)
-{
-int i;
-
- i = atoi(str) / 10; /* get the 10's of mhz */
- switch(i)
- {
- case 2:
- return 10;
- case 5:
- return 11;
- case 14:
- return 2;
- case 22:
- return 3;
- case 44:
- return 4;
- case 124:
- return 0;
- case 125:
- return 1;
- case 126:
- return 8;
- case 127:
- return 5;
- case 128:
- return 6;
- case 129:
- return 7;
- default:
- break;
- }
- return -1;
-}
-
-/* take a PL frequency and turn it into a code */
-static int rbi_pltocode(char *str)
-{
-int i;
-char *s;
-
- s = strchr(str,'.');
- i = 0;
- if (s) i = atoi(s + 1);
- i += atoi(str) * 10;
- switch(i)
- {
- case 670:
- return 0;
- case 719:
- return 1;
- case 744:
- return 2;
- case 770:
- return 3;
- case 797:
- return 4;
- case 825:
- return 5;
- case 854:
- return 6;
- case 885:
- return 7;
- case 915:
- return 8;
- case 948:
- return 9;
- case 974:
- return 10;
- case 1000:
- return 11;
- case 1035:
- return 12;
- case 1072:
- return 13;
- case 1109:
- return 14;
- case 1148:
- return 15;
- case 1188:
- return 16;
- case 1230:
- return 17;
- case 1273:
- return 18;
- case 1318:
- return 19;
- case 1365:
- return 20;
- case 1413:
- return 21;
- case 1462:
- return 22;
- case 1514:
- return 23;
- case 1567:
- return 24;
- case 1622:
- return 25;
- case 1679:
- return 26;
- case 1738:
- return 27;
- case 1799:
- return 28;
- case 1862:
- return 29;
- case 1928:
- return 30;
- case 2035:
- return 31;
- case 2107:
- return 32;
- case 2181:
- return 33;
- case 2257:
- return 34;
- case 2336:
- return 35;
- case 2418:
- return 36;
- case 2503:
- return 37;
- }
- return -1;
-}
-
-/*
-* Shift out a formatted serial bit stream
-*/
-
-static void rbi_out_parallel(struct rpt *myrpt,unsigned char *data)
- {
-#ifdef __i386__
- int i,j;
- unsigned char od,d;
- static volatile long long delayvar;
-
- for(i = 0 ; i < 5 ; i++){
- od = *data++;
- for(j = 0 ; j < 8 ; j++){
- d = od & 1;
- outb(d,myrpt->p.iobase);
- /* >= 15 us */
- for(delayvar = 1; delayvar < 15000; delayvar++);
- od >>= 1;
- outb(d | 2,myrpt->p.iobase);
- /* >= 30 us */
- for(delayvar = 1; delayvar < 30000; delayvar++);
- outb(d,myrpt->p.iobase);
- /* >= 10 us */
- for(delayvar = 1; delayvar < 10000; delayvar++);
- }
- }
- /* >= 50 us */
- for(delayvar = 1; delayvar < 50000; delayvar++);
-#endif
- }
-
-static void rbi_out(struct rpt *myrpt,unsigned char *data)
-{
-struct dahdi_radio_param r;
-
- memset(&r,0,sizeof(struct dahdi_radio_param));
- r.radpar = DAHDI_RADPAR_REMMODE;
- r.data = DAHDI_RADPAR_REM_RBI1;
- /* if setparam ioctl fails, its probably not a pciradio card */
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
- {
- rbi_out_parallel(myrpt,data);
- return;
- }
- r.radpar = DAHDI_RADPAR_REMCOMMAND;
- memcpy(&r.data,data,5);
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
- {
- ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",ast_channel_name(myrpt->dahdirxchannel));
- return;
- }
-}
-
-static int serial_remote_io(struct rpt *myrpt, unsigned char *txbuf, int txbytes,
- unsigned char *rxbuf, int rxmaxbytes, int asciiflag)
-{
- int i,j,idx,oldmode,olddata;
- struct dahdi_radio_param prm;
- char c;
-
- if(debug) {
- ast_log(LOG_NOTICE, "ioport=%s iofd=0x%x\n",myrpt->p.ioport,myrpt->iofd);
- printf("String output was:\n");
- for(i = 0; i < txbytes; i++)
- printf("%02X ", (unsigned char ) txbuf[i]);
- printf("\n");
- }
-
- if (myrpt->iofd >= 0) /* if to do out a serial port */
- {
- if (write(myrpt->iofd,txbuf,txbytes) != txbytes)
- {
- return -1;
- }
- if ((!rxmaxbytes) || (rxbuf == NULL))
- {
- return(0);
- }
- memset(rxbuf,0,rxmaxbytes);
- for(i = 0; i < rxmaxbytes; i++)
- {
- j = read(myrpt->iofd,&c,1);
- if (j < 1)
- {
- return(i);
- }
- rxbuf[i] = c;
- if (asciiflag & 1)
- {
- rxbuf[i + 1] = 0;
- if (c == '\r') break;
- }
- }
- if(debug) {
- printf("String returned was:\n");
- for(j = 0; j < i; j++)
- printf("%02X ", (unsigned char ) rxbuf[j]);
- printf("\n");
- }
- return(i);
- }
-
- /* if not a DAHDI channel, cant use pciradio stuff */
- if (myrpt->rxchannel != myrpt->dahdirxchannel) return -1;
-
- prm.radpar = DAHDI_RADPAR_UIOMODE;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_GETPARAM,&prm) == -1) return -1;
- oldmode = prm.data;
- prm.radpar = DAHDI_RADPAR_UIODATA;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_GETPARAM,&prm) == -1) return -1;
- olddata = prm.data;
- prm.radpar = DAHDI_RADPAR_REMMODE;
- if (asciiflag & 1) prm.data = DAHDI_RADPAR_REM_SERIAL_ASCII;
- else prm.data = DAHDI_RADPAR_REM_SERIAL;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
- if (asciiflag & 2)
- {
- i = DAHDI_ONHOOK;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_HOOK,&i) == -1) return -1;
- usleep(100000);
- }
- prm.radpar = DAHDI_RADPAR_REMCOMMAND;
- prm.data = rxmaxbytes;
- memcpy(prm.buf,txbuf,txbytes);
- prm.index = txbytes;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
- if (rxbuf)
- {
- *rxbuf = 0;
- memcpy(rxbuf,prm.buf,prm.index);
- }
- idx = prm.index;
- prm.radpar = DAHDI_RADPAR_REMMODE;
- prm.data = DAHDI_RADPAR_REM_NONE;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
- if (asciiflag & 2)
- {
- i = DAHDI_OFFHOOK;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_HOOK,&i) == -1) return -1;
- }
- prm.radpar = DAHDI_RADPAR_UIOMODE;
- prm.data = oldmode;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
- prm.radpar = DAHDI_RADPAR_UIODATA;
- prm.data = olddata;
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
- return(idx);
-}
-
-static int civ_cmd(struct rpt *myrpt,unsigned char *cmd, int cmdlen)
-{
-unsigned char rxbuf[100];
-int i,rv ;
-
- rv = serial_remote_io(myrpt,cmd,cmdlen,rxbuf,cmdlen + 6,0);
- if (rv == -1) return(-1);
- if (rv != (cmdlen + 6)) return(1);
- for(i = 0; i < 6; i++)
- if (rxbuf[i] != cmd[i]) return(1);
- if (rxbuf[cmdlen] != 0xfe) return(1);
- if (rxbuf[cmdlen + 1] != 0xfe) return(1);
- if (rxbuf[cmdlen + 4] != 0xfb) return(1);
- if (rxbuf[cmdlen + 5] != 0xfd) return(1);
- return(0);
-}
-
-static int sendkenwood(struct rpt *myrpt,char *txstr, char *rxstr)
-{
-int i;
-
-ast_log(LOG_NOTICE,"Sent to kenwood: %s\n",txstr);
- if (debug) printf("Send to kenwood: %s\n",txstr);
- i = serial_remote_io(myrpt, (unsigned char *)txstr, strlen(txstr),
- (unsigned char *)rxstr,RAD_SERIAL_BUFLEN - 1,3);
- if (i < 0) return -1;
- if ((i > 0) && (rxstr[i - 1] == '\r'))
- rxstr[i-- - 1] = 0;
- if (debug) printf("Got from kenwood: %s\n",rxstr);
-ast_log(LOG_NOTICE,"Got from kenwood: %s\n",rxstr);
- return(i);
-}
-
-/* take a PL frequency and turn it into a code */
-static int kenwood_pltocode(char *str)
-{
-int i;
-char *s;
-
- s = strchr(str,'.');
- i = 0;
- if (s) i = atoi(s + 1);
- i += atoi(str) * 10;
- switch(i)
- {
- case 670:
- return 1;
- case 719:
- return 3;
- case 744:
- return 4;
- case 770:
- return 5;
- case 797:
- return 6;
- case 825:
- return 7;
- case 854:
- return 8;
- case 885:
- return 9;
- case 915:
- return 10;
- case 948:
- return 11;
- case 974:
- return 12;
- case 1000:
- return 13;
- case 1035:
- return 14;
- case 1072:
- return 15;
- case 1109:
- return 16;
- case 1148:
- return 17;
- case 1188:
- return 18;
- case 1230:
- return 19;
- case 1273:
- return 20;
- case 1318:
- return 21;
- case 1365:
- return 22;
- case 1413:
- return 23;
- case 1462:
- return 24;
- case 1514:
- return 25;
- case 1567:
- return 26;
- case 1622:
- return 27;
- case 1679:
- return 28;
- case 1738:
- return 29;
- case 1799:
- return 30;
- case 1862:
- return 31;
- case 1928:
- return 32;
- case 2035:
- return 33;
- case 2107:
- return 34;
- case 2181:
- return 35;
- case 2257:
- return 36;
- case 2336:
- return 37;
- case 2418:
- return 38;
- case 2503:
- return 39;
- }
- return -1;
-}
-
-static int sendrxkenwood(struct rpt *myrpt, char *txstr, char *rxstr,
- char *cmpstr)
-{
-int i,j;
-
- for(i = 0;i < KENWOOD_RETRIES;i++)
- {
- j = sendkenwood(myrpt,txstr,rxstr);
- if (j < 0) return(j);
- if (j == 0) continue;
- if (!strncmp(rxstr,cmpstr,strlen(cmpstr))) return(0);
- }
- return(-1);
-}
-
-static int setkenwood(struct rpt *myrpt)
-{
-char rxstr[RAD_SERIAL_BUFLEN],txstr[RAD_SERIAL_BUFLEN],freq[20];
-char mhz[MAXREMSTR],offset[20],band,decimals[MAXREMSTR],band1,band2;
-int myrxpl;
-
-int offsets[] = {0,2,1};
-int powers[] = {2,1,0};
-
- if (sendrxkenwood(myrpt,"VMC 0,0\r",rxstr,"VMC") < 0) return -1;
- split_freq(mhz, decimals, myrpt->freq);
- if (atoi(mhz) > 400)
- {
- band = '6';
- band1 = '1';
- band2 = '5';
- strcpy(offset,"005000000");
- }
- else
- {
- band = '2';
- band1 = '0';
- band2 = '2';
- strcpy(offset,"000600000");
- }
- strcpy(freq,"000000");
- strncpy(freq,decimals,strlen(decimals));
- myrxpl = myrpt->rxplon;
- if (IS_XPMR(myrpt)) myrxpl = 0;
- sprintf(txstr,"VW %c,%05d%s,0,%d,0,%d,%d,,%02d,,%02d,%s\r",
- band,atoi(mhz),freq,offsets[(int)myrpt->offset],
- (myrpt->txplon != 0),myrxpl,
- kenwood_pltocode(myrpt->txpl),kenwood_pltocode(myrpt->rxpl),
- offset);
- if (sendrxkenwood(myrpt,txstr,rxstr,"VW") < 0) return -1;
- sprintf(txstr,"RBN %c\r",band2);
- if (sendrxkenwood(myrpt,txstr,rxstr,"RBN") < 0) return -1;
- sprintf(txstr,"PC %c,%d\r",band1,powers[(int)myrpt->powerlevel]);
- if (sendrxkenwood(myrpt,txstr,rxstr,"PC") < 0) return -1;
- return 0;
-}
-
-static int set_tm271(struct rpt *myrpt)
-{
-char rxstr[RAD_SERIAL_BUFLEN],txstr[RAD_SERIAL_BUFLEN],freq[20];
-char mhz[MAXREMSTR],decimals[MAXREMSTR];
-
-int offsets[] = {0,2,1};
-int powers[] = {2,1,0};
-
- split_freq(mhz, decimals, myrpt->freq);
- strcpy(freq,"000000");
- strncpy(freq,decimals,strlen(decimals));
-
- sprintf(txstr,"VF %04d%s,4,%d,0,%d,0,0,%d,%d,000,00600000,0,0\r",
- atoi(mhz),freq,offsets[(int)myrpt->offset],
- (myrpt->txplon != 0),kenwood_pltocode(myrpt->txpl),
- kenwood_pltocode(myrpt->rxpl));
-
- if (sendrxkenwood(myrpt,txstr,rxstr,"VF") < 0) return -1;
- if (sendrxkenwood(myrpt,"VM 0\r",rxstr,"VM") < 0) return -1;
- sprintf(txstr,"PC %d\r",powers[(int)myrpt->powerlevel]);
- if (sendrxkenwood(myrpt,txstr,rxstr,"PC") < 0) return -1;
- return 0;
-}
-
-static int setrbi(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s;
-unsigned char rbicmd[5];
-int band,txoffset = 0,txpower = 0,rxpl;
-
- /* must be a remote system */
- if (!myrpt->remoterig) return(0);
- if (!myrpt->remoterig[0]) return(0);
- /* must have rbi hardware */
- if (strncmp(myrpt->remoterig,remote_rig_rbi,3)) return(0);
- if (setrbi_check(myrpt) == -1) return(-1);
- strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
- s = strchr(tmp,'.');
- /* if no decimal, is invalid */
-
- if (s == NULL){
- if(debug)
- printf("@@@@ Frequency needs a decimal\n");
- return -1;
- }
-
- *s++ = 0;
- if (strlen(tmp) < 2){
- if(debug)
- printf("@@@@ Bad MHz digits: %s\n", tmp);
- return -1;
- }
-
- if (strlen(s) < 3){
- if(debug)
- printf("@@@@ Bad KHz digits: %s\n", s);
- return -1;
- }
-
- if ((s[2] != '0') && (s[2] != '5')){
- if(debug)
- printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
- return -1;
- }
-
- band = rbi_mhztoband(tmp);
- if (band == -1){
- if(debug)
- printf("@@@@ Bad Band: %s\n", tmp);
- return -1;
- }
-
- rxpl = rbi_pltocode(myrpt->rxpl);
-
- if (rxpl == -1){
- if(debug)
- printf("@@@@ Bad TX PL: %s\n", myrpt->rxpl);
- return -1;
- }
-
-
- switch(myrpt->offset)
- {
- case REM_MINUS:
- txoffset = 0;
- break;
- case REM_PLUS:
- txoffset = 0x10;
- break;
- case REM_SIMPLEX:
- txoffset = 0x20;
- break;
- }
- switch(myrpt->powerlevel)
- {
- case REM_LOWPWR:
- txpower = 0;
- break;
- case REM_MEDPWR:
- txpower = 0x20;
- break;
- case REM_HIPWR:
- txpower = 0x10;
- break;
- }
- rbicmd[0] = 0;
- rbicmd[1] = band | txpower | 0xc0;
- rbicmd[2] = (*(s - 2) - '0') | txoffset | 0x80;
- if (s[2] == '5') rbicmd[2] |= 0x40;
- rbicmd[3] = ((*s - '0') << 4) + (s[1] - '0');
- rbicmd[4] = rxpl;
- if (myrpt->txplon) rbicmd[4] |= 0x40;
- if (myrpt->rxplon) rbicmd[4] |= 0x80;
- rbi_out(myrpt,rbicmd);
- return 0;
-}
-
-static int setrtx(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s,rigstr[200],pwr,res = 0;
-int band,rxpl,txpl;
-float ofac;
-double txfreq;
-
- /* must be a remote system */
- if (!myrpt->remoterig) return(0);
- if (!myrpt->remoterig[0]) return(0);
- /* must have rtx hardware */
- if (!ISRIG_RTX(myrpt->remoterig)) return(0);
- /* must be a usbradio interface type */
- if (!IS_XPMR(myrpt)) return(0);
- strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
- s = strchr(tmp,'.');
- /* if no decimal, is invalid */
-
- if(debug)printf("setrtx() %s %s\n",myrpt->name,myrpt->remoterig);
-
- if (s == NULL){
- if(debug)
- printf("@@@@ Frequency needs a decimal\n");
- return -1;
- }
- *s++ = 0;
- if (strlen(tmp) < 2){
- if(debug)
- printf("@@@@ Bad MHz digits: %s\n", tmp);
- return -1;
- }
-
- if (strlen(s) < 3){
- if(debug)
- printf("@@@@ Bad KHz digits: %s\n", s);
- return -1;
- }
-
- if ((s[2] != '0') && (s[2] != '5')){
- if(debug)
- printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
- return -1;
- }
-
- band = rbi_mhztoband(tmp);
- if (band == -1){
- if(debug)
- printf("@@@@ Bad Band: %s\n", tmp);
- return -1;
- }
-
- rxpl = rbi_pltocode(myrpt->rxpl);
-
- if (rxpl == -1){
- if(debug)
- printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl);
- return -1;
- }
-
- txpl = rbi_pltocode(myrpt->txpl);
-
- if (txpl == -1){
- if(debug)
- printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
- return -1;
- }
-
- res = setrtx_check(myrpt);
- if (res < 0) return res;
- ofac = 0.0;
- if (myrpt->offset == REM_MINUS) ofac = -1.0;
- if (myrpt->offset == REM_PLUS) ofac = 1.0;
-
- if (!strcmp(myrpt->remoterig,remote_rig_rtx450))
- txfreq = atof(myrpt->freq) + (ofac * 5.0);
- else
- txfreq = atof(myrpt->freq) + (ofac * 0.6);
-
- pwr = 'L';
- if (myrpt->powerlevel == REM_HIPWR) pwr = 'H';
- if (!res)
- {
- sprintf(rigstr,"SETFREQ %s %f %s %s %c",myrpt->freq,txfreq,
- (myrpt->rxplon) ? myrpt->rxpl : "0.0",
- (myrpt->txplon) ? myrpt->txpl : "0.0",pwr);
- send_usb_txt(myrpt,rigstr);
- rpt_telemetry(myrpt,COMPLETE,NULL);
- res = 0;
- }
- return 0;
-}
-#if 0
-/*
- sets current signaling code for xpmr routines
- under development for new radios.
-*/
-static int setxpmr(struct rpt *myrpt)
-{
- char rigstr[200];
- int rxpl,txpl;
-
- /* must be a remote system */
- if (!myrpt->remoterig) return(0);
- if (!myrpt->remoterig[0]) return(0);
- /* must not have rtx hardware */
- if (ISRIG_RTX(myrpt->remoterig)) return(0);
- /* must be a usbradio interface type */
- if (!IS_XPMR(myrpt)) return(0);
-
- if(debug)printf("setxpmr() %s %s\n",myrpt->name,myrpt->remoterig );
-
- rxpl = rbi_pltocode(myrpt->rxpl);
-
- if (rxpl == -1){
- if(debug)
- printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl);
- return -1;
- }
-
- txpl = rbi_pltocode(myrpt->txpl);
- if (txpl == -1){
- if(debug)
- printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
- return -1;
- }
- sprintf(rigstr,"SETFREQ 0.0 0.0 %s %s L",
- (myrpt->rxplon) ? myrpt->rxpl : "0.0",
- (myrpt->txplon) ? myrpt->txpl : "0.0");
- send_usb_txt(myrpt,rigstr);
- return 0;
-}
-#endif
-
-static int setrbi_check(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s;
-int band,txpl;
-
- /* must be a remote system */
- if (!myrpt->remote) return(0);
- /* must have rbi hardware */
- if (strncmp(myrpt->remoterig,remote_rig_rbi,3)) return(0);
- strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
- s = strchr(tmp,'.');
- /* if no decimal, is invalid */
-
- if (s == NULL){
- if(debug)
- printf("@@@@ Frequency needs a decimal\n");
- return -1;
- }
-
- *s++ = 0;
- if (strlen(tmp) < 2){
- if(debug)
- printf("@@@@ Bad MHz digits: %s\n", tmp);
- return -1;
- }
-
- if (strlen(s) < 3){
- if(debug)
- printf("@@@@ Bad KHz digits: %s\n", s);
- return -1;
- }
-
- if ((s[2] != '0') && (s[2] != '5')){
- if(debug)
- printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
- return -1;
- }
-
- band = rbi_mhztoband(tmp);
- if (band == -1){
- if(debug)
- printf("@@@@ Bad Band: %s\n", tmp);
- return -1;
- }
-
- txpl = rbi_pltocode(myrpt->txpl);
-
- if (txpl == -1){
- if(debug)
- printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
- return -1;
- }
- return 0;
-}
-
-static int setrtx_check(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s;
-int band,txpl,rxpl;
-
- /* must be a remote system */
- if (!myrpt->remote) return(0);
- /* must have rbi hardware */
- if (strncmp(myrpt->remoterig,remote_rig_rbi,3)) return(0);
- strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
- s = strchr(tmp,'.');
- /* if no decimal, is invalid */
-
- if (s == NULL){
- if(debug)
- printf("@@@@ Frequency needs a decimal\n");
- return -1;
- }
-
- *s++ = 0;
- if (strlen(tmp) < 2){
- if(debug)
- printf("@@@@ Bad MHz digits: %s\n", tmp);
- return -1;
- }
-
- if (strlen(s) < 3){
- if(debug)
- printf("@@@@ Bad KHz digits: %s\n", s);
- return -1;
- }
-
- if ((s[2] != '0') && (s[2] != '5')){
- if(debug)
- printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
- return -1;
- }
-
- band = rbi_mhztoband(tmp);
- if (band == -1){
- if(debug)
- printf("@@@@ Bad Band: %s\n", tmp);
- return -1;
- }
-
- txpl = rbi_pltocode(myrpt->txpl);
-
- if (txpl == -1){
- if(debug)
- printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
- return -1;
- }
-
- rxpl = rbi_pltocode(myrpt->rxpl);
-
- if (rxpl == -1){
- if(debug)
- printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl);
- return -1;
- }
- return 0;
-}
-
-static int check_freq_kenwood(int m, int d, int *defmode)
-{
- int dflmd = REM_MODE_FM;
-
- if (m == 144){ /* 2 meters */
- if(d < 10100)
- return -1;
- }
- else if((m >= 145) && (m < 148)){
- ;
- }
- else if((m >= 430) && (m < 450)){ /* 70 centimeters */
- ;
- }
- else
- return -1;
-
- if(defmode)
- *defmode = dflmd;
-
-
- return 0;
-}
-
-
-static int check_freq_tm271(int m, int d, int *defmode)
-{
- int dflmd = REM_MODE_FM;
-
- if (m == 144){ /* 2 meters */
- if(d < 10100)
- return -1;
- }
- else if((m >= 145) && (m < 148)){
- ;
- }
- return -1;
-
- if(defmode)
- *defmode = dflmd;
-
-
- return 0;
-}
-
-
-/* Check for valid rbi frequency */
-/* Hard coded limits now, configurable later, maybe? */
-
-static int check_freq_rbi(int m, int d, int *defmode)
-{
- int dflmd = REM_MODE_FM;
-
- if(m == 50){ /* 6 meters */
- if(d < 10100)
- return -1;
- }
- else if((m >= 51) && ( m < 54)){
- ;
- }
- else if(m == 144){ /* 2 meters */
- if(d < 10100)
- return -1;
- }
- else if((m >= 145) && (m < 148)){
- ;
- }
- else if((m >= 222) && (m < 225)){ /* 1.25 meters */
- ;
- }
- else if((m >= 430) && (m < 450)){ /* 70 centimeters */
- ;
- }
- else if((m >= 1240) && (m < 1300)){ /* 23 centimeters */
- ;
- }
- else
- return -1;
-
- if(defmode)
- *defmode = dflmd;
-
-
- return 0;
-}
-
-/* Check for valid rtx frequency */
-/* Hard coded limits now, configurable later, maybe? */
-
-static int check_freq_rtx(int m, int d, int *defmode, struct rpt *myrpt)
-{
- int dflmd = REM_MODE_FM;
-
- if (!strcmp(myrpt->remoterig,remote_rig_rtx150))
- {
-
- if(m == 144){ /* 2 meters */
- if(d < 10100)
- return -1;
- }
- else if((m >= 145) && (m < 148)){
- ;
- }
- else
- return -1;
- }
- else
- {
- if((m >= 430) && (m < 450)){ /* 70 centimeters */
- ;
- }
- else
- return -1;
- }
- if(defmode)
- *defmode = dflmd;
-
-
- return 0;
-}
-
-/*
- * Convert decimals of frequency to int
- */
-
-static int decimals2int(char *fraction)
-{
- int i;
- char len = strlen(fraction);
- int multiplier = 100000;
- int res = 0;
-
- if(!len)
- return 0;
- for( i = 0 ; i < len ; i++, multiplier /= 10)
- res += (fraction[i] - '0') * multiplier;
- return res;
-}
-
-
-/*
-* Split frequency into mhz and decimals
-*/
-
-static int split_freq(char *mhz, char *decimals, char *freq)
-{
- char freq_copy[MAXREMSTR];
- char *decp;
-
- decp = strchr(strncpy(freq_copy, freq, MAXREMSTR),'.');
- if(decp){
- *decp++ = 0;
- strncpy(mhz, freq_copy, MAXREMSTR);
- strcpy(decimals, "00000");
- strncpy(decimals, decp, strlen(decp));
- decimals[5] = 0;
- return 0;
- }
- else
- return -1;
-
-}
-
-/*
-* Split ctcss frequency into hertz and decimal
-*/
-
-static int split_ctcss_freq(char *hertz, char *decimal, char *freq)
-{
- char freq_copy[MAXREMSTR];
- char *decp;
-
- decp = strchr(strncpy(freq_copy, freq, MAXREMSTR),'.');
- if(decp){
- *decp++ = 0;
- strncpy(hertz, freq_copy, MAXREMSTR);
- strncpy(decimal, decp, strlen(decp));
- decimal[strlen(decp)] = '\0';
- return 0;
- }
- else
- return -1;
-}
-
-
-
-/*
-* FT-897 I/O handlers
-*/
-
-/* Check to see that the frequency is valid */
-/* Hard coded limits now, configurable later, maybe? */
-
-
-static int check_freq_ft897(int m, int d, int *defmode)
-{
- int dflmd = REM_MODE_FM;
-
- if(m == 1){ /* 160 meters */
- dflmd = REM_MODE_LSB;
- if(d < 80000)
- return -1;
- }
- else if(m == 3){ /* 80 meters */
- dflmd = REM_MODE_LSB;
- if(d < 50000)
- return -1;
- }
- else if(m == 7){ /* 40 meters */
- dflmd = REM_MODE_LSB;
- if(d > 30000)
- return -1;
- }
- else if(m == 14){ /* 20 meters */
- dflmd = REM_MODE_USB;
- if(d > 35000)
- return -1;
- }
- else if(m == 18){ /* 17 meters */
- dflmd = REM_MODE_USB;
- if((d < 6800) || (d > 16800))
- return -1;
- }
- else if(m == 21){ /* 15 meters */
- dflmd = REM_MODE_USB;
- if((d < 20000) || (d > 45000))
- return -1;
- }
- else if(m == 24){ /* 12 meters */
- dflmd = REM_MODE_USB;
- if((d < 89000) || (d > 99000))
- return -1;
- }
- else if(m == 28){ /* 10 meters */
- dflmd = REM_MODE_USB;
- }
- else if(m == 29){
- if(d >= 51000)
- dflmd = REM_MODE_FM;
- else
- dflmd = REM_MODE_USB;
- if(d > 70000)
- return -1;
- }
- else if(m == 50){ /* 6 meters */
- if(d >= 30000)
- dflmd = REM_MODE_FM;
- else
- dflmd = REM_MODE_USB;
-
- }
- else if((m >= 51) && ( m < 54)){
- dflmd = REM_MODE_FM;
- }
- else if(m == 144){ /* 2 meters */
- if(d >= 30000)
- dflmd = REM_MODE_FM;
- else
- dflmd = REM_MODE_USB;
- }
- else if((m >= 145) && (m < 148)){
- dflmd = REM_MODE_FM;
- }
- else if((m >= 430) && (m < 450)){ /* 70 centimeters */
- if(m < 438)
- dflmd = REM_MODE_USB;
- else
- dflmd = REM_MODE_FM;
- ;
- }
- else
- return -1;
-
- if(defmode)
- *defmode = dflmd;
-
- return 0;
-}
-
-/*
-* Set a new frequency for the FT897
-*/
-
-static int set_freq_ft897(struct rpt *myrpt, char *newfreq)
-{
- unsigned char cmdstr[5];
- int m,d;
- char mhz[MAXREMSTR];
- char decimals[MAXREMSTR];
-
- if(debug)
- printf("New frequency: %s\n",newfreq);
-
- if(split_freq(mhz, decimals, newfreq))
- return -1;
-
- m = atoi(mhz);
- d = atoi(decimals);
-
- /* The FT-897 likes packed BCD frequencies */
-
- cmdstr[0] = ((m / 100) << 4) + ((m % 100)/10); /* 100MHz 10Mhz */
- cmdstr[1] = ((m % 10) << 4) + (d / 10000); /* 1MHz 100KHz */
- cmdstr[2] = (((d % 10000)/1000) << 4) + ((d % 1000)/ 100); /* 10KHz 1KHz */
- cmdstr[3] = (((d % 100)/10) << 4) + (d % 10); /* 100Hz 10Hz */
- cmdstr[4] = 0x01; /* command */
-
- return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-
-}
-
-/* ft-897 simple commands */
-
-static int simple_command_ft897(struct rpt *myrpt, char command)
-{
- unsigned char cmdstr[5];
-
- memset(cmdstr, 0, 5);
-
- cmdstr[4] = command;
-
- return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-
-}
-
-/* ft-897 offset */
-
-static int set_offset_ft897(struct rpt *myrpt, char offset)
-{
- unsigned char cmdstr[5];
-
- memset(cmdstr, 0, 5);
-
- switch(offset){
- case REM_SIMPLEX:
- cmdstr[0] = 0x89;
- break;
-
- case REM_MINUS:
- cmdstr[0] = 0x09;
- break;
-
- case REM_PLUS:
- cmdstr[0] = 0x49;
- break;
-
- default:
- return -1;
- }
-
- cmdstr[4] = 0x09;
-
- return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-/* ft-897 mode */
-
-static int set_mode_ft897(struct rpt *myrpt, char newmode)
-{
- unsigned char cmdstr[5];
-
- memset(cmdstr, 0, 5);
-
- switch(newmode){
- case REM_MODE_FM:
- cmdstr[0] = 0x08;
- break;
-
- case REM_MODE_USB:
- cmdstr[0] = 0x01;
- break;
-
- case REM_MODE_LSB:
- cmdstr[0] = 0x00;
- break;
-
- case REM_MODE_AM:
- cmdstr[0] = 0x04;
- break;
-
- default:
- return -1;
- }
- cmdstr[4] = 0x07;
-
- return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-/* Set tone encode and decode modes */
-
-static int set_ctcss_mode_ft897(struct rpt *myrpt, char txplon, char rxplon)
-{
- unsigned char cmdstr[5];
-
- memset(cmdstr, 0, 5);
-
- if(rxplon && txplon)
- cmdstr[0] = 0x2A; /* Encode and Decode */
- else if (!rxplon && txplon)
- cmdstr[0] = 0x4A; /* Encode only */
- else if (rxplon && !txplon)
- cmdstr[0] = 0x3A; /* Encode only */
- else
- cmdstr[0] = 0x8A; /* OFF */
-
- cmdstr[4] = 0x0A;
-
- return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-
-/* Set transmit and receive ctcss tone frequencies */
-
-static int set_ctcss_freq_ft897(struct rpt *myrpt, char *txtone, char *rxtone)
-{
- unsigned char cmdstr[5];
- char hertz[MAXREMSTR],decimal[MAXREMSTR];
- int h,d;
-
- memset(cmdstr, 0, 5);
-
- if(split_ctcss_freq(hertz, decimal, txtone))
- return -1;
-
- h = atoi(hertz);
- d = atoi(decimal);
-
- cmdstr[0] = ((h / 100) << 4) + (h % 100)/ 10;
- cmdstr[1] = ((h % 10) << 4) + (d % 10);
-
- if(rxtone){
-
- if(split_ctcss_freq(hertz, decimal, rxtone))
- return -1;
-
- h = atoi(hertz);
- d = atoi(decimal);
-
- cmdstr[2] = ((h / 100) << 4) + (h % 100)/ 10;
- cmdstr[3] = ((h % 10) << 4) + (d % 10);
- }
- cmdstr[4] = 0x0B;
-
- return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-
-
-static int set_ft897(struct rpt *myrpt)
-{
- int res;
-
- if(debug)
- printf("@@@@ lock on\n");
-
- res = simple_command_ft897(myrpt, 0x00); /* LOCK on */
-
- if(debug)
- printf("@@@@ ptt off\n");
-
- if(!res)
- res = simple_command_ft897(myrpt, 0x88); /* PTT off */
-
- if(debug)
- printf("Modulation mode\n");
-
- if(!res)
- res = set_mode_ft897(myrpt, myrpt->remmode); /* Modulation mode */
-
- if(debug)
- printf("Split off\n");
-
- if(!res)
- simple_command_ft897(myrpt, 0x82); /* Split off */
-
- if(debug)
- printf("Frequency\n");
-
- if(!res)
- res = set_freq_ft897(myrpt, myrpt->freq); /* Frequency */
- if((myrpt->remmode == REM_MODE_FM)){
- if(debug)
- printf("Offset\n");
- if(!res)
- res = set_offset_ft897(myrpt, myrpt->offset); /* Offset if FM */
- if((!res)&&(myrpt->rxplon || myrpt->txplon)){
- if(debug)
- printf("CTCSS tone freqs.\n");
- res = set_ctcss_freq_ft897(myrpt, myrpt->txpl, myrpt->rxpl); /* CTCSS freqs if CTCSS is enabled */
- }
- if(!res){
- if(debug)
- printf("CTCSS mode\n");
- res = set_ctcss_mode_ft897(myrpt, myrpt->txplon, myrpt->rxplon); /* CTCSS mode */
- }
- }
- if((myrpt->remmode == REM_MODE_USB)||(myrpt->remmode == REM_MODE_LSB)){
- if(debug)
- printf("Clarifier off\n");
- simple_command_ft897(myrpt, 0x85); /* Clarifier off if LSB or USB */
- }
- return res;
-}
-
-static int closerem_ft897(struct rpt *myrpt)
-{
- simple_command_ft897(myrpt, 0x88); /* PTT off */
- return 0;
-}
-
-/*
-* Bump frequency up or down by a small amount
-* Return 0 if the new frequnecy is valid, or -1 if invalid
-* Interval is in Hz, resolution is 10Hz
-*/
-
-static int multimode_bump_freq_ft897(struct rpt *myrpt, int interval)
-{
- int m,d;
- char mhz[MAXREMSTR], decimals[MAXREMSTR];
-
- if(debug)
- printf("Before bump: %s\n", myrpt->freq);
-
- if(split_freq(mhz, decimals, myrpt->freq))
- return -1;
-
- m = atoi(mhz);
- d = atoi(decimals);
-
- d += (interval / 10); /* 10Hz resolution */
- if(d < 0){
- m--;
- d += 100000;
- }
- else if(d >= 100000){
- m++;
- d -= 100000;
- }
-
- if(check_freq_ft897(m, d, NULL)){
- if(debug)
- printf("Bump freq invalid\n");
- return -1;
- }
-
- snprintf(myrpt->freq, MAXREMSTR, "%d.%05d", m, d);
-
- if(debug)
- printf("After bump: %s\n", myrpt->freq);
-
- return set_freq_ft897(myrpt, myrpt->freq);
-}
-
-
-
-/*
-* IC-706 I/O handlers
-*/
-
-/* Check to see that the frequency is valid */
-/* returns 0 if frequency is valid */
-
-static int check_freq_ic706(int m, int d, int *defmode, char mars)
-{
- int dflmd = REM_MODE_FM;
- int rv=0;
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"(%i,%i,%i,%i)\n",m,d,*defmode,mars);
-
- /* first test for standard amateur radio bands */
-
- if(m == 1){ /* 160 meters */
- dflmd = REM_MODE_LSB;
- if(d < 80000)rv=-1;
- }
- else if(m == 3){ /* 80 meters */
- dflmd = REM_MODE_LSB;
- if(d < 50000)rv=-1;
- }
- else if(m == 7){ /* 40 meters */
- dflmd = REM_MODE_LSB;
- if(d > 30000)rv=-1;
- }
- else if(m == 14){ /* 20 meters */
- dflmd = REM_MODE_USB;
- if(d > 35000)rv=-1;
- }
- else if(m == 18){ /* 17 meters */
- dflmd = REM_MODE_USB;
- if((d < 6800) || (d > 16800))rv=-1;
- }
- else if(m == 21){ /* 15 meters */
- dflmd = REM_MODE_USB;
- if((d < 20000) || (d > 45000))rv=-1;
- }
- else if(m == 24){ /* 12 meters */
- dflmd = REM_MODE_USB;
- if((d < 89000) || (d > 99000))rv=-1;
- }
- else if(m == 28){ /* 10 meters */
- dflmd = REM_MODE_USB;
- }
- else if(m == 29){
- if(d >= 51000)
- dflmd = REM_MODE_FM;
- else
- dflmd = REM_MODE_USB;
- if(d > 70000)rv=-1;
- }
- else if(m == 50){ /* 6 meters */
- if(d >= 30000)
- dflmd = REM_MODE_FM;
- else
- dflmd = REM_MODE_USB;
- }
- else if((m >= 51) && ( m < 54)){
- dflmd = REM_MODE_FM;
- }
- else if(m == 144){ /* 2 meters */
- if(d >= 30000)
- dflmd = REM_MODE_FM;
- else
- dflmd = REM_MODE_USB;
- }
- else if((m >= 145) && (m < 148)){
- dflmd = REM_MODE_FM;
- }
- else if((m >= 430) && (m < 450)){ /* 70 centimeters */
- if(m < 438)
- dflmd = REM_MODE_USB;
- else
- dflmd = REM_MODE_FM;
- }
-
- /* check expanded coverage */
- if(mars && rv<0){
- if((m >= 450) && (m < 470)){ /* LMR */
- dflmd = REM_MODE_FM;
- rv=0;
- }
- else if((m >= 148) && (m < 174)){ /* LMR */
- dflmd = REM_MODE_FM;
- rv=0;
- }
- else if((m >= 138) && (m < 144)){ /* VHF-AM AIRCRAFT */
- dflmd = REM_MODE_AM;
- rv=0;
- }
- else if((m >= 108) && (m < 138)){ /* VHF-AM AIRCRAFT */
- dflmd = REM_MODE_AM;
- rv=0;
- }
- else if( (m==0 && d>=55000) || (m==1 && d<=75000) ){ /* AM BCB*/
- dflmd = REM_MODE_AM;
- rv=0;
- }
- else if( (m == 1 && d>75000) || (m>1 && m<30) ){ /* HF SWL*/
- dflmd = REM_MODE_AM;
- rv=0;
- }
- }
-
- if(defmode)
- *defmode = dflmd;
-
- if(debug > 1)
- ast_log(LOG_NOTICE,"(%i,%i,%i,%i) returning %i\n",m,d,*defmode,mars,rv);
-
- return rv;
-}
-
-/* take a PL frequency and turn it into a code */
-static int ic706_pltocode(char *str)
-{
- int i;
- char *s;
- int rv=-1;
-
- s = strchr(str,'.');
- i = 0;
- if (s) i = atoi(s + 1);
- i += atoi(str) * 10;
- switch(i)
- {
- case 670:
- rv=0;
- case 693:
- rv=1;
- case 719:
- rv=2;
- case 744:
- rv=3;
- case 770:
- rv=4;
- case 797:
- rv=5;
- case 825:
- rv=6;
- case 854:
- rv=7;
- case 885:
- rv=8;
- case 915:
- rv=9;
- case 948:
- rv=10;
- case 974:
- rv=11;
- case 1000:
- rv=12;
- case 1035:
- rv=13;
- case 1072:
- rv=14;
- case 1109:
- rv=15;
- case 1148:
- rv=16;
- case 1188:
- rv=17;
- case 1230:
- rv=18;
- case 1273:
- rv=19;
- case 1318:
- rv=20;
- case 1365:
- rv=21;
- case 1413:
- rv=22;
- case 1462:
- rv=23;
- case 1514:
- rv=24;
- case 1567:
- rv=25;
- case 1598:
- rv=26;
- case 1622:
- rv=27;
- case 1655:
- rv=28;
- case 1679:
- rv=29;
- case 1713:
- rv=30;
- case 1738:
- rv=31;
- case 1773:
- rv=32;
- case 1799:
- rv=33;
- case 1835:
- rv=34;
- case 1862:
- rv=35;
- case 1899:
- rv=36;
- case 1928:
- rv=37;
- case 1966:
- rv=38;
- case 1995:
- rv=39;
- case 2035:
- rv=40;
- case 2065:
- rv=41;
- case 2107:
- rv=42;
- case 2181:
- rv=43;
- case 2257:
- rv=44;
- case 2291:
- rv=45;
- case 2336:
- rv=46;
- case 2418:
- rv=47;
- case 2503:
- rv=48;
- case 2541:
- rv=49;
- }
- if(debug > 1)
- ast_log(LOG_NOTICE,"%i rv=%i\n",i, rv);
-
- return rv;
-}
-
-/* ic-706 simple commands */
-
-static int simple_command_ic706(struct rpt *myrpt, char command, char subcommand)
-{
- unsigned char cmdstr[10];
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = command;
- cmdstr[5] = subcommand;
- cmdstr[6] = 0xfd;
-
- return(civ_cmd(myrpt,cmdstr,7));
-}
-
-/*
-* Set a new frequency for the ic706
-*/
-
-static int set_freq_ic706(struct rpt *myrpt, char *newfreq)
-{
- unsigned char cmdstr[20];
- char mhz[MAXREMSTR], decimals[MAXREMSTR];
- int m,d;
-
- if(debug)
- ast_log(LOG_NOTICE,"newfreq:%s\n",newfreq);
-
- if(split_freq(mhz, decimals, newfreq))
- return -1;
-
- m = atoi(mhz);
- d = atoi(decimals);
-
- /* The ic-706 likes packed BCD frequencies */
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 5;
- cmdstr[5] = ((d % 10) << 4);
- cmdstr[6] = (((d % 1000)/ 100) << 4) + ((d % 100)/10);
- cmdstr[7] = ((d / 10000) << 4) + ((d % 10000)/1000);
- cmdstr[8] = (((m % 100)/10) << 4) + (m % 10);
- cmdstr[9] = (m / 100);
- cmdstr[10] = 0xfd;
-
- return(civ_cmd(myrpt,cmdstr,11));
-}
-
-/* ic-706 offset */
-
-static int set_offset_ic706(struct rpt *myrpt, char offset)
-{
- unsigned char c;
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"offset=%i\n",offset);
-
- switch(offset){
- case REM_SIMPLEX:
- c = 0x10;
- break;
-
- case REM_MINUS:
- c = 0x11;
- break;
-
- case REM_PLUS:
- c = 0x12;
- break;
-
- default:
- return -1;
- }
-
- return simple_command_ic706(myrpt,0x0f,c);
-
-}
-
-/* ic-706 mode */
-
-static int set_mode_ic706(struct rpt *myrpt, char newmode)
-{
- unsigned char c;
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"newmode=%i\n",newmode);
-
- switch(newmode){
- case REM_MODE_FM:
- c = 5;
- break;
-
- case REM_MODE_USB:
- c = 1;
- break;
-
- case REM_MODE_LSB:
- c = 0;
- break;
-
- case REM_MODE_AM:
- c = 2;
- break;
-
- default:
- return -1;
- }
- return simple_command_ic706(myrpt,6,c);
-}
-
-/* Set tone encode and decode modes */
-
-static int set_ctcss_mode_ic706(struct rpt *myrpt, char txplon, char rxplon)
-{
- unsigned char cmdstr[10];
- int rv;
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"txplon=%i rxplon=%i \n",txplon,rxplon);
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 0x16;
- cmdstr[5] = 0x42;
- cmdstr[6] = (txplon != 0);
- cmdstr[7] = 0xfd;
-
- rv = civ_cmd(myrpt,cmdstr,8);
- if (rv) return(-1);
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 0x16;
- cmdstr[5] = 0x43;
- cmdstr[6] = (rxplon != 0);
- cmdstr[7] = 0xfd;
-
- return(civ_cmd(myrpt,cmdstr,8));
-}
-
-#if 0
-/* Set transmit and receive ctcss tone frequencies */
-
-static int set_ctcss_freq_ic706(struct rpt *myrpt, char *txtone, char *rxtone)
-{
- unsigned char cmdstr[10];
- char hertz[MAXREMSTR],decimal[MAXREMSTR];
- int h,d,rv;
-
- memset(cmdstr, 0, 5);
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"txtone=%s rxtone=%s \n",txtone,rxtone);
-
- if(split_ctcss_freq(hertz, decimal, txtone))
- return -1;
-
- h = atoi(hertz);
- d = atoi(decimal);
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 0x1b;
- cmdstr[5] = 0;
- cmdstr[6] = ((h / 100) << 4) + (h % 100)/ 10;
- cmdstr[7] = ((h % 10) << 4) + (d % 10);
- cmdstr[8] = 0xfd;
-
- rv = civ_cmd(myrpt,cmdstr,9);
- if (rv) return(-1);
-
- if (!rxtone) return(0);
-
- if(split_ctcss_freq(hertz, decimal, rxtone))
- return -1;
-
- h = atoi(hertz);
- d = atoi(decimal);
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 0x1b;
- cmdstr[5] = 1;
- cmdstr[6] = ((h / 100) << 4) + (h % 100)/ 10;
- cmdstr[7] = ((h % 10) << 4) + (d % 10);
- cmdstr[8] = 0xfd;
- return(civ_cmd(myrpt,cmdstr,9));
-}
-#endif
-
-static int vfo_ic706(struct rpt *myrpt)
-{
- unsigned char cmdstr[10];
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 7;
- cmdstr[5] = 0xfd;
-
- return(civ_cmd(myrpt,cmdstr,6));
-}
-
-static int mem2vfo_ic706(struct rpt *myrpt)
-{
- unsigned char cmdstr[10];
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 0x0a;
- cmdstr[5] = 0xfd;
-
- return(civ_cmd(myrpt,cmdstr,6));
-}
-
-static int select_mem_ic706(struct rpt *myrpt, int slot)
-{
- unsigned char cmdstr[10];
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 8;
- cmdstr[5] = 0;
- cmdstr[6] = ((slot / 10) << 4) + (slot % 10);
- cmdstr[7] = 0xfd;
-
- return(civ_cmd(myrpt,cmdstr,8));
-}
-
-static int set_ic706(struct rpt *myrpt)
-{
- int res = 0,i;
-
- if(debug)ast_log(LOG_NOTICE, "Set to VFO A iobase=%i\n",myrpt->p.iobase);
-
- if (!res)
- res = simple_command_ic706(myrpt,7,0);
-
- if((myrpt->remmode == REM_MODE_FM))
- {
- i = ic706_pltocode(myrpt->rxpl);
- if (i == -1) return -1;
- if(debug)
- printf("Select memory number\n");
- if (!res)
- res = select_mem_ic706(myrpt,i + IC706_PL_MEMORY_OFFSET);
- if(debug)
- printf("Transfer memory to VFO\n");
- if (!res)
- res = mem2vfo_ic706(myrpt);
- }
-
- if(debug)
- printf("Set to VFO\n");
-
- if (!res)
- res = vfo_ic706(myrpt);
-
- if(debug)
- printf("Modulation mode\n");
-
- if (!res)
- res = set_mode_ic706(myrpt, myrpt->remmode); /* Modulation mode */
-
- if(debug)
- printf("Split off\n");
-
- if(!res)
- simple_command_ic706(myrpt, 0x82,0); /* Split off */
-
- if(debug)
- printf("Frequency\n");
-
- if(!res)
- res = set_freq_ic706(myrpt, myrpt->freq); /* Frequency */
- if((myrpt->remmode == REM_MODE_FM)){
- if(debug)
- printf("Offset\n");
- if(!res)
- res = set_offset_ic706(myrpt, myrpt->offset); /* Offset if FM */
- if(!res){
- if(debug)
- printf("CTCSS mode\n");
- res = set_ctcss_mode_ic706(myrpt, myrpt->txplon, myrpt->rxplon); /* CTCSS mode */
- }
- }
- return res;
-}
-
-/*
-* Bump frequency up or down by a small amount
-* Return 0 if the new frequnecy is valid, or -1 if invalid
-* Interval is in Hz, resolution is 10Hz
-*/
-
-static int multimode_bump_freq_ic706(struct rpt *myrpt, int interval)
-{
- int m,d;
- char mhz[MAXREMSTR], decimals[MAXREMSTR];
- unsigned char cmdstr[20];
-
- if(debug)
- printf("Before bump: %s\n", myrpt->freq);
-
- if(split_freq(mhz, decimals, myrpt->freq))
- return -1;
-
- m = atoi(mhz);
- d = atoi(decimals);
-
- d += (interval / 10); /* 10Hz resolution */
- if(d < 0){
- m--;
- d += 100000;
- }
- else if(d >= 100000){
- m++;
- d -= 100000;
- }
-
- if(check_freq_ic706(m, d, NULL,myrpt->p.remote_mars)){
- if(debug)
- printf("Bump freq invalid\n");
- return -1;
- }
-
- snprintf(myrpt->freq, MAXREMSTR, "%d.%05d", m, d);
-
- if(debug)
- printf("After bump: %s\n", myrpt->freq);
-
- /* The ic-706 likes packed BCD frequencies */
-
- cmdstr[0] = cmdstr[1] = 0xfe;
- cmdstr[2] = myrpt->p.civaddr;
- cmdstr[3] = 0xe0;
- cmdstr[4] = 0;
- cmdstr[5] = ((d % 10) << 4);
- cmdstr[6] = (((d % 1000)/ 100) << 4) + ((d % 100)/10);
- cmdstr[7] = ((d / 10000) << 4) + ((d % 10000)/1000);
- cmdstr[8] = (((m % 100)/10) << 4) + (m % 10);
- cmdstr[9] = (m / 100);
- cmdstr[10] = 0xfd;
-
- return(serial_remote_io(myrpt,cmdstr,11,NULL,0,0));
-}
-
-
-
-/*
-* Dispatch to correct I/O handler
-*/
-static int setrem(struct rpt *myrpt)
-{
-char str[300];
-char *offsets[] = {"SIMPLEX","MINUS","PLUS"};
-char *powerlevels[] = {"LOW","MEDIUM","HIGH"};
-char *modes[] = {"FM","USB","LSB","AM"};
-int res = -1;
-
-#if 0
-printf("FREQ,%s,%s,%s,%s,%s,%s,%d,%d\n",myrpt->freq,
- modes[(int)myrpt->remmode],
- myrpt->txpl,myrpt->rxpl,offsets[(int)myrpt->offset],
- powerlevels[(int)myrpt->powerlevel],myrpt->txplon,
- myrpt->rxplon);
-#endif
- if (myrpt->p.archivedir)
- {
- sprintf(str,"FREQ,%s,%s,%s,%s,%s,%s,%d,%d",myrpt->freq,
- modes[(int)myrpt->remmode],
- myrpt->txpl,myrpt->rxpl,offsets[(int)myrpt->offset],
- powerlevels[(int)myrpt->powerlevel],myrpt->txplon,
- myrpt->rxplon);
- donodelog(myrpt,str);
- }
- if(!strcmp(myrpt->remoterig, remote_rig_ft897))
- {
- rpt_telemetry(myrpt,SETREMOTE,NULL);
- res = 0;
- }
- if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- {
- rpt_telemetry(myrpt,SETREMOTE,NULL);
- res = 0;
- }
- if(!strcmp(myrpt->remoterig, remote_rig_tm271))
- {
- rpt_telemetry(myrpt,SETREMOTE,NULL);
- res = 0;
- }
- else if(!strcmp(myrpt->remoterig, remote_rig_rbi))
- {
- res = setrbi_check(myrpt);
- if (!res)
- {
- rpt_telemetry(myrpt,SETREMOTE,NULL);
- res = 0;
- }
- }
- else if(ISRIG_RTX(myrpt->remoterig))
- {
- setrtx(myrpt);
- res = 0;
- }
- else if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) {
- rpt_telemetry(myrpt,SETREMOTE,NULL);
- res = 0;
- }
- else
- res = 0;
-
- if (res < 0) ast_log(LOG_ERROR,"Unable to send remote command on node %s\n",myrpt->name);
-
- return res;
-}
-
-static int closerem(struct rpt *myrpt)
-{
- if(!strcmp(myrpt->remoterig, remote_rig_ft897))
- return closerem_ft897(myrpt);
- else
- return 0;
-}
-
-/*
-* Dispatch to correct RX frequency checker
-*/
-
-static int check_freq(struct rpt *myrpt, int m, int d, int *defmode)
-{
- if(!strcmp(myrpt->remoterig, remote_rig_ft897))
- return check_freq_ft897(m, d, defmode);
- else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- return check_freq_ic706(m, d, defmode,myrpt->p.remote_mars);
- else if(!strcmp(myrpt->remoterig, remote_rig_rbi))
- return check_freq_rbi(m, d, defmode);
- else if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
- return check_freq_kenwood(m, d, defmode);
- else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
- return check_freq_tm271(m, d, defmode);
- else if(ISRIG_RTX(myrpt->remoterig))
- return check_freq_rtx(m, d, defmode, myrpt);
- else
- return -1;
-}
-
-/*
- * Check TX frequency before transmitting
- rv=1 if tx frequency in ok.
-*/
-
-static char check_tx_freq(struct rpt *myrpt)
-{
- int i,rv=0;
- int radio_mhz, radio_decimals, ulimit_mhz, ulimit_decimals, llimit_mhz, llimit_decimals;
- char radio_mhz_char[MAXREMSTR];
- char radio_decimals_char[MAXREMSTR];
- char limit_mhz_char[MAXREMSTR];
- char limit_decimals_char[MAXREMSTR];
- char limits[256];
- char *limit_ranges[40];
- struct ast_variable *limitlist;
-
- if(debug > 3){
- ast_log(LOG_NOTICE, "myrpt->freq = %s\n", myrpt->freq);
- }
-
- /* Must have user logged in and tx_limits defined */
-
- if(!myrpt->p.txlimitsstanzaname || !myrpt->loginuser[0] || !myrpt->loginlevel[0]){
- if(debug > 3){
- ast_log(LOG_NOTICE, "No tx band table defined, or no user logged in. rv=1\n");
- }
- rv=1;
- return 1; /* Assume it's ok otherwise */
- }
-
- /* Retrieve the band table for the loginlevel */
- limitlist = ast_variable_browse(myrpt->cfg, myrpt->p.txlimitsstanzaname);
-
- if(!limitlist){
- ast_log(LOG_WARNING, "No entries in %s band table stanza. rv=0\n", myrpt->p.txlimitsstanzaname);
- rv=0;
- return 0;
- }
-
- split_freq(radio_mhz_char, radio_decimals_char, myrpt->freq);
- radio_mhz = atoi(radio_mhz_char);
- radio_decimals = decimals2int(radio_decimals_char);
-
- if(debug > 3){
- ast_log(LOG_NOTICE, "Login User = %s, login level = %s\n", myrpt->loginuser, myrpt->loginlevel);
- }
-
- /* Find our entry */
-
- for(;limitlist; limitlist=limitlist->next){
- if(!strcmp(limitlist->name, myrpt->loginlevel))
- break;
- }
-
- if(!limitlist){
- ast_log(LOG_WARNING, "Can't find %s entry in band table stanza %s. rv=0\n", myrpt->loginlevel, myrpt->p.txlimitsstanzaname);
- rv=0;
- return 0;
- }
-
- if(debug > 3){
- ast_log(LOG_NOTICE, "Auth: %s = %s\n", limitlist->name, limitlist->value);
- }
-
- /* Parse the limits */
-
- strncpy(limits, limitlist->value, 256);
- limits[255] = 0;
- finddelim(limits, limit_ranges, 40);
- for(i = 0; i < 40 && limit_ranges[i] ; i++){
- char range[40];
- char *r,*s;
- strncpy(range, limit_ranges[i], 40);
- range[39] = 0;
- if(debug > 3)
- ast_log(LOG_NOTICE, "Check %s within %s\n", myrpt->freq, range);
-
- r = strchr(range, '-');
- if(!r){
- ast_log(LOG_WARNING, "Malformed range in %s tx band table entry. rv=0\n", limitlist->name);
- rv=0;
- break;
- }
- *r++ = 0;
- s = eatwhite(range);
- r = eatwhite(r);
- split_freq(limit_mhz_char, limit_decimals_char, s);
- llimit_mhz = atoi(limit_mhz_char);
- llimit_decimals = decimals2int(limit_decimals_char);
- split_freq(limit_mhz_char, limit_decimals_char, r);
- ulimit_mhz = atoi(limit_mhz_char);
- ulimit_decimals = decimals2int(limit_decimals_char);
-
- if((radio_mhz >= llimit_mhz) && (radio_mhz <= ulimit_mhz)){
- if(radio_mhz == llimit_mhz){ /* CASE 1: TX freq is in llimit mhz portion of band */
- if(radio_decimals >= llimit_decimals){ /* Cannot be below llimit decimals */
- if(llimit_mhz == ulimit_mhz){ /* If bandwidth < 1Mhz, check ulimit decimals */
- if(radio_decimals <= ulimit_decimals){
- rv=1;
- break;
- }
- else{
- if(debug > 3)
- ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 1\n");
- rv=0;
- break;
- }
- }
- else{
- rv=1;
- break;
- }
- }
- else{ /* Is below llimit decimals */
- if(debug > 3)
- ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 2\n");
- rv=0;
- break;
- }
- }
- else if(radio_mhz == ulimit_mhz){ /* CASE 2: TX freq not in llimit mhz portion of band */
- if(radio_decimals <= ulimit_decimals){
- if(debug > 3)
- ast_log(LOG_NOTICE, "radio_decimals <= ulimit_decimals\n");
- rv=1;
- break;
- }
- else{ /* Is above ulimit decimals */
- if(debug > 3)
- ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 3\n");
- rv=0;
- break;
- }
- }
- else /* CASE 3: TX freq within a multi-Mhz band and ok */
- if(debug > 3)
- ast_log(LOG_NOTICE, "Valid TX freq within a multi-Mhz band and ok.\n");
- rv=1;
- break;
- }
- }
- if(debug > 3)
- ast_log(LOG_NOTICE, "rv=%i\n",rv);
-
- return rv;
-}
-
-
-/*
-* Dispatch to correct frequency bumping function
-*/
-
-static int multimode_bump_freq(struct rpt *myrpt, int interval)
-{
- if(!strcmp(myrpt->remoterig, remote_rig_ft897))
- return multimode_bump_freq_ft897(myrpt, interval);
- else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- return multimode_bump_freq_ic706(myrpt, interval);
- else
- return -1;
-}
-
-
-/*
-* Queue announcment that scan has been stopped
-*/
-
-static void stop_scan(struct rpt *myrpt)
-{
- myrpt->hfscanstop = 1;
- rpt_telemetry(myrpt,SCAN,0);
-}
-
-/*
-* This is called periodically when in scan mode
-*/
-
-
-static int service_scan(struct rpt *myrpt)
-{
- int res, interval;
- char mhz[MAXREMSTR], decimals[MAXREMSTR], k10=0i, k100=0;
-
- switch(myrpt->hfscanmode){
-
- case HF_SCAN_DOWN_SLOW:
- interval = -10; /* 100Hz /sec */
- break;
-
- case HF_SCAN_DOWN_QUICK:
- interval = -50; /* 500Hz /sec */
- break;
-
- case HF_SCAN_DOWN_FAST:
- interval = -200; /* 2KHz /sec */
- break;
-
- case HF_SCAN_UP_SLOW:
- interval = 10; /* 100Hz /sec */
- break;
-
- case HF_SCAN_UP_QUICK:
- interval = 50; /* 500 Hz/sec */
- break;
-
- case HF_SCAN_UP_FAST:
- interval = 200; /* 2KHz /sec */
- break;
-
- default:
- myrpt->hfscanmode = 0; /* Huh? */
- return -1;
- }
-
- res = split_freq(mhz, decimals, myrpt->freq);
-
- if(!res){
- k100 =decimals[0];
- k10 = decimals[1];
- res = multimode_bump_freq(myrpt, interval);
- }
-
- if(!res)
- res = split_freq(mhz, decimals, myrpt->freq);
-
-
- if(res){
- myrpt->hfscanmode = 0;
- myrpt->hfscanstatus = -2;
- return -1;
- }
-
- /* Announce 10KHz boundaries */
- if(k10 != decimals[1]){
- int myhund = (interval < 0) ? k100 : decimals[0];
- int myten = (interval < 0) ? k10 : decimals[1];
- myrpt->hfscanstatus = (myten == '0') ? (myhund - '0') * 100 : (myten - '0') * 10;
- } else myrpt->hfscanstatus = 0;
- return res;
-
-}
-/*
- retrieve memory setting and set radio
-*/
-static int get_mem_set(struct rpt *myrpt, char *digitbuf)
-{
- int res=0;
- if(debug)ast_log(LOG_NOTICE," digitbuf=%s\n", digitbuf);
- res = retreive_memory(myrpt, digitbuf);
- if(!res)res=setrem(myrpt);
- if(debug)ast_log(LOG_NOTICE," freq=%s res=%i\n", myrpt->freq, res);
- return res;
-}
-/*
- steer the radio selected channel to either one programmed into the radio
- or if the radio is VFO agile, to an rpt.conf memory location.
-*/
-static int channel_steer(struct rpt *myrpt, char *data)
-{
- int res=0;
-
- if(debug)ast_log(LOG_NOTICE,"remoterig=%s, data=%s\n",myrpt->remoterig,data);
- if (!myrpt->remoterig) return(0);
- if(data<=0)
- {
- res=-1;
- }
- else
- {
- myrpt->nowchan=strtod(data,NULL);
- if(!strcmp(myrpt->remoterig, remote_rig_ppp16))
- {
- char string[16];
- sprintf(string,"SETCHAN %d ",myrpt->nowchan);
- send_usb_txt(myrpt,string);
- }
- else
- {
- if(get_mem_set(myrpt, data))res=-1;
- }
- }
- if(debug)ast_log(LOG_NOTICE,"nowchan=%i res=%i\n",myrpt->nowchan, res);
- return res;
-}
-/*
-*/
-static int channel_revert(struct rpt *myrpt)
-{
- int res=0;
- if(debug)ast_log(LOG_NOTICE,"remoterig=%s, nowchan=%02d, waschan=%02d\n",myrpt->remoterig,myrpt->nowchan,myrpt->waschan);
- if (!myrpt->remoterig) return(0);
- if(myrpt->nowchan!=myrpt->waschan)
- {
- char data[8];
- if(debug)ast_log(LOG_NOTICE,"reverting.\n");
- sprintf(data,"%02d",myrpt->waschan);
- myrpt->nowchan=myrpt->waschan;
- channel_steer(myrpt,data);
- res=1;
- }
- return(res);
-}
-/*
-* Remote base function
-*/
-
-static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
- char *s,*s1,*s2;
- int i,j,r,ht,k,l,ls2,m,d,offset,offsave, modesave, defmode=0;
- intptr_t p;
- char multimode = 0;
- char oc,*cp,*cp1,*cp2;
- char tmp[20], freq[20] = "", savestr[20] = "";
- char mhz[MAXREMSTR], decimals[MAXREMSTR];
-
- if(debug > 6) {
- ast_log(LOG_NOTICE,"%s param=%s digitbuf=%s source=%i\n",myrpt->name,param,digitbuf,command_source);
- }
-
- if((!param) || (command_source == SOURCE_RPT) || (command_source == SOURCE_LNK))
- return DC_ERROR;
-
- p = myatoi(param);
-
- if ((p != 99) && (p != 5) && (p != 140) && myrpt->p.authlevel &&
- (!myrpt->loginlevel[0])) return DC_ERROR;
- multimode = multimode_capable(myrpt);
-
- switch(p){
-
- case 1: /* retrieve memory */
- if(strlen(digitbuf) < 2) /* needs 2 digits */
- break;
-
- for(i = 0 ; i < 2 ; i++){
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- return DC_ERROR;
- }
- r=get_mem_set(myrpt, digitbuf);
- if (r < 0){
- rpt_telemetry(myrpt,MEMNOTFOUND,NULL);
- return DC_COMPLETE;
- }
- else if (r > 0){
- return DC_ERROR;
- }
- return DC_COMPLETE;
-
- case 2: /* set freq and offset */
-
-
- for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for M+*K+*O or M+*H+* depending on mode */
- if(digitbuf[i] == '*'){
- j++;
- continue;
- }
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- goto invalid_freq;
- else{
- if(j == 0)
- l++; /* # of digits before first * */
- if(j == 1)
- k++; /* # of digits after first * */
- }
- }
-
- i = strlen(digitbuf) - 1;
- if(multimode){
- if((j > 2) || (l > 3) || (k > 6))
- goto invalid_freq; /* &^@#! */
- }
- else{
- if((j > 2) || (l > 4) || (k > 3))
- goto invalid_freq; /* &^@#! */
- }
-
- /* Wait for M+*K+* */
-
- if(j < 2)
- break; /* Not yet */
-
- /* We have a frequency */
-
- strncpy(tmp, digitbuf ,sizeof(tmp) - 1);
-
- s = tmp;
- s1 = strsep(&s, "*"); /* Pick off MHz */
- s2 = strsep(&s,"*"); /* Pick off KHz and Hz */
- ls2 = strlen(s2);
-
- switch(ls2){ /* Allow partial entry of khz and hz digits for laziness support */
- case 1:
- ht = 0;
- k = 100 * atoi(s2);
- break;
-
- case 2:
- ht = 0;
- k = 10 * atoi(s2);
- break;
-
- case 3:
- if(!multimode){
- if((s2[2] != '0')&&(s2[2] != '5'))
- goto invalid_freq;
- }
- ht = 0;
- k = atoi(s2);
- break;
- case 4:
- k = atoi(s2)/10;
- ht = 10 * (atoi(s2+(ls2-1)));
- break;
-
- case 5:
- k = atoi(s2)/100;
- ht = (atoi(s2+(ls2-2)));
- break;
-
- default:
- goto invalid_freq;
- }
-
- /* Check frequency for validity and establish a default mode */
-
- snprintf(freq, sizeof(freq), "%s.%03d%02d",s1, k, ht);
-
- if(debug)
- ast_log(LOG_NOTICE, "New frequency: %s\n", freq);
-
- split_freq(mhz, decimals, freq);
- m = atoi(mhz);
- d = atoi(decimals);
-
- if(check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */
- goto invalid_freq;
-
-
- if((defmode == REM_MODE_FM) && (digitbuf[i] == '*')) /* If FM, user must enter and additional offset digit */
- break; /* Not yet */
-
-
- offset = REM_SIMPLEX; /* Assume simplex */
-
- if(defmode == REM_MODE_FM){
- oc = *s; /* Pick off offset */
-
- if (oc){
- switch(oc){
- case '1':
- offset = REM_MINUS;
- break;
-
- case '2':
- offset = REM_SIMPLEX;
- break;
-
- case '3':
- offset = REM_PLUS;
- break;
-
- default:
- goto invalid_freq;
- }
- }
- }
- offsave = myrpt->offset;
- modesave = myrpt->remmode;
- strncpy(savestr, myrpt->freq, sizeof(savestr) - 1);
- strncpy(myrpt->freq, freq, sizeof(myrpt->freq) - 1);
- myrpt->offset = offset;
- myrpt->remmode = defmode;
-
- if (setrem(myrpt) == -1){
- myrpt->offset = offsave;
- myrpt->remmode = modesave;
- strncpy(myrpt->freq, savestr, sizeof(myrpt->freq) - 1);
- goto invalid_freq;
- }
-
- return DC_COMPLETE;
-
-invalid_freq:
- rpt_telemetry(myrpt,INVFREQ,NULL);
- return DC_ERROR;
-
- case 3: /* set rx PL tone */
- for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */
- if(digitbuf[i] == '*'){
- j++;
- continue;
- }
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- return DC_ERROR;
- else{
- if(j)
- l++;
- else
- k++;
- }
- }
- if((j > 1) || (k > 3) || (l > 1))
- return DC_ERROR; /* &$@^! */
- i = strlen(digitbuf) - 1;
- if((j != 1) || (k < 2)|| (l != 1))
- break; /* Not yet */
- if(debug)
- printf("PL digits entered %s\n", digitbuf);
-
- strncpy(tmp, digitbuf, sizeof(tmp) - 1);
- /* see if we have at least 1 */
- s = strchr(tmp,'*');
- if(s)
- *s = '.';
- strncpy(savestr, myrpt->rxpl, sizeof(savestr) - 1);
- strncpy(myrpt->rxpl, tmp, sizeof(myrpt->rxpl) - 1);
- if(!strcmp(myrpt->remoterig, remote_rig_rbi))
- {
- strncpy(myrpt->txpl, tmp, sizeof(myrpt->txpl) - 1);
- }
- if (setrem(myrpt) == -1){
- strncpy(myrpt->rxpl, savestr, sizeof(myrpt->rxpl) - 1);
- return DC_ERROR;
- }
- return DC_COMPLETE;
-
- case 4: /* set tx PL tone */
- /* cant set tx tone on RBI (rx tone does both) */
- if(!strcmp(myrpt->remoterig, remote_rig_rbi))
- return DC_ERROR;
- /* eventually for the ic706 instead of just throwing the exception
- we can check if we are in encode only mode and allow the tx
- ctcss code to be changed. but at least the warning message is
- issued for now.
- */
- if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- {
- if(debug)
- ast_log(LOG_WARNING,"Setting IC706 Tx CTCSS Code Not Supported. Set Rx Code for both.\n");
- return DC_ERROR;
- }
- for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */
- if(digitbuf[i] == '*'){
- j++;
- continue;
- }
- if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
- return DC_ERROR;
- else{
- if(j)
- l++;
- else
- k++;
- }
- }
- if((j > 1) || (k > 3) || (l > 1))
- return DC_ERROR; /* &$@^! */
- i = strlen(digitbuf) - 1;
- if((j != 1) || (k < 2)|| (l != 1))
- break; /* Not yet */
- if(debug)
- printf("PL digits entered %s\n", digitbuf);
-
- strncpy(tmp, digitbuf, sizeof(tmp) - 1);
- /* see if we have at least 1 */
- s = strchr(tmp,'*');
- if(s)
- *s = '.';
- strncpy(savestr, myrpt->txpl, sizeof(savestr) - 1);
- strncpy(myrpt->txpl, tmp, sizeof(myrpt->txpl) - 1);
-
- if (setrem(myrpt) == -1){
- strncpy(myrpt->txpl, savestr, sizeof(myrpt->txpl) - 1);
- return DC_ERROR;
- }
- return DC_COMPLETE;
-
-
- case 6: /* MODE (FM,USB,LSB,AM) */
- if(strlen(digitbuf) < 1)
- break;
-
- if(!multimode)
- return DC_ERROR; /* Multimode radios only */
-
- switch(*digitbuf){
- case '1':
- split_freq(mhz, decimals, myrpt->freq);
- m=atoi(mhz);
- if(m < 29) /* No FM allowed below 29MHz! */
- return DC_ERROR;
- myrpt->remmode = REM_MODE_FM;
-
- rpt_telemetry(myrpt,REMMODE,NULL);
- break;
-
- case '2':
- myrpt->remmode = REM_MODE_USB;
- rpt_telemetry(myrpt,REMMODE,NULL);
- break;
-
- case '3':
- myrpt->remmode = REM_MODE_LSB;
- rpt_telemetry(myrpt,REMMODE,NULL);
- break;
-
- case '4':
- myrpt->remmode = REM_MODE_AM;
- rpt_telemetry(myrpt,REMMODE,NULL);
- break;
-
- default:
- return DC_ERROR;
- }
-
- if(setrem(myrpt))
- return DC_ERROR;
- return DC_COMPLETEQUIET;
- case 99:
- /* cant log in when logged in */
- if (myrpt->loginlevel[0])
- return DC_ERROR;
- *myrpt->loginuser = 0;
- myrpt->loginlevel[0] = 0;
- cp = ast_strdup(param);
- cp1 = strchr(cp,',');
- ast_mutex_lock(&myrpt->lock);
- if (cp1)
- {
- *cp1 = 0;
- cp2 = strchr(cp1 + 1,',');
- if (cp2)
- {
- *cp2 = 0;
- strncpy(myrpt->loginlevel,cp2 + 1,
- sizeof(myrpt->loginlevel) - 1);
- }
- strncpy(myrpt->loginuser,cp1 + 1,sizeof(myrpt->loginuser));
- ast_mutex_unlock(&myrpt->lock);
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"LOGIN,%s,%s",
- myrpt->loginuser,myrpt->loginlevel);
- donodelog(myrpt,str);
- }
- if (debug)
- printf("loginuser %s level %s\n",myrpt->loginuser,myrpt->loginlevel);
- rpt_telemetry(myrpt,REMLOGIN,NULL);
- }
- ast_free(cp);
- return DC_COMPLETEQUIET;
- case 100: /* RX PL Off */
- myrpt->rxplon = 0;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 101: /* RX PL On */
- myrpt->rxplon = 1;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 102: /* TX PL Off */
- myrpt->txplon = 0;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 103: /* TX PL On */
- myrpt->txplon = 1;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 104: /* Low Power */
- if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- return DC_ERROR;
- myrpt->powerlevel = REM_LOWPWR;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 105: /* Medium Power */
- if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- return DC_ERROR;
- if (ISRIG_RTX(myrpt->remoterig)) return DC_ERROR;
- myrpt->powerlevel = REM_MEDPWR;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 106: /* Hi Power */
- if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- return DC_ERROR;
- myrpt->powerlevel = REM_HIPWR;
- setrem(myrpt);
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 107: /* Bump down 20Hz */
- multimode_bump_freq(myrpt, -20);
- return DC_COMPLETE;
- case 108: /* Bump down 100Hz */
- multimode_bump_freq(myrpt, -100);
- return DC_COMPLETE;
- case 109: /* Bump down 500Hz */
- multimode_bump_freq(myrpt, -500);
- return DC_COMPLETE;
- case 110: /* Bump up 20Hz */
- multimode_bump_freq(myrpt, 20);
- return DC_COMPLETE;
- case 111: /* Bump up 100Hz */
- multimode_bump_freq(myrpt, 100);
- return DC_COMPLETE;
- case 112: /* Bump up 500Hz */
- multimode_bump_freq(myrpt, 500);
- return DC_COMPLETE;
- case 113: /* Scan down slow */
- myrpt->scantimer = REM_SCANTIME;
- myrpt->hfscanmode = HF_SCAN_DOWN_SLOW;
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 114: /* Scan down quick */
- myrpt->scantimer = REM_SCANTIME;
- myrpt->hfscanmode = HF_SCAN_DOWN_QUICK;
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 115: /* Scan down fast */
- myrpt->scantimer = REM_SCANTIME;
- myrpt->hfscanmode = HF_SCAN_DOWN_FAST;
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 116: /* Scan up slow */
- myrpt->scantimer = REM_SCANTIME;
- myrpt->hfscanmode = HF_SCAN_UP_SLOW;
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 117: /* Scan up quick */
- myrpt->scantimer = REM_SCANTIME;
- myrpt->hfscanmode = HF_SCAN_UP_QUICK;
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 118: /* Scan up fast */
- myrpt->scantimer = REM_SCANTIME;
- myrpt->hfscanmode = HF_SCAN_UP_FAST;
- rpt_telemetry(myrpt,REMXXX,(void *)p);
- return DC_COMPLETEQUIET;
- case 119: /* Tune Request */
- if(debug > 3)
- ast_log(LOG_NOTICE,"TUNE REQUEST\n");
- /* if not currently going, and valid to do */
- if((!myrpt->tunerequest) &&
- ((!strcmp(myrpt->remoterig, remote_rig_ft897) ||
- !strcmp(myrpt->remoterig, remote_rig_ic706)) )) {
- myrpt->remotetx = 0;
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
- myrpt->tunerequest = 1;
- rpt_telemetry(myrpt,TUNE,NULL);
- return DC_COMPLETEQUIET;
- }
- return DC_ERROR;
- case 5: /* Long Status */
- rpt_telemetry(myrpt,REMLONGSTATUS,NULL);
- return DC_COMPLETEQUIET;
- case 140: /* Short Status */
- rpt_telemetry(myrpt,REMSHORTSTATUS,NULL);
- return DC_COMPLETEQUIET;
- case 200:
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206:
- case 207:
- case 208:
- case 209:
- case 210:
- case 211:
- case 212:
- case 213:
- case 214:
- case 215:
- do_dtmf_local(myrpt,remdtmfstr[p - 200]);
- return DC_COMPLETEQUIET;
- default:
- break;
- }
- return DC_INDETERMINATE;
-}
-
-
-static int handle_remote_dtmf_digit(struct rpt *myrpt,char c, char *keyed, int phonemode)
-{
-time_t now;
-int ret,res = 0,src;
-
- if(debug > 6)
- ast_log(LOG_NOTICE,"c=%c phonemode=%i dtmfidx=%i\n",c,phonemode,myrpt->dtmfidx);
-
- time(&myrpt->last_activity_time);
- /* Stop scan mode if in scan mode */
- if(myrpt->hfscanmode){
- stop_scan(myrpt);
- return 0;
- }
-
- time(&now);
- /* if timed-out */
- if ((myrpt->dtmf_time_rem + DTMF_TIMEOUT) < now)
- {
- myrpt->dtmfidx = -1;
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmf_time_rem = 0;
- }
- /* if decode not active */
- if (myrpt->dtmfidx == -1)
- {
- /* if not lead-in digit, don't worry */
- if (c != myrpt->p.funcchar)
- {
- if (!myrpt->p.propagate_dtmf)
- {
- rpt_mutex_lock(&myrpt->lock);
- do_dtmf_local(myrpt,c);
- rpt_mutex_unlock(&myrpt->lock);
- }
- return 0;
- }
- myrpt->dtmfidx = 0;
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmf_time_rem = now;
- return 0;
- }
- /* if too many in buffer, start over */
- if (myrpt->dtmfidx >= MAXDTMF)
- {
- myrpt->dtmfidx = 0;
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmf_time_rem = now;
- }
- if (c == myrpt->p.funcchar)
- {
- /* if star at beginning, or 2 together, erase buffer */
- if ((myrpt->dtmfidx < 1) ||
- (myrpt->dtmfbuf[myrpt->dtmfidx - 1] == myrpt->p.funcchar))
- {
- myrpt->dtmfidx = 0;
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmf_time_rem = now;
- return 0;
- }
- }
- myrpt->dtmfbuf[myrpt->dtmfidx++] = c;
- myrpt->dtmfbuf[myrpt->dtmfidx] = 0;
- myrpt->dtmf_time_rem = now;
-
-
- src = SOURCE_RMT;
- if (phonemode == 2) src = SOURCE_DPHONE;
- else if (phonemode) src = SOURCE_PHONE;
- else if (phonemode == 4) src = SOURCE_ALT;
- ret = collect_function_digits(myrpt, myrpt->dtmfbuf, src, NULL);
-
- switch(ret){
-
- case DC_INDETERMINATE:
- res = 0;
- break;
-
- case DC_DOKEY:
- if (keyed) *keyed = 1;
- res = 0;
- break;
-
- case DC_REQ_FLUSH:
- myrpt->dtmfidx = 0;
- myrpt->dtmfbuf[0] = 0;
- res = 0;
- break;
-
-
- case DC_COMPLETE:
- res = 1;
- case DC_COMPLETEQUIET:
- myrpt->totalexecdcommands++;
- myrpt->dailyexecdcommands++;
- strncpy(myrpt->lastdtmfcommand, myrpt->dtmfbuf, MAXDTMF-1);
- myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmf_time_rem = 0;
- break;
-
- case DC_ERROR:
- default:
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmf_time_rem = 0;
- res = 0;
- break;
- }
-
- return res;
-}
-
-static int handle_remote_data(struct rpt *myrpt, char *str)
-{
-/* XXX ATTENTION: if you change the size of these arrays you MUST
- * change the limits in corresponding sscanf() calls below. */
-char tmp[300],cmd[300],dest[300],src[300],c;
-int seq,res;
-
- /* put string in our buffer */
- strncpy(tmp,str,sizeof(tmp) - 1);
- if (!strcmp(tmp,discstr)) return 0;
- if (!strcmp(tmp,newkeystr))
- {
- myrpt->newkey = 1;
- return 0;
- }
-
-#ifndef DO_NOT_NOTIFY_MDC1200_ON_REMOTE_BASES
- if (tmp[0] == 'I')
- {
- /* XXX WARNING: be very careful with the limits on the folowing
- * sscanf() call, make sure they match the values defined above */
- if (sscanf(tmp,"%299s %299s %30x",cmd,src,&seq) != 3)
- {
- ast_log(LOG_WARNING, "Unable to parse ident string %s\n",str);
- return 0;
- }
- mdc1200_notify(myrpt,src,seq);
- return 0;
- }
-#endif
- /* XXX WARNING: be very careful with the limits on the folowing
- * sscanf() call, make sure they match the values defined above */
- if (sscanf(tmp,"%299s %299s %299s %30d %1c",cmd,dest,src,&seq,&c) != 5)
- {
- ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
- return 0;
- }
- if (strcmp(cmd,"D"))
- {
- ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
- return 0;
- }
- /* if not for me, ignore */
- if (strcmp(dest,myrpt->name)) return 0;
- if (myrpt->p.archivedir)
- {
- char dtmfstr[100];
-
- sprintf(dtmfstr,"DTMF,%c",c);
- donodelog(myrpt,dtmfstr);
- }
- c = func_xlat(myrpt,c,&myrpt->p.outxlat);
- if (!c) return(0);
- res = handle_remote_dtmf_digit(myrpt,c, NULL, 0);
- if (res != 1)
- return res;
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return 0;
-}
-
-static int handle_remote_phone_dtmf(struct rpt *myrpt, char c, char *keyed, int phonemode)
-{
-int res;
-
-
- if(phonemode == 3) /* simplex phonemode, funcchar key/unkey toggle */
- {
- if (keyed && *keyed && ((c == myrpt->p.funcchar) || (c == myrpt->p.endchar)))
- {
- *keyed = 0; /* UNKEY */
- return 0;
- }
- else if (keyed && !*keyed && (c = myrpt->p.funcchar))
- {
- *keyed = 1; /* KEY */
- return 0;
- }
- }
- else /* endchar unkey */
- {
-
- if (keyed && *keyed && (c == myrpt->p.endchar))
- {
- *keyed = 0;
- return DC_INDETERMINATE;
- }
- }
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"DTMF(P),%c",c);
- donodelog(myrpt,str);
- }
- res = handle_remote_dtmf_digit(myrpt,c,keyed, phonemode);
- if (res != 1)
- return res;
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return 0;
-}
-
-static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l)
-{
- char *val, *s, *s1, *tele;
- char tmp[300], deststr[300] = "";
- char sx[320],*sy;
- struct ast_format_cap *cap = NULL;
-
-
- val = node_lookup(myrpt,l->name);
- if (!val)
- {
- fprintf(stderr,"attempt_reconnect: cannot find node %s\n",l->name);
- return -1;
- }
-
- rpt_mutex_lock(&myrpt->lock);
- /* remove from queue */
- remque((struct qelem *) l);
- rpt_mutex_unlock(&myrpt->lock);
- strncpy(tmp,val,sizeof(tmp) - 1);
- s = tmp;
- s1 = strsep(&s,",");
- if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
- {
- sy = strchr(s1,'/');
- *sy = 0;
- sprintf(sx,"%s:4569/%s",s1,sy + 1);
- s1 = sx;
- }
- strsep(&s,",");
- snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
- tele = strchr(deststr, '/');
- if (!tele) {
- fprintf(stderr,"attempt_reconnect:Dial number (%s) must be in format tech/number\n",deststr);
- return -1;
- }
- *tele++ = 0;
- l->elaptime = 0;
- l->connecttime = 0;
- l->thisconnected = 0;
- l->newkey = 0;
- l->chan = ast_request(deststr, get_slin_cap(cap), NULL, tele, NULL);
- cap = ast_format_cap_destroy(cap);
- if (l->chan){
- ast_set_read_format_by_id(l->chan, AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(l->chan, AST_FORMAT_SLINEAR);
-#ifndef NEW_ASTERISK
- l->chan->whentohangup = 0;
-#endif
- ast_channel_appl_set(l->chan, "Apprpt");
- ast_channel_data_set(l->chan, "(Remote Rx)");
- ast_verb(3, "rpt (attempt_reconnect) initiating call to %s/%s on %s\n",
- deststr, tele, ast_channel_name(l->chan));
- ast_channel_caller(l->chan)->id.number.valid = 1;
- ast_free(ast_channel_caller(l->chan)->id.number.str);
- ast_channel_caller(l->chan)->id.number.str = ast_strdup(myrpt->name);
- ast_call(l->chan,tele,999);
-
- }
- else
- {
- ast_verb(3, "Unable to place call to %s/%s on %s\n",
- deststr,tele,ast_channel_name(l->chan));
- return -1;
- }
- rpt_mutex_lock(&myrpt->lock);
- /* put back in queue */
- insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_WARNING,"Reconnect Attempt to %s in process\n",l->name);
- if (!l->phonemode) send_newkey(l->chan);
- return 0;
-}
-
-/* 0 return=continue, 1 return = break, -1 return = error */
-static void local_dtmf_helper(struct rpt *myrpt,char c_in)
-{
-int res;
-pthread_attr_t attr;
-char cmd[MAXDTMF+1] = "",c;
-
-
- c = c_in & 0x7f;
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"DTMF,MAIN,%c",c);
- donodelog(myrpt,str);
- }
- if (c == myrpt->p.endchar)
- {
- /* if in simple mode, kill autopatch */
- if (myrpt->p.simple && myrpt->callmode)
- {
- if(debug)
- ast_log(LOG_WARNING, "simple mode autopatch kill\n");
- rpt_mutex_lock(&myrpt->lock);
- myrpt->callmode = 0;
- myrpt->macropatch=0;
- channel_revert(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,TERM,NULL);
- return;
- }
- rpt_mutex_lock(&myrpt->lock);
- myrpt->stopgen = 1;
- if (myrpt->cmdnode[0])
- {
- myrpt->cmdnode[0] = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmfbuf[0] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,COMPLETE,NULL);
- return;
- }
- else if(!myrpt->inpadtest)
- {
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->p.propagate_phonedtmf)
- do_dtmf_phone(myrpt,NULL,c);
- return;
- }
- else
- rpt_mutex_unlock(&myrpt->lock);
- }
- rpt_mutex_lock(&myrpt->lock);
- if (myrpt->cmdnode[0])
- {
- rpt_mutex_unlock(&myrpt->lock);
- send_link_dtmf(myrpt,c);
- return;
- }
- if (!myrpt->p.simple)
- {
- if ((!myrpt->inpadtest)&&(c == myrpt->p.funcchar))
- {
- myrpt->dtmfidx = 0;
- myrpt->dtmfbuf[myrpt->dtmfidx] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- time(&myrpt->dtmf_time);
- return;
- }
- else if (((myrpt->inpadtest)||(c != myrpt->p.endchar)) && (myrpt->dtmfidx >= 0))
- {
- time(&myrpt->dtmf_time);
-
- if (myrpt->dtmfidx < MAXDTMF)
- {
- int src;
-
- myrpt->dtmfbuf[myrpt->dtmfidx++] = c;
- myrpt->dtmfbuf[myrpt->dtmfidx] = 0;
-
- strncpy(cmd, myrpt->dtmfbuf, sizeof(cmd) - 1);
-
- rpt_mutex_unlock(&myrpt->lock);
- src = SOURCE_RPT;
- if (c_in & 0x80) src = SOURCE_ALT;
- res = collect_function_digits(myrpt, cmd, src, NULL);
- rpt_mutex_lock(&myrpt->lock);
- switch(res){
- case DC_INDETERMINATE:
- break;
- case DC_REQ_FLUSH:
- myrpt->dtmfidx = 0;
- myrpt->dtmfbuf[0] = 0;
- break;
- case DC_COMPLETE:
- case DC_COMPLETEQUIET:
- myrpt->totalexecdcommands++;
- myrpt->dailyexecdcommands++;
- strncpy(myrpt->lastdtmfcommand, cmd, MAXDTMF-1);
- myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmf_time = 0;
- break;
-
- case DC_ERROR:
- default:
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmf_time = 0;
- break;
- }
- if(res != DC_INDETERMINATE) {
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- }
- }
- }
- else /* if simple */
- {
- if ((!myrpt->callmode) && (c == myrpt->p.funcchar))
- {
- myrpt->callmode = 1;
- myrpt->patchnoct = 0;
- myrpt->patchquiet = 0;
- myrpt->patchfarenddisconnect = 0;
- myrpt->patchdialtime = 0;
- strncpy(myrpt->patchcontext, myrpt->p.ourcontext, MAXPATCHCONTEXT);
- myrpt->cidx = 0;
- myrpt->exten[myrpt->cidx] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
- return;
- }
- }
- if (myrpt->callmode == 1)
- {
- myrpt->exten[myrpt->cidx++] = c;
- myrpt->exten[myrpt->cidx] = 0;
- /* if this exists */
- if (ast_exists_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
- {
- /* if this really it, end now */
- if (!ast_matchmore_extension(myrpt->pchannel,myrpt->patchcontext,
- myrpt->exten,1,NULL))
- {
- myrpt->callmode = 2;
- rpt_mutex_unlock(&myrpt->lock);
- if(!myrpt->patchquiet)
- rpt_telemetry(myrpt,PROC,NULL);
- return;
- }
- else /* othewise, reset timer */
- {
- myrpt->calldigittimer = 1;
- }
- }
- /* if can continue, do so */
- if (!ast_canmatch_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
- {
- /* call has failed, inform user */
- myrpt->callmode = 4;
- }
- rpt_mutex_unlock(&myrpt->lock);
- return;
- }
- if ((myrpt->callmode == 2) || (myrpt->callmode == 3))
- {
- myrpt->mydtmf = c;
- }
- rpt_mutex_unlock(&myrpt->lock);
- if ((myrpt->dtmfidx < 0) && myrpt->p.propagate_phonedtmf)
- do_dtmf_phone(myrpt,NULL,c);
- return;
-}
-
-
-/* place an ID event in the telemetry queue */
-
-static void queue_id(struct rpt *myrpt)
-{
- if(myrpt->p.idtime){ /* ID time must be non-zero */
- myrpt->mustid = myrpt->tailid = 0;
- myrpt->idtimer = myrpt->p.idtime; /* Reset our ID timer */
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,ID,NULL);
- rpt_mutex_lock(&myrpt->lock);
- }
-}
-
-/* Scheduler */
-/* must be called locked */
-
-static void do_scheduler(struct rpt *myrpt)
-{
- int i,res;
-
-#ifdef NEW_ASTERISK
- struct ast_tm tmnow;
-#else
- struct tm tmnow;
-#endif
- struct ast_variable *skedlist;
- char *strs[5],*vp,*val,value[100];
-
- memcpy(&myrpt->lasttv, &myrpt->curtv, sizeof(struct timeval));
-
- if( (res = gettimeofday(&myrpt->curtv, NULL)) < 0)
- ast_log(LOG_NOTICE, "Scheduler gettime of day returned: %s\n", strerror(res));
-
- /* Try to get close to a 1 second resolution */
-
- if(myrpt->lasttv.tv_sec == myrpt->curtv.tv_sec)
- return;
-
- rpt_localtime(&myrpt->curtv.tv_sec, &tmnow);
-
- /* If midnight, then reset all daily statistics */
-
- if((tmnow.tm_hour == 0)&&(tmnow.tm_min == 0)&&(tmnow.tm_sec == 0)){
- myrpt->dailykeyups = 0;
- myrpt->dailytxtime = 0;
- myrpt->dailykerchunks = 0;
- myrpt->dailyexecdcommands = 0;
- }
-
- if(tmnow.tm_sec != 0)
- return;
-
- /* Code below only executes once per minute */
-
-
- /* Don't schedule if remote */
-
- if (myrpt->remote)
- return;
-
- /* Don't schedule if disabled */
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable){
- if(debug > 6)
- ast_log(LOG_NOTICE, "Scheduler disabled\n");
- return;
- }
-
- if(!myrpt->p.skedstanzaname){ /* No stanza means we do nothing */
- if(debug > 6)
- ast_log(LOG_NOTICE,"No stanza for scheduler in rpt.conf\n");
- return;
- }
-
- /* get pointer to linked list of scheduler entries */
- skedlist = ast_variable_browse(myrpt->cfg, myrpt->p.skedstanzaname);
-
- if(debug > 6){
- ast_log(LOG_NOTICE, "Time now: %02d:%02d %02d %02d %02d\n",
- tmnow.tm_hour,tmnow.tm_min,tmnow.tm_mday,tmnow.tm_mon + 1, tmnow.tm_wday);
- }
- /* walk the list */
- for(; skedlist; skedlist = skedlist->next){
- if(debug > 6)
- ast_log(LOG_NOTICE, "Scheduler entry %s = %s being considered\n",skedlist->name, skedlist->value);
- strncpy(value,skedlist->value,99);
- value[99] = 0;
- /* point to the substrings for minute, hour, dom, month, and dow */
- for( i = 0, vp = value ; i < 5; i++){
- if(!*vp)
- break;
- while((*vp == ' ') || (*vp == 0x09)) /* get rid of any leading white space */
- vp++;
- strs[i] = vp; /* save pointer to beginning of substring */
- while((*vp != ' ') && (*vp != 0x09) && (*vp != 0)) /* skip over substring */
- vp++;
- if(*vp)
- *vp++ = 0; /* mark end of substring */
- }
- if(debug > 6)
- ast_log(LOG_NOTICE, "i = %d, min = %s, hour = %s, mday=%s, mon=%s, wday=%s\n",i,
- strs[0], strs[1], strs[2], strs[3], strs[4]);
- if(i == 5){
- if((*strs[0] != '*')&&(atoi(strs[0]) != tmnow.tm_min))
- continue;
- if((*strs[1] != '*')&&(atoi(strs[1]) != tmnow.tm_hour))
- continue;
- if((*strs[2] != '*')&&(atoi(strs[2]) != tmnow.tm_mday))
- continue;
- if((*strs[3] != '*')&&(atoi(strs[3]) != tmnow.tm_mon + 1))
- continue;
- if(atoi(strs[4]) == 7)
- strs[4] = "0";
- if((*strs[4] != '*')&&(atoi(strs[4]) != tmnow.tm_wday))
- continue;
- if(debug)
- ast_log(LOG_NOTICE, "Executing scheduler entry %s = %s\n", skedlist->name, skedlist->value);
- if(atoi(skedlist->name) == 0)
- return; /* Zero is reserved for the startup macro */
- val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.macro, skedlist->name);
- if (!val){
- ast_log(LOG_WARNING,"Scheduler could not find macro %s\n",skedlist->name);
- return; /* Macro not found */
- }
- if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(val)){
- ast_log(LOG_WARNING, "Scheduler could not execute macro %s: Macro buffer full\n",
- skedlist->name);
- return; /* Macro buffer full */
- }
- myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,val,MAXMACRO - 1);
- }
- else{
- ast_log(LOG_WARNING,"Malformed scheduler entry in rpt.conf: %s = %s\n",
- skedlist->name, skedlist->value);
- }
- }
-
-}
-
-/* single thread with one file (request) to dial */
-static void *rpt(void *this)
-{
-struct rpt *myrpt = (struct rpt *)this;
-char *tele,*idtalkover,c,myfirst,*p;
-int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued;
-int tailmessagequeued,ctqueued,dtmfed,lastmyrx,localmsgqueued;
-struct ast_channel *who;
-struct dahdi_confinfo ci; /* conference info */
-time_t t;
-struct rpt_link *l,*m;
-struct rpt_tele *telem;
-char tmpstr[300],lstr[MAXLINKLIST];
-struct ast_format_cap *cap = NULL;
-
-
- if (myrpt->p.archivedir) mkdir(myrpt->p.archivedir,0600);
- sprintf(tmpstr,"%s/%s",myrpt->p.archivedir,myrpt->name);
- mkdir(tmpstr,0600);
- rpt_mutex_lock(&myrpt->lock);
-
- telem = myrpt->tele.next;
- while(telem != &myrpt->tele)
- {
- ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV);
- telem = telem->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- /* find our index, and load the vars initially */
- for(i = 0; i < nrpts; i++)
- {
- if (&rpt_vars[i] == myrpt)
- {
- load_rpt_vars(i,0);
- break;
- }
- }
-
- rpt_mutex_lock(&myrpt->lock);
- while(myrpt->xlink)
- {
- myrpt->xlink = 3;
- rpt_mutex_unlock(&myrpt->lock);
- usleep(100000);
- rpt_mutex_lock(&myrpt->lock);
- }
-#ifdef HAVE_IOPERM
- if ((!strcmp(myrpt->remoterig, remote_rig_rbi)) &&
- (ioperm(myrpt->p.iobase,1,1) == -1))
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n",myrpt->p.iobase);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
-#endif
- strncpy(tmpstr,myrpt->rxchanname,sizeof(tmpstr) - 1);
- tele = strchr(tmpstr,'/');
- if (!tele)
- {
- fprintf(stderr,"rpt:Rxchannel Dial number (%s) must be in format tech/number\n",myrpt->rxchanname);
- rpt_mutex_unlock(&myrpt->lock);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- *tele++ = 0;
- myrpt->rxchannel = ast_request(tmpstr, get_slin_cap(cap), NULL, tele, NULL);
- cap = ast_format_cap_destroy(cap);
- myrpt->dahdirxchannel = NULL;
- if (!strcasecmp(tmpstr,"DAHDI"))
- myrpt->dahdirxchannel = myrpt->rxchannel;
- if (myrpt->rxchannel)
- {
- if (myrpt->rxchannel->_state == AST_STATE_BUSY)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain Rx channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->rxchannel->cdr)
- ast_set_flag(myrpt->rxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef NEW_ASTERISK
- myrpt->rxchannel->whentohangup = 0;
-#endif
- ast_channel_appl_set(myrpt->rxchannel, "Apprpt");
- ast_channel_data_set(myrpt->rxchannel, "(Repeater Rx)");
- ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n",
- tmpstr, tele, ast_channel_name(myrpt->rxchannel));
- ast_call(myrpt->rxchannel,tele,999);
- if (myrpt->rxchannel->_state != AST_STATE_UP)
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- }
- else
- {
- fprintf(stderr,"rpt:Sorry unable to obtain Rx channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- myrpt->dahditxchannel = NULL;
- if (myrpt->txchanname)
- {
- strncpy(tmpstr,myrpt->txchanname,sizeof(tmpstr) - 1);
- tele = strchr(tmpstr,'/');
- if (!tele)
- {
- fprintf(stderr,"rpt:Txchannel Dial number (%s) must be in format tech/number\n",myrpt->txchanname);
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- *tele++ = 0;
- myrpt->txchannel = ast_request(tmpstr, get_slin_cap(cap), NULL, tele, NULL);
- cap = ast_format_cap_destroy(cap);
- if (!strcasecmp(tmpstr,"DAHDI"))
- myrpt->dahditxchannel = myrpt->txchannel;
- if (myrpt->txchannel)
- {
- if (myrpt->txchannel->_state == AST_STATE_BUSY)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain Tx channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->txchannel->cdr)
- ast_set_flag(myrpt->txchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef NEW_ASTERISK
- myrpt->txchannel->whentohangup = 0;
-#endif
- ast_channel_appl_set(myrpt->txchannel, "Apprpt");
- ast_channel_data_set(myrpt->txchannel, "(Repeater Tx)");
- ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n",
- tmpstr, tele, ast_channel_name(myrpt->txchannel));
- ast_call(myrpt->txchannel,tele,999);
- if (myrpt->rxchannel->_state != AST_STATE_UP)
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- ast_hangup(myrpt->txchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- }
- else
- {
- fprintf(stderr,"rpt:Sorry unable to obtain Tx channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- }
- else
- {
- myrpt->txchannel = myrpt->rxchannel;
- if (!strncasecmp(myrpt->rxchanname,"DAHDI",3))
- myrpt->dahditxchannel = myrpt->txchannel;
- }
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
- /* allocate a pseudo-channel thru asterisk */
- myrpt->pchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->pchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->pchannel->cdr)
- ast_set_flag(myrpt->pchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
- if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel;
- if (!myrpt->dahditxchannel)
- {
- /* allocate a pseudo-channel thru asterisk */
- myrpt->dahditxchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->dahditxchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->dahditxchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->dahditxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->dahditxchannel->cdr)
- ast_set_flag(myrpt->dahditxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
- }
- /* allocate a pseudo-channel thru asterisk */
- myrpt->monchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->monchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->monchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->monchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->monchannel->cdr)
- ast_set_flag(myrpt->monchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
- /* make a conference for the tx */
- ci.chan = 0;
- ci.confno = -1; /* make a new conf */
- ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER;
- /* first put the channel on the conference in proper mode */
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- /* save tx conference number */
- myrpt->txconf = ci.confno;
- /* make a conference for the pseudo */
- ci.chan = 0;
- ci.confno = -1; /* make a new conf */
- ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON :
- (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
- /* first put the channel on the conference in announce mode */
- if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- /* save pseudo channel conference number */
- myrpt->conf = ci.confno;
- /* make a conference for the pseudo */
- ci.chan = 0;
- if ((strstr(ast_channel_name(myrpt->txchannel), "pseudo") == NULL) &&
- (myrpt->dahditxchannel == myrpt->txchannel))
- {
- /* get tx channel's port number */
- if (ioctl(myrpt->txchannel->fds[0],DAHDI_CHANNO,&ci.confno) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set tx channel's chan number\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ci.confmode = DAHDI_CONF_MONITORTX;
- }
- else
- {
- ci.confno = myrpt->txconf;
- ci.confmode = DAHDI_CONF_CONFANNMON;
- }
- /* first put the channel on the conference in announce mode */
- if (ioctl(myrpt->monchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode for monitor\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- /* allocate a pseudo-channel thru asterisk */
- myrpt->parrotchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->parrotchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->parrotchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->parrotchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->parrotchannel->cdr)
- ast_set_flag(myrpt->parrotchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
- /* allocate a pseudo-channel thru asterisk */
- myrpt->voxchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->voxchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->voxchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->voxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->voxchannel->cdr)
- ast_set_flag(myrpt->voxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
- /* allocate a pseudo-channel thru asterisk */
- myrpt->txpchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->txpchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (myrpt->txpchannel->cdr)
- ast_set_flag(myrpt->txpchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
- /* make a conference for the tx */
- ci.chan = 0;
- ci.confno = myrpt->txconf;
- ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER ;
- /* first put the channel on the conference in proper mode */
- if (ioctl(myrpt->txpchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->txpchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- }
- /* if serial io port, open it */
- myrpt->iofd = -1;
- if (myrpt->p.ioport && ((myrpt->iofd = openserial(myrpt,myrpt->p.ioport)) == -1))
- {
- ast_log(LOG_ERROR, "Unable to open %s\n",myrpt->p.ioport);
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- pthread_exit(NULL);
- }
- /* Now, the idea here is to copy from the physical rx channel buffer
- into the pseudo tx buffer, and from the pseudo rx buffer into the
- tx channel buffer */
- myrpt->links.next = &myrpt->links;
- myrpt->links.prev = &myrpt->links;
- myrpt->tailtimer = 0;
- myrpt->totimer = 0;
- myrpt->tmsgtimer = myrpt->p.tailmessagetime;
- myrpt->idtimer = myrpt->p.politeid;
- myrpt->mustid = myrpt->tailid = 0;
- myrpt->callmode = 0;
- myrpt->tounkeyed = 0;
- myrpt->tonotify = 0;
- myrpt->retxtimer = 0;
- myrpt->rerxtimer = 0;
- myrpt->skedtimer = 0;
- myrpt->tailevent = 0;
- lasttx = 0;
- myrpt->keyed = 0;
- myrpt->txkeyed = 0;
- time(&myrpt->lastkeyedtime);
- myrpt->lastkeyedtime -= RPT_LOCKOUT_SECS;
- time(&myrpt->lasttxkeyedtime);
- myrpt->lasttxkeyedtime -= RPT_LOCKOUT_SECS;
- idtalkover = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "idtalkover");
- myrpt->dtmfidx = -1;
- myrpt->dtmfbuf[0] = 0;
- myrpt->rem_dtmfidx = -1;
- myrpt->rem_dtmfbuf[0] = 0;
- myrpt->dtmf_time = 0;
- myrpt->rem_dtmf_time = 0;
- myrpt->inpadtest = 0;
- myrpt->disgorgetime = 0;
- myrpt->lastnodewhichkeyedusup[0] = '\0';
- myrpt->dailytxtime = 0;
- myrpt->totaltxtime = 0;
- myrpt->dailykeyups = 0;
- myrpt->totalkeyups = 0;
- myrpt->dailykerchunks = 0;
- myrpt->totalkerchunks = 0;
- myrpt->dailyexecdcommands = 0;
- myrpt->totalexecdcommands = 0;
- myrpt->timeouts = 0;
- myrpt->exten[0] = '\0';
- myrpt->lastdtmfcommand[0] = '\0';
- voxinit_rpt(myrpt,1);
- myrpt->wasvox = 0;
- if (myrpt->p.startupmacro)
- {
- snprintf(myrpt->macrobuf,MAXMACRO - 1,"PPPP%s",myrpt->p.startupmacro);
- }
- rpt_mutex_unlock(&myrpt->lock);
- val = 1;
- ast_channel_setoption(myrpt->rxchannel,AST_OPTION_RELAXDTMF,&val,sizeof(char),0);
- val = 1;
- ast_channel_setoption(myrpt->rxchannel,AST_OPTION_TONE_VERIFY,&val,sizeof(char),0);
- if (myrpt->p.archivedir) donodelog(myrpt,"STARTUP");
- dtmfed = 0;
- if (myrpt->remoterig && !ISRIG_RTX(myrpt->remoterig)) setrem(myrpt);
- lastmyrx = 0;
- myfirst = 0;
- while (ms >= 0)
- {
- struct ast_frame *f,*f1,*f2;
- struct ast_channel *cs[300],*cs1[300];
- int totx=0,elap=0,n,x,toexit=0;
-
- /* DEBUG Dump */
- if((myrpt->disgorgetime) && (time(NULL) >= myrpt->disgorgetime)){
- struct rpt_link *dl;
- struct rpt_tele *dt;
-
- myrpt->disgorgetime = 0;
- ast_log(LOG_NOTICE,"********** Variable Dump Start (app_rpt) **********\n");
- ast_log(LOG_NOTICE,"totx = %d\n",totx);
- ast_log(LOG_NOTICE,"remrx = %d\n",remrx);
- ast_log(LOG_NOTICE,"lasttx = %d\n",lasttx);
- ast_log(LOG_NOTICE,"elap = %d\n",elap);
- ast_log(LOG_NOTICE,"toexit = %d\n",toexit);
-
- ast_log(LOG_NOTICE,"myrpt->keyed = %d\n",myrpt->keyed);
- ast_log(LOG_NOTICE,"myrpt->localtx = %d\n",myrpt->localtx);
- ast_log(LOG_NOTICE,"myrpt->callmode = %d\n",myrpt->callmode);
- ast_log(LOG_NOTICE,"myrpt->mustid = %d\n",myrpt->mustid);
- ast_log(LOG_NOTICE,"myrpt->tounkeyed = %d\n",myrpt->tounkeyed);
- ast_log(LOG_NOTICE,"myrpt->tonotify = %d\n",myrpt->tonotify);
- ast_log(LOG_NOTICE,"myrpt->retxtimer = %ld\n",myrpt->retxtimer);
- ast_log(LOG_NOTICE,"myrpt->totimer = %d\n",myrpt->totimer);
- ast_log(LOG_NOTICE,"myrpt->tailtimer = %d\n",myrpt->tailtimer);
- ast_log(LOG_NOTICE,"myrpt->tailevent = %d\n",myrpt->tailevent);
-
- dl = myrpt->links.next;
- while(dl != &myrpt->links){
- ast_log(LOG_NOTICE,"*** Link Name: %s ***\n",dl->name);
- ast_log(LOG_NOTICE," link->lasttx %d\n",dl->lasttx);
- ast_log(LOG_NOTICE," link->lastrx %d\n",dl->lastrx);
- ast_log(LOG_NOTICE," link->connected %d\n",dl->connected);
- ast_log(LOG_NOTICE," link->hasconnected %d\n",dl->hasconnected);
- ast_log(LOG_NOTICE," link->outbound %d\n",dl->outbound);
- ast_log(LOG_NOTICE," link->disced %d\n",dl->disced);
- ast_log(LOG_NOTICE," link->killme %d\n",dl->killme);
- ast_log(LOG_NOTICE," link->disctime %ld\n",dl->disctime);
- ast_log(LOG_NOTICE," link->retrytimer %ld\n",dl->retrytimer);
- ast_log(LOG_NOTICE," link->retries = %d\n",dl->retries);
- ast_log(LOG_NOTICE," link->reconnects = %d\n",dl->reconnects);
- ast_log(LOG_NOTICE," link->newkey = %d\n",dl->newkey);
- dl = dl->next;
- }
-
- dt = myrpt->tele.next;
- if(dt != &myrpt->tele)
- ast_log(LOG_NOTICE,"*** Telemetry Queue ***\n");
- while(dt != &myrpt->tele){
- ast_log(LOG_NOTICE," Telemetry mode: %d\n",dt->mode);
- dt = dt->next;
- }
- ast_log(LOG_NOTICE,"******* Variable Dump End (app_rpt) *******\n");
-
- }
-
-
- if (myrpt->reload)
- {
- struct rpt_tele *inner_telem;
-
- rpt_mutex_lock(&myrpt->lock);
- inner_telem = myrpt->tele.next;
- while(inner_telem != &myrpt->tele)
- {
- ast_softhangup(inner_telem->chan,AST_SOFTHANGUP_DEV);
- inner_telem = inner_telem->next;
- }
- myrpt->reload = 0;
- rpt_mutex_unlock(&myrpt->lock);
- usleep(10000);
- /* find our index, and load the vars */
- for(i = 0; i < nrpts; i++)
- {
- if (&rpt_vars[i] == myrpt)
- {
- load_rpt_vars(i,0);
- break;
- }
- }
- }
-
- rpt_mutex_lock(&myrpt->lock);
- if (ast_check_hangup(myrpt->rxchannel)) break;
- if (ast_check_hangup(myrpt->txchannel)) break;
- if (ast_check_hangup(myrpt->pchannel)) break;
- if (ast_check_hangup(myrpt->monchannel)) break;
- if (myrpt->parrotchannel &&
- ast_check_hangup(myrpt->parrotchannel)) break;
- if (myrpt->voxchannel &&
- ast_check_hangup(myrpt->voxchannel)) break;
- if (ast_check_hangup(myrpt->txpchannel)) break;
- if (myrpt->dahditxchannel && ast_check_hangup(myrpt->dahditxchannel)) break;
-
- /* Set local tx with keyed */
- myrpt->localtx = myrpt->keyed;
- /* If someone's connected, and they're transmitting from their end to us, set remrx true */
- l = myrpt->links.next;
- remrx = 0;
- while(l != &myrpt->links)
- {
- if (l->lastrx){
- remrx = 1;
- if(l->name[0] != '0') /* Ignore '0' nodes */
- strcpy(myrpt->lastnodewhichkeyedusup, l->name); /* Note the node which is doing the key up */
- }
- l = l->next;
- }
- /* Create a "must_id" flag for the cleanup ID */
- if(myrpt->p.idtime) /* ID time must be non-zero */
- myrpt->mustid |= (myrpt->idtimer) && (myrpt->keyed || remrx) ;
- /* Build a fresh totx from myrpt->keyed and autopatch activated */
- /* If full duplex, add local tx to totx */
- if (myrpt->p.duplex > 1)
- {
- totx = myrpt->callmode;
- totx = totx || myrpt->localtx;
- }
- else
- {
- int myrx = myrpt->localtx || remrx || (!myrpt->callmode);
-
- if (lastmyrx != myrx)
- {
- voxinit_rpt(myrpt,!myrx);
- lastmyrx = myrx;
- }
- totx = 0;
- if (myrpt->callmode && (myrpt->voxtotimer <= 0))
- {
- if (myrpt->voxtostate)
- {
- myrpt->voxtotimer = myrpt->p.voxtimeout_ms;
- myrpt->voxtostate = 0;
- }
- else
- {
- myrpt->voxtotimer = myrpt->p.voxrecover_ms;
- myrpt->voxtostate = 1;
- }
- }
- if (!myrpt->voxtostate)
- totx = myrpt->callmode && myrpt->wasvox;
- }
- /* Traverse the telemetry list to see what's queued */
- identqueued = 0;
- localmsgqueued = 0;
- othertelemqueued = 0;
- tailmessagequeued = 0;
- ctqueued = 0;
- telem = myrpt->tele.next;
- while(telem != &myrpt->tele)
- {
- if((telem->mode == ID) || (telem->mode == IDTALKOVER)){
- identqueued = 1; /* Identification telemetry */
- }
- else if(telem->mode == TAILMSG)
- {
- tailmessagequeued = 1; /* Tail message telemetry */
- }
- else if(telem->mode == STATS_TIME_LOCAL)
- {
- localmsgqueued = 1; /* Local message */
- }
- else
- {
- if ((telem->mode != UNKEY) && (telem->mode != LINKUNKEY))
- othertelemqueued = 1; /* Other telemetry */
- else
- ctqueued = 1; /* Courtesy tone telemetry */
- }
- telem = telem->next;
- }
-
- /* Add in any "other" telemetry, unless specified otherwise */
- if (!myrpt->p.notelemtx) totx = totx || othertelemqueued;
- /* Update external (to links) transmitter PTT state with everything but */
- /* ID, CT, local messages, and tailmessage telemetry */
- myrpt->exttx = totx;
- totx = totx || myrpt->dtmf_local_timer;
- /* If half or 3/4 duplex, add localtx to external link tx */
- if (myrpt->p.duplex < 2) myrpt->exttx = myrpt->exttx || myrpt->localtx;
- /* Add in ID telemetry to local transmitter */
- 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;
- /* If full duplex, add local dtmf stuff active */
- if (myrpt->p.duplex > 1)
- {
- totx = totx || (myrpt->dtmfidx > -1) ||
- myrpt->cmdnode[0];
- }
- /* add in parrot stuff */
- totx = totx || (myrpt->parrotstate > 1);
- /* Reset time out timer variables if there is no activity */
- if (!totx)
- {
- myrpt->totimer = myrpt->p.totime;
- myrpt->tounkeyed = 0;
- myrpt->tonotify = 0;
- }
- else{
- myrpt->tailtimer = myrpt->p.s[myrpt->p.sysstate_cur].alternatetail ?
- myrpt->p.althangtime : /* Initialize tail timer */
- myrpt->p.hangtime;
- }
- /* Disable the local transmitter if we are timed out */
- totx = totx && myrpt->totimer;
- /* if timed-out and not said already, say it */
- if ((!myrpt->totimer) && (!myrpt->tonotify))
- {
- myrpt->tonotify = 1;
- myrpt->timeouts++;
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt,TIMEOUT,NULL);
- rpt_mutex_lock(&myrpt->lock);
- }
-
- /* If unkey and re-key, reset time out timer */
- if ((!totx) && (!myrpt->totimer) && (!myrpt->tounkeyed) && (!myrpt->keyed))
- {
- myrpt->tounkeyed = 1;
- }
- if ((!totx) && (!myrpt->totimer) && myrpt->tounkeyed && myrpt->keyed)
- {
- myrpt->totimer = myrpt->p.totime;
- myrpt->tounkeyed = 0;
- myrpt->tonotify = 0;
- rpt_mutex_unlock(&myrpt->lock);
- continue;
- }
- /* if timed-out and in circuit busy after call */
- if ((!totx) && (!myrpt->totimer) && (myrpt->callmode == 4))
- {
- if(debug)
- ast_log(LOG_NOTICE, "timed-out and in circuit busy after call\n");
- myrpt->callmode = 0;
- myrpt->macropatch=0;
- channel_revert(myrpt);
- }
- /* get rid of tail if timed out */
- if (!myrpt->totimer) myrpt->tailtimer = 0;
- /* if not timed-out, add in tail */
- if (myrpt->totimer) totx = totx || myrpt->tailtimer;
- /* If user or links key up or are keyed up over standard ID, switch to talkover ID, if one is defined */
- /* If tail message, kill the message if someone keys up over it */
- if ((myrpt->keyed || remrx) && ((identqueued && idtalkover) || (tailmessagequeued))) {
- int hasid = 0,hastalkover = 0;
-
- telem = myrpt->tele.next;
- while(telem != &myrpt->tele){
- if(telem->mode == ID){
- if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */
- hasid = 1;
- }
- if(telem->mode == TAILMSG){
- if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */
- }
- if (telem->mode == IDTALKOVER) hastalkover = 1;
- telem = telem->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- if (hasid && (!hastalkover)) rpt_telemetry(myrpt, IDTALKOVER, NULL); /* Start Talkover ID */
- rpt_mutex_lock(&myrpt->lock);
- }
- /* Try to be polite */
- /* If the repeater has been inactive for longer than the ID time, do an initial ID in the tail*/
- /* If within 30 seconds of the time to ID, try do it in the tail */
- /* else if at ID time limit, do it right over the top of them */
- /* Lastly, if the repeater has been keyed, and the ID timer is expired, do a clean up ID */
- if(myrpt->mustid && (!myrpt->idtimer))
- queue_id(myrpt);
-
- if ((myrpt->p.idtime && totx && (!myrpt->exttx) &&
- (myrpt->idtimer <= myrpt->p.politeid) && myrpt->tailtimer)) /* ID time must be non-zero */
- {
- myrpt->tailid = 1;
- }
-
- /* If tail timer expires, then check for tail messages */
-
- if(myrpt->tailevent){
- myrpt->tailevent = 0;
- if(myrpt->tailid){
- totx = 1;
- queue_id(myrpt);
- }
- else if ((myrpt->p.tailmessages[0]) &&
- (myrpt->p.tailmessagetime) && (myrpt->tmsgtimer == 0)){
- totx = 1;
- myrpt->tmsgtimer = myrpt->p.tailmessagetime;
- rpt_mutex_unlock(&myrpt->lock);
- rpt_telemetry(myrpt, TAILMSG, NULL);
- rpt_mutex_lock(&myrpt->lock);
- }
- }
-
- /* Main TX control */
-
- /* let telemetry transmit anyway (regardless of timeout) */
- if (myrpt->p.duplex > 0) totx = totx || (myrpt->tele.next != &myrpt->tele);
- totx = totx && !myrpt->p.s[myrpt->p.sysstate_cur].txdisable;
- myrpt->txrealkeyed = totx;
- totx = totx || (!AST_LIST_EMPTY(&myrpt->txq));
- if (totx && (!lasttx))
- {
- char mydate[100],myfname[100];
- time_t myt;
-
- if (myrpt->monstream) ast_closestream(myrpt->monstream);
- if (myrpt->p.archivedir)
- {
- long blocksleft;
-
- time(&myt);
- strftime(mydate,sizeof(mydate) - 1,"%Y%m%d%H%M%S",
- localtime(&myt));
- sprintf(myfname,"%s/%s/%s",myrpt->p.archivedir,
- myrpt->name,mydate);
- myrpt->monstream = ast_writefile(myfname,"wav49",
- "app_rpt Air Archive",O_CREAT | O_APPEND,0,0600);
- if (myrpt->p.monminblocks)
- {
- blocksleft = diskavail(myrpt);
- if (blocksleft >= myrpt->p.monminblocks)
- donodelog(myrpt,"TXKEY,MAIN");
- } else donodelog(myrpt,"TXKEY,MAIN");
- }
- lasttx = 1;
- myrpt->txkeyed = 1;
- time(&myrpt->lasttxkeyedtime);
- myrpt->dailykeyups++;
- myrpt->totalkeyups++;
- rpt_mutex_unlock(&myrpt->lock);
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
- rpt_mutex_lock(&myrpt->lock);
- }
- if ((!totx) && lasttx)
- {
- if (myrpt->monstream) ast_closestream(myrpt->monstream);
- myrpt->monstream = NULL;
-
- lasttx = 0;
- myrpt->txkeyed = 0;
- time(&myrpt->lasttxkeyedtime);
- rpt_mutex_unlock(&myrpt->lock);
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
- rpt_mutex_lock(&myrpt->lock);
- donodelog(myrpt,"TXUNKEY,MAIN");
- }
- time(&t);
- /* if DTMF timeout */
- if ((!myrpt->cmdnode[0]) && (myrpt->dtmfidx >= 0) && ((myrpt->dtmf_time + DTMF_TIMEOUT) < t))
- {
- myrpt->inpadtest = 0;
- myrpt->dtmfidx = -1;
- myrpt->dtmfbuf[0] = 0;
- }
- /* if remote DTMF timeout */
- if ((myrpt->rem_dtmfidx >= 0) && ((myrpt->rem_dtmf_time + DTMF_TIMEOUT) < t))
- {
- myrpt->inpadtest = 0;
- myrpt->rem_dtmfidx = -1;
- myrpt->rem_dtmfbuf[0] = 0;
- }
-
- if (myrpt->exttx && myrpt->parrotchannel &&
- myrpt->p.parrotmode && (!myrpt->parrotstate))
- {
- char myfname[300];
-
- ci.confno = myrpt->conf;
- ci.confmode = DAHDI_CONF_CONFANNMON;
- ci.chan = 0;
-
- /* first put the channel on the conference in announce mode */
- if (ioctl(myrpt->parrotchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode for parrot\n");
- break;
- }
-
- sprintf(myfname,PARROTFILE,myrpt->name,myrpt->parrotcnt);
- strcat(myfname,".wav");
- unlink(myfname);
- sprintf(myfname,PARROTFILE,myrpt->name,myrpt->parrotcnt);
- myrpt->parrotstate = 1;
- myrpt->parrottimer = myrpt->p.parrottime;
- if (myrpt->parrotstream)
- ast_closestream(myrpt->parrotstream);
- myrpt->parrotstream = NULL;
- myrpt->parrotstream = ast_writefile(myfname,"wav",
- "app_rpt Parrot",O_CREAT | O_TRUNC,0,0600);
- }
-
- /* Reconnect */
-
- l = myrpt->links.next;
- while(l != &myrpt->links)
- {
- if (l->killme)
- {
- /* remove from queue */
- remque((struct qelem *) l);
- if (!strcmp(myrpt->cmdnode,l->name))
- myrpt->cmdnode[0] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- /* hang-up on call to device */
- if (l->chan) ast_hangup(l->chan);
- ast_hangup(l->pchan);
- ast_free(l);
- rpt_mutex_lock(&myrpt->lock);
- /* re-start link traversal */
- l = myrpt->links.next;
- continue;
- }
- l = l->next;
- }
- n = 0;
- cs[n++] = myrpt->rxchannel;
- cs[n++] = myrpt->pchannel;
- cs[n++] = myrpt->monchannel;
- if (myrpt->parrotchannel) cs[n++] = myrpt->parrotchannel;
- if (myrpt->voxchannel) cs[n++] = myrpt->voxchannel;
- cs[n++] = myrpt->txpchannel;
- if (myrpt->txchannel != myrpt->rxchannel) cs[n++] = myrpt->txchannel;
- if (myrpt->dahditxchannel != myrpt->txchannel)
- cs[n++] = myrpt->dahditxchannel;
- l = myrpt->links.next;
- while(l != &myrpt->links)
- {
- if ((!l->killme) && (!l->disctime) && l->chan)
- {
- cs[n++] = l->chan;
- cs[n++] = l->pchan;
- }
- l = l->next;
- }
- if ((myrpt->topkeystate == 1) &&
- ((t - myrpt->topkeytime) > TOPKEYWAIT))
- {
- myrpt->topkeystate = 2;
- qsort(myrpt->topkey,TOPKEYN,sizeof(struct rpt_topkey),
- topcompar);
- }
- rpt_mutex_unlock(&myrpt->lock);
-
- if (myrpt->topkeystate == 2)
- {
- rpt_telemetry(myrpt,TOPKEY,NULL);
- myrpt->topkeystate = 3;
- }
- ms = MSWAIT;
- for(x = 0; x < n; x++)
- {
- int s = -(-x - myrpt->scram - 1) % n;
- cs1[x] = cs[s];
- }
- myrpt->scram++;
- who = ast_waitfor_n(cs1,n,&ms);
- if (who == NULL) ms = 0;
- elap = MSWAIT - ms;
- rpt_mutex_lock(&myrpt->lock);
- l = myrpt->links.next;
- while(l != &myrpt->links)
- {
- int myrx;
-
- if (l->voxtotimer) l->voxtotimer -= elap;
- if (l->voxtotimer < 0) l->voxtotimer = 0;
-
- if (l->lasttx != l->lasttx1)
- {
- voxinit_link(l,!l->lasttx);
- l->lasttx1 = l->lasttx;
- }
- myrx = l->lastrealrx;
- if ((l->phonemode) && (l->phonevox))
- {
- myrx = myrx || (!AST_LIST_EMPTY(&l->rxq));
- if (l->voxtotimer <= 0)
- {
- if (l->voxtostate)
- {
- l->voxtotimer = myrpt->p.voxtimeout_ms;
- l->voxtostate = 0;
- }
- else
- {
- l->voxtotimer = myrpt->p.voxrecover_ms;
- l->voxtostate = 1;
- }
- }
- if (!l->voxtostate)
- myrx = myrx || l->wasvox ;
- }
- l->lastrx = myrx;
- if (l->linklisttimer)
- {
- l->linklisttimer -= elap;
- if (l->linklisttimer < 0) l->linklisttimer = 0;
- }
- if ((!l->linklisttimer) && (l->name[0] != '0') && (!l->isremote))
- {
- struct ast_frame lf;
-
- memset(&lf,0,sizeof(lf));
- lf.frametype = AST_FRAME_TEXT;
- lf.subclass.integer = 0;
- lf.offset = 0;
- lf.mallocd = 0;
- lf.samples = 0;
- l->linklisttimer = LINKLISTTIME;
- strcpy(lstr,"L ");
- __mklinklist(myrpt,l,lstr + 2);
- if (l->chan)
- {
- lf.datalen = strlen(lstr) + 1;
- lf.data.ptr = lstr;
- ast_write(l->chan,&lf);
- if (debug > 6) ast_log(LOG_NOTICE,
- "@@@@ node %s sent node string %s to node %s\n",
- myrpt->name,lstr,l->name);
- }
- }
- if (l->newkey)
- {
- if ((l->retxtimer += elap) >= REDUNDANT_TX_TIME)
- {
- l->retxtimer = 0;
- if (l->chan && l->phonemode == 0)
- {
- if (l->lasttx)
- ast_indicate(l->chan,AST_CONTROL_RADIO_KEY);
- else
- ast_indicate(l->chan,AST_CONTROL_RADIO_UNKEY);
- }
- }
- if ((l->rerxtimer += elap) >= (REDUNDANT_TX_TIME * 5))
- {
- if (debug == 7) printf("@@@@ rx un-key\n");
- l->lastrealrx = 0;
- l->rerxtimer = 0;
- if (l->lastrx1)
- {
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"RXUNKEY(T),%s",l->name);
- donodelog(myrpt,str);
- }
- if(myrpt->p.duplex)
- rpt_telemetry(myrpt,LINKUNKEY,l);
- l->lastrx1 = 0;
- }
- }
- }
- if (l->disctime) /* Disconnect timer active on a channel ? */
- {
- l->disctime -= elap;
- if (l->disctime <= 0) /* Disconnect timer expired on inbound channel ? */
- l->disctime = 0; /* Yep */
- }
-
- if (l->retrytimer)
- {
- l->retrytimer -= elap;
- if (l->retrytimer < 0) l->retrytimer = 0;
- }
-
- /* Tally connect time */
- l->connecttime += elap;
-
- /* ignore non-timing channels */
- if (l->elaptime < 0)
- {
- l = l->next;
- continue;
- }
- l->elaptime += elap;
- /* if connection has taken too long */
- if ((l->elaptime > MAXCONNECTTIME) &&
- ((!l->chan) || (l->chan->_state != AST_STATE_UP)))
- {
- l->elaptime = 0;
- rpt_mutex_unlock(&myrpt->lock);
- if (l->chan) ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if ((!l->chan) && (!l->retrytimer) && l->outbound &&
- (l->retries++ < l->max_retries) && (l->hasconnected))
- {
- if (l->chan) ast_hangup(l->chan);
- l->chan = 0;
- rpt_mutex_unlock(&myrpt->lock);
- if ((l->name[0] != '0') && (!l->isremote))
- {
- if (attempt_reconnect(myrpt,l) == -1)
- {
- l->retrytimer = RETRY_TIMER_MS;
- }
- }
- else
- {
- l->retrytimer = l->max_retries + 1;
- }
-
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if ((!l->chan) && (!l->retrytimer) && l->outbound &&
- (l->retries >= l->max_retries))
- {
- /* remove from queue */
- remque((struct qelem *) l);
- if (!strcmp(myrpt->cmdnode,l->name))
- myrpt->cmdnode[0] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- if (l->name[0] != '0')
- {
- if (!l->hasconnected)
- rpt_telemetry(myrpt,CONNFAIL,l);
- else rpt_telemetry(myrpt,REMDISC,l);
- }
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- if (!l->hasconnected)
- sprintf(str,"LINKFAIL,%s",l->name);
- else
- sprintf(str,"LINKDISC,%s",l->name);
- donodelog(myrpt,str);
- }
- /* hang-up on call to device */
- ast_hangup(l->pchan);
- ast_free(l);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if ((!l->chan) && (!l->disctime) && (!l->outbound))
- {
- 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);
- if (!strcmp(myrpt->cmdnode,l->name))myrpt->cmdnode[0] = 0;
- rpt_mutex_unlock(&myrpt->lock);
- if (l->name[0] != '0')
- {
- rpt_telemetry(myrpt,REMDISC,l);
- }
- if (myrpt->p.archivedir)
- {
- char str[100];
- sprintf(str,"LINKDISC,%s",l->name);
- donodelog(myrpt,str);
- }
- /* hang-up on call to device */
- ast_hangup(l->pchan);
- ast_free(l);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- l = l->next;
- }
- if (myrpt->linkposttimer)
- {
- myrpt->linkposttimer -= elap;
- if (myrpt->linkposttimer < 0) myrpt->linkposttimer = 0;
- }
- if (myrpt->linkposttimer <= 0)
- {
- int nstr;
- char lst,*str;
- time_t now;
-
- myrpt->linkposttimer = LINKPOSTTIME;
- nstr = 0;
- for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
- {
- /* if is not a real link, ignore it */
- if (l->name[0] == '0') continue;
- nstr += strlen(l->name) + 1;
- }
- str = ast_malloc(nstr + 256);
- if (!str)
- {
- ast_log(LOG_NOTICE,"Cannot ast_malloc()\n");
- break;
- }
- nstr = 0;
- strcpy(str,"nodes=");
- for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
- {
- /* if is not a real link, ignore it */
- if (l->name[0] == '0') continue;
- lst = 'T';
- if (!l->mode) lst = 'R';
- if (!l->thisconnected) lst = 'C';
- if (nstr) strcat(str,",");
- sprintf(str + strlen(str),"%c%s",lst,l->name);
- nstr = 1;
- }
- p = strstr(tdesc, "version");
- if(p){
- int vmajor,vminor;
- if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) == 2)
- sprintf(str + strlen(str),"&apprptvers=%d.%d",vmajor,vminor);
- }
- time(&now);
- sprintf(str + strlen(str),"&apprptuptime=%d",(int)(now-starttime));
- sprintf(str + strlen(str),
- "&totalkerchunks=%d&totalkeyups=%d&totaltxtime=%d&timeouts=%d&totalexecdcommands=%d",
- myrpt->totalkerchunks,myrpt->totalkeyups,(int) myrpt->totaltxtime/1000,
- myrpt->timeouts,myrpt->totalexecdcommands);
- rpt_mutex_unlock(&myrpt->lock);
- statpost(myrpt,str);
- rpt_mutex_lock(&myrpt->lock);
- ast_free(str);
- }
- if (myrpt->keyposttimer)
- {
- myrpt->keyposttimer -= elap;
- if (myrpt->keyposttimer < 0) myrpt->keyposttimer = 0;
- }
- if (myrpt->keyposttimer <= 0)
- {
- char str[100];
- int diff = 0;
- time_t now;
-
- myrpt->keyposttimer = KEYPOSTTIME;
- time(&now);
- if (myrpt->lastkeyedtime)
- {
- diff = (int)(now - myrpt->lastkeyedtime);
- }
- sprintf(str,"keyed=%d&keytime=%d",myrpt->keyed,diff);
- rpt_mutex_unlock(&myrpt->lock);
- statpost(myrpt,str);
- rpt_mutex_lock(&myrpt->lock);
- }
- if(totx){
- myrpt->dailytxtime += elap;
- myrpt->totaltxtime += elap;
- }
- i = myrpt->tailtimer;
- if (myrpt->tailtimer) myrpt->tailtimer -= elap;
- if (myrpt->tailtimer < 0) myrpt->tailtimer = 0;
- if((i) && (myrpt->tailtimer == 0))
- myrpt->tailevent = 1;
- if ((!myrpt->p.s[myrpt->p.sysstate_cur].totdisable) && myrpt->totimer) myrpt->totimer -= elap;
- if (myrpt->totimer < 0) myrpt->totimer = 0;
- if (myrpt->idtimer) myrpt->idtimer -= elap;
- if (myrpt->idtimer < 0) myrpt->idtimer = 0;
- if (myrpt->tmsgtimer) myrpt->tmsgtimer -= elap;
- if (myrpt->tmsgtimer < 0) myrpt->tmsgtimer = 0;
- if (myrpt->voxtotimer) myrpt->voxtotimer -= elap;
- if (myrpt->voxtotimer < 0) myrpt->voxtotimer = 0;
- if (myrpt->exttx)
- {
- myrpt->parrottimer = myrpt->p.parrottime;
- }
- else
- {
- if (myrpt->parrottimer) myrpt->parrottimer -= elap;
- if (myrpt->parrottimer < 0) myrpt->parrottimer = 0;
- }
- /* do macro timers */
- if (myrpt->macrotimer) myrpt->macrotimer -= elap;
- if (myrpt->macrotimer < 0) myrpt->macrotimer = 0;
- /* do local dtmf timer */
- if (myrpt->dtmf_local_timer)
- {
- if (myrpt->dtmf_local_timer > 1) myrpt->dtmf_local_timer -= elap;
- if (myrpt->dtmf_local_timer < 1) myrpt->dtmf_local_timer = 1;
- }
- do_dtmf_local(myrpt,0);
- /* Execute scheduler appx. every 2 tenths of a second */
- if (myrpt->skedtimer <= 0){
- myrpt->skedtimer = 200;
- do_scheduler(myrpt);
- }
- else
- myrpt->skedtimer -=elap;
- if (!ms)
- {
- rpt_mutex_unlock(&myrpt->lock);
- continue;
- }
- if (myrpt->p.parrotmode && (myrpt->parrotstate == 1) &&
- (myrpt->parrottimer <= 0))
- {
-
- ci.confno = 0;
- ci.confmode = 0;
- ci.chan = 0;
-
- /* first put the channel on the conference in announce mode */
- if (ioctl(myrpt->parrotchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode for parrot\n");
- break;
- }
- if (myrpt->parrotstream)
- ast_closestream(myrpt->parrotstream);
- myrpt->parrotstream = NULL;
- myrpt->parrotstate = 2;
- rpt_telemetry(myrpt,PARROT,(void *) ((intptr_t)myrpt->parrotcnt++));
- }
- if (myrpt->cmdAction.state == CMD_STATE_READY)
- { /* there is a command waiting to be processed */
- myrpt->cmdAction.state = CMD_STATE_EXECUTING;
- // lose the lock
- rpt_mutex_unlock(&myrpt->lock);
- // do the function
- (*function_table[myrpt->cmdAction.functionNumber].function)(myrpt,myrpt->cmdAction.param, myrpt->cmdAction.digits, myrpt->cmdAction.command_source, NULL);
- // get the lock again
- rpt_mutex_lock(&myrpt->lock);
- myrpt->cmdAction.state = CMD_STATE_IDLE;
- } /* if myrpt->cmdAction.state == CMD_STATE_READY */
-
- c = myrpt->macrobuf[0];
- time(&t);
- if (c && (!myrpt->macrotimer) &&
- starttime && (t > (starttime + START_DELAY)))
- {
- char cin = c & 0x7f;
- myrpt->macrotimer = MACROTIME;
- memmove(myrpt->macrobuf,myrpt->macrobuf + 1,MAXMACRO - 1);
- if ((cin == 'p') || (cin == 'P'))
- myrpt->macrotimer = MACROPTIME;
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"DTMF(M),MAIN,%c",cin);
- donodelog(myrpt,str);
- }
- local_dtmf_helper(myrpt,c);
- } else rpt_mutex_unlock(&myrpt->lock);
- if (who == myrpt->rxchannel) /* if it was a read from rx */
- {
- int ismuted;
-
- f = ast_read(myrpt->rxchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
-#ifdef _MDC_DECODE_H_
- unsigned char ubuf[2560];
- short *sp;
- int n;
-#endif
-
- if ((!myrpt->localtx) && (!myrpt->p.linktolink)) {
- memset(f->data.ptr,0,f->datalen);
- }
-
-#ifdef _MDC_DECODE_H_
- sp = (short *) f->data;
- /* convert block to unsigned char */
- for(n = 0; n < f->datalen / 2; n++)
- {
- ubuf[n] = (*sp++ >> 8) + 128;
- }
- n = mdc_decoder_process_samples(myrpt->mdc,ubuf,f->datalen / 2);
- if (n == 1)
- {
- unsigned char op,arg;
- unsigned short unitID;
-
- mdc_decoder_get_packet(myrpt->mdc,&op,&arg,&unitID);
- if (debug > 2)
- {
- ast_log(LOG_NOTICE,"Got (single-length) packet:\n");
- ast_log(LOG_NOTICE,"op: %02x, arg: %02x, UnitID: %04x\n",
- op & 255,arg & 255,unitID);
- }
- if ((op == 1) && (arg == 0))
- {
- myrpt->lastunit = unitID;
- mdc1200_notify(myrpt,NULL,myrpt->lastunit);
- mdc1200_send(myrpt,myrpt->lastunit);
- }
- }
- if ((debug > 2) && (i == 2))
- {
- unsigned char op,arg,ex1,ex2,ex3,ex4;
- unsigned short unitID;
-
- mdc_decoder_get_double_packet(myrpt->mdc,&op,&arg,&unitID,
- &ex1,&ex2,&ex3,&ex4);
- ast_log(LOG_NOTICE,"Got (double-length) packet:\n");
- ast_log(LOG_NOTICE,"op: %02x, arg: %02x, UnitID: %04x\n",
- op & 255,arg & 255,unitID);
- ast_log(LOG_NOTICE,"ex1: %02x, ex2: %02x, ex3: %02x, ex4: %02x\n",
- ex1 & 255, ex2 & 255, ex3 & 255, ex4 & 255);
- }
-#endif
-#ifdef __RPT_NOTCH
- /* apply inbound filters, if any */
- rpt_filter(myrpt,f->data,f->datalen / 2);
-#endif
- if (ioctl(myrpt->dahdirxchannel->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
- {
- ismuted = 0;
- }
- if (dtmfed) ismuted = 1;
- dtmfed = 0;
- if (ismuted)
- {
- memset(f->data.ptr,0,f->datalen);
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- }
- if (f) f2 = ast_frdup(f);
- else f2 = NULL;
- f1 = myrpt->lastf2;
- myrpt->lastf2 = myrpt->lastf1;
- myrpt->lastf1 = f2;
- if (ismuted)
- {
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- }
- if (f1)
- {
- ast_write(myrpt->pchannel,f1);
- ast_frfree(f1);
- }
- }
-#ifndef OLD_ASTERISK
- else if (f->frametype == AST_FRAME_DTMF_BEGIN)
- {
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- dtmfed = 1;
- }
-#endif
- else if (f->frametype == AST_FRAME_DTMF)
- {
- c = (char) f->subclass.integer; /* get DTMF char */
- ast_frfree(f);
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- dtmfed = 1;
- if (!myrpt->keyed) continue;
- c = func_xlat(myrpt,c,&myrpt->p.inxlat);
- if (c) local_dtmf_helper(myrpt,c);
- continue;
- }
- else if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- /* if RX key */
- if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
- {
- if ((!lasttx) || (myrpt->p.duplex > 1) || (myrpt->p.linktolink))
- {
- if (debug == 7) printf("@@@@ rx key\n");
- myrpt->keyed = 1;
- time(&myrpt->lastkeyedtime);
- myrpt->keyposttimer = KEYPOSTSHORTTIME;
- }
- if (myrpt->p.archivedir)
- {
- donodelog(myrpt,"RXKEY,MAIN");
- }
- if (f->datalen && f->data.ptr)
- {
- char busy = 0;
-
- if (debug) ast_log(LOG_NOTICE,"Got PL %s on node %s\n",(char *)f->data.ptr,myrpt->name);
- // ctcss code autopatch initiate
- if (strstr((char *)f->data.ptr,"/M/")&& !myrpt->macropatch)
- {
- char value[16] = "";
- strcat(value,"*6");
- myrpt->macropatch=1;
- rpt_mutex_lock(&myrpt->lock);
- if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(value)){
- rpt_mutex_unlock(&myrpt->lock);
- busy=1;
- }
- if(!busy){
- myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,value,MAXMACRO - 1);
- if (!busy) strcpy(myrpt->lasttone,(char*)f->data.ptr);
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- else if (strcmp((char *)f->data.ptr,myrpt->lasttone))
- {
- char *value = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.tonemacro, (char *)f->data.ptr);
- if (value)
- {
- if (debug) ast_log(LOG_NOTICE,"Tone %s doing %s on node %s\n",(char *) f->data.ptr,value,myrpt->name);
- rpt_mutex_lock(&myrpt->lock);
- if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(value)){
- rpt_mutex_unlock(&myrpt->lock);
- busy=1;
- }
- if(!busy){
- myrpt->macrotimer = MACROTIME;
- strncat(myrpt->macrobuf,value,MAXMACRO - 1);
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
- if (!busy) strcpy(myrpt->lasttone,(char*)f->data.ptr);
- }
- } else myrpt->lasttone[0] = 0;
- }
- /* if RX un-key */
- if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
- {
- if ((!lasttx) || (myrpt->p.duplex > 1) || (myrpt->p.linktolink))
- {
- if (debug == 7) printf("@@@@ rx un-key\n");
- if(myrpt->p.duplex && myrpt->keyed) {
- rpt_telemetry(myrpt,UNKEY,NULL);
- }
- }
- myrpt->keyed = 0;
- time(&myrpt->lastkeyedtime);
- myrpt->keyposttimer = KEYPOSTSHORTTIME;
- if (myrpt->p.archivedir)
- {
- donodelog(myrpt,"RXUNKEY,MAIN");
- }
- }
- }
- ast_frfree(f);
- continue;
- }
- if (who == myrpt->pchannel) /* if it was a read from pseudo */
- {
- f = ast_read(myrpt->pchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- ast_write(myrpt->txpchannel,f);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- if (who == myrpt->txchannel) /* if it was a read from tx */
- {
- f = ast_read(myrpt->txchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- if (who == myrpt->dahditxchannel) /* if it was a read from pseudo-tx */
- {
- f = ast_read(myrpt->dahditxchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- struct ast_frame *vframe;
-
- if (myrpt->p.duplex < 2)
- {
- if (myrpt->txrealkeyed)
- {
- if ((!myfirst) && myrpt->callmode)
- {
- x = 0;
- AST_LIST_TRAVERSE(&myrpt->txq, vframe,
- frame_list) x++;
- for(;x < myrpt->p.simplexpatchdelay; x++)
- {
- vframe = ast_frdup(f);
- memset(vframe->data.ptr,0,vframe->datalen);
- AST_LIST_INSERT_TAIL(&myrpt->txq,vframe,frame_list);
- }
- myfirst = 1;
- }
- vframe = ast_frdup(f);
- AST_LIST_INSERT_TAIL(&myrpt->txq,
- vframe,frame_list);
- } else myfirst = 0;
- x = 0;
- AST_LIST_TRAVERSE(&myrpt->txq, vframe,
- frame_list) x++;
- if (!x)
- {
- memset(f->data.ptr,0,f->datalen);
- }
- else
- {
- ast_frfree(f);
- f = AST_LIST_REMOVE_HEAD(&myrpt->txq,
- frame_list);
- }
- }
- else
- {
- while((vframe = AST_LIST_REMOVE_HEAD(&myrpt->txq,
- frame_list))) ast_frfree(vframe);
- }
- ast_write(myrpt->txchannel,f);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- toexit = 0;
- rpt_mutex_lock(&myrpt->lock);
- l = myrpt->links.next;
- while(l != &myrpt->links)
- {
- int remnomute;
- struct timeval now;
-
- if (l->disctime)
- {
- l = l->next;
- continue;
- }
-
- remrx = 0;
- /* see if any other links are receiving */
- m = myrpt->links.next;
- while(m != &myrpt->links)
- {
- /* if not us, count it */
- if ((m != l) && (m->lastrx)) remrx = 1;
- m = m->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- now = ast_tvnow();
- if ((who == l->chan) || (!l->lastlinktv.tv_sec) ||
- (ast_tvdiff_ms(now,l->lastlinktv) >= 19))
- {
- l->lastlinktv = now;
- remnomute = myrpt->localtx &&
- (!(myrpt->cmdnode[0] ||
- (myrpt->dtmfidx > -1)));
- totx = (((l->isremote) ? (remnomute) :
- myrpt->exttx) || remrx) && l->mode;
- if (l->phonemode == 0 && l->chan && (l->lasttx != totx))
- {
- if (totx)
- {
- ast_indicate(l->chan,AST_CONTROL_RADIO_KEY);
- }
- else
- {
- ast_indicate(l->chan,AST_CONTROL_RADIO_UNKEY);
- }
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- if (totx)
- sprintf(str,"TXKEY,%s",l->name);
- else
- sprintf(str,"TXUNKEY,%s",l->name);
- donodelog(myrpt,str);
- }
- }
- l->lasttx = totx;
- }
- rpt_mutex_lock(&myrpt->lock);
- if (who == l->chan) /* if it was a read from rx */
- {
- rpt_mutex_unlock(&myrpt->lock);
- f = ast_read(l->chan);
- if (!f)
- {
- rpt_mutex_lock(&myrpt->lock);
- __kickshort(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if ((!l->disced) && (!l->outbound))
- {
- if ((l->name[0] == '0') || l->isremote)
- l->disctime = 1;
- else
- l->disctime = DISC_TIME;
- rpt_mutex_lock(&myrpt->lock);
- ast_hangup(l->chan);
- l->chan = 0;
- break;
- }
-
- if (l->retrytimer)
- {
- ast_hangup(l->chan);
- l->chan = 0;
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if (l->outbound && (l->retries++ < l->max_retries) && (l->hasconnected))
- {
- rpt_mutex_lock(&myrpt->lock);
- if (l->chan) ast_hangup(l->chan);
- l->chan = 0;
- l->hasconnected = 1;
- l->retrytimer = RETRY_TIMER_MS;
- l->elaptime = 0;
- l->connecttime = 0;
- l->thisconnected = 0;
- break;
- }
- rpt_mutex_lock(&myrpt->lock);
- /* remove from queue */
- remque((struct qelem *) l);
- if (!strcmp(myrpt->cmdnode,l->name))
- myrpt->cmdnode[0] = 0;
- __kickshort(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if (!l->hasconnected)
- rpt_telemetry(myrpt,CONNFAIL,l);
- else if (l->disced != 2) rpt_telemetry(myrpt,REMDISC,l);
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- if (!l->hasconnected)
- sprintf(str,"LINKFAIL,%s",l->name);
- else
- sprintf(str,"LINKDISC,%s",l->name);
- donodelog(myrpt,str);
- }
- if (l->lastf1) ast_frfree(l->lastf1);
- l->lastf1 = NULL;
- if (l->lastf2) ast_frfree(l->lastf2);
- l->lastf2 = NULL;
- /* hang-up on call to device */
- ast_hangup(l->chan);
- ast_hangup(l->pchan);
- ast_free(l);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- int ismuted,n1;
-
- if ((l->phonemode) && (l->phonevox))
- {
- n1 = dovox(&l->vox,
- f->data.ptr,f->datalen / 2);
- if (n1 != l->wasvox)
- {
- ast_debug(1,"Link Node %s, vox %d\n",l->name,n1);
- l->wasvox = n1;
- l->voxtostate = 0;
- if (n1) l->voxtotimer = myrpt->p.voxtimeout_ms;
- else l->voxtotimer = 0;
- }
- if (l->lastrealrx || n1)
- {
- if (!myfirst)
- {
- x = 0;
- AST_LIST_TRAVERSE(&l->rxq, f1,
- frame_list) x++;
- for(;x < myrpt->p.simplexphonedelay; x++)
- {
- f1 = ast_frdup(f);
- memset(f1->data.ptr,0,f1->datalen);
- AST_LIST_INSERT_TAIL(&l->rxq,
- f1,frame_list);
- }
- myfirst = 1;
- }
- f1 = ast_frdup(f);
- AST_LIST_INSERT_TAIL(&l->rxq,f1,frame_list);
- } else myfirst = 0;
- x = 0;
- AST_LIST_TRAVERSE(&l->rxq, f1,frame_list) x++;
- if (!x)
- {
- memset(f->data.ptr,0,f->datalen);
- }
- else
- {
- ast_frfree(f);
- f = AST_LIST_REMOVE_HEAD(&l->rxq,frame_list);
- }
- if (ioctl(l->chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
- {
- ismuted = 0;
- }
- /* if not receiving, zero-out audio */
- ismuted |= (!l->lastrx);
- if (l->dtmfed && l->phonemode) ismuted = 1;
- l->dtmfed = 0;
- if (ismuted)
- {
- memset(f->data.ptr,0,f->datalen);
- if (l->lastf1)
- memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
- if (l->lastf2)
- memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
- }
- if (f) f2 = ast_frdup(f);
- else f2 = NULL;
- f1 = l->lastf2;
- l->lastf2 = l->lastf1;
- l->lastf1 = f2;
- if (ismuted)
- {
- if (l->lastf1)
- memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
- if (l->lastf2)
- memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
- }
- if (f1)
- {
- ast_write(l->pchan,f1);
- ast_frfree(f1);
- }
- }
- else
- {
- if (!l->lastrx)
- memset(f->data.ptr,0,f->datalen);
- ast_write(l->pchan,f);
- }
- }
-#ifndef OLD_ASTERISK
- else if (f->frametype == AST_FRAME_DTMF_BEGIN)
- {
- if (l->lastf1)
- memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
- if (l->lastf2)
- memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
- l->dtmfed = 1;
- }
-#endif
- if (f->frametype == AST_FRAME_TEXT)
- {
- handle_link_data(myrpt,l,f->data.ptr);
- }
- if (f->frametype == AST_FRAME_DTMF)
- {
- if (l->lastf1)
- memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
- if (l->lastf2)
- memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
- l->dtmfed = 1;
- handle_link_phone_dtmf(myrpt,l,f->subclass.integer);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_ANSWER)
- {
- char lconnected = l->connected;
-
- __kickshort(myrpt);
- l->connected = 1;
- l->hasconnected = 1;
- l->thisconnected = 1;
- l->elaptime = -1;
- if (!l->phonemode) send_newkey(l->chan);
- if (!l->isremote) l->retries = 0;
- if (!lconnected)
- {
- rpt_telemetry(myrpt,CONNECTED,l);
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- if (l->mode)
- sprintf(str,"LINKTRX,%s",l->name);
- else
- sprintf(str,"LINKMONITOR,%s",l->name);
- donodelog(myrpt,str);
- }
- }
- else
- l->reconnects++;
- }
- /* if RX key */
- if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
- {
- if (debug == 7 ) printf("@@@@ rx key\n");
- l->lastrealrx = 1;
- l->rerxtimer = 0;
- if (!l->lastrx1)
- {
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"RXKEY,%s",l->name);
- donodelog(myrpt,str);
- }
- l->lastrx1 = 1;
- }
- }
- /* if RX un-key */
- if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
- {
- if (debug == 7) printf("@@@@ rx un-key\n");
- l->lastrealrx = 0;
- l->rerxtimer = 0;
- if (l->lastrx1)
- {
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- sprintf(str,"RXUNKEY,%s",l->name);
- donodelog(myrpt,str);
- }
- l->lastrx1 = 0;
- if(myrpt->p.duplex)
- rpt_telemetry(myrpt,LINKUNKEY,l);
- }
- }
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- ast_frfree(f);
- rpt_mutex_lock(&myrpt->lock);
- __kickshort(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if ((!l->outbound) && (!l->disced))
- {
- if ((l->name[0] == '0') || l->isremote)
- l->disctime = 1;
- else
- l->disctime = DISC_TIME;
- rpt_mutex_lock(&myrpt->lock);
- ast_hangup(l->chan);
- l->chan = 0;
- break;
- }
- if (l->retrytimer)
- {
- if (l->chan) ast_hangup(l->chan);
- l->chan = 0;
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if (l->outbound && (l->retries++ < l->max_retries) && (l->hasconnected))
- {
- rpt_mutex_lock(&myrpt->lock);
- if (l->chan) ast_hangup(l->chan);
- l->chan = 0;
- l->hasconnected = 1;
- l->elaptime = 0;
- l->retrytimer = RETRY_TIMER_MS;
- l->connecttime = 0;
- l->thisconnected = 0;
- break;
- }
- rpt_mutex_lock(&myrpt->lock);
- /* remove from queue */
- remque((struct qelem *) l);
- if (!strcmp(myrpt->cmdnode,l->name))
- myrpt->cmdnode[0] = 0;
- __kickshort(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if (!l->hasconnected)
- rpt_telemetry(myrpt,CONNFAIL,l);
- else if (l->disced != 2) rpt_telemetry(myrpt,REMDISC,l);
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- if (!l->hasconnected)
- sprintf(str,"LINKFAIL,%s",l->name);
- else
- sprintf(str,"LINKDISC,%s",l->name);
- donodelog(myrpt,str);
- }
- if (l->lastf1) ast_frfree(l->lastf1);
- l->lastf1 = NULL;
- if (l->lastf2) ast_frfree(l->lastf2);
- l->lastf2 = NULL;
- /* hang-up on call to device */
- ast_hangup(l->chan);
- ast_hangup(l->pchan);
- ast_free(l);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- }
- ast_frfree(f);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if (who == l->pchan)
- {
- rpt_mutex_unlock(&myrpt->lock);
- f = ast_read(l->pchan);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- toexit = 1;
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- if (l->chan) ast_write(l->chan,f);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- toexit = 1;
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- }
- ast_frfree(f);
- rpt_mutex_lock(&myrpt->lock);
- break;
- }
- l = l->next;
- }
- rpt_mutex_unlock(&myrpt->lock);
- if (toexit) break;
- if (who == myrpt->monchannel)
- {
- f = ast_read(myrpt->monchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- if (myrpt->monstream)
- ast_writestream(myrpt->monstream,f);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- if (myrpt->parrotchannel && (who == myrpt->parrotchannel))
- {
- f = ast_read(myrpt->parrotchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (!myrpt->p.parrotmode)
- {
- char myfname[300];
-
- if (myrpt->parrotstream)
- {
- ast_closestream(myrpt->parrotstream);
- myrpt->parrotstream = 0;
- }
- sprintf(myfname,PARROTFILE,myrpt->name,myrpt->parrotcnt);
- strcat(myfname,".wav");
- unlink(myfname);
- } else if (f->frametype == AST_FRAME_VOICE)
- {
- if (myrpt->parrotstream)
- ast_writestream(myrpt->parrotstream,f);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- if (myrpt->voxchannel && (who == myrpt->voxchannel))
- {
- f = ast_read(myrpt->voxchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- n = dovox(&myrpt->vox,f->data.ptr,f->datalen / 2);
- if (n != myrpt->wasvox)
- {
- ast_debug(1,"Node %s, vox %d\n",myrpt->name,n);
- myrpt->wasvox = n;
- myrpt->voxtostate = 0;
- if (n) myrpt->voxtotimer = myrpt->p.voxtimeout_ms;
- else myrpt->voxtotimer = 0;
- }
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- if (who == myrpt->txpchannel) /* if it was a read from remote tx */
- {
- f = ast_read(myrpt->txpchannel);
- if (!f)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- }
- usleep(100000);
- ast_hangup(myrpt->pchannel);
- ast_hangup(myrpt->monchannel);
- if (myrpt->parrotchannel) ast_hangup(myrpt->parrotchannel);
- myrpt->parrotstate = 0;
- if (myrpt->voxchannel) ast_hangup(myrpt->voxchannel);
- ast_hangup(myrpt->txpchannel);
- if (myrpt->txchannel != myrpt->rxchannel) ast_hangup(myrpt->txchannel);
- if (myrpt->dahditxchannel != myrpt->txchannel) ast_hangup(myrpt->dahditxchannel);
- if (myrpt->lastf1) ast_frfree(myrpt->lastf1);
- myrpt->lastf1 = NULL;
- if (myrpt->lastf2) ast_frfree(myrpt->lastf2);
- myrpt->lastf2 = NULL;
- ast_hangup(myrpt->rxchannel);
- rpt_mutex_lock(&myrpt->lock);
- l = myrpt->links.next;
- while(l != &myrpt->links)
- {
- struct rpt_link *ll = l;
- /* remove from queue */
- remque((struct qelem *) l);
- /* hang-up on call to device */
- if (l->chan) ast_hangup(l->chan);
- ast_hangup(l->pchan);
- l = l->next;
- ast_free(ll);
- }
- if (myrpt->xlink == 1) myrpt->xlink = 2;
- rpt_mutex_unlock(&myrpt->lock);
- if (debug) printf("@@@@ rpt:Hung up channel\n");
- myrpt->rpt_thread = AST_PTHREADT_STOP;
- pthread_exit(NULL);
- return NULL;
-}
-
-
-static void *rpt_master(void *ignore)
-{
-int i,n;
-pthread_attr_t attr;
-struct ast_config *cfg;
-char *this,*val;
-
- /* init nodelog queue */
- nodelog.next = nodelog.prev = &nodelog;
- /* go thru all the specified repeaters */
- this = NULL;
- n = 0;
-#ifndef OLD_ASTERISK
- /* wait until asterisk starts */
- while(!ast_test_flag(&ast_options,AST_OPT_FLAG_FULLY_BOOTED))
- usleep(250000);
-#endif
-#ifdef NEW_ASTERISK
- rpt_vars[n].cfg = ast_config_load("rpt.conf",config_flags);
-#else
- rpt_vars[n].cfg = ast_config_load("rpt.conf");
-#endif
- cfg = rpt_vars[n].cfg;
- if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
- ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n");
- pthread_exit(NULL);
- }
- while((this = ast_category_browse(cfg,this)) != NULL)
- {
- for(i = 0 ; i < strlen(this) ; i++){
- if((this[i] < '0') || (this[i] > '9'))
- break;
- }
- if(i != strlen(this)) continue; /* Not a node defn */
- memset(&rpt_vars[n],0,sizeof(rpt_vars[n]));
- rpt_vars[n].name = ast_strdup(this);
- val = (char *) ast_variable_retrieve(cfg,this,"rxchannel");
- if (val) rpt_vars[n].rxchanname = ast_strdup(val);
- val = (char *) ast_variable_retrieve(cfg,this,"txchannel");
- if (val) rpt_vars[n].txchanname = ast_strdup(val);
- rpt_vars[n].remote = 0;
- rpt_vars[n].remoterig = "";
- val = (char *) ast_variable_retrieve(cfg,this,"remote");
- if (val)
- {
- rpt_vars[n].remoterig = ast_strdup(val);
- rpt_vars[n].remote = 1;
- }
- val = (char *) ast_variable_retrieve(cfg,this,"radiotype");
- if (val) rpt_vars[n].remoterig = ast_strdup(val);
- ast_mutex_init(&rpt_vars[n].lock);
- ast_mutex_init(&rpt_vars[n].remlock);
- ast_mutex_init(&rpt_vars[n].statpost_lock);
- rpt_vars[n].tele.next = &rpt_vars[n].tele;
- rpt_vars[n].tele.prev = &rpt_vars[n].tele;
- rpt_vars[n].rpt_thread = AST_PTHREADT_NULL;
- rpt_vars[n].tailmessagen = 0;
-#ifdef _MDC_DECODE_H_
- rpt_vars[n].mdc = mdc_decoder_new(8000);
-#endif
- n++;
- }
- nrpts = n;
- ast_config_destroy(cfg);
-
- /* start em all */
- for(i = 0; i < n; i++)
- {
- load_rpt_vars(i,1);
-
- /* if is a remote, don't start one for it */
- if (rpt_vars[i].remote)
- {
- if(retreive_memory(&rpt_vars[i],"init")){ /* Try to retreive initial memory channel */
- if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx450))
- strncpy(rpt_vars[i].freq, "446.500", sizeof(rpt_vars[i].freq) - 1);
- else
- strncpy(rpt_vars[i].freq, "146.580", sizeof(rpt_vars[i].freq) - 1);
- strncpy(rpt_vars[i].rxpl, "100.0", sizeof(rpt_vars[i].rxpl) - 1);
-
- strncpy(rpt_vars[i].txpl, "100.0", sizeof(rpt_vars[i].txpl) - 1);
- rpt_vars[i].remmode = REM_MODE_FM;
- rpt_vars[i].offset = REM_SIMPLEX;
- rpt_vars[i].powerlevel = REM_LOWPWR;
- }
- continue;
- }
- else /* is a normal repeater */
- {
- rpt_vars[i].p.memory = rpt_vars[i].name;
- if(retreive_memory(&rpt_vars[i],"radiofreq")){ /* Try to retreive initial memory channel */
- if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx450))
- strncpy(rpt_vars[i].freq, "446.500", sizeof(rpt_vars[i].freq) - 1);
- else if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx150))
- strncpy(rpt_vars[i].freq, "146.580", sizeof(rpt_vars[i].freq) - 1);
- strncpy(rpt_vars[i].rxpl, "100.0", sizeof(rpt_vars[i].rxpl) - 1);
-
- strncpy(rpt_vars[i].txpl, "100.0", sizeof(rpt_vars[i].txpl) - 1);
- rpt_vars[i].remmode = REM_MODE_FM;
- rpt_vars[i].offset = REM_SIMPLEX;
- rpt_vars[i].powerlevel = REM_LOWPWR;
- }
- ast_log(LOG_NOTICE,"Normal Repeater Init %s %s %s\n",rpt_vars[i].name, rpt_vars[i].remoterig, rpt_vars[i].freq);
- }
- if (!rpt_vars[i].p.ident)
- {
- ast_log(LOG_WARNING,"Did not specify ident for node %s\n",rpt_vars[i].name);
- ast_config_destroy(cfg);
- pthread_exit(NULL);
- }
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
- }
- usleep(500000);
- time(&starttime);
- for(;;)
- {
- /* Now monitor each thread, and restart it if necessary */
- for(i = 0; i < n; i++)
- {
- int rv;
- if (rpt_vars[i].remote) continue;
- if (rpt_vars[i].rpt_thread == AST_PTHREADT_STOP)
- rv = -1;
- else
- rv = pthread_kill(rpt_vars[i].rpt_thread,0);
- if (rv)
- {
- if(time(NULL) - rpt_vars[i].lastthreadrestarttime <= 15)
- {
- if(rpt_vars[i].threadrestarts >= 5)
- {
- ast_log(LOG_ERROR,"Continual RPT thread restarts, killing Asterisk\n");
- exit(1); /* Stuck in a restart loop, kill Asterisk and start over */
- }
- else
- {
- ast_log(LOG_NOTICE,"RPT thread restarted on %s\n",rpt_vars[i].name);
- rpt_vars[i].threadrestarts++;
- }
- }
- else
- rpt_vars[i].threadrestarts = 0;
-
- rpt_vars[i].lastthreadrestarttime = time(NULL);
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
- /* if (!rpt_vars[i].xlink) */
- ast_log(LOG_WARNING, "rpt_thread restarted on node %s\n", rpt_vars[i].name);
- }
-
- }
- for(;;)
- {
- struct nodelog *nodep;
- char *space,datestr[100],fname[300];
- int fd;
-
- ast_mutex_lock(&nodeloglock);
- nodep = nodelog.next;
- if(nodep == &nodelog) /* if nothing in queue */
- {
- ast_mutex_unlock(&nodeloglock);
- break;
- }
- remque((struct qelem *)nodep);
- ast_mutex_unlock(&nodeloglock);
- space = strchr(nodep->str,' ');
- if (!space)
- {
- ast_free(nodep);
- continue;
- }
- *space = 0;
- strftime(datestr,sizeof(datestr) - 1,"%Y%m%d",
- localtime(&nodep->timestamp));
- sprintf(fname,"%s/%s/%s.txt",nodep->archivedir,
- nodep->str,datestr);
- fd = open(fname,O_WRONLY | O_CREAT | O_APPEND,0600);
- if (fd == -1)
- {
- ast_log(LOG_ERROR,"Cannot open node log file %s for write",space + 1);
- ast_free(nodep);
- continue;
- }
- if (write(fd,space + 1,strlen(space + 1)) !=
- strlen(space + 1))
- {
- ast_log(LOG_ERROR,"Cannot write node log file %s for write",space + 1);
- ast_free(nodep);
- continue;
- }
- close(fd);
- ast_free(nodep);
- }
- sleep(2);
- }
- ast_config_destroy(cfg);
- pthread_exit(NULL);
-}
-
-static int rpt_exec(struct ast_channel *chan, const char *data)
-{
- int res=-1,i,rem_totx,rem_rx,remkeyed,n,phone_mode = 0;
- int iskenwood_pci4,authtold,authreq,setting,notremming,reming;
- int ismuted,dtmfed,phone_vox = 0;
-#ifdef OLD_ASTERISK
- struct localuser *u;
-#endif
- char tmp[256], keyed = 0,keyed1 = 0;
- char *options,*stringp,*tele,c,*altp,*memp;
- char sx[320],*sy;
- struct rpt *myrpt;
- struct ast_frame *f,*f1,*f2;
- struct ast_channel *who;
- struct ast_channel *cs[20];
- struct rpt_link *l;
- struct dahdi_confinfo ci; /* conference info */
- struct dahdi_params par;
- int ms,elap,nullfd;
- time_t t,last_timeout_warning;
- struct dahdi_radio_param z;
- struct rpt_tele *telem;
- int numlinks;
- struct ast_format_cap *cap = NULL;
-
- nullfd = open("/dev/null",O_RDWR);
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "Rpt requires an argument (system node)\n");
- return -1;
- }
-
- strncpy(tmp, (char *)data, sizeof(tmp)-1);
- time(&t);
- /* if time has externally shifted negative, screw it */
- if (t < starttime) t = starttime + START_DELAY;
- if ((!starttime) || (t < (starttime + START_DELAY)))
- {
- ast_log(LOG_NOTICE,"Node %s rejecting call: too soon!\n",tmp);
- ast_safe_sleep(chan,3000);
- return -1;
- }
-
- ast_log(LOG_NOTICE,"parsing argument=%s \n",tmp);
-
- altp=strstr(tmp, "|*");
- if(altp){
- altp[0]=0;
- altp++;
- }
-
- memp=strstr(tmp, "|M");
- if(memp){
- memp[0]=0;
- memp+=2;
- }
-
- stringp=tmp;
- strsep(&stringp, "|");
- options = stringp;
-
- ast_log(LOG_NOTICE,"options=%s \n",options);
- if(memp>0)ast_log(LOG_NOTICE,"memp=%s \n",memp);
- if(altp>0)ast_log(LOG_NOTICE,"altp=%s \n",altp);
-
- myrpt = NULL;
- /* see if we can find our specified one */
- for(i = 0; i < nrpts; i++)
- {
- /* if name matches, assign it and exit loop */
- if (!strcmp(tmp,rpt_vars[i].name))
- {
- myrpt = &rpt_vars[i];
- break;
- }
- }
-
- pbx_builtin_setvar_helper(chan, "RPT_STAT_ERR", "");
-
- if (myrpt == NULL)
- {
- pbx_builtin_setvar_helper(chan, "RPT_STAT_ERR", "NODE_NOT_FOUND");
- ast_log(LOG_WARNING, "Cannot find specified system node %s\n",tmp);
- return (priority_jump(NULL,chan));
- }
-
- numlinks=linkcount(myrpt);
-
- if(options && *options == 'q')
- {
- char buf2[128];
-
- if(myrpt->keyed)
- pbx_builtin_setvar_helper(chan, "RPT_STAT_RXKEYED", "1");
- else
- pbx_builtin_setvar_helper(chan, "RPT_STAT_RXKEYED", "0");
-
- if(myrpt->txkeyed)
- pbx_builtin_setvar_helper(chan, "RPT_STAT_TXKEYED", "1");
- else
- pbx_builtin_setvar_helper(chan, "RPT_STAT_TXKEYED", "0");
-
- snprintf(buf2,sizeof(buf2),"%s=%i", "RPT_STAT_XLINK", myrpt->xlink);
- pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%i", "RPT_STAT_LINKS", numlinks);
- pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_WASCHAN", myrpt->waschan);
- pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_NOWCHAN", myrpt->nowchan);
- pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_DUPLEX", myrpt->p.duplex);
- pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_PARROT", myrpt->p.parrotmode);
- pbx_builtin_setvar(chan, buf2);
- //snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_PHONEVOX", myrpt->phonevox);
- //pbx_builtin_setvar(chan, buf2);
- //snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_CONNECTED", myrpt->connected);
- //pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_CALLMODE", myrpt->callmode);
- pbx_builtin_setvar(chan, buf2);
- snprintf(buf2,sizeof(buf2),"%s=%s", "RPT_STAT_LASTTONE", myrpt->lasttone);
- pbx_builtin_setvar(chan, buf2);
-
- return priority_jump(myrpt,chan);
- }
-
- if(options && *options == 'o')
- {
- return(channel_revert(myrpt));
- }
-
- #if 0
- if((altp)&&(*options == 'Z'))
- {
- rpt_push_alt_macro(myrpt,altp);
- return 0;
- }
- #endif
-
-
- /* if not phone access, must be an IAX connection */
- if (options && ((*options == 'P') || (*options == 'D') || (*options == 'R') || (*options == 'S')))
- {
- int val;
-
- pbx_builtin_setvar_helper(chan, "RPT_STAT_BUSY", "0");
-
- myrpt->bargechan=0;
- if(options && strstr(options, "f")>0)
- {
- myrpt->bargechan=1;
- }
-
- if(memp>0)
- {
- char radiochan;
- radiochan=strtod(data,NULL);
- // if(myrpt->nowchan!=0 && radiochan!=myrpt->nowchan && !myrpt->bargechan)
-
- if(numlinks>0 && radiochan!=myrpt->nowchan && !myrpt->bargechan)
- {
- pbx_builtin_setvar_helper(chan, "RPT_STAT_BUSY", "1");
- ast_log(LOG_NOTICE, "Radio Channel Busy.\n");
- return (priority_jump(myrpt,chan));
- }
- else if(radiochan!=myrpt->nowchan || myrpt->bargechan)
- {
- channel_steer(myrpt,memp);
- }
- }
- if(altp)rpt_push_alt_macro(myrpt,altp);
- phone_mode = 1;
- if (*options == 'D') phone_mode = 2;
- if (*options == 'S') phone_mode = 3;
- ast_set_callerid(chan,"0","app_rpt user","0");
- val = 1;
- ast_channel_setoption(chan,AST_OPTION_TONE_VERIFY,&val,sizeof(char),0);
- if ((*(options + 1) == 'V') || (*(options + 1) == 'v')) phone_vox = 1;
- }
- else
- {
-#ifdef ALLOW_LOCAL_CHANNELS
- /* Check to insure the connection is IAX2 or Local*/
- if ( (strncmp(ast_channel_name(chan),"IAX2",4)) && (strncmp(ast_channel_name(chan),"Local",5)) ) {
- ast_log(LOG_WARNING, "We only accept links via IAX2 or Local!!\n");
- return -1;
- }
-#else
- if (strncmp(ast_channel_name(chan),"IAX2",4))
- {
- ast_log(LOG_WARNING, "We only accept links via IAX2!!\n");
- return -1;
- }
-#endif
- if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable){ /* Do not allow incoming radio connections if disabled */
- ast_log(LOG_NOTICE, "Connect attempt to node %s with tx disabled", myrpt->name);
- return -1;
- }
- }
- if (options && (*options == 'R'))
- {
- /* Parts of this section taken from app_parkandannounce */
- char *return_context;
- int length, m, lot, timeout = 0;
- char buffer[256],*template;
- char *working, *context, *exten, *priority;
- char *s,*orig_s;
-
- rpt_mutex_lock(&myrpt->lock);
- m = myrpt->callmode;
- rpt_mutex_unlock(&myrpt->lock);
-
- if ((!myrpt->p.nobusyout) && m)
- {
- if (ast_channel_state(chan) != AST_STATE_UP)
- {
- ast_indicate(chan,AST_CONTROL_BUSY);
- }
- while(ast_safe_sleep(chan,10000) != -1);
- return -1;
- }
-
- if (ast_channel_state(chan) != AST_STATE_UP)
- {
- ast_answer(chan);
- if (!phone_mode) send_newkey(chan);
- }
-
- length=strlen(options)+2;
- orig_s=ast_malloc(length);
- if(!orig_s) {
- ast_log(LOG_WARNING, "Out of memory\n");
- return -1;
- }
- s=orig_s;
- strncpy(s,options,length);
-
- template=strsep(&s,"|");
- if(!template) {
- ast_log(LOG_WARNING, "An announce template must be defined\n");
- ast_free(orig_s);
- return -1;
- }
-
- if(s) {
- timeout = atoi(strsep(&s, "|"));
- timeout *= 1000;
- }
-
- return_context = s;
-
- if(return_context != NULL) {
- /* set the return context. Code borrowed from the Goto builtin */
-
- working = return_context;
- context = strsep(&working, "|");
- exten = strsep(&working, "|");
- if(!exten) {
- /* Only a priority in this one */
- priority = context;
- exten = NULL;
- context = NULL;
- } else {
- priority = strsep(&working, "|");
- if(!priority) {
- /* Only an extension and priority in this one */
- priority = exten;
- exten = context;
- context = NULL;
- }
- }
- if(atoi(priority) < 0) {
- ast_log(LOG_WARNING, "Priority '%s' must be a number > 0\n", priority);
- ast_free(orig_s);
- return -1;
- }
- /* At this point we have a priority and maybe an extension and a context */
- ast_channel_priority_set(chan, atoi(priority));
-#ifdef OLD_ASTERISK
- if(exten && strcasecmp(exten, "BYEXTENSION"))
-#else
- if(exten)
-#endif
- ast_channel_exten_set(chan, exten);
- if(context)
- ast_channel_context_set(chan, context);
- } else { /* increment the priority by default*/
- ast_channel_priority(chan)++;
- }
-
- ast_verb(3, "Return Context: (%s,%s,%d) ID: %s\n",
- ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan),
- S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""));
- if (!ast_exists_extension(chan, ast_channel_context(chan), ast_channel_exten(chan), ast_channel_priority(chan),
- S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
- ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n");
- }
-
- /* we are using masq_park here to protect * from touching the channel once we park it. If the channel comes out of timeout
- before we are done announcing and the channel is messed with, Kablooeee. So we use Masq to prevent this. */
-
- ast_masq_park_call(chan, NULL, timeout, &lot);
-
- ast_verb(3, "Call Parking Called, lot: %d, timeout: %d, context: %s\n", lot, timeout, return_context);
-
- snprintf(buffer, sizeof(buffer) - 1, "%d,%s", lot, template + 1);
-
- rpt_telemetry(myrpt,REV_PATCH,buffer);
-
- ast_free(orig_s);
-
- return 0;
-
- }
-
- if (!options)
- {
- struct ast_hostent ahp;
- struct hostent *hp;
- struct in_addr ia;
- char hisip[100],nodeip[100],*val, *s, *s1, *s2, *s3, *b,*b1;
-
- /* look at callerid to see what node this comes from */
- b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL);
- if (!b) /* if doesn't have caller id */
- {
- ast_log(LOG_WARNING, "Does not have callerid on %s\n",tmp);
- return -1;
- }
- /* get his IP from IAX2 module */
- memset(hisip,0,sizeof(hisip));
-#ifdef ALLOW_LOCAL_CHANNELS
- /* set IP address if this is a local connection*/
- if (strncmp(ast_channel_name(chan),"Local",5)==0) {
- strcpy(hisip,"127.0.0.1");
- } else {
- pbx_substitute_variables_helper(chan,"${IAXPEER(CURRENTCHANNEL)}",hisip,sizeof(hisip) - 1);
- }
-#else
- pbx_substitute_variables_helper(chan,"${IAXPEER(CURRENTCHANNEL)}",hisip,sizeof(hisip) - 1);
-#endif
-
- if (!hisip[0])
- {
- ast_log(LOG_WARNING, "Link IP address cannot be determined!!\n");
- return -1;
- }
-
- b1 = ast_strdupa(b);
- ast_shrink_phone_number(b1);
- if (!strcmp(myrpt->name,b1))
- {
- ast_log(LOG_WARNING, "Trying to link to self!!\n");
- return -1;
- }
-
- if (*b1 < '1')
- {
- ast_log(LOG_WARNING, "Node %s Invalid for connection here!!\n",b1);
- return -1;
- }
-
-
- /* look for his reported node string */
- val = node_lookup(myrpt,b1);
- if (!val)
- {
- ast_log(LOG_WARNING, "Reported node %s cannot be found!!\n",b1);
- return -1;
- }
- strncpy(tmp,val,sizeof(tmp) - 1);
- s = tmp;
- s1 = strsep(&s,",");
- if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
- {
- sy = strchr(s1,'/');
- *sy = 0;
- sprintf(sx,"%s:4569/%s",s1,sy + 1);
- s1 = sx;
- }
- s2 = strsep(&s,",");
- if (!s2)
- {
- ast_log(LOG_WARNING, "Reported node %s not in correct format!!\n",b1);
- return -1;
- }
- if (strcmp(s2,"NONE")) {
- hp = ast_gethostbyname(s2, &ahp);
- if (!hp)
- {
- ast_log(LOG_WARNING, "Reported node %s, name %s cannot be found!!\n",b1,s2);
- return -1;
- }
- memcpy(&ia,hp->h_addr,sizeof(in_addr_t));
-#ifdef OLD_ASTERISK
- ast_inet_ntoa(nodeip,sizeof(nodeip) - 1,ia);
-#else
- strncpy(nodeip,ast_inet_ntoa(ia),sizeof(nodeip) - 1);
-#endif
- s3 = strchr(hisip,':');
- if (s3) *s3 = 0;
- if (strcmp(hisip,nodeip))
- {
- s3 = strchr(s1,'@');
- if (s3) s1 = s3 + 1;
- s3 = strchr(s1,'/');
- if (s3) *s3 = 0;
- s3 = strchr(s1,':');
- if (s3) *s3 = 0;
- hp = ast_gethostbyname(s1, &ahp);
- if (!hp)
- {
- ast_log(LOG_WARNING, "Reported node %s, name %s cannot be found!!\n",b1,s1);
- return -1;
- }
- memcpy(&ia,hp->h_addr,sizeof(in_addr_t));
-#ifdef OLD_ASTERISK
- ast_inet_ntoa(nodeip,sizeof(nodeip) - 1,ia);
-#else
- strncpy(nodeip,ast_inet_ntoa(ia),sizeof(nodeip) - 1);
-#endif
- if (strcmp(hisip,nodeip))
- {
- ast_log(LOG_WARNING, "Node %s IP %s does not match link IP %s!!\n",b1,nodeip,hisip);
- return -1;
- }
- }
- }
- }
-
- /* if is not a remote */
- if (!myrpt->remote)
- {
- char *b,*b1;
- int reconnects = 0;
-
- rpt_mutex_lock(&myrpt->lock);
- i = myrpt->xlink;
- rpt_mutex_unlock(&myrpt->lock);
- if (i)
- {
- ast_log(LOG_WARNING, "Cannot connect to node %s, system busy\n",myrpt->name);
- return -1;
- }
- /* look at callerid to see what node this comes from */
- b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL);
- if (!b) /* if doesn't have caller id */
- {
- ast_log(LOG_WARNING, "Doesnt have callerid on %s\n",tmp);
- return -1;
- }
-
- b1 = ast_strdupa(b);
- ast_shrink_phone_number(b1);
- if (!strcmp(myrpt->name,b1))
- {
- ast_log(LOG_WARNING, "Trying to link to self!!\n");
- return -1;
- }
- rpt_mutex_lock(&myrpt->lock);
- l = myrpt->links.next;
- /* try to find this one in queue */
- while(l != &myrpt->links)
- {
- if (l->name[0] == '0')
- {
- l = l->next;
- continue;
- }
- /* if found matching string */
- if (!strcmp(l->name,b1)) break;
- l = l->next;
- }
- /* if found */
- if (l != &myrpt->links)
- {
- l->killme = 1;
- l->retries = l->max_retries + 1;
- l->disced = 2;
- reconnects = l->reconnects;
- reconnects++;
- rpt_mutex_unlock(&myrpt->lock);
- usleep(500000);
- } else
- rpt_mutex_unlock(&myrpt->lock);
- /* establish call in tranceive mode */
- l = ast_malloc(sizeof(struct rpt_link));
- if (!l)
- {
- ast_log(LOG_WARNING, "Unable to malloc\n");
- pthread_exit(NULL);
- }
- /* zero the silly thing */
- memset((char *)l,0,sizeof(struct rpt_link));
- l->mode = 1;
- strncpy(l->name,b1,MAXNODESTR - 1);
- l->isremote = 0;
- l->chan = chan;
- l->connected = 1;
- l->thisconnected = 1;
- l->hasconnected = 1;
- l->reconnects = reconnects;
- l->phonemode = phone_mode;
- l->phonevox = phone_vox;
- l->lastf1 = NULL;
- l->lastf2 = NULL;
- l->dtmfed = 0;
- voxinit_link(l,1);
- ast_set_read_format_by_id(l->chan,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(l->chan,AST_FORMAT_SLINEAR);
- /* allocate a pseudo-channel thru asterisk */
- l->pchan = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!l->pchan)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(l->pchan,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(l->pchan,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(l->pchan))
- ast_set_flag(ast_channel_cdr(l->pchan),AST_CDR_FLAG_POST_DISABLED);
-#endif
- /* make a conference for the tx */
- ci.chan = 0;
- ci.confno = myrpt->conf;
- ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER;
- /* first put the channel on the conference in proper mode */
- if (ioctl(l->pchan->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- pthread_exit(NULL);
- }
- rpt_mutex_lock(&myrpt->lock);
- if ((phone_mode == 2) && (!phone_vox)) l->lastrealrx = 1;
- l->max_retries = MAX_RETRIES;
- /* insert at end of queue */
- insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
- __kickshort(myrpt);
- rpt_mutex_unlock(&myrpt->lock);
- if (ast_channel_state(chan) != AST_STATE_UP) {
- ast_answer(chan);
- if (!phone_mode) send_newkey(chan);
- }
- if (myrpt->p.archivedir)
- {
- char str[100];
-
- if (l->phonemode)
- sprintf(str,"LINK(P),%s",l->name);
- else
- sprintf(str,"LINK,%s",l->name);
- donodelog(myrpt,str);
- }
- if (!phone_mode) send_newkey(chan);
- return 0;
- }
- /* well, then it is a remote */
- rpt_mutex_lock(&myrpt->lock);
- /* if remote, error if anyone else already linked */
- if (myrpt->remoteon)
- {
- rpt_mutex_unlock(&myrpt->lock);
- usleep(500000);
- if (myrpt->remoteon)
- {
- ast_log(LOG_WARNING, "Trying to use busy link on %s\n",tmp);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(chan))
- ast_set_flag(ast_channel_cdr(chan),AST_CDR_FLAG_POST_DISABLED);
-#endif
- return -1;
- }
- rpt_mutex_lock(&myrpt->lock);
- }
- if (myrpt->p.rptnode)
- {
- char killedit = 0;
- time_t now;
-
- time(&now);
- for(i = 0; i < nrpts; i++)
- {
- if (!strcasecmp(rpt_vars[i].name,myrpt->p.rptnode))
- {
- if ((rpt_vars[i].links.next != &rpt_vars[i].links) ||
- rpt_vars[i].keyed ||
- ((rpt_vars[i].lastkeyedtime + RPT_LOCKOUT_SECS) > now) ||
- rpt_vars[i].txkeyed ||
- ((rpt_vars[i].lasttxkeyedtime + RPT_LOCKOUT_SECS) > now))
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_WARNING, "Trying to use busy link (repeater node %s) on %s\n",rpt_vars[i].name,tmp);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(chan))
- ast_set_flag(ast_channel_cdr(chan),AST_CDR_FLAG_POST_DISABLED);
-#endif
- return -1;
- }
- while(rpt_vars[i].xlink != 3)
- {
- if (!killedit)
- {
- ast_softhangup(rpt_vars[i].rxchannel,AST_SOFTHANGUP_DEV);
- rpt_vars[i].xlink = 1;
- killedit = 1;
- }
- rpt_mutex_unlock(&myrpt->lock);
- if (ast_safe_sleep(chan,500) == -1)
- {
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(chan))
- ast_set_flag(ast_channel_cdr(chan),AST_CDR_FLAG_POST_DISABLED);
-#endif
- return -1;
- }
- rpt_mutex_lock(&myrpt->lock);
- }
- break;
- }
- }
- }
-
-#ifdef HAVE_IOPERM
- if ( (!strcmp(myrpt->remoterig, remote_rig_rbi)||!strcmp(myrpt->remoterig, remote_rig_ppp16)) &&
- (ioperm(myrpt->p.iobase,1,1) == -1))
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_log(LOG_WARNING, "Can't get io permission on IO port %x hex\n",myrpt->p.iobase);
- return -1;
- }
-#endif
- myrpt->remoteon = 1;
-#ifdef OLD_ASTERISK
- LOCAL_USER_ADD(u);
-#endif
- rpt_mutex_unlock(&myrpt->lock);
- /* find our index, and load the vars initially */
- for(i = 0; i < nrpts; i++)
- {
- if (&rpt_vars[i] == myrpt)
- {
- load_rpt_vars(i,0);
- break;
- }
- }
- rpt_mutex_lock(&myrpt->lock);
- tele = strchr(myrpt->rxchanname,'/');
- if (!tele)
- {
- fprintf(stderr,"rpt:Dial number must be in format tech/number\n");
- rpt_mutex_unlock(&myrpt->lock);
- pthread_exit(NULL);
- }
- *tele++ = 0;
- myrpt->rxchannel = ast_request(myrpt->rxchanname, get_slin_cap(cap), NULL, tele, NULL);
- cap = ast_format_cap_destroy(cap);
- myrpt->dahdirxchannel = NULL;
- if (!strcasecmp(myrpt->rxchanname,"DAHDI"))
- myrpt->dahdirxchannel = myrpt->rxchannel;
- if (myrpt->rxchannel)
- {
- ast_set_read_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(myrpt->rxchannel))
- ast_set_flag(ast_channel_cdr(myrpt->rxchannel),AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef NEW_ASTERISK
- myrpt->rxchannel->whentohangup = 0;
-#endif
- ast_channel_appl_set(myrpt->rxchannel, "Apprpt");
- ast_channel_data_set(myrpt->rxchannel, "(Link Rx)");
- ast_verb(3, "rpt (Rx) initiating call to %s/%s on %s\n",
- myrpt->rxchanname,tele,ast_channel_name(myrpt->rxchannel));
- rpt_mutex_unlock(&myrpt->lock);
- ast_call(myrpt->rxchannel,tele,999);
- rpt_mutex_lock(&myrpt->lock);
- }
- else
- {
- fprintf(stderr,"rpt:Sorry unable to obtain Rx channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- pthread_exit(NULL);
- }
- *--tele = '/';
- myrpt->dahditxchannel = NULL;
- if (myrpt->txchanname)
- {
- tele = strchr(myrpt->txchanname,'/');
- if (!tele)
- {
- fprintf(stderr,"rpt:Dial number must be in format tech/number\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- pthread_exit(NULL);
- }
- *tele++ = 0;
- myrpt->txchannel = ast_request(myrpt->txchanname, get_slin_cap(cap), NULL, tele, NULL);
- cap = ast_format_cap_destroy(cap);
- if (!strncasecmp(myrpt->txchanname,"DAHDI",3))
- myrpt->dahditxchannel = myrpt->txchannel;
- if (myrpt->txchannel)
- {
- ast_set_read_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(myrpt->txchannel))
- ast_set_flag(ast_channel_cdr(myrpt->txchannel),AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef NEW_ASTERISK
- myrpt->txchannel->whentohangup = 0;
-#endif
- ast_channel_appl_set(myrpt->txchannel, "Apprpt");
- ast_channel_data_set(myrpt->txchannel, "(Link Tx)");
- ast_verb(3, "rpt (Tx) initiating call to %s/%s on %s\n",
- myrpt->txchanname,tele,ast_channel_name(myrpt->txchannel));
- rpt_mutex_unlock(&myrpt->lock);
- ast_call(myrpt->txchannel,tele,999);
- rpt_mutex_lock(&myrpt->lock);
- }
- else
- {
- fprintf(stderr,"rpt:Sorry unable to obtain Tx channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->rxchannel);
- pthread_exit(NULL);
- }
- *--tele = '/';
- }
- else
- {
- myrpt->txchannel = myrpt->rxchannel;
- if (!strncasecmp(myrpt->rxchanname,"DAHDI",3))
- myrpt->dahditxchannel = myrpt->rxchannel;
- }
- /* allocate a pseudo-channel thru asterisk */
- myrpt->pchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
- cap = ast_format_cap_destroy(cap);
- if (!myrpt->pchannel)
- {
- fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- pthread_exit(NULL);
- }
- ast_set_read_format_by_id(myrpt->pchannel,AST_FORMAT_SLINEAR);
- ast_set_write_format_by_id(myrpt->pchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
- if (ast_channel_cdr(myrpt->pchannel))
- ast_set_flag(ast_channel_cdr(myrpt->pchannel),AST_CDR_FLAG_POST_DISABLED);
-#endif
- if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel;
- if (!myrpt->dahditxchannel) myrpt->dahditxchannel = myrpt->pchannel;
- /* make a conference for the pseudo */
- ci.chan = 0;
- ci.confno = -1; /* make a new conf */
- ci.confmode = DAHDI_CONF_CONFANNMON ;
- /* first put the channel on the conference in announce/monitor mode */
- if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
- {
- ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- pthread_exit(NULL);
- }
- /* save pseudo channel conference number */
- myrpt->conf = myrpt->txconf = ci.confno;
- /* if serial io port, open it */
- myrpt->iofd = -1;
- if (myrpt->p.ioport && ((myrpt->iofd = openserial(myrpt,myrpt->p.ioport)) == -1))
- {
- rpt_mutex_unlock(&myrpt->lock);
- ast_hangup(myrpt->pchannel);
- if (myrpt->txchannel != myrpt->rxchannel)
- ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- pthread_exit(NULL);
- }
- iskenwood_pci4 = 0;
- memset(&z,0,sizeof(z));
- if ((myrpt->iofd < 1) && (myrpt->txchannel == myrpt->dahditxchannel))
- {
- z.radpar = DAHDI_RADPAR_REMMODE;
- z.data = DAHDI_RADPAR_REM_NONE;
- res = ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z);
- /* if PCIRADIO and kenwood selected */
- if ((!res) && (!strcmp(myrpt->remoterig,remote_rig_kenwood)))
- {
- z.radpar = DAHDI_RADPAR_UIOMODE;
- z.data = 1;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
- return -1;
- }
- z.radpar = DAHDI_RADPAR_UIODATA;
- z.data = 3;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIODATA\n");
- return -1;
- }
- i = DAHDI_OFFHOOK;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set hook\n");
- return -1;
- }
- iskenwood_pci4 = 1;
- }
- }
- if (myrpt->txchannel == myrpt->dahditxchannel)
- {
- i = DAHDI_ONHOOK;
- ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i);
- /* if PCIRADIO and Yaesu ft897/ICOM IC-706 selected */
- if ((myrpt->iofd < 1) && (!res) &&
- ((!strcmp(myrpt->remoterig,remote_rig_ft897)) ||
- (!strcmp(myrpt->remoterig,remote_rig_ic706)) ||
- (!strcmp(myrpt->remoterig,remote_rig_tm271))))
- {
- z.radpar = DAHDI_RADPAR_UIOMODE;
- z.data = 1;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
- return -1;
- }
- z.radpar = DAHDI_RADPAR_UIODATA;
- z.data = 3;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIODATA\n");
- return -1;
- }
- }
- }
- myrpt->remoterx = 0;
- myrpt->remotetx = 0;
- myrpt->retxtimer = 0;
- myrpt->rerxtimer = 0;
- myrpt->remoteon = 1;
- myrpt->dtmfidx = -1;
- myrpt->dtmfbuf[0] = 0;
- myrpt->dtmf_time_rem = 0;
- myrpt->hfscanmode = 0;
- myrpt->hfscanstatus = 0;
- if (myrpt->p.startupmacro)
- {
- snprintf(myrpt->macrobuf,MAXMACRO - 1,"PPPP%s",myrpt->p.startupmacro);
- }
- time(&myrpt->start_time);
- myrpt->last_activity_time = myrpt->start_time;
- last_timeout_warning = 0;
- myrpt->reload = 0;
- myrpt->tele.next = &myrpt->tele;
- myrpt->tele.prev = &myrpt->tele;
- myrpt->newkey = 0;
- rpt_mutex_unlock(&myrpt->lock);
- ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR);
- ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR);
- rem_rx = 0;
- remkeyed = 0;
- /* if we are on 2w loop and are a remote, turn EC on */
- if (myrpt->remote && (myrpt->rxchannel == myrpt->txchannel))
- {
- i = 128;
- ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_ECHOCANCEL,&i);
- }
- if (ast_channel_state(chan) != AST_STATE_UP) {
- ast_answer(chan);
- if (!phone_mode) send_newkey(chan);
- }
-
- if (myrpt->rxchannel == myrpt->dahdirxchannel)
- {
- if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_GET_PARAMS,&par) != -1)
- {
- if (par.rxisoffhook)
- {
- ast_indicate(chan,AST_CONTROL_RADIO_KEY);
- myrpt->remoterx = 1;
- remkeyed = 1;
- }
- }
- }
- if (myrpt->p.archivedir)
- {
- char mycmd[100],mydate[100],*b,*b1;
- time_t myt;
- long blocksleft;
-
-
- mkdir(myrpt->p.archivedir,0600);
- sprintf(mycmd,"%s/%s",myrpt->p.archivedir,myrpt->name);
- mkdir(mycmd,0600);
- time(&myt);
- strftime(mydate,sizeof(mydate) - 1,"%Y%m%d%H%M%S",
- localtime(&myt));
- sprintf(mycmd,"mixmonitor start %s %s/%s/%s.wav49 a",ast_channel_name(chan),
- myrpt->p.archivedir,myrpt->name,mydate);
- if (myrpt->p.monminblocks)
- {
- blocksleft = diskavail(myrpt);
- if (myrpt->p.remotetimeout)
- {
- blocksleft -= (myrpt->p.remotetimeout *
- MONITOR_DISK_BLOCKS_PER_MINUTE) / 60;
- }
- if (blocksleft >= myrpt->p.monminblocks)
- ast_cli_command(nullfd,mycmd);
- } else ast_cli_command(nullfd,mycmd);
- /* look at callerid to see what node this comes from */
- b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL);
- if (!b) /* if doesn't have caller id */
- {
- b1 = "0";
- } else {
- b1 = ast_strdupa(b);
- ast_shrink_phone_number(b1);
- }
- sprintf(mycmd,"CONNECT,%s",b1);
- donodelog(myrpt,mycmd);
- }
- myrpt->loginuser[0] = 0;
- myrpt->loginlevel[0] = 0;
- myrpt->authtelltimer = 0;
- myrpt->authtimer = 0;
- authtold = 0;
- authreq = 0;
- if (myrpt->p.authlevel > 1) authreq = 1;
- setrem(myrpt);
- n = 0;
- dtmfed = 0;
- cs[n++] = chan;
- cs[n++] = myrpt->rxchannel;
- cs[n++] = myrpt->pchannel;
- if (myrpt->rxchannel != myrpt->txchannel)
- cs[n++] = myrpt->txchannel;
- if (!phone_mode) send_newkey(chan);
- /* start un-locked */
- for(;;)
- {
- if (ast_check_hangup(chan)) break;
- if (ast_check_hangup(myrpt->rxchannel)) break;
- notremming = 0;
- setting = 0;
- reming = 0;
- telem = myrpt->tele.next;
- while(telem != &myrpt->tele)
- {
- if (telem->mode == SETREMOTE) setting = 1;
- if ((telem->mode == SETREMOTE) ||
- (telem->mode == SCAN) ||
- (telem->mode == TUNE)) reming = 1;
- else notremming = 1;
- telem = telem->next;
- }
- if (myrpt->reload)
- {
- myrpt->reload = 0;
- /* find our index, and load the vars */
- for(i = 0; i < nrpts; i++)
- {
- if (&rpt_vars[i] == myrpt)
- {
- load_rpt_vars(i,0);
- break;
- }
- }
- }
- time(&t);
- if (myrpt->p.remotetimeout)
- {
- time_t r;
-
- r = (t - myrpt->start_time);
- if (r >= myrpt->p.remotetimeout)
- {
- saynode(myrpt,chan,myrpt->name);
- sayfile(chan,"rpt/timeout");
- ast_safe_sleep(chan,1000);
- break;
- }
- if ((myrpt->p.remotetimeoutwarning) &&
- (r >= (myrpt->p.remotetimeout -
- myrpt->p.remotetimeoutwarning)) &&
- (r <= (myrpt->p.remotetimeout -
- myrpt->p.remotetimeoutwarningfreq)))
- {
- if (myrpt->p.remotetimeoutwarningfreq)
- {
- if ((t - last_timeout_warning) >=
- myrpt->p.remotetimeoutwarningfreq)
- {
- time(&last_timeout_warning);
- rpt_telemetry(myrpt,TIMEOUT_WARNING,0);
- }
- }
- else
- {
- if (!last_timeout_warning)
- {
- time(&last_timeout_warning);
- rpt_telemetry(myrpt,TIMEOUT_WARNING,0);
- }
- }
- }
- }
- if (myrpt->p.remoteinacttimeout && myrpt->last_activity_time)
- {
- time_t r;
-
- r = (t - myrpt->last_activity_time);
- if (r >= myrpt->p.remoteinacttimeout)
- {
- saynode(myrpt,chan,myrpt->name);
- ast_safe_sleep(chan,1000);
- break;
- }
- if ((myrpt->p.remotetimeoutwarning) &&
- (r >= (myrpt->p.remoteinacttimeout -
- myrpt->p.remotetimeoutwarning)) &&
- (r <= (myrpt->p.remoteinacttimeout -
- myrpt->p.remotetimeoutwarningfreq)))
- {
- if (myrpt->p.remotetimeoutwarningfreq)
- {
- if ((t - last_timeout_warning) >=
- myrpt->p.remotetimeoutwarningfreq)
- {
- time(&last_timeout_warning);
- rpt_telemetry(myrpt,ACT_TIMEOUT_WARNING,0);
- }
- }
- else
- {
- if (!last_timeout_warning)
- {
- time(&last_timeout_warning);
- rpt_telemetry(myrpt,ACT_TIMEOUT_WARNING,0);
- }
- }
- }
- }
- ms = MSWAIT;
- who = ast_waitfor_n(cs,n,&ms);
- if (who == NULL) ms = 0;
- elap = MSWAIT - ms;
- if (myrpt->macrotimer) myrpt->macrotimer -= elap;
- if (myrpt->macrotimer < 0) myrpt->macrotimer = 0;
- if (!ms) continue;
- /* do local dtmf timer */
- if (myrpt->dtmf_local_timer)
- {
- if (myrpt->dtmf_local_timer > 1) myrpt->dtmf_local_timer -= elap;
- if (myrpt->dtmf_local_timer < 1) myrpt->dtmf_local_timer = 1;
- }
- rpt_mutex_lock(&myrpt->lock);
- do_dtmf_local(myrpt,0);
- rpt_mutex_unlock(&myrpt->lock);
- //
- rem_totx = myrpt->dtmf_local_timer && (!phone_mode);
- rem_totx |= keyed && (!myrpt->tunerequest);
- rem_rx = (remkeyed && (!setting)) || (myrpt->tele.next != &myrpt->tele);
- if(!strcmp(myrpt->remoterig, remote_rig_ic706))
- rem_totx |= myrpt->tunerequest;
- //
- if((debug > 6) && rem_totx) {
- ast_log(LOG_NOTICE,"Set rem_totx=%i. dtmf_local_timer=%i phone_mode=%i keyed=%i tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,phone_mode,keyed,myrpt->tunerequest);
- }
- if (keyed && (!keyed1))
- {
- keyed1 = 1;
- }
-
- if (!keyed && (keyed1))
- {
- time_t myt;
-
- keyed1 = 0;
- time(&myt);
- /* if login necessary, and not too soon */
- if ((myrpt->p.authlevel) &&
- (!myrpt->loginlevel[0]) &&
- (myt > (t + 3)))
- {
- authreq = 1;
- authtold = 0;
- myrpt->authtelltimer = AUTHTELLTIME - AUTHTXTIME;
- }
- }
-
- if (rem_rx && (!myrpt->remoterx))
- {
- myrpt->remoterx = 1;
- ast_indicate(chan,AST_CONTROL_RADIO_KEY);
- }
- if ((!rem_rx) && (myrpt->remoterx))
- {
- myrpt->remoterx = 0;
- ast_indicate(chan,AST_CONTROL_RADIO_UNKEY);
- }
- /* if auth requested, and not authed yet */
- if (authreq && (!myrpt->loginlevel[0]))
- {
- if ((!authtold) && ((myrpt->authtelltimer += elap)
- >= AUTHTELLTIME))
- {
- authtold = 1;
- rpt_telemetry(myrpt,LOGINREQ,NULL);
- }
- if ((myrpt->authtimer += elap) >= AUTHLOGOUTTIME)
- {
- break; /* if not logged in, hang up after a time */
- }
- }
- if (myrpt->newkey)
- {
- if ((myrpt->retxtimer += elap) >= REDUNDANT_TX_TIME)
- {
- myrpt->retxtimer = 0;
- if ((myrpt->remoterx) && (!myrpt->remotetx))
- ast_indicate(chan,AST_CONTROL_RADIO_KEY);
- else
- ast_indicate(chan,AST_CONTROL_RADIO_UNKEY);
- }
-
- if ((myrpt->rerxtimer += elap) >= (REDUNDANT_TX_TIME * 2))
- {
- keyed = 0;
- myrpt->rerxtimer = 0;
- }
- }
- if (rem_totx && (!myrpt->remotetx))
- {
- /* if not authed, and needed, do not transmit */
- if ((!myrpt->p.authlevel) || myrpt->loginlevel[0])
- {
- if(debug > 6)
- ast_log(LOG_NOTICE,"Handle rem_totx=%i. dtmf_local_timer=%i tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,myrpt->tunerequest);
-
- myrpt->remotetx = 1;
- /* asdf maw ??? is this really what you want? Doesn't it always get executed? */
- if((myrpt->remtxfreqok = check_tx_freq(myrpt)))
- {
- time(&myrpt->last_activity_time);
- if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
- {
- z.radpar = DAHDI_RADPAR_UIODATA;
- z.data = 1;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIODATA\n");
- return -1;
- }
- }
- else
- {
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
- }
- if (myrpt->p.archivedir) donodelog(myrpt,"TXKEY");
- }
- }
- }
- if ((!rem_totx) && myrpt->remotetx) /* Remote base radio TX unkey */
- {
- myrpt->remotetx = 0;
- if(!myrpt->remtxfreqok){
- rpt_telemetry(myrpt,UNAUTHTX,NULL);
- }
- if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
- {
- z.radpar = DAHDI_RADPAR_UIODATA;
- z.data = 3;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIODATA\n");
- return -1;
- }
- }
- else
- {
- ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
- }
- if (myrpt->p.archivedir) donodelog(myrpt,"TXUNKEY");
- }
- if (myrpt->hfscanmode){
- myrpt->scantimer -= elap;
- if(myrpt->scantimer <= 0){
- if (!reming)
- {
- myrpt->scantimer = REM_SCANTIME;
- rpt_telemetry(myrpt,SCAN,0);
- } else myrpt->scantimer = 1;
- }
- }
- rpt_mutex_lock(&myrpt->lock);
- c = myrpt->macrobuf[0];
- if (c && (!myrpt->macrotimer))
- {
- myrpt->macrotimer = MACROTIME;
- memmove(myrpt->macrobuf,myrpt->macrobuf + 1,MAXMACRO - 1);
- if ((c == 'p') || (c == 'P'))
- myrpt->macrotimer = MACROPTIME;
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->p.archivedir)
- {
- char str[100];
- sprintf(str,"DTMF(M),%c",c);
- donodelog(myrpt,str);
- }
- if (handle_remote_dtmf_digit(myrpt,c,&keyed,0) == -1) break;
- continue;
- } else rpt_mutex_unlock(&myrpt->lock);
- if (who == chan) /* if it was a read from incoming */
- {
- f = ast_read(chan);
- if (!f)
- {
- if (debug) printf("@@@@ link:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- if (ioctl(chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
- {
- ismuted = 0;
- }
- /* if not transmitting, zero-out audio */
- ismuted |= (!myrpt->remotetx);
- if (dtmfed && phone_mode) ismuted = 1;
- dtmfed = 0;
- if (ismuted)
- {
- memset(f->data.ptr,0,f->datalen);
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- }
- if (f) f2 = ast_frdup(f);
- else f2 = NULL;
- f1 = myrpt->lastf2;
- myrpt->lastf2 = myrpt->lastf1;
- myrpt->lastf1 = f2;
- if (ismuted)
- {
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- }
- if (f1)
- {
- if (phone_mode)
- ast_write(myrpt->txchannel,f1);
- else
- ast_write(myrpt->txchannel,f);
- ast_frfree(f1);
- }
- }
-#ifndef OLD_ASTERISK
- else if (f->frametype == AST_FRAME_DTMF_BEGIN)
- {
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- dtmfed = 1;
- }
-#endif
- if (f->frametype == AST_FRAME_DTMF)
- {
- if (myrpt->lastf1)
- memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
- if (myrpt->lastf2)
- memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
- dtmfed = 1;
- if (handle_remote_phone_dtmf(myrpt,f->subclass.integer,&keyed,phone_mode) == -1)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- if (f->frametype == AST_FRAME_TEXT)
- {
- if (handle_remote_data(myrpt,f->data.ptr) == -1)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- /* if RX key */
- if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
- {
- if (debug == 7) printf("@@@@ rx key\n");
- keyed = 1;
- myrpt->rerxtimer = 0;
- }
- /* if RX un-key */
- if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
- {
- myrpt->rerxtimer = 0;
- if (debug == 7) printf("@@@@ rx un-key\n");
- keyed = 0;
- }
- }
- ast_frfree(f);
- continue;
- }
- if (who == myrpt->rxchannel) /* if it was a read from radio */
- {
- f = ast_read(myrpt->rxchannel);
- if (!f)
- {
- if (debug) printf("@@@@ link:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- int myreming = 0;
-
- if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
- myreming = reming;
-
- if (myreming || (!remkeyed) ||
- ((myrpt->remote) && (myrpt->remotetx)) ||
- ((myrpt->remmode != REM_MODE_FM) &&
- notremming))
- memset(f->data.ptr,0,f->datalen);
- ast_write(myrpt->pchannel,f);
- }
- else if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- /* if RX key */
- if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
- {
- if (debug == 7) printf("@@@@ remote rx key\n");
- if (!myrpt->remotetx)
- {
- remkeyed = 1;
- }
- }
- /* if RX un-key */
- if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
- {
- if (debug == 7) printf("@@@@ remote rx un-key\n");
- if (!myrpt->remotetx)
- {
- remkeyed = 0;
- }
- }
- }
- ast_frfree(f);
- continue;
- }
- if (who == myrpt->pchannel) /* if is remote mix output */
- {
- f = ast_read(myrpt->pchannel);
- if (!f)
- {
- if (debug) printf("@@@@ link:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_VOICE)
- {
- ast_write(chan,f);
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- if ((myrpt->rxchannel != myrpt->txchannel) &&
- (who == myrpt->txchannel)) /* do this cuz you have to */
- {
- f = ast_read(myrpt->txchannel);
- if (!f)
- {
- if (debug) printf("@@@@ link:Hung Up\n");
- break;
- }
- if (f->frametype == AST_FRAME_CONTROL)
- {
- if (f->subclass.integer == AST_CONTROL_HANGUP)
- {
- if (debug) printf("@@@@ rpt:Hung Up\n");
- ast_frfree(f);
- break;
- }
- }
- ast_frfree(f);
- continue;
- }
- }
- if (myrpt->p.archivedir)
- {
- char mycmd[100],*b,*b1;
-
- /* look at callerid to see what node this comes from */
- b = S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL);
- if (!b) /* if doesn't have caller id */
- {
- b1 = "0";
- } else {
- b1 = ast_strdupa(b);
- ast_shrink_phone_number(b1);
- }
- sprintf(mycmd,"DISCONNECT,%s",b1);
- donodelog(myrpt,mycmd);
- }
- /* wait for telem to be done */
- while(myrpt->tele.next != &myrpt->tele) usleep(100000);
- sprintf(tmp,"mixmonitor stop %s",ast_channel_name(chan));
- ast_cli_command(nullfd,tmp);
- close(nullfd);
- rpt_mutex_lock(&myrpt->lock);
- myrpt->hfscanmode = 0;
- myrpt->hfscanstatus = 0;
- myrpt->remoteon = 0;
- rpt_mutex_unlock(&myrpt->lock);
- if (myrpt->lastf1) ast_frfree(myrpt->lastf1);
- myrpt->lastf1 = NULL;
- if (myrpt->lastf2) ast_frfree(myrpt->lastf2);
- myrpt->lastf2 = NULL;
- if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
- {
- z.radpar = DAHDI_RADPAR_UIOMODE;
- z.data = 3;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
- return -1;
- }
- z.radpar = DAHDI_RADPAR_UIODATA;
- z.data = 3;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set UIODATA\n");
- return -1;
- }
- i = DAHDI_OFFHOOK;
- if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i) == -1)
- {
- ast_log(LOG_ERROR,"Cannot set hook\n");
- return -1;
- }
- }
- if (myrpt->iofd) close(myrpt->iofd);
- myrpt->iofd = -1;
- ast_hangup(myrpt->pchannel);
- if (myrpt->rxchannel != myrpt->txchannel) ast_hangup(myrpt->txchannel);
- ast_hangup(myrpt->rxchannel);
- closerem(myrpt);
- if (myrpt->p.rptnode)
- {
- rpt_mutex_lock(&myrpt->lock);
- for(i = 0; i < nrpts; i++)
- {
- if (!strcasecmp(rpt_vars[i].name,myrpt->p.rptnode))
- {
- rpt_vars[i].xlink = 0;
- break;
- }
- }
- rpt_mutex_unlock(&myrpt->lock);
- }
-#ifdef OLD_ASTERISK
- LOCAL_USER_REMOVE(u);
-#endif
- return res;
-}
-
-#ifndef OLD_ASTERISK
-/*!\brief callback to display list of locally configured nodes
- \addtogroup Group_AMI
- */
-static int manager_rpt_local_nodes(struct mansession *s, const struct message *m)
-{
- int i;
- astman_append(s, "<?xml version=\"1.0\"?>\r\n");
- astman_append(s, "<nodes>\r\n");
- for (i=0; i< nrpts; i++)
- {
- astman_append(s, " <node>%s</node>\r\n", rpt_vars[i].name);
- } /* for i */
- astman_append(s, "</nodes>\r\n");
- astman_append(s, "\r\n"); /* Properly terminate Manager output */
- return RESULT_SUCCESS;
-} /* manager_rpt_local_nodes() */
-
-
-
-/*
- * Append Success and ActionID to manager response message
- */
-
-static void rpt_manager_success(struct mansession *s, const struct message *m)
-{
- const char *id = astman_get_header(m, "ActionID");
- if (!ast_strlen_zero(id))
- astman_append(s, "ActionID: %s\r\n", id);
- astman_append(s, "Response: Success\r\n");
-}
-
-/*
-* Dump statistics to manager session
-*/
-
-static int rpt_manager_do_stats(struct mansession *s, const struct message *m, char *str)
-{
- int i,j,numoflinks;
- int dailytxtime, dailykerchunks;
- time_t now;
- int totalkerchunks, dailykeyups, totalkeyups, timeouts;
- int totalexecdcommands, dailyexecdcommands, hours, minutes, seconds;
- long long totaltxtime;
- struct rpt_link *l;
- char *listoflinks[MAX_STAT_LINKS];
- char *lastdtmfcommand,*parrot_ena;
- char *tot_state, *ider_state, *patch_state;
- char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena;
- char *sch_ena, *input_signal, *called_number, *user_funs, *tail_type;
- char *transmitterkeyed;
- const char *node = astman_get_header(m, "Node");
- struct rpt *myrpt;
-
- static char *not_applicable = "N/A";
-
- tot_state = ider_state =
- patch_state = reverse_patch_state =
- input_signal = not_applicable;
- called_number = lastdtmfcommand = transmitterkeyed = NULL;
-
- time(&now);
- for(i = 0; i < nrpts; i++)
- {
- if ((node)&&(!strcmp(node,rpt_vars[i].name))){
- rpt_manager_success(s,m);
-
- myrpt = &rpt_vars[i];
-
- if(myrpt->remote){ /* Remote base ? */
- char *loginuser, *loginlevel, *freq, *rxpl, *txpl, *modestr;
- char offset = 0, powerlevel = 0, rxplon = 0, txplon = 0, remoteon, remmode = 0, reportfmstuff;
- char offsetc,powerlevelc;
-
- loginuser = loginlevel = freq = rxpl = txpl = NULL;
- /* Make a copy of all stat variables while locked */
- rpt_mutex_lock(&myrpt->lock); /* LOCK */
- if((remoteon = myrpt->remoteon)){
- if(!ast_strlen_zero(myrpt->loginuser))
- loginuser = ast_strdup(myrpt->loginuser);
- if(!ast_strlen_zero(myrpt->loginlevel))
- loginlevel = ast_strdup(myrpt->loginlevel);
- if(!ast_strlen_zero(myrpt->freq))
- freq = ast_strdup(myrpt->freq);
- if(!ast_strlen_zero(myrpt->rxpl))
- rxpl = ast_strdup(myrpt->rxpl);
- if(!ast_strlen_zero(myrpt->txpl))
- txpl = ast_strdup(myrpt->txpl);
- remmode = myrpt->remmode;
- offset = myrpt->offset;
- powerlevel = myrpt->powerlevel;
- rxplon = myrpt->rxplon;
- txplon = myrpt->txplon;
- }
- rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
- astman_append(s, "IsRemoteBase: YES\r\n");
- astman_append(s, "RemoteOn: %s\r\n",(remoteon) ? "YES": "NO");
- if(remoteon){
- if(loginuser){
- astman_append(s, "LogInUser: %s\r\n", loginuser);
- ast_free(loginuser);
- }
- if(loginlevel){
- astman_append(s, "LogInLevel: %s\r\n", loginlevel);
- ast_free(loginlevel);
- }
- if(freq){
- astman_append(s, "Freq: %s\r\n", freq);
- ast_free(freq);
- }
- reportfmstuff = 0;
- switch(remmode){
- case REM_MODE_FM:
- modestr = "FM";
- reportfmstuff = 1;
- break;
- case REM_MODE_AM:
- modestr = "AM";
- break;
- case REM_MODE_USB:
- modestr = "USB";
- break;
- default:
- modestr = "LSB";
- break;
- }
- astman_append(s, "RemMode: %s\r\n", modestr);
- if(reportfmstuff){
- switch(offset){
- case REM_SIMPLEX:
- offsetc = 'S';
- break;
- case REM_MINUS:
- offsetc = '-';
- break;
- default:
- offsetc = '+';
- break;
- }
- astman_append(s, "RemOffset: %c\r\n", offsetc);
- if(rxplon && rxpl){
- astman_append(s, "RxPl: %s\r\n",rxpl);
- ast_free(rxpl);
- }
- if(txplon && txpl){
- astman_append(s, "TxPl: %s\r\n",txpl);
- ast_free(txpl);
- }
- }
- switch(powerlevel){
- case REM_LOWPWR:
- powerlevelc = 'L';
- break;
- case REM_MEDPWR:
- powerlevelc = 'M';
- break;
- default:
- powerlevelc = 'H';
- break;
- }
- astman_append(s,"PowerLevel: %c\r\n", powerlevelc);
- }
- astman_append(s, "\r\n");
- return 0; /* End of remote base status reporting */
- }
-
- /* ELSE Process as a repeater node */
- /* Make a copy of all stat variables while locked */
- rpt_mutex_lock(&myrpt->lock); /* LOCK */
- dailytxtime = myrpt->dailytxtime;
- totaltxtime = myrpt->totaltxtime;
- dailykeyups = myrpt->dailykeyups;
- totalkeyups = myrpt->totalkeyups;
- dailykerchunks = myrpt->dailykerchunks;
- totalkerchunks = myrpt->totalkerchunks;
- dailyexecdcommands = myrpt->dailyexecdcommands;
- totalexecdcommands = myrpt->totalexecdcommands;
- timeouts = myrpt->timeouts;
-
-
- /* Traverse the list of connected nodes */
- reverse_patch_state = "DOWN";
- numoflinks = 0;
- l = myrpt->links.next;
- while(l && (l != &myrpt->links)){
- if(numoflinks >= MAX_STAT_LINKS){
- ast_log(LOG_NOTICE,
- "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
- break;
- }
- if (l->name[0] == '0'){ /* Skip '0' nodes */
- reverse_patch_state = "UP";
- l = l->next;
- continue;
- }
- listoflinks[numoflinks] = ast_strdup(l->name);
- if(listoflinks[numoflinks] == NULL){
- break;
- }
- else{
- numoflinks++;
- }
- l = l->next;
- }
-
- if(myrpt->keyed)
- input_signal = "YES";
- else
- input_signal = "NO";
-
- if(myrpt->txkeyed)
- transmitterkeyed = "YES";
- else
- transmitterkeyed = "NO";
-
- if(myrpt->p.parrotmode)
- parrot_ena = "ENABLED";
- else
- parrot_ena = "DISABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable)
- sys_ena = "DISABLED";
- else
- sys_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable)
- tot_ena = "DISABLED";
- else
- tot_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable)
- link_ena = "DISABLED";
- else
- link_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
- patch_ena = "DISABLED";
- else
- patch_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable)
- sch_ena = "DISABLED";
- else
- sch_ena = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable)
- user_funs = "DISABLED";
- else
- user_funs = "ENABLED";
-
- if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail)
- tail_type = "ALTERNATE";
- else
- tail_type = "STANDARD";
-
- if(!myrpt->totimer)
- tot_state = "TIMED OUT!";
- else if(myrpt->totimer != myrpt->p.totime)
- tot_state = "ARMED";
- else
- tot_state = "RESET";
-
- if(myrpt->tailid)
- ider_state = "QUEUED IN TAIL";
- else if(myrpt->mustid)
- ider_state = "QUEUED FOR CLEANUP";
- else
- ider_state = "CLEAN";
-
- switch(myrpt->callmode){
- case 1:
- patch_state = "DIALING";
- break;
- case 2:
- patch_state = "CONNECTING";
- break;
- case 3:
- patch_state = "UP";
- break;
-
- case 4:
- patch_state = "CALL FAILED";
- break;
-
- default:
- patch_state = "DOWN";
- }
-
- if(strlen(myrpt->exten)){
- called_number = ast_strdup(myrpt->exten);
- }
-
- if(strlen(myrpt->lastdtmfcommand)){
- lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand);
- }
- rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-
- astman_append(s, "IsRemoteBase: NO\r\n");
- astman_append(s, "NodeState: %d\r\n", myrpt->p.sysstate_cur);
- astman_append(s, "SignalOnInput: %s\r\n", input_signal);
- astman_append(s, "TransmitterKeyed: %s\r\n", transmitterkeyed);
- astman_append(s, "Transmitter: %s\r\n", sys_ena);
- astman_append(s, "Parrot: %s\r\n", parrot_ena);
- astman_append(s, "Scheduler: %s\r\n", sch_ena);
- astman_append(s, "TailLength: %s\r\n", tail_type);
- astman_append(s, "TimeOutTimer: %s\r\n", tot_ena);
- astman_append(s, "TimeOutTimerState: %s\r\n", tot_state);
- astman_append(s, "TimeOutsSinceSystemInitialization: %d\r\n", timeouts);
- astman_append(s, "IdentifierState: %s\r\n", ider_state);
- astman_append(s, "KerchunksToday: %d\r\n", dailykerchunks);
- astman_append(s, "KerchunksSinceSystemInitialization: %d\r\n", totalkerchunks);
- astman_append(s, "KeyupsToday: %d\r\n", dailykeyups);
- astman_append(s, "KeyupsSinceSystemInitialization: %d\r\n", totalkeyups);
- astman_append(s, "DtmfCommandsToday: %d\r\n", dailyexecdcommands);
- astman_append(s, "DtmfCommandsSinceSystemInitialization: %d\r\n", totalexecdcommands);
- astman_append(s, "LastDtmfCommandExecuted: %s\r\n",
- (lastdtmfcommand && strlen(lastdtmfcommand)) ? lastdtmfcommand : not_applicable);
- hours = dailytxtime/3600000;
- dailytxtime %= 3600000;
- minutes = dailytxtime/60000;
- dailytxtime %= 60000;
- seconds = dailytxtime/1000;
- dailytxtime %= 1000;
-
- astman_append(s, "TxTimeToday: %02d:%02d:%02d.%d\r\n",
- hours, minutes, seconds, dailytxtime);
-
- hours = (int) totaltxtime/3600000;
- totaltxtime %= 3600000;
- minutes = (int) totaltxtime/60000;
- totaltxtime %= 60000;
- seconds = (int) totaltxtime/1000;
- totaltxtime %= 1000;
-
- astman_append(s, "TxTimeSinceSystemInitialization: %02d:%02d:%02d.%d\r\n",
- hours, minutes, seconds, (int) totaltxtime);
-
- sprintf(str, "NodesCurrentlyConnectedToUs: ");
- if(!numoflinks){
- strcat(str,"<NONE>");
- }
- else{
- for(j = 0 ;j < numoflinks; j++){
- sprintf(str+strlen(str), "%s", listoflinks[j]);
- if(j < numoflinks - 1)
- strcat(str,",");
- }
- }
- astman_append(s,"%s\r\n", str);
-
- astman_append(s, "Autopatch: %s\r\n", patch_ena);
- astman_append(s, "AutopatchState: %s\r\n", patch_state);
- astman_append(s, "AutopatchCalledNumber: %s\r\n",
- (called_number && strlen(called_number)) ? called_number : not_applicable);
- astman_append(s, "ReversePatchIaxrptConnected: %s\r\n", reverse_patch_state);
- astman_append(s, "UserLinkingCommands: %s\r\n", link_ena);
- astman_append(s, "UserFunctions: %s\r\n", user_funs);
-
- for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */
- ast_free(listoflinks[j]);
- }
- if(called_number){
- ast_free(called_number);
- }
- if(lastdtmfcommand){
- ast_free(lastdtmfcommand);
- }
- astman_append(s, "\r\n"); /* We're Done! */
- return 0;
- }
- }
- astman_send_error(s, m, "RptStatus unknown or missing node");
- return -1;
-}
-
-
-
-/*
- * Implement the RptStatus Manager Interface
- */
-
-static int manager_rpt_status(struct mansession *s, const struct message *m)
-{
- int i,res,len,idx;
- int uptime,hours,minutes;
- time_t now;
- const char *cmd = astman_get_header(m, "Command");
- char *str;
- enum {MGRCMD_RPTSTAT,MGRCMD_NODESTAT};
- struct mgrcmdtbl{
- const char *cmd;
- int index;
- };
- static struct mgrcmdtbl mct[] = {
- {"RptStat",MGRCMD_RPTSTAT},
- {"NodeStat",MGRCMD_NODESTAT},
- {NULL,0} /* NULL marks end of command table */
- };
-
- time(&now);
-
- len = 1024; /* Allocate a working buffer */
- if(!(str = ast_malloc(len)))
- return -1;
-
- /* Check for Command */
- if(ast_strlen_zero(cmd)){
- astman_send_error(s, m, "RptStatus missing command");
- ast_free(str);
- return 0;
- }
- /* Try to find the command in the table */
- for(i = 0 ; mct[i].cmd ; i++){
- if(!strcmp(mct[i].cmd, cmd))
- break;
- }
-
- if(!mct[i].cmd){ /* Found or not found ? */
- astman_send_error(s, m, "RptStatus unknown command");
- ast_free(str);
- return 0;
- }
- else
- idx = mct[i].index;
-
- switch(idx){ /* Use the index to go to the correct command */
-
- case MGRCMD_RPTSTAT:
- /* Return Nodes: and a comma separated list of nodes */
- if((res = snprintf(str, len, "Nodes: ")) > -1)
- len -= res;
- else{
- ast_free(str);
- return 0;
- }
- for(i = 0; i < nrpts; i++){
- if(i < nrpts - 1){
- if((res = snprintf(str+strlen(str), len, "%s,",rpt_vars[i].name)) < 0){
- ast_free(str);
- return 0;
- }
- }
- else{
- if((res = snprintf(str+strlen(str), len, "%s",rpt_vars[i].name)) < 0){
- ast_free(str);
- return 0;
- }
- }
- len -= res;
- }
-
- rpt_manager_success(s,m);
-
- if(!nrpts)
- astman_append(s, "<NONE>\r\n");
- else
- astman_append(s, "%s\r\n", str);
-
- uptime = (int)(now - starttime);
- hours = uptime/3600;
- uptime %= 3600;
- minutes = uptime/60;
- uptime %= 60;
-
- astman_append(s, "RptUptime: %02d:%02d:%02d\r\n",
- hours, minutes, uptime);
-
- astman_append(s, "\r\n");
- break;
-
- case MGRCMD_NODESTAT:
- res = rpt_manager_do_stats(s,m,str);
- ast_free(str);
- return res;
-
- default:
- astman_send_error(s, m, "RptStatus invalid command");
- break;
- }
- ast_free(str);
- return 0;
-}
-
-#endif
-
-#ifdef OLD_ASTERISK
-int unload_module()
-#else
-static int unload_module(void)
-#endif
-{
- int i, res;
-
-#ifdef OLD_ASTERISK
- STANDARD_HANGUP_LOCALUSERS;
-#endif
- for(i = 0; i < nrpts; i++) {
- if (!strcmp(rpt_vars[i].name,rpt_vars[i].p.nodes)) continue;
- ast_mutex_destroy(&rpt_vars[i].lock);
- ast_mutex_destroy(&rpt_vars[i].remlock);
- }
- res = ast_unregister_application(app);
-
-#ifdef NEW_ASTERISK
- ast_cli_unregister_multiple(rpt_cli, ARRAY_LEN(rpt_cli));
-#else
- /* Unregister cli extensions */
- ast_cli_unregister(&cli_debug);
- ast_cli_unregister(&cli_dump);
- ast_cli_unregister(&cli_stats);
- ast_cli_unregister(&cli_lstats);
- ast_cli_unregister(&cli_nodes);
- ast_cli_unregister(&cli_local_nodes);
- ast_cli_unregister(&cli_reload);
- ast_cli_unregister(&cli_restart);
- ast_cli_unregister(&cli_fun);
- ast_cli_unregister(&cli_fun1);
- res |= ast_cli_unregister(&cli_cmd);
-#endif
-#ifndef OLD_ASTERISK
- res |= ast_manager_unregister("RptLocalNodes");
- res |= ast_manager_unregister("RptStatus");
-#endif
- return res;
-}
-
-#ifdef OLD_ASTERISK
-int load_module()
-#else
-static int load_module(void)
-#endif
-{
- int res;
- ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
-
-#ifdef NEW_ASTERISK
- ast_cli_register_multiple(rpt_cli, ARRAY_LEN(rpt_cli));
- res = 0;
-#else
- /* Register cli extensions */
- ast_cli_register(&cli_debug);
- ast_cli_register(&cli_dump);
- ast_cli_register(&cli_stats);
- ast_cli_register(&cli_lstats);
- ast_cli_register(&cli_nodes);
- ast_cli_register(&cli_local_nodes);
- ast_cli_register(&cli_reload);
- ast_cli_register(&cli_restart);
- ast_cli_register(&cli_fun);
- ast_cli_register(&cli_fun1);
- res = ast_cli_register(&cli_cmd);
-#endif
-#ifndef OLD_ASTERISK
- res |= ast_manager_register("RptLocalNodes", 0, manager_rpt_local_nodes, "List local node numbers");
- res |= ast_manager_register("RptStatus", 0, manager_rpt_status, "Return Rpt Status for CGI");
-
-#endif
- res |= ast_register_application(app, rpt_exec, synopsis, descrip);
- return res;
-}
-
-#ifdef OLD_ASTERISK
-char *description()
-{
- return tdesc;
-}
-int usecount(void)
-{
- int res;
- STANDARD_USECOUNT(res);
- return res;
-}
-
-char *key()
-{
- return ASTERISK_GPL_KEY;
-}
-#endif
-
-#ifdef OLD_ASTERISK
-int reload()
-#else
-static int reload(void)
-#endif
-{
-int n;
-
- for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1;
- return(0);
-}
-
-
-#ifndef OLD_ASTERISK
-/* STD_MOD(MOD_1, reload, NULL, NULL); */
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Radio Repeater/Remote Base Application",
- .load = load_module,
- .unload = unload_module,
- .reload = reload,
- );
-#endif
-
diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index e97edc605..b597ee9fe 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -61,7 +61,6 @@ SUPPSERV=@PBX_SUPPSERV@
SYSLOG=@PBX_SYSLOG@
TONEZONE=@PBX_TONEZONE@
UNIXODBC=@PBX_UNIXODBC@
-USB=@PBX_USB@
VORBIS=@PBX_VORBIS@
VPB=@PBX_VPB@
WINARCH=@PBX_WINARCH@
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
deleted file mode 100644
index f45514261..000000000
--- a/channels/chan_usbradio.c
+++ /dev/null
@@ -1,4035 +0,0 @@
-#define NEW_ASTERISK
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- * Copyright (C) 2007 - 2008, Jim Dixon
- *
- * Jim Dixon, WB6NIL <jim@lambdatel.com>
- * Steve Henke, W9SH <w9sh@arrl.net>
- * Based upon work by Mark Spencer <markster@digium.com> and Luigi Rizzo
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief Channel driver for CM108 USB Cards with Radio Interface
- *
- * \author Jim Dixon <jim@lambdatel.com>
- * \author Steve Henke <w9sh@arrl.net>
- *
- * \par See also
- * \arg \ref Config_usbradio
- *
- * \ingroup channel_drivers
- */
-
-/*** MODULEINFO
- <depend>oss</depend>
- <depend>alsa</depend>
- <depend>usb</depend>
- <defaultenabled>no</defaultenabled>
- <support_level>extended</support_level>
- ***/
-
-/*** MAKEOPTS
-<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes">
- <member name="RADIO_RTX" displayname="Build RTX/DTX Radio Programming" touch_on_change="channels/chan_usbradio.c channels/xpmr/xpmr.h">
- <defaultenabled>no</defaultenabled>
- <depend>chan_usbradio</depend>
- <support_level>extended</support_level>
- </member>
- <member name="RADIO_XPMRX" displayname="Build Experimental Radio Protocols" touch_on_change="channels/chan_usbradio.c">
- <defaultenabled>no</defaultenabled>
- <depend>chan_usbradio</depend>
- <support_level>extended</support_level>
- </member>
-</category>
- ***/
-
-// 20070918 1600 EDT sph@xelatec.com changing to rx driven streams
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef HAVE_SYS_IO_H
-#include <sys/io.h>
-#endif
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <usb.h>
-#include <alsa/asoundlib.h>
-
-//#define HAVE_XPMRX 1
-#ifdef RADIO_XPMRX
-#define HAVE_XPMRX 1
-#endif
-
-#define CHAN_USBRADIO 1
-#define DEBUG_USBRADIO 0
-#define DEBUG_CAPTURES 1
-#define DEBUG_CAP_RX_OUT 0
-#define DEBUG_CAP_TX_OUT 0
-#define DEBUG_FILETEST 0
-
-#define RX_CAP_RAW_FILE "/tmp/rx_cap_in.pcm"
-#define RX_CAP_TRACE_FILE "/tmp/rx_trace.pcm"
-#define RX_CAP_OUT_FILE "/tmp/rx_cap_out.pcm"
-
-#define TX_CAP_RAW_FILE "/tmp/tx_cap_in.pcm"
-#define TX_CAP_TRACE_FILE "/tmp/tx_trace.pcm"
-#define TX_CAP_OUT_FILE "/tmp/tx_cap_out.pcm"
-
-#define MIXER_PARAM_MIC_PLAYBACK_SW "Mic Playback Switch"
-#define MIXER_PARAM_MIC_PLAYBACK_VOL "Mic Playback Volume"
-#define MIXER_PARAM_MIC_CAPTURE_SW "Mic Capture Switch"
-#define MIXER_PARAM_MIC_CAPTURE_VOL "Mic Capture Volume"
-#define MIXER_PARAM_MIC_BOOST "Auto Gain Control"
-#define MIXER_PARAM_SPKR_PLAYBACK_SW "Speaker Playback Switch"
-#define MIXER_PARAM_SPKR_PLAYBACK_VOL "Speaker Playback Volume"
-
-#define DELIMCHR ','
-#define QUOTECHR 34
-
-#define READERR_THRESHOLD 50
-
-#include "./xpmr/xpmr.h"
-#ifdef HAVE_XPMRX
-#include "./xpmrx/xpmrx.h"
-#include "./xpmrx/bitweight.h"
-#endif
-
-#if 0
-#define traceusb1(a) {printf a;}
-#else
-#define traceusb1(a)
-#endif
-
-#if 0
-#define traceusb2(a) {printf a;}
-#else
-#define traceusb2(a)
-#endif
-
-#ifdef __linux
-#include <linux/soundcard.h>
-#elif defined(__FreeBSD__)
-#include <sys/soundcard.h>
-#else
-#include <soundcard.h>
-#endif
-
-#include "asterisk/lock.h"
-#include "asterisk/frame.h"
-#include "asterisk/logger.h"
-#include "asterisk/callerid.h"
-#include "asterisk/channel.h"
-#include "asterisk/module.h"
-#include "asterisk/options.h"
-#include "asterisk/pbx.h"
-#include "asterisk/config.h"
-#include "asterisk/cli.h"
-#include "asterisk/utils.h"
-#include "asterisk/causes.h"
-#include "asterisk/endian.h"
-#include "asterisk/stringfields.h"
-#include "asterisk/abstract_jb.h"
-#include "asterisk/musiconhold.h"
-#include "asterisk/dsp.h"
-
-#ifndef NEW_ASTERISK
-
-/* ringtones we use */
-#include "busy.h"
-#include "ringtone.h"
-#include "ring10.h"
-#include "answer.h"
-
-#endif
-
-#define C108_VENDOR_ID 0x0d8c
-#define C108_PRODUCT_ID 0x000c
-#define C108_HID_INTERFACE 3
-
-#define HID_REPORT_GET 0x01
-#define HID_REPORT_SET 0x09
-
-#define HID_RT_INPUT 0x01
-#define HID_RT_OUTPUT 0x02
-
-#define EEPROM_START_ADDR 6
-#define EEPROM_END_ADDR 63
-#define EEPROM_PHYSICAL_LEN 64
-#define EEPROM_TEST_ADDR EEPROM_END_ADDR
-#define EEPROM_MAGIC_ADDR 6
-#define EEPROM_MAGIC 34329
-#define EEPROM_CS_ADDR 62
-#define EEPROM_RXMIXERSET 8
-#define EEPROM_TXMIXASET 9
-#define EEPROM_TXMIXBSET 10
-#define EEPROM_RXVOICEADJ 11
-#define EEPROM_RXCTCSSADJ 13
-#define EEPROM_TXCTCSSADJ 15
-#define EEPROM_RXSQUELCHADJ 16
-
-/*! Global jitterbuffer configuration - by default, jb is disabled
- * \note Values shown here match the defaults shown in usbradio.conf.sample */
-static struct ast_jb_conf default_jbconf =
-{
- .flags = 0,
- .max_size = 200,
- .resync_threshold = 1000,
- .impl = "fixed",
- .target_extra = 40,
-};
-static struct ast_jb_conf global_jbconf;
-
-/*
- * usbradio.conf parameters are
-START_CONFIG
-
-[general]
- ; General config options which propigate to all devices, with
- ; default values shown. You may have as many devices as the
- ; system will allow. You must use one section per device, with
- ; [usb] generally (although its up to you) being the first device.
- ;
- ;
- ; debug = 0x0 ; misc debug flags, default is 0
-
- ; Set the device to use for I/O
- ; devicenum = 0
- ; Set hardware type here
- ; hdwtype=0 ; 0=limey, 1=sph
-
- ; rxboost=0 ; no rx gain boost
- ; rxctcssrelax=1 ; reduce talkoff from radios w/o CTCSS Tx HPF
- ; rxctcssfreqs=100.0,123.0 ; list of rx ctcss freq in floating point. must be in table
- ; txctcssfreqs=100.0,123.0 ; list tx ctcss freq, any frequency permitted
- ; txctcssdefault=100.0 ; default tx ctcss freq, any frequency permitted
-
- ; carrierfrom=dsp ;no,usb,usbinvert,dsp,vox
- ; ctcssfrom=dsp ;no,usb,dsp
-
- ; rxdemod=flat ; input type from radio: no,speaker,flat
- ; txprelim=yes ; output is pre-emphasised and limited
- ; txtoctype=no ; no,phase,notone
-
- ; txmixa=composite ;no,voice,tone,composite,auxvoice
- ; txmixb=no ;no,voice,tone,composite,auxvoice
-
- ; invertptt=0
-
- ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
- ; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an
- ; USBRADIO channel. Defaults to "no". An enabled jitterbuffer will
- ; be used only if the sending side can create and the receiving
- ; side can not accept jitter. The USBRADIO channel can't accept jitter,
- ; thus an enabled jitterbuffer on the receive USBRADIO side will always
- ; be used if the sending side can create jitter.
-
- ; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds.
-
- ; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is
- ; resynchronized. Useful to improve the quality of the voice, with
- ; big jumps in/broken timestamps, usualy sent from exotic devices
- ; and programs. Defaults to 1000.
-
- ; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of an USBRADIO
- ; channel. Two implementations are currenlty available - "fixed"
- ; (with size always equals to jbmax-size) and "adaptive" (with
- ; variable size, actually the new jb of IAX2). Defaults to fixed.
-
- ; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no".
- ;-----------------------------------------------------------------------------------
-
-[usb]
-
-; First channel unique config
-
-[usb1]
-
-; Second channel config
-
-END_CONFIG
-
- */
-
-/*
- * Helper macros to parse config arguments. They will go in a common
- * header file if their usage is globally accepted. In the meantime,
- * we define them here. Typical usage is as below.
- * Remember to open a block right before M_START (as it declares
- * some variables) and use the M_* macros WITHOUT A SEMICOLON:
- *
- * {
- * M_START(v->name, v->value)
- *
- * M_BOOL("dothis", x->flag1)
- * M_STR("name", x->somestring)
- * M_F("bar", some_c_code)
- * M_END(some_final_statement)
- * ... other code in the block
- * }
- *
- * XXX NOTE these macros should NOT be replicated in other parts of asterisk.
- * Likely we will come up with a better way of doing config file parsing.
- */
-#define M_START(var, val) \
- char *__s = var; char *__val = val;
-#define M_END(x) x;
-#define M_F(tag, f) if (!strcasecmp((__s), tag)) { f; } else
-#define M_BOOL(tag, dst) M_F(tag, (dst) = ast_true(__val) )
-#define M_UINT(tag, dst) M_F(tag, (dst) = strtoul(__val, NULL, 0) )
-#define M_STR(tag, dst) M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
-
-/*
- * The following parameters are used in the driver:
- *
- * FRAME_SIZE the size of an audio frame, in samples.
- * 160 is used almost universally, so you should not change it.
- *
- * FRAGS the argument for the SETFRAGMENT ioctl.
- * Overridden by the 'frags' parameter in usbradio.conf
- *
- * Bits 0-7 are the base-2 log of the device's block size,
- * bits 16-31 are the number of blocks in the driver's queue.
- * There are a lot of differences in the way this parameter
- * is supported by different drivers, so you may need to
- * experiment a bit with the value.
- * A good default for linux is 30 blocks of 64 bytes, which
- * results in 6 frames of 320 bytes (160 samples).
- * FreeBSD works decently with blocks of 256 or 512 bytes,
- * leaving the number unspecified.
- * Note that this only refers to the device buffer size,
- * this module will then try to keep the lenght of audio
- * buffered within small constraints.
- *
- * QUEUE_SIZE The max number of blocks actually allowed in the device
- * driver's buffer, irrespective of the available number.
- * Overridden by the 'queuesize' parameter in usbradio.conf
- *
- * Should be >=2, and at most as large as the hw queue above
- * (otherwise it will never be full).
- */
-
-#define FRAME_SIZE 160
-#define QUEUE_SIZE 2
-
-#if defined(__FreeBSD__)
-#define FRAGS 0x8
-#else
-#define FRAGS ( ( (6 * 5) << 16 ) | 0xc )
-#endif
-
-/*
- * XXX text message sizes are probably 256 chars, but i am
- * not sure if there is a suitable definition anywhere.
- */
-#define TEXT_SIZE 256
-
-#if 0
-#define TRYOPEN 1 /* try to open on startup */
-#endif
-#define O_CLOSE 0x444 /* special 'close' mode for device */
-/* Which device to use */
-#if defined( __OpenBSD__ ) || defined( __NetBSD__ )
-#define DEV_DSP "/dev/audio"
-#else
-#define DEV_DSP "/dev/dsp"
-#endif
-
-static const char *config = "usbradio.conf"; /* default config file */
-#define config1 "usbradio_tune_%s.conf" /* tune config file */
-
-static FILE *frxcapraw = NULL, *frxcaptrace = NULL, *frxoutraw = NULL;
-static FILE *ftxcapraw = NULL, *ftxcaptrace = NULL, *ftxoutraw = NULL;
-
-static char *usb_device_list = NULL;
-static int usb_device_list_size = 0;
-
-static int usbradio_debug;
-#if 0 //maw asdf sph
-static int usbradio_debug_level = 0;
-#endif
-
-enum {RX_AUDIO_NONE,RX_AUDIO_SPEAKER,RX_AUDIO_FLAT};
-enum {CD_IGNORE,CD_XPMR_NOISE,CD_XPMR_VOX,CD_HID,CD_HID_INVERT};
-enum {SD_IGNORE,SD_HID,SD_HID_INVERT,SD_XPMR}; // no,external,externalinvert,software
-enum {RX_KEY_CARRIER,RX_KEY_CARRIER_CODE};
-enum {TX_OUT_OFF,TX_OUT_VOICE,TX_OUT_LSD,TX_OUT_COMPOSITE,TX_OUT_AUX};
-enum {TOC_NONE,TOC_PHASE,TOC_NOTONE};
-
-/* DECLARE STRUCTURES */
-
-/*
- * Each sound is made of 'datalen' samples of sound, repeated as needed to
- * generate 'samplen' samples of data, then followed by 'silencelen' samples
- * of silence. The loop is repeated if 'repeat' is set.
- */
-struct sound {
- int ind;
- short *data;
- int datalen;
- int samplen;
- int silencelen;
- int repeat;
-};
-
-#ifndef NEW_ASTERISK
-
-static struct sound sounds[] = {
- { AST_CONTROL_RINGING, "RINGING", ringtone, sizeof(ringtone)/2, 16000, 32000, 1 },
- { AST_CONTROL_BUSY, "BUSY", busy, sizeof(busy)/2, 4000, 4000, 1 },
- { AST_CONTROL_CONGESTION, "CONGESTION", busy, sizeof(busy)/2, 2000, 2000, 1 },
- { AST_CONTROL_RING, "RING10", ring10, sizeof(ring10)/2, 16000, 32000, 1 },
- { AST_CONTROL_ANSWER, "ANSWER", answer, sizeof(answer)/2, 2200, 0, 0 },
- { -1, NULL, 0, 0, 0, 0 }, /* end marker */
-};
-
-#endif
-
-/*
- * descriptor for one of our channels.
- * There is one used for 'default' values (from the [general] entry in
- * the configuration file), and then one instance for each device
- * (the default is cloned from [general], others are only created
- * if the relevant section exists).
- */
-struct chan_usbradio_pvt {
- struct chan_usbradio_pvt *next;
-
- char *name;
-#ifndef NEW_ASTERISK
- /*
- * cursound indicates which in struct sound we play. -1 means nothing,
- * any other value is a valid sound, in which case sampsent indicates
- * the next sample to send in [0..samplen + silencelen]
- * nosound is set to disable the audio data from the channel
- * (so we can play the tones etc.).
- */
- int sndcmd[2]; /* Sound command pipe */
- int cursound; /* index of sound to send */
- int sampsent; /* # of sound samples sent */
- int nosound; /* set to block audio from the PBX */
-#endif
-
- int pttkick[2];
- int total_blocks; /* total blocks in the output device */
- int sounddev;
- enum { M_UNSET, M_FULL, M_READ, M_WRITE } duplex;
- i16 cdMethod;
- int autoanswer;
- int autohangup;
- int hookstate;
- unsigned int queuesize; /* max fragments in queue */
- unsigned int frags; /* parameter for SETFRAGMENT */
-
- int warned; /* various flags used for warnings */
-#define WARN_used_blocks 1
-#define WARN_speed 2
-#define WARN_frag 4
- int w_errors; /* overfull in the write path */
- struct timeval lastopen;
-
- int overridecontext;
- int mute;
-
- /* boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must
- * be representable in 16 bits to avoid overflows.
- */
-#define BOOST_SCALE (1<<9)
-#define BOOST_MAX 40 /* slightly less than 7 bits */
- int boost; /* input boost, scaled by BOOST_SCALE */
- char devicenum;
- char devstr[128];
- int spkrmax;
- int micmax;
-
-#ifndef NEW_ASTERISK
- pthread_t sthread;
-#endif
- pthread_t hidthread;
-
- int stophid;
- FILE *hkickhid;
-
- struct ast_channel *owner;
- char ext[AST_MAX_EXTENSION];
- char ctx[AST_MAX_CONTEXT];
- char language[MAX_LANGUAGE];
- char cid_name[256]; /*XXX */
- char cid_num[256]; /*XXX */
- char mohinterpret[MAX_MUSICCLASS];
-
- /* buffers used in usbradio_write, 2 per int by 2 channels by 6 times oversampling (48KS/s) */
- char usbradio_write_buf[FRAME_SIZE * 2 * 2 * 6];
- char usbradio_write_buf_1[FRAME_SIZE * 2 * 2* 6];
-
- int usbradio_write_dst;
- /* buffers used in usbradio_read - AST_FRIENDLY_OFFSET space for headers
- * plus enough room for a full frame
- */
- char usbradio_read_buf[FRAME_SIZE * (2 * 12) + AST_FRIENDLY_OFFSET];
- char usbradio_read_buf_8k[FRAME_SIZE * 2 + AST_FRIENDLY_OFFSET];
- int readpos; /* read position above */
- struct ast_frame read_f; /* returned by usbradio_read */
-
- char debuglevel;
- char radioduplex; //
- char wanteeprom;
-
- int tracetype;
- int tracelevel;
- char area;
- char rptnum;
- int idleinterval;
- int turnoffs;
- int txsettletime;
- char ukey[48];
-
- char lastrx;
- char rxhidsq;
- char rxcarrierdetect; // status from pmr channel
- char rxctcssdecode; // status from pmr channel
-
- int rxdcsdecode;
- int rxlsddecode;
-
- char rxkeytype;
- char rxkeyed; // indicates rx signal present
-
- char lasttx;
- char txkeyed; // tx key request from upper layers
- char txchankey;
- char txtestkey;
-
- time_t lasthidtime;
- struct ast_dsp *dsp;
-
- t_pmr_chan *pmrChan;
-
- char rxcpusaver;
- char txcpusaver;
-
- char rxdemod;
- float rxgain;
- char rxcdtype;
- char rxsdtype;
- int rxsquelchadj; /* this copy needs to be here for initialization */
- int rxsqvoxadj;
- char txtoctype;
-
- char txprelim;
- float txctcssgain;
- char txmixa;
- char txmixb;
-
- char invertptt;
-
- char rxctcssrelax;
- float rxctcssgain;
-
- char txctcssdefault[16]; // for repeater operation
- char rxctcssfreqs[512]; // a string
- char txctcssfreqs[512];
-
- char txctcssfreq[32]; // encode now
- char rxctcssfreq[32]; // decode now
-
- char numrxctcssfreqs; // how many
- char numtxctcssfreqs;
-
- char *rxctcss[CTCSS_NUM_CODES]; // pointers to strings
- char *txctcss[CTCSS_NUM_CODES];
-
- int txfreq; // in Hz
- int rxfreq;
-
- // start remote operation info
- char set_txctcssdefault[16]; // for remote operation
- char set_txctcssfreq[16]; // encode now
- char set_rxctcssfreq[16]; // decode now
-
- char set_numrxctcssfreqs; // how many
- char set_numtxctcssfreqs;
-
- char set_rxctcssfreqs[16]; // a string
- char set_txctcssfreqs[16];
-
- char *set_rxctcss; // pointers to strings
- char *set_txctcss;
-
- int set_txfreq; // in Hz
- int set_rxfreq;
- // end remote operation info
-
- int rxmixerset;
- int rxboostset;
- float rxvoiceadj;
- float rxctcssadj;
- int txmixaset;
- int txmixbset;
- int txctcssadj;
-
- int hdwtype;
- int hid_gpio_ctl;
- int hid_gpio_ctl_loc;
- int hid_io_cor;
- int hid_io_cor_loc;
- int hid_io_ctcss;
- int hid_io_ctcss_loc;
- int hid_io_ptt;
- int hid_gpio_loc;
-
- struct {
- unsigned rxcapraw:1;
- unsigned txcapraw:1;
- unsigned txcap2:1;
- unsigned rxcap2:1;
- unsigned rxplmon:1;
- unsigned remoted:1;
- unsigned txpolarity:1;
- unsigned rxpolarity:1;
- unsigned dcstxpolarity:1;
- unsigned dcsrxpolarity:1;
- unsigned lsdtxpolarity:1;
- unsigned lsdrxpolarity:1;
- unsigned loopback:1;
- unsigned radioactive:1;
- }b;
- unsigned short eeprom[EEPROM_PHYSICAL_LEN];
- char eepromctl;
- ast_mutex_t eepromlock;
-
- struct usb_dev_handle *usb_handle;
- int readerrs;
-};
-
-// maw add additional defaults !!!
-static struct chan_usbradio_pvt usbradio_default = {
-#ifndef NEW_ASTERISK
- .cursound = -1,
-#endif
- .sounddev = -1,
- .duplex = M_UNSET, /* XXX check this */
- .autoanswer = 1,
- .autohangup = 1,
- .queuesize = QUEUE_SIZE,
- .frags = FRAGS,
- .ext = "s",
- .ctx = "default",
- .readpos = AST_FRIENDLY_OFFSET, /* start here on reads */
- .lastopen = { 0, 0 },
- .boost = BOOST_SCALE,
- .wanteeprom = 1,
- .area = 0,
- .rptnum = 0,
-};
-
-/* DECLARE FUNCTION PROTOTYPES */
-
-static void store_txtoctype(struct chan_usbradio_pvt *o, const char *s);
-static int hidhdwconfig(struct chan_usbradio_pvt *o);
-static int set_txctcss_level(struct chan_usbradio_pvt *o);
-static void pmrdump(struct chan_usbradio_pvt *o);
-static void mult_set(struct chan_usbradio_pvt *o);
-static int mult_calc(int value);
-static void mixer_write(struct chan_usbradio_pvt *o);
-static void tune_rxinput(int fd, struct chan_usbradio_pvt *o);
-static void tune_rxvoice(int fd, struct chan_usbradio_pvt *o);
-static void tune_rxctcss(int fd, struct chan_usbradio_pvt *o);
-static void tune_txoutput(struct chan_usbradio_pvt *o, int value, int fd);
-static void tune_write(struct chan_usbradio_pvt *o);
-
-static char *usbradio_active; /* the active device */
-
-static int setformat(struct chan_usbradio_pvt *o, int mode);
-
-static struct ast_channel *usbradio_request(const char *type, struct ast_format_cap *cap,
- const struct ast_channel *requestor,
- const char *data, int *cause);
-static int usbradio_digit_begin(struct ast_channel *c, char digit);
-static int usbradio_digit_end(struct ast_channel *c, char digit, unsigned int duration);
-static int usbradio_text(struct ast_channel *c, const char *text);
-static int usbradio_hangup(struct ast_channel *c);
-static int usbradio_answer(struct ast_channel *c);
-static struct ast_frame *usbradio_read(struct ast_channel *chan);
-static int usbradio_call(struct ast_channel *c, const char *dest, int timeout);
-static int usbradio_write(struct ast_channel *chan, struct ast_frame *f);
-static int usbradio_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen);
-static int usbradio_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
-static int xpmr_config(struct chan_usbradio_pvt *o);
-
-#if DEBUG_FILETEST == 1
-static int RxTestIt(struct chan_usbradio_pvt *o);
-#endif
-
-static char tdesc[] = "USB (CM108) Radio Channel Driver";
-
-static struct ast_format slin;
-
-static struct ast_channel_tech usbradio_tech = {
- .type = "Radio",
- .description = tdesc,
- .requester = usbradio_request,
- .send_digit_begin = usbradio_digit_begin,
- .send_digit_end = usbradio_digit_end,
- .send_text = usbradio_text,
- .hangup = usbradio_hangup,
- .answer = usbradio_answer,
- .read = usbradio_read,
- .call = usbradio_call,
- .write = usbradio_write,
- .indicate = usbradio_indicate,
- .fixup = usbradio_fixup,
-};
-
-/* Call with: devnum: alsa major device number, param: ascii Formal
-Parameter Name, val1, first or only value, val2 second value, or 0
-if only 1 value. Values: 0-99 (percent) or 0-1 for baboon.
-
-Note: must add -lasound to end of linkage */
-
-static int amixer_max(int devnum,char *param)
-{
-int rv,type;
-char str[100];
-snd_hctl_t *hctl;
-snd_ctl_elem_id_t *id;
-snd_hctl_elem_t *elem;
-snd_ctl_elem_info_t *info;
-
- sprintf(str,"hw:%d",devnum);
- if (snd_hctl_open(&hctl, str, 0)) return(-1);
- snd_hctl_load(hctl);
- snd_ctl_elem_id_alloca(&id);
- snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_id_set_name(id, param);
- elem = snd_hctl_find_elem(hctl, id);
- if (!elem)
- {
- snd_hctl_close(hctl);
- return(-1);
- }
- snd_ctl_elem_info_alloca(&info);
- snd_hctl_elem_info(elem,info);
- type = snd_ctl_elem_info_get_type(info);
- rv = 0;
- switch(type)
- {
- case SND_CTL_ELEM_TYPE_INTEGER:
- rv = snd_ctl_elem_info_get_max(info);
- break;
- case SND_CTL_ELEM_TYPE_BOOLEAN:
- rv = 1;
- break;
- }
- snd_hctl_close(hctl);
- return(rv);
-}
-
-/* Call with: devnum: alsa major device number, param: ascii Formal
-Parameter Name, val1, first or only value, val2 second value, or 0
-if only 1 value. Values: 0-99 (percent) or 0-1 for baboon.
-
-Note: must add -lasound to end of linkage */
-
-static int setamixer(int devnum,char *param, int v1, int v2)
-{
-int type;
-char str[100];
-snd_hctl_t *hctl;
-snd_ctl_elem_id_t *id;
-snd_ctl_elem_value_t *control;
-snd_hctl_elem_t *elem;
-snd_ctl_elem_info_t *info;
-
- sprintf(str,"hw:%d",devnum);
- if (snd_hctl_open(&hctl, str, 0)) return(-1);
- snd_hctl_load(hctl);
- snd_ctl_elem_id_alloca(&id);
- snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
- snd_ctl_elem_id_set_name(id, param);
- elem = snd_hctl_find_elem(hctl, id);
- if (!elem)
- {
- snd_hctl_close(hctl);
- return(-1);
- }
- snd_ctl_elem_info_alloca(&info);
- snd_hctl_elem_info(elem,info);
- type = snd_ctl_elem_info_get_type(info);
- snd_ctl_elem_value_alloca(&control);
- snd_ctl_elem_value_set_id(control, id);
- switch(type)
- {
- case SND_CTL_ELEM_TYPE_INTEGER:
- snd_ctl_elem_value_set_integer(control, 0, v1);
- if (v2 > 0) snd_ctl_elem_value_set_integer(control, 1, v2);
- break;
- case SND_CTL_ELEM_TYPE_BOOLEAN:
- snd_ctl_elem_value_set_integer(control, 0, (v1 != 0));
- break;
- }
- if (snd_hctl_elem_write(elem, control))
- {
- snd_hctl_close(hctl);
- return(-1);
- }
- snd_hctl_close(hctl);
- return(0);
-}
-
-static void hid_set_outputs(struct usb_dev_handle *handle,
- unsigned char *outputs)
-{
- usleep(1500);
- usb_control_msg(handle,
- USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE,
- HID_REPORT_SET,
- 0 + (HID_RT_OUTPUT << 8),
- C108_HID_INTERFACE,
- (char*)outputs, 4, 5000);
-}
-
-static void hid_get_inputs(struct usb_dev_handle *handle,
- unsigned char *inputs)
-{
- usleep(1500);
- usb_control_msg(handle,
- USB_ENDPOINT_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE,
- HID_REPORT_GET,
- 0 + (HID_RT_INPUT << 8),
- C108_HID_INTERFACE,
- (char*)inputs, 4, 5000);
-}
-
-static unsigned short read_eeprom(struct usb_dev_handle *handle, int addr)
-{
- unsigned char buf[4];
-
- buf[0] = 0x80;
- buf[1] = 0;
- buf[2] = 0;
- buf[3] = 0x80 | (addr & 0x3f);
- hid_set_outputs(handle,buf);
- memset(buf,0,sizeof(buf));
- hid_get_inputs(handle,buf);
- return(buf[1] + (buf[2] << 8));
-}
-
-static void write_eeprom(struct usb_dev_handle *handle, int addr,
- unsigned short data)
-{
-
- unsigned char buf[4];
-
- buf[0] = 0x80;
- buf[1] = data & 0xff;
- buf[2] = data >> 8;
- buf[3] = 0xc0 | (addr & 0x3f);
- hid_set_outputs(handle,buf);
-}
-
-static unsigned short get_eeprom(struct usb_dev_handle *handle,
- unsigned short *buf)
-{
-int i;
-unsigned short cs;
-
- cs = 0xffff;
- for(i = EEPROM_START_ADDR; i < EEPROM_END_ADDR; i++)
- {
- cs += buf[i] = read_eeprom(handle,i);
- }
- return(cs);
-}
-
-static void put_eeprom(struct usb_dev_handle *handle,unsigned short *buf)
-{
-int i;
-unsigned short cs;
-
- cs = 0xffff;
- buf[EEPROM_MAGIC_ADDR] = EEPROM_MAGIC;
- for(i = EEPROM_START_ADDR; i < EEPROM_CS_ADDR; i++)
- {
- write_eeprom(handle,i,buf[i]);
- cs += buf[i];
- }
- buf[EEPROM_CS_ADDR] = (65535 - cs) + 1;
- write_eeprom(handle,i,buf[EEPROM_CS_ADDR]);
-}
-
-static struct usb_device *hid_device_init(char *desired_device)
-{
- struct usb_bus *usb_bus;
- struct usb_device *dev;
- char devstr[200],str[200],desdev[200],*cp;
- int i;
- FILE *fp;
-
- usb_init();
- usb_find_busses();
- usb_find_devices();
- for (usb_bus = usb_busses;
- usb_bus;
- usb_bus = usb_bus->next) {
- for (dev = usb_bus->devices;
- dev;
- dev = dev->next) {
- if ((dev->descriptor.idVendor
- == C108_VENDOR_ID) &&
- (dev->descriptor.idProduct
- == C108_PRODUCT_ID))
- {
- sprintf(devstr,"%s/%s", usb_bus->dirname,dev->filename);
- for(i = 0; i < 32; i++)
- {
- sprintf(str,"/proc/asound/card%d/usbbus",i);
- fp = fopen(str,"r");
- if (!fp) continue;
- if ((!fgets(desdev,sizeof(desdev) - 1,fp)) || (!desdev[0]))
- {
- fclose(fp);
- continue;
- }
- fclose(fp);
- if (desdev[strlen(desdev) - 1] == '\n')
- desdev[strlen(desdev) -1 ] = 0;
- if (strcasecmp(desdev,devstr)) continue;
- if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i);
- else strcpy(str,"/sys/class/sound/dsp/device");
- memset(desdev,0,sizeof(desdev));
- if (readlink(str,desdev,sizeof(desdev) - 1) == -1)
- {
- sprintf(str,"/sys/class/sound/controlC%d/device",i);
- memset(desdev,0,sizeof(desdev));
- if (readlink(str,desdev,sizeof(desdev) - 1) == -1) continue;
- }
- cp = strrchr(desdev,'/');
- if (cp) *cp = 0; else continue;
- cp = strrchr(desdev,'/');
- if (!cp) continue;
- cp++;
- break;
- }
- if (i >= 32) continue;
- if (!strcmp(cp,desired_device)) return dev;
- }
-
- }
- }
- return NULL;
-}
-
-static int hid_device_mklist(void)
-{
- struct usb_bus *usb_bus;
- struct usb_device *dev;
- char devstr[200],str[200],desdev[200],*cp;
- int i;
- FILE *fp;
-
- usb_device_list = ast_malloc(2);
- if (!usb_device_list) return -1;
- memset(usb_device_list,0,2);
-
- usb_init();
- usb_find_busses();
- usb_find_devices();
- for (usb_bus = usb_busses;
- usb_bus;
- usb_bus = usb_bus->next) {
- for (dev = usb_bus->devices;
- dev;
- dev = dev->next) {
- if ((dev->descriptor.idVendor
- == C108_VENDOR_ID) &&
- (dev->descriptor.idProduct
- == C108_PRODUCT_ID))
- {
- sprintf(devstr,"%s/%s", usb_bus->dirname,dev->filename);
- for(i = 0;i < 32; i++)
- {
- sprintf(str,"/proc/asound/card%d/usbbus",i);
- fp = fopen(str,"r");
- if (!fp) continue;
- if ((!fgets(desdev,sizeof(desdev) - 1,fp)) || (!desdev[0]))
- {
- fclose(fp);
- continue;
- }
- fclose(fp);
- if (desdev[strlen(desdev) - 1] == '\n')
- desdev[strlen(desdev) -1 ] = 0;
- if (strcasecmp(desdev,devstr)) continue;
- if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i);
- else strcpy(str,"/sys/class/sound/dsp/device");
- memset(desdev,0,sizeof(desdev));
- if (readlink(str,desdev,sizeof(desdev) - 1) == -1)
- {
- sprintf(str,"/sys/class/sound/controlC%d/device",i);
- memset(desdev,0,sizeof(desdev));
- if (readlink(str,desdev,sizeof(desdev) - 1) == -1) continue;
- }
- cp = strrchr(desdev,'/');
- if (cp) *cp = 0; else continue;
- cp = strrchr(desdev,'/');
- if (!cp) continue;
- cp++;
- break;
- }
- if (i >= 32) return -1;
- usb_device_list = ast_realloc(usb_device_list,
- usb_device_list_size + 2 +
- strlen(cp));
- if (!usb_device_list) return -1;
- usb_device_list_size += strlen(cp) + 2;
- i = 0;
- while(usb_device_list[i])
- {
- i += strlen(usb_device_list + i) + 1;
- }
- strcat(usb_device_list + i,cp);
- usb_device_list[strlen(cp) + i + 1] = 0;
- }
-
- }
- }
- return 0;
-}
-
-/* returns internal formatted string from external one */
-static int usb_get_usbdev(char *devstr)
-{
-int i;
-char str[200],desdev[200],*cp;
-
- for(i = 0;i < 32; i++)
- {
- if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i);
- else strcpy(str,"/sys/class/sound/dsp/device");
- memset(desdev,0,sizeof(desdev));
- if (readlink(str,desdev,sizeof(desdev) - 1) == -1)
- {
- sprintf(str,"/sys/class/sound/controlC%d/device",i);
- memset(desdev,0,sizeof(desdev));
- if (readlink(str,desdev,sizeof(desdev) - 1) == -1) continue;
- }
- cp = strrchr(desdev,'/');
- if (cp) *cp = 0; else continue;
- cp = strrchr(desdev,'/');
- if (!cp) continue;
- cp++;
- if (!strcasecmp(cp,devstr)) break;
- }
- if (i >= 32) return -1;
- return i;
-
-}
-
-static int usb_list_check(char *devstr)
-{
-
-char *s = usb_device_list;
-
- if (!s) return(0);
- while(*s)
- {
- if (!strcasecmp(s,devstr)) return(1);
- s += strlen(s) + 1;
- }
- return(0);
-}
-
-
-static int hidhdwconfig(struct chan_usbradio_pvt *o)
-{
- if(o->hdwtype==1) //sphusb
- {
- o->hid_gpio_ctl = 0x08; /* set GPIO4 to output mode */
- o->hid_gpio_ctl_loc = 2; /* For CTL of GPIO */
- o->hid_io_cor = 4; /* GPIO3 is COR */
- o->hid_io_cor_loc = 1; /* GPIO3 is COR */
- o->hid_io_ctcss = 2; /* GPIO 2 is External CTCSS */
- o->hid_io_ctcss_loc = 1; /* is GPIO 2 */
- o->hid_io_ptt = 8; /* GPIO 4 is PTT */
- o->hid_gpio_loc = 1; /* For ALL GPIO */
- }
- else if(o->hdwtype==0) //dudeusb
- {
- o->hid_gpio_ctl = 0x0c; /* set GPIO 3 & 4 to output mode */
- o->hid_gpio_ctl_loc = 2; /* For CTL of GPIO */
- o->hid_io_cor = 2; /* VOLD DN is COR */
- o->hid_io_cor_loc = 0; /* VOL DN COR */
- o->hid_io_ctcss = 2; /* GPIO 2 is External CTCSS */
- o->hid_io_ctcss_loc = 1; /* is GPIO 2 */
- o->hid_io_ptt = 4; /* GPIO 3 is PTT */
- o->hid_gpio_loc = 1; /* For ALL GPIO */
- }
- else if(o->hdwtype==3) // custom version
- {
- o->hid_gpio_ctl = 0x0c; /* set GPIO 3 & 4 to output mode */
- o->hid_gpio_ctl_loc = 2; /* For CTL of GPIO */
- o->hid_io_cor = 2; /* VOLD DN is COR */
- o->hid_io_cor_loc = 0; /* VOL DN COR */
- o->hid_io_ctcss = 2; /* GPIO 2 is External CTCSS */
- o->hid_io_ctcss_loc = 1; /* is GPIO 2 */
- o->hid_io_ptt = 4; /* GPIO 3 is PTT */
- o->hid_gpio_loc = 1; /* For ALL GPIO */
- }
-
- return 0;
-}
-/*
-*/
-static void kickptt(struct chan_usbradio_pvt *o)
-{
- char c = 0;
- //printf("kickptt %i %i %i\n",o->txkeyed,o->txchankey,o->txtestkey);
- if (!o) return;
- if (!o->pttkick) return;
- if (write(o->pttkick[1],&c,1) < 0) {
- ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));
- }
-}
-/*
-*/
-static void *hidthread(void *arg)
-{
- unsigned char buf[4],bufsave[4],keyed;
- char txtmp;
- int res;
- struct usb_device *usb_dev;
- struct usb_dev_handle *usb_handle;
- struct chan_usbradio_pvt *o = (struct chan_usbradio_pvt *) arg;
- struct pollfd pfd = { .events = POLLIN };
-
- usb_dev = hid_device_init(o->devstr);
- if (usb_dev == NULL) {
- ast_log(LOG_ERROR,"USB HID device not found\n");
- pthread_exit(NULL);
- }
- usb_handle = usb_open(usb_dev);
- if (usb_handle == NULL) {
- ast_log(LOG_ERROR,"Not able to open USB device\n");
- pthread_exit(NULL);
- }
- if (usb_claim_interface(usb_handle,C108_HID_INTERFACE) < 0)
- {
- if (usb_detach_kernel_driver_np(usb_handle,C108_HID_INTERFACE) < 0) {
- ast_log(LOG_ERROR,"Not able to detach the USB device\n");
- pthread_exit(NULL);
- }
- if (usb_claim_interface(usb_handle,C108_HID_INTERFACE) < 0) {
- ast_log(LOG_ERROR,"Not able to claim the USB device\n");
- pthread_exit(NULL);
- }
- }
- memset(buf,0,sizeof(buf));
- buf[2] = o->hid_gpio_ctl;
- buf[1] = 0;
- hid_set_outputs(usb_handle,buf);
- memcpy(bufsave,buf,sizeof(buf));
- if (pipe(o->pttkick) == -1)
- {
- ast_log(LOG_ERROR,"Not able to create pipe\n");
- pthread_exit(NULL);
- }
- traceusb1(("hidthread: Starting normally on %s!!\n",o->name));
- // popen
- while (!o->stophid) {
- pfd.fd = o->pttkick[0];
- pfd.revents = 0;
-
- res = ast_poll(&pfd, 1, 50);
- if (res < 0) {
- ast_log(LOG_WARNING, "poll() failed: %s\n", strerror(errno));
- usleep(10000);
- continue;
- }
- if (pfd.revents & POLLIN) {
- char c;
-
- if (read(o->pttkick[0], &c, 1) < 0) {
- ast_log(LOG_ERROR, "read() failed: %s\n", strerror(errno));
- }
- }
- if (o->wanteeprom) {
- ast_mutex_lock(&o->eepromlock);
- if (o->eepromctl == 1) { /* to read */
- /* if CS okay */
- if (!get_eeprom(usb_handle, o->eeprom)) {
- if (o->eeprom[EEPROM_MAGIC_ADDR] != EEPROM_MAGIC) {
- ast_log(LOG_NOTICE, "UNSUCCESSFUL: EEPROM MAGIC NUMBER BAD on channel %s\n", o->name);
- } else {
- o->rxmixerset = o->eeprom[EEPROM_RXMIXERSET];
- o->txmixaset = o->eeprom[EEPROM_TXMIXASET];
- o->txmixbset = o->eeprom[EEPROM_TXMIXBSET];
- memcpy(&o->rxvoiceadj, &o->eeprom[EEPROM_RXVOICEADJ], sizeof(float));
- memcpy(&o->rxctcssadj, &o->eeprom[EEPROM_RXCTCSSADJ], sizeof(float));
- o->txctcssadj = o->eeprom[EEPROM_TXCTCSSADJ];
- o->rxsquelchadj = o->eeprom[EEPROM_RXSQUELCHADJ];
- ast_log(LOG_NOTICE,"EEPROM Loaded on channel %s\n",o->name);
- }
- } else {
- ast_log(LOG_NOTICE, "USB Adapter has no EEPROM installed or Checksum BAD on channel %s\n", o->name);
- }
- hid_set_outputs(usb_handle,bufsave);
- }
- if (o->eepromctl == 2) { /* to write */
- put_eeprom(usb_handle,o->eeprom);
- hid_set_outputs(usb_handle,bufsave);
- ast_log(LOG_NOTICE, "USB Parameters written to EEPROM on %s\n", o->name);
- }
- o->eepromctl = 0;
- ast_mutex_unlock(&o->eepromlock);
- }
- buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
- hid_get_inputs(usb_handle,buf);
- keyed = !(buf[o->hid_io_cor_loc] & o->hid_io_cor);
- if (keyed != o->rxhidsq) {
- if (o->debuglevel) {
- printf("chan_usbradio() hidthread: update rxhidsq = %d\n", keyed);
- }
- o->rxhidsq=keyed;
- }
-
- /* if change in tx state as controlled by xpmr */
- txtmp = o->pmrChan->txPttOut;
-
- if (o->lasttx != txtmp) {
- o->pmrChan->txPttHid = o->lasttx = txtmp;
- if (o->debuglevel) {
- ast_debug(0, "hidthread: tx set to %d\n", txtmp);
- }
- buf[o->hid_gpio_loc] = 0;
- if (!o->invertptt) {
- if (txtmp) {
- buf[o->hid_gpio_loc] = o->hid_io_ptt;
- }
- } else {
- if (!txtmp) {
- buf[o->hid_gpio_loc] = o->hid_io_ptt;
- }
- }
- buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
- memcpy(bufsave, buf, sizeof(buf));
- hid_set_outputs(usb_handle, buf);
- }
- time(&o->lasthidtime);
- }
- buf[o->hid_gpio_loc] = 0;
- if (o->invertptt) {
- buf[o->hid_gpio_loc] = o->hid_io_ptt;
- }
- buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
- hid_set_outputs(usb_handle, buf);
- pthread_exit(0);
-}
-
-/*
- * returns a pointer to the descriptor with the given name
- */
-static struct chan_usbradio_pvt *find_desc(const char *dev)
-{
- struct chan_usbradio_pvt *o = NULL;
-
- if (!dev)
- ast_log(LOG_WARNING, "null dev\n");
-
- for (o = usbradio_default.next; o && o->name && dev && strcmp(o->name, dev) != 0; o = o->next);
- if (!o)
- {
- ast_log(LOG_WARNING, "could not find <%s>\n", dev ? dev : "--no-device--");
- }
-
- return o;
-}
-
-static struct chan_usbradio_pvt *find_desc_usb(char *devstr)
-{
- struct chan_usbradio_pvt *o = NULL;
-
- if (!devstr)
- ast_log(LOG_WARNING, "null dev\n");
-
- for (o = usbradio_default.next; o && devstr && strcmp(o->devstr, devstr) != 0; o = o->next);
-
- return o;
-}
-
-/*
- * split a string in extension-context, returns pointers to malloc'ed
- * strings.
- * If we do not have 'overridecontext' then the last @ is considered as
- * a context separator, and the context is overridden.
- * This is usually not very necessary as you can play with the dialplan,
- * and it is nice not to need it because you have '@' in SIP addresses.
- * Return value is the buffer address.
- */
-#if 0
-static char *ast_ext_ctx(const char *src, char **ext, char **ctx)
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
- if (ext == NULL || ctx == NULL)
- return NULL; /* error */
-
- *ext = *ctx = NULL;
-
- if (src && *src != '\0')
- *ext = ast_strdup(src);
-
- if (*ext == NULL)
- return NULL;
-
- if (!o->overridecontext) {
- /* parse from the right */
- *ctx = strrchr(*ext, '@');
- if (*ctx)
- *(*ctx)++ = '\0';
- }
-
- return *ext;
-}
-#endif
-
-/*
- * Returns the number of blocks used in the audio output channel
- */
-static int used_blocks(struct chan_usbradio_pvt *o)
-{
- struct audio_buf_info info;
-
- if (ioctl(o->sounddev, SNDCTL_DSP_GETOSPACE, &info)) {
- if (!(o->warned & WARN_used_blocks)) {
- ast_log(LOG_WARNING, "Error reading output space\n");
- o->warned |= WARN_used_blocks;
- }
- return 1;
- }
-
- if (o->total_blocks == 0) {
- if (0) /* debugging */
- ast_log(LOG_WARNING, "fragtotal %d size %d avail %d\n", info.fragstotal, info.fragsize, info.fragments);
- o->total_blocks = info.fragments;
- }
-
- return o->total_blocks - info.fragments;
-}
-
-/* Write an exactly FRAME_SIZE sized frame */
-static int soundcard_writeframe(struct chan_usbradio_pvt *o, short *data)
-{
- int res;
-
- if (o->sounddev < 0)
- setformat(o, O_RDWR);
- if (o->sounddev < 0)
- return 0; /* not fatal */
- // maw maw sph !!! may or may not be a good thing
- // drop the frame if not transmitting, this keeps from gradually
- // filling the buffer when asterisk clock > usb sound clock
- if(!o->pmrChan->txPttIn && !o->pmrChan->txPttOut)
- {
- //return 0;
- }
- /*
- * Nothing complex to manage the audio device queue.
- * If the buffer is full just drop the extra, otherwise write.
- * XXX in some cases it might be useful to write anyways after
- * a number of failures, to restart the output chain.
- */
- res = used_blocks(o);
- if (res > o->queuesize) { /* no room to write a block */
- // ast_log(LOG_WARNING, "sound device write buffer overflow\n");
- if (o->w_errors++ == 0 && (usbradio_debug & 0x4))
- ast_log(LOG_WARNING, "write: used %d blocks (%d)\n", res, o->w_errors);
- return 0;
- }
- o->w_errors = 0;
-
- return write(o->sounddev, ((void *) data), FRAME_SIZE * 2 * 12);
-}
-
-#ifndef NEW_ASTERISK
-
-/*
- * Handler for 'sound writable' events from the sound thread.
- * Builds a frame from the high level description of the sounds,
- * and passes it to the audio device.
- * The actual sound is made of 1 or more sequences of sound samples
- * (s->datalen, repeated to make s->samplen samples) followed by
- * s->silencelen samples of silence. The position in the sequence is stored
- * in o->sampsent, which goes between 0 .. s->samplen+s->silencelen.
- * In case we fail to write a frame, don't update o->sampsent.
- */
-static void send_sound(struct chan_usbradio_pvt *o)
-{
- short myframe[FRAME_SIZE];
- int ofs, l, start;
- int l_sampsent = o->sampsent;
- struct sound *s;
-
- if (o->cursound < 0) /* no sound to send */
- return;
-
- s = &sounds[o->cursound];
-
- for (ofs = 0; ofs < FRAME_SIZE; ofs += l) {
- l = s->samplen - l_sampsent; /* # of available samples */
- if (l > 0) {
- start = l_sampsent % s->datalen; /* source offset */
- if (l > FRAME_SIZE - ofs) /* don't overflow the frame */
- l = FRAME_SIZE - ofs;
- if (l > s->datalen - start) /* don't overflow the source */
- l = s->datalen - start;
- memmove(myframe + ofs, s->data + start, l * 2);
- if (0)
- ast_log(LOG_WARNING, "send_sound sound %d/%d of %d into %d\n", l_sampsent, l, s->samplen, ofs);
- l_sampsent += l;
- } else { /* end of samples, maybe some silence */
- static const short silence[FRAME_SIZE] = { 0, };
-
- l += s->silencelen;
- if (l > 0) {
- if (l > FRAME_SIZE - ofs)
- l = FRAME_SIZE - ofs;
- memmove(myframe + ofs, silence, l * 2);
- l_sampsent += l;
- } else { /* silence is over, restart sound if loop */
- if (s->repeat == 0) { /* last block */
- o->cursound = -1;
- o->nosound = 0; /* allow audio data */
- if (ofs < FRAME_SIZE) /* pad with silence */
- memmove(myframe + ofs, silence, (FRAME_SIZE - ofs) * 2);
- }
- l_sampsent = 0;
- }
- }
- }
- l = soundcard_writeframe(o, myframe);
- if (l > 0)
- o->sampsent = l_sampsent; /* update status */
-}
-
-static void *sound_thread(void *arg)
-{
- char ign[4096];
- struct chan_usbradio_pvt *o = (struct chan_usbradio_pvt *) arg;
-
- /*
- * Just in case, kick the driver by trying to read from it.
- * Ignore errors - this read is almost guaranteed to fail.
- */
- read(o->sounddev, ign, sizeof(ign));
- for (;;) {
- struct pollfd pfd[2] = { { .fd = o->sndcmd[0], .events = POLLIN }, { .fd = o->sounddev } };
- int res;
-
- if (o->cursound > -1 && o->sounddev < 0) {
- setformat(o, O_RDWR); /* need the channel, try to reopen */
- } else if (o->cursound == -1 && o->owner == NULL) {
- setformat(o, O_CLOSE); /* can close */
- }
- if (o->sounddev > -1) {
- if (!o->owner) { /* no one owns the audio, so we must drain it */
- pfd[1].events = POLLIN;
- }
- if (o->cursound > -1) {
- pfd[1].events |= POLLOUT;
- }
- }
- res = ast_poll(pfd, o->sounddev > -1 ? 2 : 1, -1);
- if (res < 1) {
- ast_log(LOG_WARNING, "poll failed: %s\n", strerror(errno));
- sleep(1);
- continue;
- }
- if (pfd[0].revents & POLLIN) {
- /* read which sound to play from the pipe */
- int i, what = -1;
-
- read(o->sndcmd[0], &what, sizeof(what));
- for (i = 0; sounds[i].ind != -1; i++) {
- if (sounds[i].ind == what) {
- o->cursound = i;
- o->sampsent = 0;
- o->nosound = 1; /* block audio from pbx */
- break;
- }
- }
- if (sounds[i].ind == -1) {
- ast_log(LOG_WARNING, "invalid sound index: %d\n", what);
- }
- }
- if (o->sounddev > -1) {
- if (pfd[1].revents & POLLIN) { /* read and ignore errors */
- read(o->sounddev, ign, sizeof(ign));
- }
- if (pfd[1].revents & POLLOUT) {
- send_sound(o);
- }
- }
- }
- return NULL; /* Never reached */
-}
-
-#endif
-
-/*
- * reset and close the device if opened,
- * then open and initialize it in the desired mode,
- * trigger reads and writes so we can start using it.
- */
-static int setformat(struct chan_usbradio_pvt *o, int mode)
-{
- int fmt, desired, res, fd;
- char device[100];
-
- if (o->sounddev >= 0) {
- ioctl(o->sounddev, SNDCTL_DSP_RESET, 0);
- close(o->sounddev);
- o->duplex = M_UNSET;
- o->sounddev = -1;
- }
- if (mode == O_CLOSE) /* we are done */
- return 0;
- o->lastopen = ast_tvnow();
- strcpy(device,"/dev/dsp");
- if (o->devicenum)
- sprintf(device,"/dev/dsp%d",o->devicenum);
- fd = o->sounddev = open(device, mode | O_NONBLOCK);
- if (fd < 0) {
- ast_log(LOG_WARNING, "Unable to re-open DSP device %d: %s\n", o->devicenum, strerror(errno));
- return -1;
- }
- if (o->owner) {
- ast_channel_internal_fd_set(o->owner, 0, fd);
- }
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- fmt = AFMT_S16_LE;
-#else
- fmt = AFMT_S16_BE;
-#endif
- res = ioctl(fd, SNDCTL_DSP_SETFMT, &fmt);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set format to 16-bit signed\n");
- return -1;
- }
- switch (mode) {
- case O_RDWR:
- res = ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);
- /* Check to see if duplex set (FreeBSD Bug) */
- res = ioctl(fd, SNDCTL_DSP_GETCAPS, &fmt);
- if (res == 0 && (fmt & DSP_CAP_DUPLEX)) {
- ast_verb(2, "Console is full duplex\n");
- o->duplex = M_FULL;
- };
- break;
- case O_WRONLY:
- o->duplex = M_WRITE;
- break;
- case O_RDONLY:
- o->duplex = M_READ;
- break;
- }
-
- fmt = 1;
- res = ioctl(fd, SNDCTL_DSP_STEREO, &fmt);
- if (res < 0) {
- ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
- return -1;
- }
- fmt = desired = 48000; /* 8000 Hz desired */
- res = ioctl(fd, SNDCTL_DSP_SPEED, &fmt);
-
- if (res < 0) {
- ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
- return -1;
- }
- if (fmt != desired) {
- if (!(o->warned & WARN_speed)) {
- ast_log(LOG_WARNING,
- "Requested %d Hz, got %d Hz -- sound may be choppy\n",
- desired, fmt);
- o->warned |= WARN_speed;
- }
- }
- /*
- * on Freebsd, SETFRAGMENT does not work very well on some cards.
- * Default to use 256 bytes, let the user override
- */
- if (o->frags) {
- fmt = o->frags;
- res = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fmt);
- if (res < 0) {
- if (!(o->warned & WARN_frag)) {
- ast_log(LOG_WARNING,
- "Unable to set fragment size -- sound may be choppy\n");
- o->warned |= WARN_frag;
- }
- }
- }
- /* on some cards, we need SNDCTL_DSP_SETTRIGGER to start outputting */
- res = PCM_ENABLE_INPUT | PCM_ENABLE_OUTPUT;
- res = ioctl(fd, SNDCTL_DSP_SETTRIGGER, &res);
- /* it may fail if we are in half duplex, never mind */
- return 0;
-}
-
-/*
- * some of the standard methods supported by channels.
- */
-static int usbradio_digit_begin(struct ast_channel *c, char digit)
-{
- return 0;
-}
-
-static int usbradio_digit_end(struct ast_channel *c, char digit, unsigned int duration)
-{
- /* no better use for received digits than print them */
- ast_verbose(" << Console Received digit %c of duration %u ms >> \n",
- digit, duration);
- return 0;
-}
-/*
- SETFREQ - sets spi programmable xcvr
- SETCHAN - sets binary parallel xcvr
-*/
-static int usbradio_text(struct ast_channel *c, const char *text)
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
- double tx,rx;
- char cnt,rxs[16],txs[16],txpl[16],rxpl[16];
- char pwr,*cmd;
-
- cmd = alloca(strlen(text) + 10);
-
- /* print received messages */
- if(o->debuglevel)ast_verbose(" << Console Received usbradio text %s >> \n", text);
-
- cnt = sscanf(text, "%300s %15s %15s %15s %15s %1c", cmd, rxs, txs, rxpl, txpl, &pwr);
-
- if (strcmp(cmd,"SETCHAN")==0)
- {
- u8 chan;
- chan=strtod(rxs,NULL);
- ppbinout(chan);
- if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETCHAN cmd: %s chan: %i\n",text,chan);
- return 0;
- }
-
- if (cnt < 6)
- {
- ast_log(LOG_ERROR,"Cannot parse usbradio text: %s\n",text);
- return 0;
- }
- else
- {
- if(o->debuglevel)ast_verbose(" << %s %s %s %s %s %c >> \n", cmd,rxs,txs,rxpl,txpl,pwr);
- }
-
- if (strcmp(cmd,"SETFREQ")==0)
- {
- if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETFREQ cmd: %s\n",text);
- tx=strtod(txs,NULL);
- rx=strtod(rxs,NULL);
- o->set_txfreq = round(tx * (double)1000000);
- o->set_rxfreq = round(rx * (double)1000000);
- o->pmrChan->txpower = (pwr == 'H');
- strcpy(o->set_rxctcssfreqs,rxpl);
- strcpy(o->set_txctcssfreqs,txpl);
-
- o->b.remoted=1;
- xpmr_config(o);
- return 0;
- }
- ast_log(LOG_ERROR,"Cannot parse usbradio cmd: %s\n",text);
- return 0;
-}
-
-/* Play ringtone 'x' on device 'o' */
-static void ring(struct chan_usbradio_pvt *o, int x)
-{
-#ifndef NEW_ASTERISK
- write(o->sndcmd[1], &x, sizeof(x));
-#endif
-}
-
-/*
- * handler for incoming calls. Either autoanswer, or start ringing
- */
-static int usbradio_call(struct ast_channel *c, const char *dest, int timeout)
-{
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(c);
-
- o->stophid = 0;
- time(&o->lasthidtime);
- ast_pthread_create_background(&o->hidthread, NULL, hidthread, o);
- ast_setstate(c, AST_STATE_UP);
- return 0;
-}
-
-/*
- * remote side answered the phone
- */
-static int usbradio_answer(struct ast_channel *c)
-{
-#ifndef NEW_ASTERISK
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(c);
-#endif
-
- ast_setstate(c, AST_STATE_UP);
-#ifndef NEW_ASTERISK
- o->cursound = -1;
- o->nosound = 0;
-#endif
- return 0;
-}
-
-static int usbradio_hangup(struct ast_channel *c)
-{
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(c);
-
- //ast_log(LOG_NOTICE, "usbradio_hangup()\n");
-#ifndef NEW_ASTERISK
- o->cursound = -1;
- o->nosound = 0;
-#endif
- ast_channel_tech_pvt_set(c, NULL);
- o->owner = NULL;
- ast_module_unref(ast_module_info->self);
- if (o->hookstate) {
- if (o->autoanswer || o->autohangup) {
- /* Assume auto-hangup too */
- o->hookstate = 0;
- setformat(o, O_CLOSE);
- } else {
- /* Make congestion noise */
- ring(o, AST_CONTROL_CONGESTION);
- }
- }
- o->stophid = 1;
- pthread_join(o->hidthread,NULL);
- return 0;
-}
-
-
-/* used for data coming from the network */
-static int usbradio_write(struct ast_channel *c, struct ast_frame *f)
-{
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(c);
-
- traceusb2(("usbradio_write() o->nosound= %i\n",o->nosound));
-
-#ifndef NEW_ASTERISK
- /* Immediately return if no sound is enabled */
- if (o->nosound)
- return 0;
- /* Stop any currently playing sound */
- o->cursound = -1;
-#endif
- /*
- * we could receive a block which is not a multiple of our
- * FRAME_SIZE, so buffer it locally and write to the device
- * in FRAME_SIZE chunks.
- * Keep the residue stored for future use.
- */
-
- #if DEBUG_CAPTURES == 1 // to write input data to a file datalen=320
- if (ftxcapraw && o->b.txcapraw)
- {
- i16 i, tbuff[f->datalen];
- for(i=0;i<f->datalen;i+=2)
- {
- tbuff[i]= ((i16*)(f->data.ptr))[i/2];
- tbuff[i+1]= o->txkeyed*M_Q13;
- }
- if (fwrite(tbuff,2,f->datalen,ftxcapraw) != f->datalen) {
- ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));
- }
- //fwrite(f->data,1,f->datalen,ftxcapraw);
- }
- #endif
-
- // maw just take the data from the network and save it for PmrRx processing
-
- PmrTx(o->pmrChan,(i16*)f->data.ptr);
-
- return 0;
-}
-
-static struct ast_frame *usbradio_read(struct ast_channel *c)
-{
- int res, src, datalen, oldpttout;
- int cd,sd;
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(c);
- struct ast_frame *f = &o->read_f,*f1;
- struct ast_frame wf = { AST_FRAME_CONTROL };
- time_t now;
-
- traceusb2(("usbradio_read()\n"));
-
- if (o->lasthidtime)
- {
- time(&now);
- if ((now - o->lasthidtime) > 3)
- {
- ast_log(LOG_ERROR,"HID process has died or something!!\n");
- return NULL;
- }
- }
- /* XXX can be simplified returning &ast_null_frame */
- /* prepare a NULL frame in case we don't have enough data to return */
- memset(f, '\0', sizeof(struct ast_frame));
- f->frametype = AST_FRAME_NULL;
- f->src = usbradio_tech.type;
-
- res = read(o->sounddev, o->usbradio_read_buf + o->readpos,
- sizeof(o->usbradio_read_buf) - o->readpos);
- if (res < 0) /* audio data not ready, return a NULL frame */
- {
- if (errno != EAGAIN) return NULL;
- if (o->readerrs++ > READERR_THRESHOLD)
- {
- ast_log(LOG_ERROR,"Stuck USB read channel [%s], un-sticking it!\n",o->name);
- o->readerrs = 0;
- return NULL;
- }
- if (o->readerrs == 1)
- ast_log(LOG_WARNING,"Possibly stuck USB read channel. [%s]\n",o->name);
- return f;
- }
- if (o->readerrs) ast_log(LOG_WARNING,"Nope, USB read channel [%s] wasn't stuck after all.\n",o->name);
- o->readerrs = 0;
- o->readpos += res;
- if (o->readpos < sizeof(o->usbradio_read_buf)) /* not enough samples */
- return f;
-
- if (o->mute)
- return f;
-
- #if DEBUG_CAPTURES == 1
- if ((o->b.rxcapraw && frxcapraw) && (fwrite((o->usbradio_read_buf + AST_FRIENDLY_OFFSET),1,FRAME_SIZE * 2 * 2 * 6,frxcapraw) != FRAME_SIZE * 2 * 2 * 6)) {
- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
- }
- #endif
-
- #if 1
- if(o->txkeyed||o->txtestkey)
- {
- if(!o->pmrChan->txPttIn)
- {
- o->pmrChan->txPttIn=1;
- if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,ast_channel_name(o->owner));
- }
- }
- else if(o->pmrChan->txPttIn)
- {
- o->pmrChan->txPttIn=0;
- if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,ast_channel_name(o->owner));
- }
- oldpttout = o->pmrChan->txPttOut;
-
- PmrRx( o->pmrChan,
- (i16 *)(o->usbradio_read_buf + AST_FRIENDLY_OFFSET),
- (i16 *)(o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET),
- (i16 *)(o->usbradio_write_buf_1));
-
- if (oldpttout != o->pmrChan->txPttOut)
- {
- if(o->debuglevel) ast_log(LOG_NOTICE,"txPttOut = %i, chan %s\n",o->pmrChan->txPttOut,ast_channel_name(o->owner));
- kickptt(o);
- }
-
- #if 0 // to write 48KS/s stereo tx data to a file
- if (!ftxoutraw) ftxoutraw = fopen(TX_CAP_OUT_FILE,"w");
- if (ftxoutraw) fwrite(o->usbradio_write_buf_1,1,FRAME_SIZE * 2 * 6,ftxoutraw);
- #endif
-
- #if DEBUG_CAPTURES == 1 && XPMR_DEBUG0 == 1
- if ((o->b.txcap2 && ftxcaptrace) && (fwrite((o->pmrChan->ptxDebug),1,FRAME_SIZE * 2 * 16,ftxcaptrace) != FRAME_SIZE * 2 * 16)) {
- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
- }
- #endif
-
- // 160 samples * 2 bytes/sample * 2 chan * 6x oversampling to 48KS/s
- datalen = FRAME_SIZE * 24;
- src = 0; /* read position into f->data */
- while (src < datalen)
- {
- /* Compute spare room in the buffer */
- int l = sizeof(o->usbradio_write_buf) - o->usbradio_write_dst;
-
- if (datalen - src >= l)
- {
- /* enough to fill a frame */
- memcpy(o->usbradio_write_buf + o->usbradio_write_dst, o->usbradio_write_buf_1 + src, l);
- soundcard_writeframe(o, (short *) o->usbradio_write_buf);
- src += l;
- o->usbradio_write_dst = 0;
- }
- else
- {
- /* copy residue */
- l = datalen - src;
- memcpy(o->usbradio_write_buf + o->usbradio_write_dst, o->usbradio_write_buf_1 + src, l);
- src += l; /* but really, we are done */
- o->usbradio_write_dst += l;
- }
- }
- #else
- static FILE *hInput;
- i16 iBuff[FRAME_SIZE*2*6];
-
- o->pmrChan->b.rxCapture=1;
-
- if(!hInput)
- {
- hInput = fopen("/usr/src/xpmr/testdata/rx_in.pcm","r");
- if(!hInput)
- {
- printf(" Input Data File Not Found.\n");
- return 0;
- }
- }
-
- if(0==fread((void *)iBuff,2,FRAME_SIZE*2*6,hInput))exit;
-
- PmrRx( o->pmrChan,
- (i16 *)iBuff,
- (i16 *)(o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET));
-
- #endif
-
- #if 0
- if (!frxoutraw) frxoutraw = fopen(RX_CAP_OUT_FILE,"w");
- if (frxoutraw) fwrite((o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET),1,FRAME_SIZE * 2,frxoutraw);
- #endif
-
- #if DEBUG_CAPTURES == 1 && XPMR_DEBUG0 == 1
- if ((frxcaptrace && o->b.rxcap2 && o->pmrChan->b.radioactive) && (fwrite((o->pmrChan->prxDebug),1,FRAME_SIZE * 2 * 16,frxcaptrace) != FRAME_SIZE * 2 * 16 )) {
- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
- }
- #endif
-
- cd = 0;
- if(o->rxcdtype==CD_HID && (o->pmrChan->rxExtCarrierDetect!=o->rxhidsq))
- o->pmrChan->rxExtCarrierDetect=o->rxhidsq;
-
- if(o->rxcdtype==CD_HID_INVERT && (o->pmrChan->rxExtCarrierDetect==o->rxhidsq))
- o->pmrChan->rxExtCarrierDetect=!o->rxhidsq;
-
- if( (o->rxcdtype==CD_HID && o->rxhidsq) ||
- (o->rxcdtype==CD_HID_INVERT && !o->rxhidsq) ||
- (o->rxcdtype==CD_XPMR_NOISE && o->pmrChan->rxCarrierDetect) ||
- (o->rxcdtype==CD_XPMR_VOX && o->pmrChan->rxCarrierDetect)
- )
- {
- if (!o->pmrChan->txPttOut || o->radioduplex)cd=1;
- }
- else
- {
- cd=0;
- }
-
- if(cd!=o->rxcarrierdetect)
- {
- o->rxcarrierdetect=cd;
- if(o->debuglevel) ast_log(LOG_NOTICE,"rxcarrierdetect = %i, chan %s\n",cd,ast_channel_name(o->owner));
- // printf("rxcarrierdetect = %i, chan %s\n",res,o->owner->name);
- }
-
- if(o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode!=o->rxctcssdecode)
- {
- if(o->debuglevel)ast_log(LOG_NOTICE,"rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,ast_channel_name(o->owner));
- // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name);
- o->rxctcssdecode=o->pmrChan->rxCtcss->decode;
- strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq);
- }
-
- #ifndef HAVE_XPMRX
- if( !o->pmrChan->b.ctcssRxEnable ||
- ( o->pmrChan->b.ctcssRxEnable &&
- o->pmrChan->rxCtcss->decode>CTCSS_NULL &&
- o->pmrChan->smode==SMODE_CTCSS )
- )
- {
- sd=1;
- }
- else
- {
- sd=0;
- }
- #else
- if( (!o->pmrChan->b.ctcssRxEnable && !o->pmrChan->b.dcsRxEnable && !o->pmrChan->b.lmrRxEnable) ||
- ( o->pmrChan->b.ctcssRxEnable &&
- o->pmrChan->rxCtcss->decode>CTCSS_NULL &&
- o->pmrChan->smode==SMODE_CTCSS ) ||
- ( o->pmrChan->b.dcsRxEnable &&
- o->pmrChan->decDcs->decode > 0 &&
- o->pmrChan->smode==SMODE_DCS )
- )
- {
- sd=1;
- }
- else
- {
- sd=0;
- }
-
- if(o->pmrChan->decDcs->decode!=o->rxdcsdecode)
- {
- if(o->debuglevel)ast_log(LOG_NOTICE,"rxdcsdecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,ast_channel_name(o->owner));
- // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name);
- o->rxdcsdecode=o->pmrChan->decDcs->decode;
- strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq);
- }
-
- if(o->pmrChan->rptnum && (o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed != o->rxlsddecode))
- {
- if(o->debuglevel)ast_log(LOG_NOTICE,"rxLSDecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,ast_channel_name(o->owner));
- o->rxlsddecode=o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed;
- strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq);
- }
-
- if( (o->pmrChan->rptnum>0 && o->pmrChan->smode==SMODE_LSD && o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed)||
- (o->pmrChan->smode==SMODE_DCS && o->pmrChan->decDcs->decode>0) )
- {
- sd=1;
- }
- #endif
-
- if ( cd && sd )
- {
- //if(!o->rxkeyed)o->pmrChan->dd.b.doitnow=1;
- if(!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %s\n", ast_channel_name(o->owner));
- o->rxkeyed = 1;
- }
- else
- {
- //if(o->rxkeyed)o->pmrChan->dd.b.doitnow=1;
- if(o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 0, chan %s\n",ast_channel_name(o->owner));
- o->rxkeyed = 0;
- }
-
- // provide rx signal detect conditions
- if (o->lastrx && (!o->rxkeyed))
- {
- o->lastrx = 0;
- //printf("AST_CONTROL_RADIO_UNKEY\n");
- wf.subclass.integer = AST_CONTROL_RADIO_UNKEY;
- ast_queue_frame(o->owner, &wf);
- }
- else if ((!o->lastrx) && (o->rxkeyed))
- {
- o->lastrx = 1;
- //printf("AST_CONTROL_RADIO_KEY\n");
- wf.subclass.integer = AST_CONTROL_RADIO_KEY;
- if(o->rxctcssdecode)
- {
- wf.data.ptr = o->rxctcssfreq;
- wf.datalen = strlen(o->rxctcssfreq) + 1;
- TRACEO(1,("AST_CONTROL_RADIO_KEY text=%s\n",o->rxctcssfreq));
- }
- ast_queue_frame(o->owner, &wf);
- }
-
- o->readpos = AST_FRIENDLY_OFFSET; /* reset read pointer for next frame */
- if (ast_channel_state(c) != AST_STATE_UP) /* drop data if frame is not up */
- return f;
- /* ok we can build and deliver the frame to the caller */
- f->frametype = AST_FRAME_VOICE;
- ast_format_set(&f->subclass.format, AST_FORMAT_SLINEAR, 0);
- f->samples = FRAME_SIZE;
- f->datalen = FRAME_SIZE * 2;
- f->data.ptr = o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET;
- if (o->boost != BOOST_SCALE) { /* scale and clip values */
- int i, x;
- int16_t *p = (int16_t *) f->data.ptr;
- for (i = 0; i < f->samples; i++) {
- x = (p[i] * o->boost) / BOOST_SCALE;
- if (x > 32767)
- x = 32767;
- else if (x < -32768)
- x = -32768;
- p[i] = x;
- }
- }
-
- f->offset = AST_FRIENDLY_OFFSET;
- if (o->dsp)
- {
- f1 = ast_dsp_process(c,o->dsp,f);
- if ((f1->frametype == AST_FRAME_DTMF_END) ||
- (f1->frametype == AST_FRAME_DTMF_BEGIN))
- {
- if ((f1->subclass.integer == 'm') || (f1->subclass.integer == 'u'))
- {
- f1->frametype = AST_FRAME_NULL;
- f1->subclass.integer = 0;
- return(f1);
- }
- if (f1->frametype == AST_FRAME_DTMF_END)
- ast_log(LOG_NOTICE, "Got DTMF char %c\n", f1->subclass.integer);
- return(f1);
- }
- }
- return f;
-}
-
-static int usbradio_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
-{
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(newchan);
- ast_log(LOG_WARNING,"usbradio_fixup()\n");
- o->owner = newchan;
- return 0;
-}
-
-static int usbradio_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen)
-{
- struct chan_usbradio_pvt *o = ast_channel_tech_pvt(c);
- int res = -1;
-
- switch (cond) {
- case AST_CONTROL_BUSY:
- case AST_CONTROL_CONGESTION:
- case AST_CONTROL_RINGING:
- res = cond;
- break;
- case AST_CONTROL_INCOMPLETE:
- res = AST_CONTROL_CONGESTION;
- break;
- case -1:
-#ifndef NEW_ASTERISK
- o->cursound = -1;
- o->nosound = 0; /* when cursound is -1 nosound must be 0 */
-#endif
- return 0;
-
- case AST_CONTROL_VIDUPDATE:
- res = -1;
- break;
- case AST_CONTROL_HOLD:
- ast_verbose(" << Console Has Been Placed on Hold >> \n");
- ast_moh_start(c, data, o->mohinterpret);
- break;
- case AST_CONTROL_UNHOLD:
- ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
- ast_moh_stop(c);
- break;
- case AST_CONTROL_PROCEEDING:
- ast_verbose(" << Call Proceeding... >> \n");
- ast_moh_stop(c);
- break;
- case AST_CONTROL_PROGRESS:
- ast_verbose(" << Call Progress... >> \n");
- ast_moh_stop(c);
- break;
- case AST_CONTROL_RADIO_KEY:
- o->txkeyed = 1;
- if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_KEY Radio Transmit On. >> \n");
- break;
- case AST_CONTROL_RADIO_UNKEY:
- o->txkeyed = 0;
- if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_UNKEY Radio Transmit Off. >> \n");
- break;
- default:
- ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, ast_channel_name(c));
- return -1;
- }
-
- if (res > -1)
- ring(o, res);
-
- return 0;
-}
-
-/*
- * allocate a new channel.
- */
-static struct ast_channel *usbradio_new(struct chan_usbradio_pvt *o, char *ext, char *ctx, int state, const char *linkedid)
-{
- struct ast_channel *c;
-
- c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", ext, ctx, linkedid, 0, "Radio/%s", o->name);
- if (c == NULL)
- return NULL;
- ast_channel_tech_set(c, &usbradio_tech);
- if (o->sounddev < 0)
- setformat(o, O_RDWR);
- ast_channel_internal_fd_set(c, 0, o->sounddev);/* -1 if device closed, override later */
- ast_format_cap_add(ast_channel_nativeformats(c), &slin);
- ast_format_set(ast_channel_readformat(c), AST_FORMAT_SLINEAR, 0);
- ast_format_set(ast_channel_writeformat(c), AST_FORMAT_SLINEAR, 0);
- ast_channel_tech_pvt_set(c, o);
-
- if (!ast_strlen_zero(o->language))
- ast_channel_language_set(c, o->language);
- /* Don't use ast_set_callerid() here because it will
- * generate a needless NewCallerID event */
- if (!ast_strlen_zero(o->cid_num)) {
- ast_channel_caller(c)->ani.number.valid = 1;
- ast_channel_caller(c)->ani.number.str = ast_strdup(o->cid_num);
- }
- if (!ast_strlen_zero(ext)) {
- ast_channel_dialed(c)->number.str = ast_strdup(ext);
- }
-
- o->owner = c;
- ast_module_ref(ast_module_info->self);
- ast_jb_configure(c, &global_jbconf);
- if (state != AST_STATE_DOWN) {
- if (ast_pbx_start(c)) {
- ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ast_channel_name(c));
- ast_hangup(c);
- o->owner = c = NULL;
- /* XXX what about the channel itself ? */
- /* XXX what about usecnt ? */
- }
- }
-
- return c;
-}
-/*
-*/
-static struct ast_channel *usbradio_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
-{
- struct ast_channel *c;
- struct chan_usbradio_pvt *o = find_desc(data);
-
- TRACEO(1,("usbradio_request()\n"));
-
- if (0)
- {
- ast_log(LOG_WARNING, "usbradio_request type <%s> data 0x%p <%s>\n", type, data, data);
- }
- if (o == NULL) {
- ast_log(LOG_NOTICE, "Device %s not found\n", data);
- /* XXX we could default to 'dsp' perhaps ? */
- return NULL;
- }
- if (!(ast_format_cap_iscompatible(cap, &slin))) {
- return NULL;
- }
- if (o->owner) {
- ast_log(LOG_NOTICE, "Already have a call (chan %p) on the usb channel\n", o->owner);
- *cause = AST_CAUSE_BUSY;
- return NULL;
- }
- c = usbradio_new(o, NULL, NULL, AST_STATE_DOWN, requestor ? ast_channel_linkedid(requestor) : NULL);
- if (c == NULL) {
- ast_log(LOG_WARNING, "Unable to create new usb channel\n");
- return NULL;
- }
-
- o->b.remoted=0;
- xpmr_config(o);
-
- return c;
-}
-/*
-*/
-static int console_key(int fd, int argc, char *argv[])
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
- if (argc != 2)
- return RESULT_SHOWUSAGE;
- o->txtestkey = 1;
- return RESULT_SUCCESS;
-}
-/*
-*/
-static int console_unkey(int fd, int argc, char *argv[])
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
- if (argc != 2)
- return RESULT_SHOWUSAGE;
- o->txtestkey = 0;
- return RESULT_SUCCESS;
-}
-
-static int radio_tune(int fd, int argc, char *argv[])
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
- int i=0;
-
- if ((argc < 2) || (argc > 4))
- return RESULT_SHOWUSAGE;
-
- if (argc == 2) /* just show stuff */
- {
- ast_cli(fd,"Active radio interface is [%s]\n",usbradio_active);
- ast_cli(fd,"Output A is currently set to ");
- if(o->txmixa==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n");
- else if (o->txmixa==TX_OUT_VOICE)ast_cli(fd,"voice.\n");
- else if (o->txmixa==TX_OUT_LSD)ast_cli(fd,"tone.\n");
- else if (o->txmixa==TX_OUT_AUX)ast_cli(fd,"auxvoice.\n");
- else ast_cli(fd,"off.\n");
-
- ast_cli(fd,"Output B is currently set to ");
- if(o->txmixb==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n");
- else if (o->txmixb==TX_OUT_VOICE)ast_cli(fd,"voice.\n");
- else if (o->txmixb==TX_OUT_LSD)ast_cli(fd,"tone.\n");
- else if (o->txmixb==TX_OUT_AUX)ast_cli(fd,"auxvoice.\n");
- else ast_cli(fd,"off.\n");
-
- ast_cli(fd,"Tx Voice Level currently set to %d\n",o->txmixaset);
- ast_cli(fd,"Tx Tone Level currently set to %d\n",o->txctcssadj);
- ast_cli(fd,"Rx Squelch currently set to %d\n",o->rxsquelchadj);
- ast_cli(fd,"Device String is %s\n",o->devstr);
- return RESULT_SHOWUSAGE;
- }
-
- o->pmrChan->b.tuning=1;
-
- if (!strcasecmp(argv[2],"rxnoise")) tune_rxinput(fd,o);
- else if (!strcasecmp(argv[2],"rxvoice")) tune_rxvoice(fd,o);
- else if (!strcasecmp(argv[2],"rxtone")) tune_rxctcss(fd,o);
- else if (!strcasecmp(argv[2],"rxsquelch"))
- {
- if (argc == 3)
- {
- ast_cli(fd,"Current Signal Strength is %d\n",((32767-o->pmrChan->rxRssi)*1000/32767));
- ast_cli(fd,"Current Squelch setting is %d\n",o->rxsquelchadj);
- //ast_cli(fd,"Current Raw RSSI is %d\n",o->pmrChan->rxRssi);
- //ast_cli(fd,"Current (real) Squelch setting is %d\n",*(o->pmrChan->prxSquelchAdjust));
- } else {
- i = atoi(argv[3]);
- if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
- ast_cli(fd,"Changed Squelch setting to %d\n",i);
- o->rxsquelchadj = i;
- *(o->pmrChan->prxSquelchAdjust)= ((999 - i) * 32767) / 1000;
- }
- }
- else if (!strcasecmp(argv[2],"txvoice")) {
- i = 0;
-
- if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) &&
- (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE)
- )
- {
- ast_log(LOG_ERROR,"No txvoice output configured.\n");
- }
- else if (argc == 3)
- {
- if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
- ast_cli(fd,"Current txvoice setting on Channel A is %d\n",o->txmixaset);
- else
- ast_cli(fd,"Current txvoice setting on Channel B is %d\n",o->txmixbset);
- }
- else
- {
- i = atoi(argv[3]);
- if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-
- if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
- {
- o->txmixaset=i;
- ast_cli(fd,"Changed txvoice setting on Channel A to %d\n",o->txmixaset);
- }
- else
- {
- o->txmixbset=i;
- ast_cli(fd,"Changed txvoice setting on Channel B to %d\n",o->txmixbset);
- }
- mixer_write(o);
- mult_set(o);
- ast_cli(fd,"Changed Tx Voice Output setting to %d\n",i);
- }
- o->pmrChan->b.txCtcssInhibit=1;
- tune_txoutput(o,i,fd);
- o->pmrChan->b.txCtcssInhibit=0;
- }
- else if (!strcasecmp(argv[2],"txall")) {
- i = 0;
-
- if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) &&
- (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE)
- )
- {
- ast_log(LOG_ERROR,"No txvoice output configured.\n");
- }
- else if (argc == 3)
- {
- if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
- ast_cli(fd,"Current txvoice setting on Channel A is %d\n",o->txmixaset);
- else
- ast_cli(fd,"Current txvoice setting on Channel B is %d\n",o->txmixbset);
- }
- else
- {
- i = atoi(argv[3]);
- if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-
- if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
- {
- o->txmixaset=i;
- ast_cli(fd,"Changed txvoice setting on Channel A to %d\n",o->txmixaset);
- }
- else
- {
- o->txmixbset=i;
- ast_cli(fd,"Changed txvoice setting on Channel B to %d\n",o->txmixbset);
- }
- mixer_write(o);
- mult_set(o);
- ast_cli(fd,"Changed Tx Voice Output setting to %d\n",i);
- }
- tune_txoutput(o,i,fd);
- }
- else if (!strcasecmp(argv[2],"auxvoice")) {
- i = 0;
- if( (o->txmixa!=TX_OUT_AUX) && (o->txmixb!=TX_OUT_AUX))
- {
- ast_log(LOG_WARNING,"No auxvoice output configured.\n");
- }
- else if (argc == 3)
- {
- if(o->txmixa==TX_OUT_AUX)
- ast_cli(fd,"Current auxvoice setting on Channel A is %d\n",o->txmixaset);
- else
- ast_cli(fd,"Current auxvoice setting on Channel B is %d\n",o->txmixbset);
- }
- else
- {
- i = atoi(argv[3]);
- if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
- if(o->txmixa==TX_OUT_AUX)
- {
- o->txmixbset=i;
- ast_cli(fd,"Changed auxvoice setting on Channel A to %d\n",o->txmixaset);
- }
- else
- {
- o->txmixbset=i;
- ast_cli(fd,"Changed auxvoice setting on Channel B to %d\n",o->txmixbset);
- }
- mixer_write(o);
- mult_set(o);
- }
- //tune_auxoutput(o,i);
- }
- else if (!strcasecmp(argv[2],"txtone"))
- {
- if (argc == 3)
- ast_cli(fd,"Current Tx CTCSS modulation setting = %d\n",o->txctcssadj);
- else
- {
- i = atoi(argv[3]);
- if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
- o->txctcssadj = i;
- set_txctcss_level(o);
- ast_cli(fd,"Changed Tx CTCSS modulation setting to %i\n",i);
- }
- o->txtestkey=1;
- usleep(5000000);
- o->txtestkey=0;
- }
- else if (!strcasecmp(argv[2],"dump")) pmrdump(o);
- else if (!strcasecmp(argv[2],"nocap"))
- {
- ast_cli(fd,"File capture (trace) was rx=%d tx=%d and now off.\n",o->b.rxcap2,o->b.txcap2);
- ast_cli(fd,"File capture (raw) was rx=%d tx=%d and now off.\n",o->b.rxcapraw,o->b.txcapraw);
- o->b.rxcapraw=o->b.txcapraw=o->b.rxcap2=o->b.txcap2=o->pmrChan->b.rxCapture=o->pmrChan->b.txCapture=0;
- if (frxcapraw) { fclose(frxcapraw); frxcapraw = NULL; }
- if (frxcaptrace) { fclose(frxcaptrace); frxcaptrace = NULL; }
- if (frxoutraw) { fclose(frxoutraw); frxoutraw = NULL; }
- if (ftxcapraw) { fclose(ftxcapraw); ftxcapraw = NULL; }
- if (ftxcaptrace) { fclose(ftxcaptrace); ftxcaptrace = NULL; }
- if (ftxoutraw) { fclose(ftxoutraw); ftxoutraw = NULL; }
- }
- else if (!strcasecmp(argv[2],"rxtracecap"))
- {
- if (!frxcaptrace) frxcaptrace= fopen(RX_CAP_TRACE_FILE,"w");
- ast_cli(fd,"Trace rx on.\n");
- o->b.rxcap2=o->pmrChan->b.rxCapture=1;
- }
- else if (!strcasecmp(argv[2],"txtracecap"))
- {
- if (!ftxcaptrace) ftxcaptrace= fopen(TX_CAP_TRACE_FILE,"w");
- ast_cli(fd,"Trace tx on.\n");
- o->b.txcap2=o->pmrChan->b.txCapture=1;
- }
- else if (!strcasecmp(argv[2],"rxcap"))
- {
- if (!frxcapraw) frxcapraw = fopen(RX_CAP_RAW_FILE,"w");
- ast_cli(fd,"cap rx raw on.\n");
- o->b.rxcapraw=1;
- }
- else if (!strcasecmp(argv[2],"txcap"))
- {
- if (!ftxcapraw) ftxcapraw = fopen(TX_CAP_RAW_FILE,"w");
- ast_cli(fd,"cap tx raw on.\n");
- o->b.txcapraw=1;
- }
- else if (!strcasecmp(argv[2],"save"))
- {
- tune_write(o);
- ast_cli(fd,"Saved radio tuning settings to usbradio_tune_%s.conf\n",o->name);
- }
- else if (!strcasecmp(argv[2],"load"))
- {
- ast_mutex_lock(&o->eepromlock);
- while(o->eepromctl)
- {
- ast_mutex_unlock(&o->eepromlock);
- usleep(10000);
- ast_mutex_lock(&o->eepromlock);
- }
- o->eepromctl = 1; /* request a load */
- ast_mutex_unlock(&o->eepromlock);
-
- ast_cli(fd,"Requesting loading of tuning settings from EEPROM for channel %s\n",o->name);
- }
- else
- {
- o->pmrChan->b.tuning=0;
- return RESULT_SHOWUSAGE;
- }
- o->pmrChan->b.tuning=0;
- return RESULT_SUCCESS;
-}
-
-/*
- set transmit ctcss modulation level
- adjust mixer output or internal gain depending on output type
- setting range is 0.0 to 0.9
-*/
-static int set_txctcss_level(struct chan_usbradio_pvt *o)
-{
- if (o->txmixa == TX_OUT_LSD)
- {
-// o->txmixaset=(151*o->txctcssadj) / 1000;
- o->txmixaset=o->txctcssadj;
- mixer_write(o);
- mult_set(o);
- }
- else if (o->txmixb == TX_OUT_LSD)
- {
-// o->txmixbset=(151*o->txctcssadj) / 1000;
- o->txmixbset=o->txctcssadj;
- mixer_write(o);
- mult_set(o);
- }
- else
- {
- *o->pmrChan->ptxCtcssAdjust=(o->txctcssadj * M_Q8) / 1000;
- }
- return 0;
-}
-/*
- CLI debugging on and off
-*/
-static int radio_set_debug(int fd, int argc, char *argv[])
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
- o->debuglevel=1;
- ast_cli(fd,"usbradio debug on.\n");
- return RESULT_SUCCESS;
-}
-
-static int radio_set_debug_off(int fd, int argc, char *argv[])
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
- o->debuglevel=0;
- ast_cli(fd,"usbradio debug off.\n");
- return RESULT_SUCCESS;
-}
-
-static int radio_active(int fd, int argc, char *argv[])
-{
- if (argc == 2)
- ast_cli(fd, "active (command) USB Radio device is [%s]\n", usbradio_active);
- else if (argc != 3)
- return RESULT_SHOWUSAGE;
- else {
- struct chan_usbradio_pvt *o;
- if (strcmp(argv[2], "show") == 0) {
- for (o = usbradio_default.next; o; o = o->next)
- ast_cli(fd, "device [%s] exists\n", o->name);
- return RESULT_SUCCESS;
- }
- o = find_desc(argv[2]);
- if (o == NULL)
- ast_cli(fd, "No device [%s] exists\n", argv[2]);
- else
- {
- struct chan_usbradio_pvt *ao;
- for (ao = usbradio_default.next; ao && ao->name ; ao = ao->next)ao->pmrChan->b.radioactive=0;
- usbradio_active = o->name;
- o->pmrChan->b.radioactive=1;
- }
- }
- return RESULT_SUCCESS;
-}
-/*
- CLI debugging on and off
-*/
-static int radio_set_xpmr_debug(int fd, int argc, char *argv[])
-{
- struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
- if (argc == 4)
- {
- int i;
- i = atoi(argv[3]);
- if ((i >= 0) && (i <= 100))
- {
- o->pmrChan->tracelevel=i;
- }
- }
- // add ability to set it for a number of frames after which it reverts
- ast_cli(fd,"usbradio xdebug on tracelevel %i\n",o->pmrChan->tracelevel);
-
- return RESULT_SUCCESS;
-}
-
-
-static char key_usage[] =
- "Usage: radio key\n"
- " Simulates COR active.\n";
-
-static char unkey_usage[] =
- "Usage: radio unkey\n"
- " Simulates COR un-active.\n";
-
-static char active_usage[] =
- "Usage: radio active [device-name]\n"
- " If used without a parameter, displays which device is the current\n"
- "one being commanded. If a device is specified, the commanded radio device is changed\n"
- "to the device specified.\n";
-/*
-radio tune 6 3000 measured tx value
-*/
-static char radio_tune_usage[] =
- "Usage: radio tune <function>\n"
- " rxnoise\n"
- " rxvoice\n"
- " rxtone\n"
- " rxsquelch [newsetting]\n"
- " txvoice [newsetting]\n"
- " txtone [newsetting]\n"
- " auxvoice [newsetting]\n"
- " save (settings to tuning file)\n"
- " load (tuning settings from EEPROM)\n"
- "\n All [newsetting]'s are values 0-999\n\n";
-
-#ifndef NEW_ASTERISK
-
-static struct ast_cli_entry cli_usbradio[] = {
- { { "radio", "key", NULL },
- console_key, "Simulate Rx Signal Present",
- key_usage, NULL, NULL},
-
- { { "radio", "unkey", NULL },
- console_unkey, "Simulate Rx Signal Lusb",
- unkey_usage, NULL, NULL },
-
- { { "radio", "tune", NULL },
- radio_tune, "Radio Tune",
- radio_tune_usage, NULL, NULL },
-
- { { "radio", "set", "debug", NULL },
- radio_set_debug, "Radio Debug",
- radio_tune_usage, NULL, NULL },
-
- { { "radio", "set", "debug", "off", NULL },
- radio_set_debug_off, "Radio Debug",
- radio_tune_usage, NULL, NULL },
-
- { { "radio", "active", NULL },
- radio_active, "Change commanded device",
- active_usage, NULL, NULL },
-
- { { "radio", "set", "xdebug", NULL },
- radio_set_xpmr_debug, "Radio set xpmr debug level",
- active_usage, NULL, NULL },
-
-};
-#endif
-
-/*
- * store the callerid components
- */
-#if 0
-static void store_callerid(struct chan_usbradio_pvt *o, char *s)
-{
- ast_callerid_split(s, o->cid_name, sizeof(o->cid_name), o->cid_num, sizeof(o->cid_num));
-}
-#endif
-
-static void store_rxdemod(struct chan_usbradio_pvt *o, const char *s)
-{
- if (!strcasecmp(s,"no")){
- o->rxdemod = RX_AUDIO_NONE;
- }
- else if (!strcasecmp(s,"speaker")){
- o->rxdemod = RX_AUDIO_SPEAKER;
- }
- else if (!strcasecmp(s,"flat")){
- o->rxdemod = RX_AUDIO_FLAT;
- }
- else {
- ast_log(LOG_WARNING,"Unrecognized rxdemod parameter: %s\n",s);
- }
-
- //ast_log(LOG_WARNING, "set rxdemod = %s\n", s);
-}
-
-
-static void store_txmixa(struct chan_usbradio_pvt *o, const char *s)
-{
- if (!strcasecmp(s,"no")){
- o->txmixa = TX_OUT_OFF;
- }
- else if (!strcasecmp(s,"voice")){
- o->txmixa = TX_OUT_VOICE;
- }
- else if (!strcasecmp(s,"tone")){
- o->txmixa = TX_OUT_LSD;
- }
- else if (!strcasecmp(s,"composite")){
- o->txmixa = TX_OUT_COMPOSITE;
- }
- else if (!strcasecmp(s,"auxvoice")){
- o->txmixa = TX_OUT_AUX;
- }
- else {
- ast_log(LOG_WARNING,"Unrecognized txmixa parameter: %s\n",s);
- }
-
- //ast_log(LOG_WARNING, "set txmixa = %s\n", s);
-}
-
-static void store_txmixb(struct chan_usbradio_pvt *o, const char *s)
-{
- if (!strcasecmp(s,"no")){
- o->txmixb = TX_OUT_OFF;
- }
- else if (!strcasecmp(s,"voice")){
- o->txmixb = TX_OUT_VOICE;
- }
- else if (!strcasecmp(s,"tone")){
- o->txmixb = TX_OUT_LSD;
- }
- else if (!strcasecmp(s,"composite")){
- o->txmixb = TX_OUT_COMPOSITE;
- }
- else if (!strcasecmp(s,"auxvoice")){
- o->txmixb = TX_OUT_AUX;
- }
- else {
- ast_log(LOG_WARNING,"Unrecognized txmixb parameter: %s\n",s);
- }
-
- //ast_log(LOG_WARNING, "set txmixb = %s\n", s);
-}
-/*
-*/
-static void store_rxcdtype(struct chan_usbradio_pvt *o, const char *s)
-{
- if (!strcasecmp(s,"no")){
- o->rxcdtype = CD_IGNORE;
- }
- else if (!strcasecmp(s,"usb")){
- o->rxcdtype = CD_HID;
- }
- else if (!strcasecmp(s,"dsp")){
- o->rxcdtype = CD_XPMR_NOISE;
- }
- else if (!strcasecmp(s,"vox")){
- o->rxcdtype = CD_XPMR_VOX;
- }
- else if (!strcasecmp(s,"usbinvert")){
- o->rxcdtype = CD_HID_INVERT;
- }
- else {
- ast_log(LOG_WARNING,"Unrecognized rxcdtype parameter: %s\n",s);
- }
-
- //ast_log(LOG_WARNING, "set rxcdtype = %s\n", s);
-}
-/*
-*/
-static void store_rxsdtype(struct chan_usbradio_pvt *o, const char *s)
-{
- if (!strcasecmp(s,"no") || !strcasecmp(s,"SD_IGNORE")){
- o->rxsdtype = SD_IGNORE;
- }
- else if (!strcasecmp(s,"usb") || !strcasecmp(s,"SD_HID")){
- o->rxsdtype = SD_HID;
- }
- else if (!strcasecmp(s,"usbinvert") || !strcasecmp(s,"SD_HID_INVERT")){
- o->rxsdtype = SD_HID_INVERT;
- }
- else if (!strcasecmp(s,"software") || !strcasecmp(s,"SD_XPMR")){
- o->rxsdtype = SD_XPMR;
- }
- else {
- ast_log(LOG_WARNING,"Unrecognized rxsdtype parameter: %s\n",s);
- }
-
- //ast_log(LOG_WARNING, "set rxsdtype = %s\n", s);
-}
-/*
-*/
-static void store_rxgain(struct chan_usbradio_pvt *o, const char *s)
-{
- float f;
- sscanf(s, "%30f", &f);
- o->rxgain = f;
- //ast_log(LOG_WARNING, "set rxgain = %f\n", f);
-}
-/*
-*/
-static void store_rxvoiceadj(struct chan_usbradio_pvt *o, const char *s)
-{
- float f;
- sscanf(s, "%30f", &f);
- o->rxvoiceadj = f;
- //ast_log(LOG_WARNING, "set rxvoiceadj = %f\n", f);
-}
-/*
-*/
-static void store_rxctcssadj(struct chan_usbradio_pvt *o, const char *s)
-{
- float f;
- sscanf(s, "%30f", &f);
- o->rxctcssadj = f;
- //ast_log(LOG_WARNING, "set rxctcssadj = %f\n", f);
-}
-/*
-*/
-static void store_txtoctype(struct chan_usbradio_pvt *o, const char *s)
-{
- if (!strcasecmp(s,"no") || !strcasecmp(s,"TOC_NONE")){
- o->txtoctype = TOC_NONE;
- }
- else if (!strcasecmp(s,"phase") || !strcasecmp(s,"TOC_PHASE")){
- o->txtoctype = TOC_PHASE;
- }
- else if (!strcasecmp(s,"notone") || !strcasecmp(s,"TOC_NOTONE")){
- o->txtoctype = TOC_NOTONE;
- }
- else {
- ast_log(LOG_WARNING,"Unrecognized txtoctype parameter: %s\n",s);
- }
-}
-/*
-*/
-static void tune_txoutput(struct chan_usbradio_pvt *o, int value, int fd)
-{
- o->txtestkey=1;
- o->pmrChan->txPttIn=1;
- TxTestTone(o->pmrChan, 1); // generate 1KHz tone at 7200 peak
- if (fd > 0) ast_cli(fd,"Tone output starting on channel %s...\n",o->name);
- usleep(5000000);
- TxTestTone(o->pmrChan, 0);
- if (fd > 0) ast_cli(fd,"Tone output ending on channel %s...\n",o->name);
- o->pmrChan->txPttIn=0;
- o->txtestkey=0;
-}
-/*
-*/
-static void tune_rxinput(int fd, struct chan_usbradio_pvt *o)
-{
- const int target=23000;
- const int tolerance=2000;
- const int settingmin=1;
- const int settingstart=2;
- const int maxtries=12;
-
- float settingmax;
-
- int setting=0, tries=0, tmpdiscfactor, meas;
-
- settingmax = o->micmax;
-
- o->pmrChan->b.tuning=1;
-
- setting = settingstart;
-
- ast_cli(fd,"tune rxnoise maxtries=%i, target=%i, tolerance=%i\n",maxtries,target,tolerance);
-
- while(tries<maxtries)
- {
- setamixer(o->devicenum,MIXER_PARAM_MIC_CAPTURE_VOL,setting,0);
- setamixer(o->devicenum,MIXER_PARAM_MIC_BOOST,o->rxboostset,0);
-
- usleep(100000);
- if(o->rxcdtype!=CD_XPMR_NOISE || o->rxdemod==RX_AUDIO_SPEAKER)
- {
- // printf("Measure Direct Input\n");
- o->pmrChan->spsMeasure->source = o->pmrChan->spsRx->source;
- o->pmrChan->spsMeasure->discfactor=2000;
- o->pmrChan->spsMeasure->enabled=1;
- o->pmrChan->spsMeasure->amax = o->pmrChan->spsMeasure->amin = 0;
- usleep(400000);
- meas=o->pmrChan->spsMeasure->apeak;
- o->pmrChan->spsMeasure->enabled=0;
- }
- else
- {
- // printf("Measure HF Noise\n");
- tmpdiscfactor=o->pmrChan->spsRx->discfactor;
- o->pmrChan->spsRx->discfactor=(i16)2000;
- o->pmrChan->spsRx->discounteru=o->pmrChan->spsRx->discounterl=0;
- o->pmrChan->spsRx->amax=o->pmrChan->spsRx->amin=0;
- usleep(200000);
- meas=o->pmrChan->rxRssi;
- o->pmrChan->spsRx->discfactor=tmpdiscfactor;
- o->pmrChan->spsRx->discounteru=o->pmrChan->spsRx->discounterl=0;
- o->pmrChan->spsRx->amax=o->pmrChan->spsRx->amin=0;
- }
- if(!meas)meas++;
- ast_cli(fd,"tries=%i, setting=%i, meas=%i\n",tries,setting,meas);
-
- if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){
- setting=setting*target/meas;
- }
- else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) )
- {
- break;
- }
-
- if(setting<settingmin)setting=settingmin;
- else if(setting>settingmax)setting=settingmax;
-
- tries++;
- }
- ast_cli(fd,"DONE tries=%i, setting=%i, meas=%i\n",tries,
- (setting * 1000) / o->micmax,meas);
- if( meas<(target-tolerance) || meas>(target+tolerance) ){
- ast_cli(fd,"ERROR: RX INPUT ADJUST FAILED.\n");
- }else{
- ast_cli(fd,"INFO: RX INPUT ADJUST SUCCESS.\n");
- o->rxmixerset=(setting * 1000) / o->micmax;
- }
- o->pmrChan->b.tuning=0;
-}
-/*
-*/
-static void tune_rxvoice(int fd, struct chan_usbradio_pvt *o)
-{
- const int target=7200; // peak
- const int tolerance=360; // peak to peak
- const float settingmin=0.1;
- const float settingmax=4;
- const float settingstart=1;
- const int maxtries=12;
-
- float setting;
-
- int tries=0, meas;
-
- ast_cli(fd,"INFO: RX VOICE ADJUST START.\n");
- ast_cli(fd,"target=%i tolerance=%i \n",target,tolerance);
-
- o->pmrChan->b.tuning=1;
- if(!o->pmrChan->spsMeasure)
- ast_cli(fd,"ERROR: NO MEASURE BLOCK.\n");
-
- if(!o->pmrChan->spsMeasure->source || !o->pmrChan->prxVoiceAdjust )
- ast_cli(fd,"ERROR: NO SOURCE OR MEASURE SETTING.\n");
-
- o->pmrChan->spsMeasure->source=o->pmrChan->spsRxOut->sink;
- o->pmrChan->spsMeasure->enabled=1;
- o->pmrChan->spsMeasure->discfactor=1000;
-
- setting=settingstart;
-
- // ast_cli(fd,"ERROR: NO MEASURE BLOCK.\n");
-
- while(tries<maxtries)
- {
- *(o->pmrChan->prxVoiceAdjust)=setting*M_Q8;
- usleep(10000);
- o->pmrChan->spsMeasure->amax = o->pmrChan->spsMeasure->amin = 0;
- usleep(1000000);
- meas = o->pmrChan->spsMeasure->apeak;
- ast_cli(fd,"tries=%i, setting=%f, meas=%i\n",tries,setting,meas);
-
- if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){
- setting=setting*target/meas;
- }
- else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) )
- {
- break;
- }
- if(setting<settingmin)setting=settingmin;
- else if(setting>settingmax)setting=settingmax;
-
- tries++;
- }
-
- o->pmrChan->spsMeasure->enabled=0;
-
- ast_cli(fd,"DONE tries=%i, setting=%f, meas=%f\n",tries,setting,(float)meas);
- if( meas<(target-tolerance) || meas>(target+tolerance) ){
- ast_cli(fd,"ERROR: RX VOICE GAIN ADJUST FAILED.\n");
- }else{
- ast_cli(fd,"INFO: RX VOICE GAIN ADJUST SUCCESS.\n");
- o->rxvoiceadj=setting;
- }
- o->pmrChan->b.tuning=0;
-}
-/*
-*/
-static void tune_rxctcss(int fd, struct chan_usbradio_pvt *o)
-{
- const int target=2400; // was 4096 pre 20080205
- const int tolerance=100;
- const float settingmin=0.1;
- const float settingmax=8;
- const float settingstart=1;
- const int maxtries=12;
-
- float setting;
- int tries=0, meas;
-
- ast_cli(fd,"INFO: RX CTCSS ADJUST START.\n");
- ast_cli(fd,"target=%i tolerance=%i \n",target,tolerance);
-
- o->pmrChan->b.tuning=1;
- o->pmrChan->spsMeasure->source=o->pmrChan->prxCtcssMeasure;
- o->pmrChan->spsMeasure->discfactor=400;
- o->pmrChan->spsMeasure->enabled=1;
-
- setting=settingstart;
-
- while(tries<maxtries)
- {
- *(o->pmrChan->prxCtcssAdjust)=setting*M_Q8;
- usleep(10000);
- o->pmrChan->spsMeasure->amax = o->pmrChan->spsMeasure->amin = 0;
- usleep(500000);
- meas = o->pmrChan->spsMeasure->apeak;
- ast_cli(fd,"tries=%i, setting=%f, meas=%i\n",tries,setting,meas);
-
- if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){
- setting=setting*target/meas;
- }
- else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) )
- {
- break;
- }
- if(setting<settingmin)setting=settingmin;
- else if(setting>settingmax)setting=settingmax;
-
- tries++;
- }
- o->pmrChan->spsMeasure->enabled=0;
- ast_cli(fd,"DONE tries=%i, setting=%f, meas=%f\n",tries,setting,(float)meas);
- if( meas<(target-tolerance) || meas>(target+tolerance) ){
- ast_cli(fd,"ERROR: RX CTCSS GAIN ADJUST FAILED.\n");
- }else{
- ast_cli(fd,"INFO: RX CTCSS GAIN ADJUST SUCCESS.\n");
- o->rxctcssadj=setting;
- }
- o->pmrChan->b.tuning=0;
-}
-/*
- after radio tune is performed data is serialized here
-*/
-static void tune_write(struct chan_usbradio_pvt *o)
-{
- FILE *fp;
- char fname[200];
-
- snprintf(fname,sizeof(fname) - 1,"/etc/asterisk/usbradio_tune_%s.conf",o->name);
- fp = fopen(fname,"w");
-
- fprintf(fp,"[%s]\n",o->name);
-
- fprintf(fp,"; name=%s\n",o->name);
- fprintf(fp,"; devicenum=%i\n",o->devicenum);
- fprintf(fp,"devstr=%s\n",o->devstr);
- fprintf(fp,"rxmixerset=%i\n",o->rxmixerset);
- fprintf(fp,"txmixaset=%i\n",o->txmixaset);
- fprintf(fp,"txmixbset=%i\n",o->txmixbset);
- fprintf(fp,"rxvoiceadj=%f\n",o->rxvoiceadj);
- fprintf(fp,"rxctcssadj=%f\n",o->rxctcssadj);
- fprintf(fp,"txctcssadj=%i\n",o->txctcssadj);
- fprintf(fp,"rxsquelchadj=%i\n",o->rxsquelchadj);
- fclose(fp);
-
- if(o->wanteeprom)
- {
- ast_mutex_lock(&o->eepromlock);
- while(o->eepromctl)
- {
- ast_mutex_unlock(&o->eepromlock);
- usleep(10000);
- ast_mutex_lock(&o->eepromlock);
- }
- o->eeprom[EEPROM_RXMIXERSET] = o->rxmixerset;
- o->eeprom[EEPROM_TXMIXASET] = o->txmixaset;
- o->eeprom[EEPROM_TXMIXBSET] = o->txmixbset;
- memcpy(&o->eeprom[EEPROM_RXVOICEADJ],&o->rxvoiceadj,sizeof(float));
- memcpy(&o->eeprom[EEPROM_RXCTCSSADJ],&o->rxctcssadj,sizeof(float));
- o->eeprom[EEPROM_TXCTCSSADJ] = o->txctcssadj;
- o->eeprom[EEPROM_RXSQUELCHADJ] = o->rxsquelchadj;
- o->eepromctl = 2; /* request a write */
- ast_mutex_unlock(&o->eepromlock);
- }
-}
-//
-static void mixer_write(struct chan_usbradio_pvt *o)
-{
- setamixer(o->devicenum,MIXER_PARAM_MIC_PLAYBACK_SW,0,0);
- setamixer(o->devicenum,MIXER_PARAM_MIC_PLAYBACK_VOL,0,0);
- setamixer(o->devicenum,MIXER_PARAM_SPKR_PLAYBACK_SW,1,0);
- setamixer(o->devicenum,MIXER_PARAM_SPKR_PLAYBACK_VOL,
- o->txmixaset * o->spkrmax / 1000,
- o->txmixbset * o->spkrmax / 1000);
- setamixer(o->devicenum,MIXER_PARAM_MIC_CAPTURE_VOL,
- o->rxmixerset * o->micmax / 1000,0);
- setamixer(o->devicenum,MIXER_PARAM_MIC_BOOST,o->rxboostset,0);
- setamixer(o->devicenum,MIXER_PARAM_MIC_CAPTURE_SW,1,0);
-}
-/*
- adjust dsp multiplier to add resolution to tx level adjustment
-*/
-static void mult_set(struct chan_usbradio_pvt *o)
-{
-
- if(o->pmrChan->spsTxOutA) {
- o->pmrChan->spsTxOutA->outputGain =
- mult_calc((o->txmixaset * 152) / 1000);
- }
- if(o->pmrChan->spsTxOutB){
- o->pmrChan->spsTxOutB->outputGain =
- mult_calc((o->txmixbset * 152) / 1000);
- }
-}
-//
-// input 0 - 151 outputs are pot and multiplier
-//
-static int mult_calc(int value)
-{
- const int multx=M_Q8;
- int pot,mult;
-
- pot=((int)(value/4)*4)+2;
- mult = multx-( ( multx * (3-(value%4)) ) / (pot+2) );
- return(mult);
-}
-
-#define pd(x) {printf(#x" = %d\n",x);}
-#define pp(x) {printf(#x" = %p\n",x);}
-#define ps(x) {printf(#x" = %s\n",x);}
-#define pf(x) {printf(#x" = %f\n",x);}
-
-
-#if 0
-/*
- do hid output if only requirement is ptt out
- this give fastest performance with least overhead
- where gpio inputs are not required.
-*/
-
-static int usbhider(struct chan_usbradio_pvt *o, int opt)
-{
- unsigned char buf[4];
- char lastrx, txtmp;
-
- if(opt)
- {
- struct usb_device *usb_dev;
-
- usb_dev = hid_device_init(o->devstr);
- if (usb_dev == NULL) {
- ast_log(LOG_ERROR,"USB HID device not found\n");
- return -1;
- }
- o->usb_handle = usb_open(usb_dev);
- if (o->usb_handle == NULL) {
- ast_log(LOG_ERROR,"Not able to open USB device\n");
- return -1;
- }
- if (usb_claim_interface(o->usb_handle,C108_HID_INTERFACE) < 0)
- {
- if (usb_detach_kernel_driver_np(o->usb_handle,C108_HID_INTERFACE) < 0) {
- ast_log(LOG_ERROR,"Not able to detach the USB device\n");
- return -1;
- }
- if (usb_claim_interface(o->usb_handle,C108_HID_INTERFACE) < 0) {
- ast_log(LOG_ERROR,"Not able to claim the USB device\n");
- return -1;
- }
- }
-
- memset(buf,0,sizeof(buf));
- buf[2] = o->hid_gpio_ctl;
- buf[1] = 0;
- hid_set_outputs(o->usb_handle,buf);
- memcpy(bufsave,buf,sizeof(buf));
-
- buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
- o->lasttx=0;
- }
-
- /* if change in tx state as controlled by xpmr */
- txtmp=o->pmrChan->txPttOut;
-
- if (o->lasttx != txtmp)
- {
- o->pmrChan->txPttHid=o->lasttx = txtmp;
- if(o->debuglevel)printf("usbhid: tx set to %d\n",txtmp);
- buf[o->hid_gpio_loc] = 0;
- if (!o->invertptt)
- {
- if (txtmp) buf[o->hid_gpio_loc] = o->hid_io_ptt;
- }
- else
- {
- if (!txtmp) buf[o->hid_gpio_loc] = o->hid_io_ptt;
- }
- buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
- hid_set_outputs(o->usb_handle,buf);
- }
-
- return(0);
-}
-#endif
-/*
-*/
-static void pmrdump(struct chan_usbradio_pvt *o)
-{
- t_pmr_chan *p;
- int i;
-
- p=o->pmrChan;
-
- printf("\nodump()\n");
-
- pd(o->devicenum);
- ps(o->devstr);
-
- pd(o->micmax);
- pd(o->spkrmax);
-
- pd(o->rxdemod);
- pd(o->rxcdtype);
- pd(o->rxsdtype);
- pd(o->txtoctype);
-
- pd(o->rxmixerset);
- pd(o->rxboostset);
-
- pf(o->rxvoiceadj);
- pf(o->rxctcssadj);
- pd(o->rxsquelchadj);
-
- ps(o->txctcssdefault);
- ps(o->txctcssfreq);
-
- pd(o->numrxctcssfreqs);
- if(o->numrxctcssfreqs>0)
- {
- for(i=0;i<o->numrxctcssfreqs;i++)
- {
- printf(" %i = %s %s\n",i,o->rxctcss[i],o->txctcss[i]);
- }
- }
-
- pd(o->b.rxpolarity);
- pd(o->b.txpolarity);
-
- pd(o->txprelim);
- pd(o->txmixa);
- pd(o->txmixb);
-
- pd(o->txmixaset);
- pd(o->txmixbset);
-
- printf("\npmrdump()\n");
-
- pd(p->devicenum);
-
- printf("prxSquelchAdjust=%i\n",*(o->pmrChan->prxSquelchAdjust));
-
- pd(p->rxCarrierPoint);
- pd(p->rxCarrierHyst);
-
- pd(*p->prxVoiceAdjust);
- pd(*p->prxCtcssAdjust);
-
- pd(p->rxfreq);
- pd(p->txfreq);
-
- pd(p->rxCtcss->relax);
- //pf(p->rxCtcssFreq);
- pd(p->numrxcodes);
- if(o->pmrChan->numrxcodes>0)
- {
- for(i=0;i<o->pmrChan->numrxcodes;i++)
- {
- printf(" %i = %s\n",i,o->pmrChan->pRxCode[i]);
- }
- }
-
- pd(p->txTocType);
- ps(p->pTxCodeDefault);
- pd(p->txcodedefaultsmode);
- pd(p->numtxcodes);
- if(o->pmrChan->numtxcodes>0)
- {
- for(i=0;i<o->pmrChan->numtxcodes;i++)
- {
- printf(" %i = %s\n",i,o->pmrChan->pTxCode[i]);
- }
- }
-
- pd(p->b.rxpolarity);
- pd(p->b.txpolarity);
- pd(p->b.dcsrxpolarity);
- pd(p->b.dcstxpolarity);
- pd(p->b.lsdrxpolarity);
- pd(p->b.lsdtxpolarity);
-
- pd(p->txMixA);
- pd(p->txMixB);
-
- pd(p->rxDeEmpEnable);
- pd(p->rxCenterSlicerEnable);
- pd(p->rxCtcssDecodeEnable);
- pd(p->rxDcsDecodeEnable);
- pd(p->b.ctcssRxEnable);
- pd(p->b.dcsRxEnable);
- pd(p->b.lmrRxEnable);
- pd(p->b.dstRxEnable);
- pd(p->smode);
-
- pd(p->txHpfEnable);
- pd(p->txLimiterEnable);
- pd(p->txPreEmpEnable);
- pd(p->txLpfEnable);
-
- if(p->spsTxOutA)pd(p->spsTxOutA->outputGain);
- if(p->spsTxOutB)pd(p->spsTxOutB->outputGain);
- pd(p->txPttIn);
- pd(p->txPttOut);
-
- pd(p->tracetype);
-
- return;
-}
-/*
- takes data from a chan_usbradio_pvt struct (e.g. o->)
- and configures the xpmr radio layer
-*/
-static int xpmr_config(struct chan_usbradio_pvt *o)
-{
- //ast_log(LOG_NOTICE,"xpmr_config()\n");
-
- TRACEO(1,("xpmr_config()\n"));
-
- if(o->pmrChan==NULL)
- {
- ast_log(LOG_ERROR,"pmr channel structure NULL\n");
- return 1;
- }
-
- o->pmrChan->rxCtcss->relax = o->rxctcssrelax;
- o->pmrChan->txpower=0;
-
- if(o->b.remoted)
- {
- o->pmrChan->pTxCodeDefault = o->set_txctcssdefault;
- o->pmrChan->pRxCodeSrc=o->set_rxctcssfreqs;
- o->pmrChan->pTxCodeSrc=o->set_txctcssfreqs;
-
- o->pmrChan->rxfreq=o->set_rxfreq;
- o->pmrChan->txfreq=o->set_txfreq;
- /* printf(" remoted %s %s --> %s \n",o->pmrChan->txctcssdefault,
- o->pmrChan->txctcssfreq,o->pmrChan->rxctcssfreq); */
- }
- else
- {
- // set xpmr pointers to source strings
-
- o->pmrChan->pTxCodeDefault = o->txctcssdefault;
- o->pmrChan->pRxCodeSrc = o->rxctcssfreqs;
- o->pmrChan->pTxCodeSrc = o->txctcssfreqs;
-
- o->pmrChan->rxfreq = o->rxfreq;
- o->pmrChan->txfreq = o->txfreq;
- }
-
- code_string_parse(o->pmrChan);
- if(o->pmrChan->rxfreq) o->pmrChan->b.reprog=1;
-
- return 0;
-}
-/*
- * grab fields from the config file, init the descriptor and open the device.
- */
-static struct chan_usbradio_pvt *store_config(struct ast_config *cfg, char *ctg)
-{
- struct ast_variable *v;
- struct chan_usbradio_pvt *o;
- struct ast_config *cfg1;
- int i;
- char fname[200];
-#ifdef NEW_ASTERISK
- struct ast_flags zeroflag = {0};
-#endif
- if (ctg == NULL) {
- traceusb1((" store_config() ctg == NULL\n"));
- o = &usbradio_default;
- ctg = "general";
- } else {
- /* "general" is also the default thing */
- if (strcmp(ctg, "general") == 0) {
- o = &usbradio_default;
- } else {
- // ast_log(LOG_NOTICE,"ast_calloc for chan_usbradio_pvt of %s\n",ctg);
- if (!(o = ast_calloc(1, sizeof(*o))))
- return NULL;
- *o = usbradio_default;
- o->name = ast_strdup(ctg);
- if (!usbradio_active)
- usbradio_active = o->name;
- }
- }
- ast_mutex_init(&o->eepromlock);
- strcpy(o->mohinterpret, "default");
- /* fill other fields from configuration */
- for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
- M_START((char *)v->name, (char *)v->value);
-
- /* handle jb conf */
- if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
- continue;
-
-#if 0
- M_BOOL("autoanswer", o->autoanswer)
- M_BOOL("autohangup", o->autohangup)
- M_BOOL("overridecontext", o->overridecontext)
- M_STR("context", o->ctx)
- M_STR("language", o->language)
- M_STR("mohinterpret", o->mohinterpret)
- M_STR("extension", o->ext)
- M_F("callerid", store_callerid(o, v->value))
-#endif
- M_UINT("frags", o->frags)
- M_UINT("queuesize",o->queuesize)
-#if 0
- M_UINT("devicenum",o->devicenum)
-#endif
- M_UINT("debug", usbradio_debug)
- M_BOOL("rxcpusaver",o->rxcpusaver)
- M_BOOL("txcpusaver",o->txcpusaver)
- M_BOOL("invertptt",o->invertptt)
- M_F("rxdemod",store_rxdemod(o,(char *)v->value))
- M_BOOL("txprelim",o->txprelim);
- M_F("txmixa",store_txmixa(o,(char *)v->value))
- M_F("txmixb",store_txmixb(o,(char *)v->value))
- M_F("carrierfrom",store_rxcdtype(o,(char *)v->value))
- M_F("rxsdtype",store_rxsdtype(o,(char *)v->value))
- M_UINT("rxsqvox",o->rxsqvoxadj)
- M_STR("txctcssdefault",o->txctcssdefault)
- M_STR("rxctcssfreqs",o->rxctcssfreqs)
- M_STR("txctcssfreqs",o->txctcssfreqs)
- M_UINT("rxfreq",o->rxfreq)
- M_UINT("txfreq",o->txfreq)
- M_F("rxgain",store_rxgain(o,(char *)v->value))
- M_BOOL("rxboost",o->rxboostset)
- M_UINT("rxctcssrelax",o->rxctcssrelax)
- M_F("txtoctype",store_txtoctype(o,(char *)v->value))
- M_UINT("hdwtype",o->hdwtype)
- M_UINT("eeprom",o->wanteeprom)
- M_UINT("duplex",o->radioduplex)
- M_UINT("txsettletime",o->txsettletime)
- M_BOOL("rxpolarity",o->b.rxpolarity)
- M_BOOL("txpolarity",o->b.txpolarity)
- M_BOOL("dcsrxpolarity",o->b.dcsrxpolarity)
- M_BOOL("dcstxpolarity",o->b.dcstxpolarity)
- M_BOOL("lsdrxpolarity",o->b.lsdrxpolarity)
- M_BOOL("lsdtxpolarity",o->b.lsdtxpolarity)
- M_BOOL("loopback",o->b.loopback)
- M_BOOL("radioactive",o->b.radioactive)
- M_UINT("rptnum",o->rptnum)
- M_UINT("idleinterval",o->idleinterval)
- M_UINT("turnoffs",o->turnoffs)
- M_UINT("tracetype",o->tracetype)
- M_UINT("tracelevel",o->tracelevel)
- M_UINT("area",o->area)
- M_STR("ukey",o->ukey)
- M_END(;
- );
- }
-
- o->debuglevel=0;
-
- if (o == &usbradio_default) /* we are done with the default */
- return NULL;
-
- snprintf(fname,sizeof(fname) - 1,config1,o->name);
-#ifdef NEW_ASTERISK
- cfg1 = ast_config_load(fname,zeroflag);
-#else
- cfg1 = ast_config_load(fname);
-#endif
- o->rxmixerset = 500;
- o->txmixaset = 500;
- o->txmixbset = 500;
- o->rxvoiceadj = 0.5;
- o->rxctcssadj = 0.5;
- o->txctcssadj = 200;
- o->rxsquelchadj = 500;
- o->devstr[0] = 0;
- if (cfg1 && cfg1 != CONFIG_STATUS_FILEINVALID) {
- for (v = ast_variable_browse(cfg1, o->name); v; v = v->next) {
-
- M_START((char *)v->name, (char *)v->value);
- M_UINT("rxmixerset", o->rxmixerset)
- M_UINT("txmixaset", o->txmixaset)
- M_UINT("txmixbset", o->txmixbset)
- M_F("rxvoiceadj",store_rxvoiceadj(o,(char *)v->value))
- M_F("rxctcssadj",store_rxctcssadj(o,(char *)v->value))
- M_UINT("txctcssadj",o->txctcssadj);
- M_UINT("rxsquelchadj", o->rxsquelchadj)
- M_STR("devstr", o->devstr)
- M_END(;
- );
- }
- ast_config_destroy(cfg1);
- } else ast_log(LOG_WARNING,"File %s not found, using default parameters.\n",fname);
-
- if(o->wanteeprom)
- {
- ast_mutex_lock(&o->eepromlock);
- while(o->eepromctl)
- {
- ast_mutex_unlock(&o->eepromlock);
- usleep(10000);
- ast_mutex_lock(&o->eepromlock);
- }
- o->eepromctl = 1; /* request a load */
- ast_mutex_unlock(&o->eepromlock);
- }
- /* if our specified one exists in the list */
- if ((!usb_list_check(o->devstr)) || find_desc_usb(o->devstr))
- {
- char *s;
-
- for(s = usb_device_list; *s; s += strlen(s) + 1)
- {
- if (!find_desc_usb(s)) break;
- }
- if (!*s)
- {
- ast_log(LOG_WARNING,"Unable to assign USB device for channel %s\n",o->name);
- goto error;
- }
- ast_log(LOG_NOTICE,"Assigned USB device %s to usbradio channel %s\n",s,o->name);
- strcpy(o->devstr,s);
- }
-
- i = usb_get_usbdev(o->devstr);
- if (i < 0)
- {
- ast_log(LOG_ERROR,"Not able to find alsa USB device\n");
- goto error;
- }
- o->devicenum = i;
-
- o->micmax = amixer_max(o->devicenum,MIXER_PARAM_MIC_CAPTURE_VOL);
- o->spkrmax = amixer_max(o->devicenum,MIXER_PARAM_SPKR_PLAYBACK_VOL);
- o->lastopen = ast_tvnow(); /* don't leave it 0 or tvdiff may wrap */
- o->dsp = ast_dsp_new();
- if (o->dsp)
- {
-#ifdef NEW_ASTERISK
- ast_dsp_set_features(o->dsp,DSP_FEATURE_DIGIT_DETECT);
- ast_dsp_set_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
-#else
- ast_dsp_set_features(o->dsp,DSP_FEATURE_DTMF_DETECT);
- ast_dsp_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
-#endif
- }
-
- if(o->pmrChan==NULL)
- {
- t_pmr_chan tChan;
-
- // ast_log(LOG_NOTICE,"createPmrChannel() %s\n",o->name);
- memset(&tChan,0,sizeof(t_pmr_chan));
-
- tChan.pTxCodeDefault = o->txctcssdefault;
- tChan.pRxCodeSrc = o->rxctcssfreqs;
- tChan.pTxCodeSrc = o->txctcssfreqs;
-
- tChan.rxDemod=o->rxdemod;
- tChan.rxCdType=o->rxcdtype;
- tChan.rxSqVoxAdj=o->rxsqvoxadj;
-
- if (o->txprelim)
- tChan.txMod = 2;
-
- tChan.txMixA = o->txmixa;
- tChan.txMixB = o->txmixb;
-
- tChan.rxCpuSaver=o->rxcpusaver;
- tChan.txCpuSaver=o->txcpusaver;
-
- tChan.b.rxpolarity=o->b.rxpolarity;
- tChan.b.txpolarity=o->b.txpolarity;
-
- tChan.b.dcsrxpolarity=o->b.dcsrxpolarity;
- tChan.b.dcstxpolarity=o->b.dcstxpolarity;
-
- tChan.b.lsdrxpolarity=o->b.lsdrxpolarity;
- tChan.b.lsdtxpolarity=o->b.lsdtxpolarity;
-
- tChan.tracetype=o->tracetype;
- tChan.tracelevel=o->tracelevel;
- tChan.rptnum=o->rptnum;
- tChan.idleinterval=o->idleinterval;
- tChan.turnoffs=o->turnoffs;
- tChan.area=o->area;
- tChan.ukey=o->ukey;
- tChan.name=o->name;
-
- o->pmrChan=createPmrChannel(&tChan,FRAME_SIZE);
-
- o->pmrChan->radioDuplex=o->radioduplex;
- o->pmrChan->b.loopback=0;
- o->pmrChan->txsettletime=o->txsettletime;
- o->pmrChan->rxCpuSaver=o->rxcpusaver;
- o->pmrChan->txCpuSaver=o->txcpusaver;
-
- *(o->pmrChan->prxSquelchAdjust) =
- ((999 - o->rxsquelchadj) * 32767) / 1000;
-
- *(o->pmrChan->prxVoiceAdjust)=o->rxvoiceadj*M_Q8;
- *(o->pmrChan->prxCtcssAdjust)=o->rxctcssadj*M_Q8;
- o->pmrChan->rxCtcss->relax=o->rxctcssrelax;
- o->pmrChan->txTocType = o->txtoctype;
-
- if ( (o->txmixa == TX_OUT_LSD) ||
- (o->txmixa == TX_OUT_COMPOSITE) ||
- (o->txmixb == TX_OUT_LSD) ||
- (o->txmixb == TX_OUT_COMPOSITE))
- {
- set_txctcss_level(o);
- }
-
- if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) &&
- (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE)
- )
- {
- ast_log(LOG_ERROR,"No txvoice output configured.\n");
- }
-
- if( o->txctcssfreq[0] &&
- o->txmixa!=TX_OUT_LSD && o->txmixa!=TX_OUT_COMPOSITE &&
- o->txmixb!=TX_OUT_LSD && o->txmixb!=TX_OUT_COMPOSITE
- )
- {
- ast_log(LOG_ERROR,"No txtone output configured.\n");
- }
-
- if(o->b.radioactive)
- {
- // 20080328 sphenke asdf maw !!!
- // this diagnostic option was working but now appears broken
- // it's not required for operation so I'll fix it later.
- //struct chan_usbradio_pvt *ao;
- //for (ao = usbradio_default.next; ao && ao->name ; ao = ao->next)ao->pmrChan->b.radioactive=0;
- usbradio_active = o->name;
- // o->pmrChan->b.radioactive=1;
- //o->b.radioactive=0;
- //o->pmrChan->b.radioactive=0;
- ast_log(LOG_NOTICE,"radio active set to [%s]\n",o->name);
- }
- }
-
- xpmr_config(o);
-
- TRACEO(1,("store_config() 120\n"));
- mixer_write(o);
- TRACEO(1,("store_config() 130\n"));
- mult_set(o);
- TRACEO(1,("store_config() 140\n"));
- hidhdwconfig(o);
-
- TRACEO(1,("store_config() 200\n"));
-
-#ifndef NEW_ASTERISK
- if (pipe(o->sndcmd) != 0) {
- ast_log(LOG_ERROR, "Unable to create pipe\n");
- goto error;
- }
-
- ast_pthread_create_background(&o->sthread, NULL, sound_thread, o);
-#endif
-
- /* link into list of devices */
- if (o != &usbradio_default) {
- o->next = usbradio_default.next;
- usbradio_default.next = o;
- }
- TRACEO(1,("store_config() complete\n"));
- return o;
-
- error:
- if (o != &usbradio_default)
- free(o);
- return NULL;
-}
-
-
-#if DEBUG_FILETEST == 1
-/*
- Test It on a File
-*/
-int RxTestIt(struct chan_usbradio_pvt *o)
-{
- const int numSamples = SAMPLES_PER_BLOCK;
- const int numChannels = 16;
-
- i16 sample,i,ii;
-
- i32 txHangTime;
-
- i16 txEnable;
-
- t_pmr_chan tChan;
- t_pmr_chan *pChan;
-
- FILE *hInput=NULL, *hOutput=NULL, *hOutputTx=NULL;
-
- i16 iBuff[numSamples*2*6], oBuff[numSamples];
-
- printf("RxTestIt()\n");
-
- pChan=o->pmrChan;
- pChan->b.txCapture=1;
- pChan->b.rxCapture=1;
-
- txEnable = 0;
-
- hInput = fopen("/usr/src/xpmr/testdata/rx_in.pcm","r");
- if(!hInput){
- printf(" RxTestIt() File Not Found.\n");
- return 0;
- }
- hOutput = fopen("/usr/src/xpmr/testdata/rx_debug.pcm","w");
-
- printf(" RxTestIt() Working...\n");
-
- while(!feof(hInput))
- {
- fread((void *)iBuff,2,numSamples*2*6,hInput);
-
- if(txHangTime)txHangTime-=numSamples;
- if(txHangTime<0)txHangTime=0;
-
- if(pChan->rxCtcss->decode)txHangTime=(8000/1000*2000);
-
- if(pChan->rxCtcss->decode && !txEnable)
- {
- txEnable=1;
- //pChan->inputBlanking=(8000/1000*200);
- }
- else if(!pChan->rxCtcss->decode && txEnable)
- {
- txEnable=0;
- }
-
- PmrRx(pChan,iBuff,oBuff);
-
- if (fwrite((void *)pChan->prxDebug,2,numSamples*numChannels,hOutput) != numSamples * numChannels) {
- ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
- }
- }
- pChan->b.txCapture=0;
- pChan->b.rxCapture=0;
-
- if(hInput)fclose(hInput);
- if(hOutput)fclose(hOutput);
-
- printf(" RxTestIt() Complete.\n");
-
- return 0;
-}
-#endif
-
-#ifdef NEW_ASTERISK
-
-static char *res2cli(int r)
-
-{
- switch (r)
- {
- case RESULT_SUCCESS:
- return(CLI_SUCCESS);
- case RESULT_SHOWUSAGE:
- return(CLI_SHOWUSAGE);
- default:
- return(CLI_FAILURE);
- }
-}
-
-static char *handle_console_key(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- char *argv[] = { "radio", "key", NULL };
-
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio key";
- e->usage = key_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(console_key(a->fd, 2, argv));
-}
-
-static char *handle_console_unkey(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- char *argv[] = { "radio", "unkey", NULL };
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio unkey";
- e->usage = unkey_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(console_unkey(a->fd, 2, argv));
-}
-
-static char *handle_radio_tune(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- char *argv[5] = { "radio", "tune", a->argc > 2 ? (char *) a->argv[2] : NULL, a->argc > 3 ? (char *) a->argv[3] : NULL };
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio tune";
- e->usage = radio_tune_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(radio_tune(a->fd, a->argc, argv));
-}
-
-static char *handle_radio_debug(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio debug";
- e->usage = radio_tune_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(radio_set_debug(a->fd, a->argc, NULL /* ignored */));
-}
-
-static char *handle_radio_debug_off(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio debug off";
- e->usage = radio_tune_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(radio_set_debug_off(a->fd, a->argc, NULL /* ignored */));
-}
-
-static char *handle_radio_active(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- char *argv[4] = { "radio", "active", a->argc > 2 ? (char *) a->argv[2] : NULL, };
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio active";
- e->usage = active_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(radio_active(a->fd, a->argc, argv));
-}
-
-static char *handle_set_xdebug(struct ast_cli_entry *e,
- int cmd, struct ast_cli_args *a)
-{
- char *argv[5] = { "radio", "set", "xdebug", a->argc == 4 ? (char *) a->argv[3] : NULL, };
- switch (cmd) {
- case CLI_INIT:
- e->command = "radio set xdebug";
- e->usage = active_usage;
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- return res2cli(radio_set_xpmr_debug(a->fd, a->argc, argv));
-}
-
-
-static struct ast_cli_entry cli_usbradio[] = {
- AST_CLI_DEFINE(handle_console_key,"Simulate Rx Signal Present"),
- AST_CLI_DEFINE(handle_console_unkey,"Simulate Rx Signal Loss"),
- AST_CLI_DEFINE(handle_radio_tune,"Radio Tune"),
- AST_CLI_DEFINE(handle_radio_debug,"Radio Debug On"),
- AST_CLI_DEFINE(handle_radio_debug_off,"Radio Debug Off"),
- AST_CLI_DEFINE(handle_radio_active,"Change commanded device"),
- AST_CLI_DEFINE(handle_set_xdebug,"Radio set xpmr debug level")
-};
-
-#endif
-
-#include "./xpmr/xpmr.c"
-#ifdef HAVE_XPMRX
-#include "./xpmrx/xpmrx.c"
-#endif
-
-/*
-*/
-static int load_module(void)
-{
- struct ast_config *cfg = NULL;
- char *ctg = NULL;
-#ifdef NEW_ASTERISK
- struct ast_flags zeroflag = {0};
-#endif
-
- if (!(usbradio_tech.capabilities = ast_format_cap_alloc())) {
- return AST_MODULE_LOAD_DECLINE;
- }
- ast_format_cap_add(usbradio_tech.capabilities, ast_format_set(&slin, AST_FORMAT_SLINEAR, 0));
-
- if (hid_device_mklist()) {
- ast_log(LOG_NOTICE, "Unable to make hid list\n");
- return AST_MODULE_LOAD_DECLINE;
- }
-
- usb_list_check("");
-
- usbradio_active = NULL;
-
- /* Copy the default jb config over global_jbconf */
- memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
-
- /* load config file */
-#ifdef NEW_ASTERISK
- if (!(cfg = ast_config_load(config,zeroflag)) || cfg == CONFIG_STATUS_FILEINVALID) {
-#else
- if (!(cfg = ast_config_load(config))) || cfg == CONFIG_STATUS_FILEINVALID {
-#endif
- ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
- return AST_MODULE_LOAD_DECLINE;
- }
-
- do {
- store_config(cfg, ctg);
- } while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
-
- ast_config_destroy(cfg);
-
- if (find_desc(usbradio_active) == NULL) {
- ast_log(LOG_NOTICE, "radio active device %s not found\n", usbradio_active);
- /* XXX we could default to 'dsp' perhaps ? */
- /* XXX should cleanup allocated memory etc. */
- return AST_MODULE_LOAD_DECLINE;
- }
-
- if (ast_channel_register(&usbradio_tech)) {
- ast_log(LOG_ERROR, "Unable to register channel type 'usb'\n");
- return AST_MODULE_LOAD_DECLINE;
- }
-
- ast_cli_register_multiple(cli_usbradio, ARRAY_LEN(cli_usbradio));
-
- return AST_MODULE_LOAD_SUCCESS;
-}
-/*
-*/
-static int unload_module(void)
-{
- struct chan_usbradio_pvt *o;
-
- ast_log(LOG_WARNING, "unload_module() called\n");
-
- ast_channel_unregister(&usbradio_tech);
- ast_cli_unregister_multiple(cli_usbradio, ARRAY_LEN(cli_usbradio));
-
- for (o = usbradio_default.next; o; o = o->next) {
-
- ast_log(LOG_WARNING, "destroyPmrChannel() called\n");
- if(o->pmrChan)destroyPmrChannel(o->pmrChan);
-
- #if DEBUG_CAPTURES == 1
- if (frxcapraw) { fclose(frxcapraw); frxcapraw = NULL; }
- if (frxcaptrace) { fclose(frxcaptrace); frxcaptrace = NULL; }
- if (frxoutraw) { fclose(frxoutraw); frxoutraw = NULL; }
- if (ftxcapraw) { fclose(ftxcapraw); ftxcapraw = NULL; }
- if (ftxcaptrace) { fclose(ftxcaptrace); ftxcaptrace = NULL; }
- if (ftxoutraw) { fclose(ftxoutraw); ftxoutraw = NULL; }
- #endif
-
- close(o->sounddev);
-#ifndef NEW_ASTERISK
- if (o->sndcmd[0] > 0) {
- close(o->sndcmd[0]);
- close(o->sndcmd[1]);
- }
-#endif
- if (o->dsp) ast_dsp_free(o->dsp);
- if (o->owner)
- ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
- if (o->owner) /* XXX how ??? */
- return -1;
- /* XXX what about the thread ? */
- /* XXX what about the memory allocated ? */
- }
-
- usbradio_tech.capabilities = ast_format_cap_destroy(usbradio_tech.capabilities);
- return 0;
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "usb Console Channel Driver");
-
-/* end of file */
-
-
diff --git a/channels/xpmr/sinetabx.h b/channels/xpmr/sinetabx.h
deleted file mode 100755
index 14d8f9f4c..000000000
--- a/channels/xpmr/sinetabx.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * sinetabx.h - for Xelatec Private Mobile Radio Processes
- *
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- *
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-
-#ifndef XPMR_SINETABX_H
-#define XPMR_SINETABX_H 1
-
-#define SAMPLES_PER_SINE 256
-
-static const i16 sinetablex[]={
-0, // 0
-804, // 1
-1608, // 2
-2410, // 3
-3212, // 4
-4011, // 5
-4808, // 6
-5602, // 7
-6393, // 8
-7179, // 9
-7962, // 10
-8739, // 11
-9512, // 12
-10278, // 13
-11039, // 14
-11793, // 15
-12539, // 16
-13279, // 17
-14010, // 18
-14732, // 19
-15446, // 20
-16151, // 21
-16846, // 22
-17530, // 23
-18204, // 24
-18868, // 25
-19519, // 26
-20159, // 27
-20787, // 28
-21403, // 29
-22005, // 30
-22594, // 31
-23170, // 32
-23731, // 33
-24279, // 34
-24811, // 35
-25329, // 36
-25832, // 37
-26319, // 38
-26790, // 39
-27245, // 40
-27683, // 41
-28105, // 42
-28510, // 43
-28898, // 44
-29268, // 45
-29621, // 46
-29956, // 47
-30273, // 48
-30571, // 49
-30852, // 50
-31113, // 51
-31356, // 52
-31580, // 53
-31785, // 54
-31971, // 55
-32137, // 56
-32285, // 57
-32412, // 58
-32521, // 59
-32609, // 60
-32678, // 61
-32728, // 62
-32757, // 63
-32767, // 64
-32757, // 65
-32728, // 66
-32678, // 67
-32609, // 68
-32521, // 69
-32412, // 70
-32285, // 71
-32137, // 72
-31971, // 73
-31785, // 74
-31580, // 75
-31356, // 76
-31113, // 77
-30852, // 78
-30571, // 79
-30273, // 80
-29956, // 81
-29621, // 82
-29268, // 83
-28898, // 84
-28510, // 85
-28105, // 86
-27683, // 87
-27245, // 88
-26790, // 89
-26319, // 90
-25832, // 91
-25329, // 92
-24811, // 93
-24279, // 94
-23731, // 95
-23170, // 96
-22594, // 97
-22005, // 98
-21403, // 99
-20787, // 100
-20159, // 101
-19519, // 102
-18868, // 103
-18204, // 104
-17530, // 105
-16846, // 106
-16151, // 107
-15446, // 108
-14732, // 109
-14010, // 110
-13279, // 111
-12539, // 112
-11793, // 113
-11039, // 114
-10278, // 115
-9512, // 116
-8739, // 117
-7962, // 118
-7179, // 119
-6393, // 120
-5602, // 121
-4808, // 122
-4011, // 123
-3212, // 124
-2410, // 125
-1608, // 126
-804, // 127
-0, // 128
--804, // 129
--1608, // 130
--2410, // 131
--3212, // 132
--4011, // 133
--4808, // 134
--5602, // 135
--6393, // 136
--7179, // 137
--7962, // 138
--8739, // 139
--9512, // 140
--10278, // 141
--11039, // 142
--11793, // 143
--12539, // 144
--13279, // 145
--14010, // 146
--14732, // 147
--15446, // 148
--16151, // 149
--16846, // 150
--17530, // 151
--18204, // 152
--18868, // 153
--19519, // 154
--20159, // 155
--20787, // 156
--21403, // 157
--22005, // 158
--22594, // 159
--23170, // 160
--23731, // 161
--24279, // 162
--24811, // 163
--25329, // 164
--25832, // 165
--26319, // 166
--26790, // 167
--27245, // 168
--27683, // 169
--28105, // 170
--28510, // 171
--28898, // 172
--29268, // 173
--29621, // 174
--29956, // 175
--30273, // 176
--30571, // 177
--30852, // 178
--31113, // 179
--31356, // 180
--31580, // 181
--31785, // 182
--31971, // 183
--32137, // 184
--32285, // 185
--32412, // 186
--32521, // 187
--32609, // 188
--32678, // 189
--32728, // 190
--32757, // 191
--32767, // 192
--32757, // 193
--32728, // 194
--32678, // 195
--32609, // 196
--32521, // 197
--32412, // 198
--32285, // 199
--32137, // 200
--31971, // 201
--31785, // 202
--31580, // 203
--31356, // 204
--31113, // 205
--30852, // 206
--30571, // 207
--30273, // 208
--29956, // 209
--29621, // 210
--29268, // 211
--28898, // 212
--28510, // 213
--28105, // 214
--27683, // 215
--27245, // 216
--26790, // 217
--26319, // 218
--25832, // 219
--25329, // 220
--24811, // 221
--24279, // 222
--23731, // 223
--23170, // 224
--22594, // 225
--22005, // 226
--21403, // 227
--20787, // 228
--20159, // 229
--19519, // 230
--18868, // 231
--18204, // 232
--17530, // 233
--16846, // 234
--16151, // 235
--15446, // 236
--14732, // 237
--14010, // 238
--13279, // 239
--12539, // 240
--11793, // 241
--11039, // 242
--10278, // 243
--9512, // 244
--8739, // 245
--7962, // 246
--7179, // 247
--6393, // 248
--5602, // 249
--4808, // 250
--4011, // 251
--3212, // 252
--2410, // 253
--1608, // 254
--804, // 255
-};
-
-#endif /* !XPMR_SINETABX_H */
diff --git a/channels/xpmr/xpmr.c b/channels/xpmr/xpmr.c
deleted file mode 100755
index 4bfc2c561..000000000
--- a/channels/xpmr/xpmr.c
+++ /dev/null
@@ -1,3325 +0,0 @@
-/*
- * xpmr.c - Xelatec Private Mobile Radio Processes
- *
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- *
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- * 20080118 0800 sph@xelatec.com major fixes and features
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-/*
- FYI = For Your Information
- PMR = Private Mobile Radio
- RX = Receive
- TX = Transmit
- CTCSS = Continuous Tone Coded Squelch System
- TONE = Same as above.
- LSD = Low Speed Data, subaudible signaling. May be tones or codes.
- VOX = Voice Operated Transmit
- DSP = Digital Signal Processing
- LPF = Low Pass Filter
- FIR = Finite Impulse Response (Filter)
- IIR = Infinite Impulse Response (Filter)
-*/
-
-// XPMR_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#ifdef HAVE_SYS_IO_H
-#include <sys/io.h>
-#endif
-#include <fcntl.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "xpmr.h"
-#include "xpmr_coef.h"
-#include "sinetabx.h"
-
-static i16 pmrChanIndex=0; // count of created pmr instances
-//static i16 pmrSpsIndex=0;
-
-#if (DTX_PROG == 1) || XPMR_PPTP == 1
-static int ppdrvdev=0;
-#endif
-
-/*
- Trace Routines
-*/
-void strace(i16 point, t_sdbg *sdbg, i16 idx, i16 value)
-{
- // make dbg_trace buffer in structure
- if(!sdbg->mode || sdbg->point[point]<0){
- return;
- } else {
- sdbg->buffer[(idx*XPMR_DEBUG_CHANS) + sdbg->point[point]] = value;
- }
-}
-/*
-
-*/
-void strace2(t_sdbg *sdbg)
-{
- int i;
- for(i=0;i<XPMR_DEBUG_CHANS;i++)
- {
- if(sdbg->source[i])
- {
- int ii;
- for(ii=0;ii<SAMPLES_PER_BLOCK;ii++)
- {
- sdbg->buffer[ii*XPMR_DEBUG_CHANS + i] = sdbg->source[i][ii];
- }
- }
- }
-}
-#if XPMR_PPTP == 1
-/*
- Hardware Trace Signals via the PC Parallel Port
-*/
-void pptp_init (void)
-{
- if (ppdrvdev == 0)
- ppdrvdev = open("/dev/ppdrv_device", 0);
-
- if (ppdrvdev < 0)
- {
- ast_log(LOG_ERROR, "open /dev/ppdrv_ppdrvdev returned %i\n",ppdrvdev);
- exit(0);
- }
- ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX | DTX_TP1 | DTX_TP2);
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX | DTX_TP1 | DTX_TP2);
-}
-/*
-*/
-void pptp_write(i16 bit, i16 state)
-{
- if(bit==0)
- {
- if(state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP1);
- else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,DTX_TP1);
- }
- else
- {
- if(state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP2);
- else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,DTX_TP2);
- }
-}
-#endif
-/*
- take source string allocate and copy
- copy is modified, delimiters are replaced with zeros to mark
- end of string
- count set pointers
- string_parse( char *src, char *dest, char **sub)
-*/
-i16 string_parse(char *src, char **dest, char ***ptrs)
-{
- char *p,*pd;
- char *ptstr[1000];
- i16 i, slen, numsub;
-
- TRACEJ(2,("string_parse(%s)\n",src));
-
- slen=strlen(src);
- TRACEJ(2,(" source len = %i\n",slen));
-
- pd=*dest;
- free(pd);
- pd=calloc(slen+1,1);
- memcpy(pd,src,slen);
- *dest=pd;
-
- p=0;
- numsub=0;
- for(i=0;i<slen+1;i++)
- {
- TRACEJ(5,(" pd[%i] = %c\n",i,pd[i]));
-
- if( p==0 && pd[i]!=',' && pd[i]!=' ' )
- {
- p=&(pd[i]);
- }
- else if(pd[i]==',' || pd[i]==0 )
- {
- ptstr[numsub]=p;
- pd[i]=0;
- p=0;
- numsub++;
- }
- }
-
- for(i=0;i<numsub;i++)
- {
- TRACEJ(5,(" ptstr[%i] = %p %s\n",i,ptstr[i],ptstr[i]));
- }
-
- if(*ptrs)free(*ptrs);
- *ptrs=calloc(numsub,4);
- for(i=0;i<numsub;i++)
- {
- (*ptrs)[i]=ptstr[i];
- TRACEJ(5,(" %i = %s\n",i,(*ptrs)[i]));
- }
- TRACEJ(5,("string_parse()=%i\n\n",numsub));
-
- return numsub;
-}
-/*
- the parent program defines
- pRxCodeSrc and pTxCodeSrc string pointers to the list of codes
- pTxCodeDefault the default Tx Code.
-
-*/
-i16 code_string_parse(t_pmr_chan *pChan)
-{
- i16 i, ii, hit, ti;
- char *p;
- float f, maxctcsstxfreq;
-
- t_pmr_sps *pSps;
- i16 maxctcssindex;
-
- TRACEF(1,("code_string_parse(%i)\n",0));
- TRACEF(1,("pChan->pRxCodeSrc %s \n",pChan->pRxCodeSrc));
- TRACEF(1,("pChan->pTxCodeSrc %s \n",pChan->pTxCodeSrc));
- TRACEF(1,("pChan->pTxCodeDefault %s \n",pChan->pTxCodeDefault));
-
- //printf("code_string_parse() %s / %s / %s / %s \n",pChan->name, pChan->pTxCodeDefault,pChan->pTxCodeSrc,pChan->pRxCodeSrc);
-
- maxctcssindex=CTCSS_NULL;
- maxctcsstxfreq=CTCSS_NULL;
- pChan->txctcssdefault_index=CTCSS_NULL;
- pChan->txctcssdefault_value=CTCSS_NULL;
-
- pChan->b.ctcssRxEnable=pChan->b.ctcssTxEnable=0;
- pChan->b.dcsRxEnable=pChan->b.dcsTxEnable=0;
- pChan->b.lmrRxEnable=pChan->b.lmrTxEnable=0;
- pChan->b.mdcRxEnable=pChan->b.mdcTxEnable=0;
- pChan->b.dstRxEnable=pChan->b.dstTxEnable=0;
- pChan->b.p25RxEnable=pChan->b.p25TxEnable=0;
-
- if(pChan->spsLsdGen){
- pChan->spsLsdGen->enabled=0;
- pChan->spsLsdGen->state=0;
- }
-
- TRACEF(1,("code_string_parse(%i) 05\n",0));
-
- pChan->numrxcodes = string_parse( pChan->pRxCodeSrc, &(pChan->pRxCodeStr), &(pChan->pRxCode));
- pChan->numtxcodes = string_parse( pChan->pTxCodeSrc, &(pChan->pTxCodeStr), &(pChan->pTxCode));
-
- if(pChan->numrxcodes!=pChan->numtxcodes)printf("ERROR: numrxcodes != numtxcodes \n");
-
- pChan->rxCtcss->enabled=0;
- pChan->rxCtcss->gain=1*M_Q8;
- pChan->rxCtcss->limit=8192;
- pChan->rxCtcss->input=pChan->pRxLsdLimit;
- pChan->rxCtcss->decode=CTCSS_NULL;
-
- pChan->rxCtcss->testIndex=0;
- if(!pChan->rxCtcss->testIndex)pChan->rxCtcss->testIndex=3;
-
- pChan->rxctcssfreq[0]=0; // decode now CTCSS_RXONLY
-
- for(i=0;i<CTCSS_NUM_CODES;i++)
- {
- pChan->rxctcss[i]=0;
- pChan->txctcss[i]=0;
- pChan->rxCtcssMap[i]=CTCSS_NULL;
- }
-
- TRACEF(1,("code_string_parse(%i) 10\n",0));
-
- #ifdef XPMRX_H
- xpmrx(pChan,XXO_LSDCODEPARSE);
- #endif
-
- // Do Receive Codes String
- for(i=0;i<pChan->numrxcodes;i++)
- {
- i16 ri,_ti;
- float _f;
-
- p=pChan->pStr=pChan->pRxCode[i];
-
- #ifdef HAVE_XPMRX
- if(!xpmrx(pChan,XXO_LSDCODEPARSE_1))
- #endif
- {
- sscanf(p, "%30f", &_f);
- ri=CtcssFreqIndex(_f);
- if(ri>maxctcssindex)maxctcssindex=ri;
-
- sscanf(pChan->pTxCode[i], "%30f", &_f);
- _ti=CtcssFreqIndex(_f);
- if(_f>maxctcsstxfreq)maxctcsstxfreq=_f;
-
- if(ri>CTCSS_NULL && _ti>CTCSS_NULL)
- {
- pChan->b.ctcssRxEnable=pChan->b.ctcssTxEnable=1;
- pChan->rxCtcssMap[ri]=_ti;
- pChan->numrxctcssfreqs++;
- TRACEF(1,("pChan->rxctcss[%i]=%s pChan->rxCtcssMap[%i]=%i\n",i,pChan->rxctcss[i],ri,_ti));
- }
- else if(ri>CTCSS_NULL && _f==0)
- {
- pChan->b.ctcssRxEnable=1;
- pChan->rxCtcssMap[ri]=CTCSS_RXONLY;
- pChan->numrxctcssfreqs++;
- TRACEF(1,("pChan->rxctcss[%i]=%s pChan->rxCtcssMap[%i]=%i RXONLY\n",i,pChan->rxctcss[i],ri,_ti));
- }
- else
- {
- i16 _ii;
- pChan->numrxctcssfreqs=0;
- for(_ii=0;_ii<CTCSS_NUM_CODES;_ii++) pChan->rxCtcssMap[_ii]=CTCSS_NULL;
- TRACEF(1,("WARNING: Invalid Channel code detected and ignored. %i %s %s \n",i,pChan->pRxCode[i],pChan->pTxCode[i]));
- }
- }
- }
-
- TRACEF(1,("code_string_parse() CTCSS Init Struct %i %i\n",pChan->b.ctcssRxEnable,pChan->b.ctcssTxEnable));
- if(pChan->b.ctcssRxEnable)
- {
- pChan->rxHpfEnable=1;
- pChan->spsRxLsdNrz->enabled=pChan->rxCenterSlicerEnable=1;
- pChan->rxCtcssDecodeEnable=1;
- pChan->rxCtcss->enabled=1;
- }
- else
- {
- pChan->rxHpfEnable=1;
- pChan->spsRxLsdNrz->enabled=pChan->rxCenterSlicerEnable=0;
- pChan->rxCtcssDecodeEnable=0;
- pChan->rxCtcss->enabled=0;
- }
-
- TRACEF(1,("code_string_parse() CTCSS Init Decoders \n"));
- for(i=0;i<CTCSS_NUM_CODES;i++)
- {
- t_tdet *ptdet;
- ptdet=&(pChan->rxCtcss->tdet[i]);
- ptdet->counterFactor=coef_ctcss_div[i];
- ptdet->state=1;
- ptdet->setpt=(M_Q15*0.041); // 0.069
- ptdet->hyst =(M_Q15*0.0130);
- ptdet->binFactor=(M_Q15*0.135); // was 0.140
- ptdet->fudgeFactor=8;
- }
-
-
- // DEFAULT TX CODE
- TRACEF(1,("code_string_parse() Default Tx Code %s \n",pChan->pTxCodeDefault));
- pChan->txcodedefaultsmode=SMODE_NULL;
- p=pChan->pStr=pChan->pTxCodeDefault;
-
- #ifdef HAVE_XPMRX
- if(!lsd_code_parse(pChan,3))
- #endif
- {
- sscanf(p, "%30f", &f);
- ti=CtcssFreqIndex(f);
- if(f>maxctcsstxfreq)maxctcsstxfreq=f;
-
- if(ti>CTCSS_NULL)
- {
- pChan->b.ctcssTxEnable=1;
- pChan->txctcssdefault_index=ti;
- pChan->txctcssdefault_value=f;
- pChan->spsSigGen0->freq=f*10;
- pChan->txcodedefaultsmode=SMODE_CTCSS;
- TRACEF(1,("code_string_parse() Tx Default CTCSS = %s %i %f\n",p,ti,f));
- }
- }
-
-
- // set x for maximum length and just change pointers
- TRACEF(1,("code_string_parse() Filter Config \n"));
- pSps=pChan->spsTxLsdLpf;
- if(pSps->x)free(pSps->x);
- if(maxctcsstxfreq>203.5)
- {
- pSps->ncoef=taps_fir_lpf_250_9_66;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_250_9_66;
- pSps->nx=taps_fir_lpf_250_9_66;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_250_9_66;
- TRACEF(1,("code_string_parse() Tx Filter Freq High\n"));
- }
- else
- {
- pSps->ncoef=taps_fir_lpf_215_9_88;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_215_9_88;
- pSps->nx=taps_fir_lpf_215_9_88;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_215_9_88;
- TRACEF(1,("code_string_parse() Tx Filter Freq Low\n"));
- }
-
- // CTCSS Rx Decoder Low Pass Filter
- hit=0;
- ii= CtcssFreqIndex(203.5);
- for(i=ii;i<CTCSS_NUM_CODES;i++)
- {
- if(pChan->rxCtcssMap[i]>CTCSS_NULL)hit=1;
- }
-
- pSps=pChan->spsRxLsd;
- if(pSps->x)free(pSps->x);
- if(hit)
- {
- pSps->ncoef=taps_fir_lpf_250_9_66;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_250_9_66;
- pSps->nx=taps_fir_lpf_250_9_66;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_250_9_66;
- TRACEF(1,("code_string_parse() Rx Filter Freq High\n"));
- }
- else
- {
- pSps->ncoef=taps_fir_lpf_215_9_88;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_215_9_88;
- pSps->nx=taps_fir_lpf_215_9_88;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_215_9_88;
- TRACEF(1,("code_string_parse() Rx Filter Freq Low\n"));
- }
-
- if(pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable)
- {
- pChan->rxCenterSlicerEnable=1;
- pSps->enabled=1;
- }
- else
- {
- pChan->rxCenterSlicerEnable=0;
- pSps->enabled=0;
- }
-
- #if XPMR_DEBUG0 == 1
- TRACEF(2,("code_string_parse() ctcssRxEnable = %i \n",pChan->b.ctcssRxEnable));
- TRACEF(2,(" ctcssTxEnable = %i \n",pChan->b.ctcssTxEnable));
- TRACEF(2,(" dcsRxEnable = %i \n",pChan->b.dcsRxEnable));
- TRACEF(2,(" lmrRxEnable = %i \n",pChan->b.lmrRxEnable));
- TRACEF(2,(" txcodedefaultsmode = %i \n",pChan->txcodedefaultsmode));
- for(i=0;i<CTCSS_NUM_CODES;i++)
- {
- TRACEF(2,("rxCtcssMap[%i] = %i \n",i,pChan->rxCtcssMap[i]));
- }
- #endif
-
- #ifdef HAVE_XPMRX
- lsd_code_parse(pChan,5);
- #endif
-
- TRACEF(1,("code_string_parse(%i) end\n",0));
-
- return 0;
-}
-/*
- Convert a Frequency in Hz to a zero based CTCSS Table index
-*/
-i16 CtcssFreqIndex(float freq)
-{
- i16 i,hit=CTCSS_NULL;
-
- for(i=0;i<CTCSS_NUM_CODES;i++){
- if(freq==freq_ctcss[i])hit=i;
- }
- return hit;
-}
-/*
- pmr_rx_frontend
- Takes a block of data and low pass filters it.
- Determines the amplitude of high frequency noise for carrier detect.
- Decimates input data to change the rate.
-*/
-i16 pmr_rx_frontend(t_pmr_sps *mySps)
-{
- #define DCgainBpfNoise 65536
-
- i16 samples,iOutput, *input, *output, *noutput;
- i16 *x, *coef;
- i32 i, naccum, outputGain, calcAdjust;
- i64 y;
- i16 nx, hyst, setpt, compOut;
- i16 amax, amin, apeak, discounteru, discounterl, discfactor;
- i16 decimator, decimate, doNoise;
-
- TRACEJ(5,("pmr_rx_frontend()\n"));
-
- if(!mySps->enabled)return(1);
-
- decimator = mySps->decimator;
- decimate = mySps->decimate;
-
- input = mySps->source;
- output = mySps->sink;
- noutput = mySps->parentChan->pRxNoise;
-
- nx = mySps->nx;
- coef = mySps->coef;
-
- calcAdjust = mySps->calcAdjust;
- outputGain = mySps->outputGain;
-
- amax=mySps->amax;
- amin=mySps->amin;
- apeak=mySps->apeak;
- discounteru=mySps->discounteru;
- discounterl=mySps->discounterl;
- discfactor=mySps->discfactor;
- setpt=mySps->setpt;
- hyst=mySps->hyst;
- compOut=mySps->compOut;
-
- samples=mySps->nSamples*decimate;
- x=mySps->x;
- iOutput=0;
-
- if(mySps->parentChan->rxCdType!=CD_XPMR_VOX)doNoise=1;
- else doNoise=0;
-
- for(i=0;i<samples;i++)
- {
- i16 n;
-
- //shift the old samples
- for(n=nx-1; n>0; n--)
- x[n] = x[n-1];
-
- x[0] = input[i*2];
-
- --decimator;
-
- if(decimator<=0)
- {
- decimator=decimate;
-
- y=0;
- for(n=0; n<nx; n++)
- y += coef[n] * x[n];
-
- y=((y/calcAdjust)*outputGain)/M_Q8;
-
- if(y>32767)y=32767;
- else if(y<-32767)y=-32767;
-
- output[iOutput]=y; // Rx Baseband decimated
- noutput[iOutput++] = apeak; // Rx Noise
- }
-
- if(doNoise)
- {
- // calculate noise output
- naccum=0;
- for(n=0; n<nx; n++)
- naccum += coef_fir_bpf_noise_1[n] * x[n];
-
- naccum /= DCgainBpfNoise;
-
- if(naccum>amax)
- {
- amax=naccum;
- discounteru=discfactor;
- }
- else if(--discounteru<=0)
- {
- discounteru=discfactor;
- amax=(i32)((amax*32700)/32768);
- }
-
- if(naccum<amin)
- {
- amin=naccum;
- discounterl=discfactor;
- }
- else if(--discounterl<=0)
- {
- discounterl=discfactor;
- amin=(i32)((amin*32700)/32768);
- }
-
- apeak=(amax-amin)/2;
-
- } // if doNoise
- }
-
- if(doNoise)
- {
- ((t_pmr_chan *)(mySps->parentChan))->rxRssi=apeak;
-
- if(apeak>setpt || (compOut&&(apeak>(setpt-hyst)))) compOut=1;
- else compOut=0;
- mySps->compOut=compOut;
- mySps->amax=amax;
- mySps->amin=amin;
- mySps->apeak=apeak;
- mySps->discounteru=discounteru;
- mySps->discounterl=discounterl;
- }
-
- return 0;
-}
-/*
- pmr general purpose fir
- works on a block of samples
-*/
-i16 pmr_gp_fir(t_pmr_sps *mySps)
-{
- i32 nsamples,inputGain,outputGain,calcAdjust;
- i16 *input, *output;
- i16 *x, *coef;
- i32 i, ii;
- i16 nx, hyst, setpt, compOut;
- i16 amax, amin, apeak=0, discounteru=0, discounterl=0, discfactor;
- i16 decimator, decimate, interpolate;
- i16 numChanOut, selChanOut, mixOut, monoOut;
-
- TRACEJ(5,("pmr_gp_fir() %i %i\n",mySps->index, mySps->enabled));
-
- if(!mySps->enabled)return(1);
-
- inputGain = mySps->inputGain;
- calcAdjust = mySps->calcAdjust;
- outputGain = mySps->outputGain;
-
- input = mySps->source;
- output = mySps->sink;
- x = mySps->x;
- nx = mySps->nx;
- coef = mySps->coef;
-
- decimator = mySps->decimator;
- decimate = mySps->decimate;
- interpolate = mySps->interpolate;
-
- setpt = mySps->setpt;
- compOut = mySps->compOut;
-
- inputGain = mySps->inputGain;
- outputGain = mySps->outputGain;
- numChanOut = mySps->numChanOut;
- selChanOut = mySps->selChanOut;
- mixOut = mySps->mixOut;
- monoOut = mySps->monoOut;
-
- amax=mySps->amax;
- amin=mySps->amin;
-
- discfactor=mySps->discfactor;
- hyst=mySps->hyst;
- setpt=mySps->setpt;
- nsamples=mySps->nSamples;
-
- if(mySps->option==3)
- {
- mySps->option=0;
- mySps->enabled=0;
- for(i=0;i<nsamples;i++)
- {
- if(monoOut)
- output[(i*2)]=output[(i*2)+1]=0;
- else
- output[(i*numChanOut)+selChanOut]=0;
- }
- return 0;
- }
-
- ii=0;
- for(i=0;i<nsamples;i++)
- {
- int ix;
-
- int64_t y=0;
-
- if(decimate<0)
- {
- decimator=decimate;
- }
-
- for(ix=0;ix<interpolate;ix++)
- {
- i16 n;
- y=0;
-
- for(n=nx-1; n>0; n--)
- x[n] = x[n-1];
- x[0] = (input[i]*inputGain)/M_Q8;
-
- #if 0
- --decimator;
- if(decimator<=0)
- {
- decimator=decimate;
- for(n=0; n<nx; n++)
- y += coef[n] * x[n];
- y /= (outputGain*3);
- output[ii++]=y;
- }
- #else
- for(n=0; n<nx; n++)
- y += coef[n] * x[n];
-
- y=((y/calcAdjust)*outputGain)/M_Q8;
-
- if(mixOut){
- if(monoOut){
- output[(ii*2)]=output[(ii*2)+1]+=y;
- }
- else{
- output[(ii*numChanOut)+selChanOut]+=y;
- }
- }
- else{
- if(monoOut){
- output[(ii*2)]=output[(ii*2)+1]=y;
- }
- else{
- output[(ii*numChanOut)+selChanOut]=y;
- }
- }
- ii++;
- #endif
- }
-
- // amplitude detector
- if(setpt)
- {
- i16 accum=y;
-
- if(accum>amax)
- {
- amax=accum;
- discounteru=discfactor;
- }
- else if(--discounteru<=0)
- {
- discounteru=discfactor;
- amax=(i32)((amax*32700)/32768);
- }
-
- if(accum<amin)
- {
- amin=accum;
- discounterl=discfactor;
- }
- else if(--discounterl<=0)
- {
- discounterl=discfactor;
- amin=(i32)((amin*32700)/32768);
- }
-
- apeak = (i32)(amax-amin)/2;
-
- if(apeak>setpt)compOut=1;
- else if(compOut&&(apeak<(setpt-hyst)))compOut=0;
- }
- }
-
- mySps->decimator = decimator;
-
- mySps->amax=amax;
- mySps->amin=amin;
- mySps->apeak=apeak;
- mySps->discounteru=discounteru;
- mySps->discounterl=discounterl;
-
- mySps->compOut=compOut;
-
- return 0;
-}
-/*
- general purpose integrator lpf
-*/
-i16 gp_inte_00(t_pmr_sps *mySps)
-{
- i16 npoints;
- i16 *input, *output;
-
- i32 outputGain;
- i32 i;
- i32 accum;
-
- i32 state00;
- i16 coeff00, coeff01;
-
- TRACEJ(5,("gp_inte_00() %i\n",mySps->enabled));
- if(!mySps->enabled)return(1);
-
- input = mySps->source;
- output = mySps->sink;
-
- npoints=mySps->nSamples;
-
- outputGain=mySps->outputGain;
-
- coeff00=((i16*)mySps->coef)[0];
- coeff01=((i16*)mySps->coef)[1];
- state00=((i32*)mySps->x)[0];
-
- // note fixed gain of 2 to compensate for attenuation
- // in passband
-
- for(i=0;i<npoints;i++)
- {
- accum=input[i];
- state00 = accum + (state00*coeff01)/M_Q15;
- accum = (state00*coeff00)/(M_Q15/4);
- output[i]=(accum*outputGain)/M_Q8;
- }
-
- ((i32*)(mySps->x))[0]=state00;
-
- return 0;
-}
-/*
- general purpose differentiator hpf
-*/
-i16 gp_diff(t_pmr_sps *mySps)
-{
- i16 *input, *output;
- i16 npoints;
- i32 outputGain, calcAdjust;
- i32 i;
- i32 temp0,temp1;
- i16 x0;
- i32 _y0;
- i16 a0,a1;
- i16 *coef;
- i16 *x;
-
- input = mySps->source;
- output = mySps->sink;
-
- npoints=mySps->nSamples;
-
- outputGain=mySps->outputGain;
- calcAdjust=mySps->calcAdjust;
-
- coef=(i16*)(mySps->coef);
- x=(i16*)(mySps->x);
- a0=coef[0];
- a1=coef[1];
-
- x0=x[0];
-
- TRACEJ(5,("gp_diff()\n"));
-
- for (i=0;i<npoints;i++)
- {
- temp0 = x0 * a1;
- x0 = input[i];
- temp1 = input[i] * a0;
- _y0 = (temp0 + temp1)/calcAdjust;
- _y0 = (_y0*outputGain)/M_Q8;
-
- if(_y0>32766)_y0=32766;
- else if(_y0<-32766)_y0=-32766;
- output[i]=_y0;
- }
-
- x[0]=x0;
-
- return 0;
-}
-/* ----------------------------------------------------------------------
- CenterSlicer
-*/
-i16 CenterSlicer(t_pmr_sps *mySps)
-{
- i16 npoints/*, lhit, uhit*/;
- i16 *input, *output, *buff;
-
- i32 inputGainB;
- i32 i;
- i32 accum;
-
- i32 amax; // buffer amplitude maximum
- i32 amin; // buffer amplitude minimum
- i32 apeak; // buffer amplitude peak
- i32 center;
- i32 setpt; // amplitude set point for peak tracking
-
- i32 discounteru; // amplitude detector integrator discharge counter upper
- i32 discounterl; // amplitude detector integrator discharge counter lower
- i32 discfactor; // amplitude detector integrator discharge factor
-
- TRACEJ(5,("CenterSlicer() %i\n",mySps->enabled));
- if(!mySps->enabled)return(1);
-
- input = mySps->source;
- output = mySps->sink; // limited output
- buff = mySps->buff;
-
- npoints=mySps->nSamples;
-
- inputGainB=mySps->inputGainB;
-
- amax=mySps->amax;
- amin=mySps->amin;
- setpt=mySps->setpt;
- apeak=mySps->apeak;
- discounteru=mySps->discounteru;
- discounterl=mySps->discounterl;
-
- discfactor=mySps->discfactor;
- npoints=mySps->nSamples;
-
- for(i=0;i<npoints;i++)
- {
- #if XPMR_DEBUG0 == 1
- static i32 tfx=0;
- #endif
- accum=input[i];
-
- /* lhit=uhit=0; */
-
- if(accum>amax)
- {
- amax=accum;
- /* uhit=1; */
- if(amin<(amax-setpt))
- {
- amin=(amax-setpt);
- /* lhit=1; */
- }
- }
- else if(accum<amin)
- {
- amin=accum;
- /* lhit=1; */
- if(amax>(amin+setpt))
- {
- amax=(amin+setpt);
- /* uhit=1; */
- }
- }
- #if 0
- if((discounteru-=1)<=0 && amax>amin)
- {
- if((amax-=10)<amin)amax=amin;
- uhit=1;
- }
-
- if((discounterl-=1)<=0 && amin<amax)
- {
- if((amin+=10)>amax)amin=amax;
- lhit=1;
- }
- if(uhit)discounteru=discfactor;
- if(lhit)discounterl=discfactor;
-
- #else
-
- if((amax-=discfactor)<amin)amax=amin;
- if((amin+=discfactor)>amax)amin=amax;
-
- #endif
-
- apeak = (amax-amin)/2;
- center = (amax+amin)/2;
- accum = accum - center;
-
- output[i]=accum; // sink output unlimited/centered.
-
- // do limiter function
- if(accum>inputGainB)accum=inputGainB;
- else if(accum<-inputGainB)accum=-inputGainB;
- buff[i]=accum;
-
- #if XPMR_DEBUG0 == 1
- #if 0
- mySps->parentChan->pRxLsdCen[i]=center; // trace center ref
- #else
- if((tfx++/8)&1) // trace min/max levels
- mySps->parentChan->pRxLsdCen[i]=amax;
- else
- mySps->parentChan->pRxLsdCen[i]=amin;
- #endif
- #if 0
- if(mySps->parentChan->frameCountRx&0x01) mySps->parentChan->prxDebug1[i]=amax;
- else mySps->parentChan->prxDebug1[i]=amin;
- #endif
- #endif
- }
-
- mySps->amax=amax;
- mySps->amin=amin;
- mySps->apeak=apeak;
- mySps->discounteru=discounteru;
- mySps->discounterl=discounterl;
-
- return 0;
-}
-/* ----------------------------------------------------------------------
- MeasureBlock
- determine peak amplitude
-*/
-i16 MeasureBlock(t_pmr_sps *mySps)
-{
- i16 npoints;
- i16 *input, *output;
-
- i32 i;
- i32 accum;
-
- i16 amax; // buffer amplitude maximum
- i16 amin; // buffer amplitude minimum
- i16 apeak=0; // buffer amplitude peak (peak to peak)/2
- i16 setpt; // amplitude set point for amplitude comparator
-
- i32 discounteru; // amplitude detector integrator discharge counter upper
- i32 discounterl; // amplitude detector integrator discharge counter lower
- i32 discfactor; // amplitude detector integrator discharge factor
-
- TRACEJ(5,("MeasureBlock() %i\n",mySps->enabled));
-
- if(!mySps->enabled)return 1;
-
- if(mySps->option==3)
- {
- mySps->amax = mySps->amin = mySps->apeak = \
- mySps->discounteru = mySps->discounterl = \
- mySps->enabled = 0;
- return 1;
- }
-
- input = mySps->source;
- output = mySps->sink;
-
- npoints=mySps->nSamples;
-
- amax=mySps->amax;
- amin=mySps->amin;
- setpt=mySps->setpt;
- discounteru=mySps->discounteru;
- discounterl=mySps->discounterl;
-
- discfactor=mySps->discfactor;
- npoints=mySps->nSamples;
-
- for(i=0;i<npoints;i++)
- {
- accum=input[i];
-
- if(accum>amax)
- {
- amax=accum;
- discounteru=discfactor;
- }
- else if(--discounteru<=0)
- {
- discounteru=discfactor;
- amax=(i32)((amax*32700)/32768);
- }
-
- if(accum<amin)
- {
- amin=accum;
- discounterl=discfactor;
- }
- else if(--discounterl<=0)
- {
- discounterl=discfactor;
- amin=(i32)((amin*32700)/32768);
- }
-
- apeak = (i32)(amax-amin)/2;
- if(output)output[i]=apeak;
- }
-
- mySps->amax=amax;
- mySps->amin=amin;
- mySps->apeak=apeak;
- mySps->discounteru=discounteru;
- mySps->discounterl=discounterl;
- if(apeak>=setpt) mySps->compOut=1;
- else mySps->compOut=0;
-
- //TRACEX((" -MeasureBlock()=%i\n",mySps->apeak));
- return 0;
-}
-/*
- SoftLimiter
-*/
-i16 SoftLimiter(t_pmr_sps *mySps)
-{
- i16 npoints;
- //i16 samples, lhit,uhit;
- i16 *input, *output;
-
- i32 /*inputGain, */outputGain;
- i32 i;
- i32 accum;
- i32 tmp;
-
- i32 amax; // buffer amplitude maximum
- i32 amin; // buffer amplitude minimum
- //i32 apeak; // buffer amplitude peak
- i32 setpt; // amplitude set point for amplitude comparator
-
- input = mySps->source;
- output = mySps->sink;
-
- /* inputGain=mySps->inputGain; */
- outputGain=mySps->outputGain;
-
- npoints=mySps->nSamples;
-
- setpt=mySps->setpt;
- amax=(setpt*124)/128;
- amin=-amax;
-
- TRACEJ(5,("SoftLimiter() %i %i %i) \n",amin, amax,setpt));
-
- for(i=0;i<npoints;i++)
- {
- accum=input[i];
- //accum=input[i]*mySps->inputGain/256;
-
- if(accum>setpt)
- {
- tmp=((accum-setpt)*4)/128;
- accum=setpt+tmp;
- if(accum>amax)accum=amax;
- accum=setpt;
- }
- else if(accum<-setpt)
- {
- tmp=((accum+setpt)*4)/128;
- accum=(-setpt)-tmp;
- if(accum<amin)accum=amin;
- accum=-setpt;
- }
-
- output[i]=(accum*outputGain)/M_Q8;
- }
-
- return 0;
-}
-/*
- SigGen() - sine, square function generator
- sps overloaded values
- discfactor = phase factor
- discfactoru = phase index
- if source is not NULL then mix it in!
-
- sign table and output gain are in Q15 format (32767=.999)
-*/
-i16 SigGen(t_pmr_sps *mySps)
-{
- #define PH_FRACT_FACT 128
-
- i32 ph;
- i16 i,outputgain,waveform,numChanOut,selChanOut;
- i32 accum;
-
- t_pmr_chan *pChan;
- pChan=mySps->parentChan;
- TRACEC(5,("SigGen(%i %i %i)\n",mySps->option,mySps->enabled,mySps->state));
-
- if(!mySps->freq ||!mySps->enabled)return 0;
-
- outputgain=mySps->outputGain;
- waveform=0;
- numChanOut=mySps->numChanOut;
- selChanOut=mySps->selChanOut;
-
- if(mySps->option==1)
- {
- mySps->option=0;
- mySps->state=1;
- mySps->discfactor=
- (SAMPLES_PER_SINE*mySps->freq*PH_FRACT_FACT)/mySps->sampleRate/10;
-
- TRACEF(5,(" SigGen() discfactor = %i\n",mySps->discfactor));
- if(mySps->discounterl)mySps->state=2;
- }
- else if(mySps->option==2)
- {
- i16 shiftfactor=CTCSS_TURN_OFF_SHIFT;
- // phase shift request
- mySps->option=0;
- mySps->state=2;
- mySps->discounterl=CTCSS_TURN_OFF_TIME-(2*MS_PER_FRAME); //
-
- mySps->discounteru = \
- (mySps->discounteru + (((SAMPLES_PER_SINE*shiftfactor)/360)*PH_FRACT_FACT)) % (SAMPLES_PER_SINE*PH_FRACT_FACT);
- //printf("shiftfactor = %i\n",shiftfactor);
- //shiftfactor+=10;
- }
- else if(mySps->option==3)
- {
- // stop it and clear the output buffer
- mySps->option=0;
- mySps->state=0;
- mySps->enabled=0;
- for(i=0;i<mySps->nSamples;i++)
- mySps->sink[(i*numChanOut)+selChanOut]=0;
- return(0);
- }
- else if(mySps->state==2)
- {
- // doing turn off
- mySps->discounterl-=MS_PER_FRAME;
- if(mySps->discounterl<=0)
- {
- mySps->option=3;
- mySps->state=2;
- }
- }
- else if(mySps->state==0)
- {
- return(0);
- }
-
- ph=mySps->discounteru;
-
- for(i=0;i<mySps->nSamples;i++)
- {
- if(!waveform)
- {
- // sine
- //tmp=(sinetablex[ph/PH_FRACT_FACT]*amplitude)/M_Q16;
- accum=sinetablex[ph/PH_FRACT_FACT];
- accum=(accum*outputgain)/M_Q8;
- }
- else
- {
- // square
- if(ph>SAMPLES_PER_SINE/2)
- accum=outputgain/M_Q8;
- else
- accum=-outputgain/M_Q8;
- }
-
- if(mySps->source)accum+=mySps->source[i];
-
- mySps->sink[(i*numChanOut)+selChanOut]=accum;
-
- ph=(ph+mySps->discfactor)%(SAMPLES_PER_SINE*PH_FRACT_FACT);
- }
-
- mySps->discounteru=ph;
-
- return 0;
-}
-/*
- adder/mixer
- takes existing buffer and adds source buffer to destination buffer
- sink buffer = (sink buffer * gain) + source buffer
-*/
-i16 pmrMixer(t_pmr_sps *mySps)
-{
- i32 accum;
- i16 i, *input, *inputB, *output;
- i16 inputGain, inputGainB; // apply to input data in Q7.8 format
- i16 outputGain; // apply to output data in Q7.8 format
- i16 discounteru,discounterl,amax,amin,setpt,discfactor;
- i16 npoints,uhit,lhit,apeak,measPeak;
-
- t_pmr_chan *pChan;
- pChan=mySps->parentChan;
- TRACEF(5,("pmrMixer()\n"));
-
- input = mySps->source;
- inputB = mySps->sourceB;
- output = mySps->sink;
-
- inputGain=mySps->inputGain;
- inputGainB=mySps->inputGainB;
- outputGain=mySps->outputGain;
-
- amax=mySps->amax;
- amin=mySps->amin;
- setpt=mySps->setpt;
- discounteru=mySps->discounteru;
- discounterl=mySps->discounteru;
-
- discfactor=mySps->discfactor;
- npoints=mySps->nSamples;
- measPeak=mySps->measPeak;
-
- for(i=0;i<npoints;i++)
- {
- accum = ((input[i]*inputGain)/M_Q8) +
- ((inputB[i]*inputGainB)/M_Q8);
-
- accum=(accum*outputGain)/M_Q8;
- output[i]=accum;
-
- if(measPeak){
- lhit=uhit=0;
-
- if(accum>amax){
- amax=accum;
- uhit=1;
- if(amin<(amax-setpt)){
- amin=(amax-setpt);
- lhit=1;
- }
- }
- else if(accum<amin){
- amin=accum;
- lhit=1;
- if(amax>(amin+setpt)){
- amax=(amin+setpt);
- uhit=1;
- }
- }
-
- if(--discounteru<=0 && amax>0){
- amax--;
- uhit=1;
- }
-
- if(--discounterl<=0 && amin<0){
- amin++;
- lhit=1;
- }
-
- if(uhit)discounteru=discfactor;
- if(lhit)discounterl=discfactor;
- }
- }
-
- if(measPeak){
- apeak = (amax-amin)/2;
- mySps->apeak=apeak;
- mySps->amax=amax;
- mySps->amin=amin;
- mySps->discounteru=discounteru;
- mySps->discounterl=discounterl;
- }
-
- return 0;
-}
-/*
- DelayLine
-*/
-i16 DelayLine(t_pmr_sps *mySps)
-{
- i16 *input, *output, *buff;
- i16 i, npoints,buffsize,inindex,outindex;
-
- t_pmr_chan *pChan;
- pChan=mySps->parentChan;
- TRACEF(5,(" DelayLine() %i\n",mySps->enabled));
-
- input = mySps->source;
- output = mySps->sink;
- buff = (i16*)(mySps->buff);
- buffsize = mySps->buffSize;
- npoints = mySps->nSamples;
-
- outindex = mySps->buffOutIndex;
- inindex = outindex + mySps->buffLead;
-
- for(i=0;i<npoints;i++)
- {
- inindex %= buffsize;
- outindex %= buffsize;
-
- buff[inindex]=input[i];
- output[i]=buff[outindex];
- inindex++;
- outindex++;
- }
- mySps->buffOutIndex=outindex;
-
- return 0;
-}
-/*
- Continuous Tone Coded Squelch (CTCSS) Detector
-*/
-i16 ctcss_detect(t_pmr_chan *pChan)
-{
- i16 i,points2do,*pInput,hit,thit,relax;
- i16 tnum, tmp,indexNow,diffpeak;
- /* i16 difftrig; */
- i16 tv0,tv1,tv2,tv3,indexDebug;
- i16 points=0;
- i16 indexWas=0;
-
- TRACEF(5,("ctcss_detect(%p) %i %i %i %i\n",pChan,
- pChan->rxCtcss->enabled,
- 0,
- pChan->rxCtcss->testIndex,
- pChan->rxCtcss->decode));
-
- if(!pChan->rxCtcss->enabled)return(1);
-
- relax = pChan->rxCtcss->relax;
- pInput = pChan->rxCtcss->input;
-
- /*
- if(relax) difftrig=(-0.1*M_Q15);
- else difftrig=(-0.05*M_Q15);
- */
-
- thit=hit=-1;
-
- //TRACEX((" ctcss_detect() %i %i %i %i\n", CTCSS_NUM_CODES,0,0,0));
-
- for(tnum=0;tnum<CTCSS_NUM_CODES;tnum++)
- {
- i32 accum, peak;
- t_tdet *ptdet;
- i16 fudgeFactor;
- i16 binFactor;
-
- TRACEF(6,(" ctcss_detect() tnum=%i %i\n",tnum,pChan->rxCtcssMap[tnum]));
- //if(tnum==14)printf("ctcss_detect() %i %i %i\n",tnum,pChan->rxCtcssMap[tnum], pChan->rxCtcss->decode );
-
- if( (pChan->rxCtcssMap[tnum]==CTCSS_NULL) ||
- (pChan->rxCtcss->decode>CTCSS_NULL && (tnum!= pChan->rxCtcss->decode))
- )
- continue;
-
- TRACEF(6,(" ctcss_detect() tnum=%i\n",tnum));
-
- ptdet=&(pChan->rxCtcss->tdet[tnum]);
- indexDebug=0;
- points=points2do=pChan->nSamplesRx;
- fudgeFactor=ptdet->fudgeFactor;
- binFactor=ptdet->binFactor;
-
- while(ptdet->counter < (points2do*CTCSS_SCOUNT_MUL))
- {
- tmp=(ptdet->counter/CTCSS_SCOUNT_MUL)+1;
- ptdet->counter-=(tmp*CTCSS_SCOUNT_MUL);
- points2do-=tmp;
- indexNow=points-points2do;
-
- ptdet->counter += ptdet->counterFactor;
-
- accum = pInput[indexNow-1]; // duuuude's major bug fix!
-
- ptdet->z[ptdet->zIndex]+=
- (((accum - ptdet->z[ptdet->zIndex])*binFactor)/M_Q15);
-
- peak = abs(ptdet->z[0]-ptdet->z[2]) + abs(ptdet->z[1]-ptdet->z[3]);
-
- if (ptdet->peak < peak)
- ptdet->peak += ( ((peak-ptdet->peak)*binFactor)/M_Q15);
- else
- ptdet->peak=peak;
-
- {
- static const i16 a0=13723;
- static const i16 a1=-13723;
- i32 temp0,temp1;
- i16 x0;
-
- //differentiate
- x0=ptdet->zd;
- temp0 = x0 * a1;
- ptdet->zd = ptdet->peak;
- temp1 = ptdet->peak * a0;
- diffpeak = (temp0 + temp1)/1024;
- }
-
- if(diffpeak<(-0.03*M_Q15))ptdet->dvd-=4;
- else if(ptdet->dvd<0)ptdet->dvd++;
-
- if((ptdet->dvd < -12) && diffpeak > (-0.02*M_Q15))ptdet->dvu+=2;
- else if(ptdet->dvu)ptdet->dvu--;
-
- tmp=ptdet->setpt;
- if(pChan->rxCtcss->decode==tnum)
- {
- if(relax)tmp=(tmp*55)/100;
- else tmp=(tmp*80)/100;
- }
-
- if(ptdet->peak > tmp)
- {
- if(ptdet->decode<(fudgeFactor*32))ptdet->decode++;
- }
- else if(pChan->rxCtcss->decode==tnum)
- {
- if(ptdet->peak > ptdet->hyst)ptdet->decode--;
- else if(relax) ptdet->decode--;
- else ptdet->decode-=4;
- }
- else
- {
- ptdet->decode=0;
- }
-
- if((pChan->rxCtcss->decode==tnum) && !relax && (ptdet->dvu > (0.00075*M_Q15)))
- {
- ptdet->decode=0;
- ptdet->z[0]=ptdet->z[1]=ptdet->z[2]=ptdet->z[3]=ptdet->dvu=0;
- TRACEF(4,("ctcss_detect() turnoff detected by dvdt for tnum = %i.\n",tnum));
- }
-
- if(ptdet->decode<0 || !pChan->rxCarrierDetect)ptdet->decode=0;
-
- if(ptdet->decode>=fudgeFactor)
- {
- thit=tnum;
- if(pChan->rxCtcss->decode!=tnum)
- {
- ptdet->zd=ptdet->dvu=ptdet->dvd=0;
- }
- }
-
- #if XPMR_DEBUG0 == 1
- if(thit>=0 && thit==tnum)
- TRACEF(6,(" ctcss_detect() %i %i %i %i \n",tnum,ptdet->peak,ptdet->setpt,ptdet->hyst));
-
- if(ptdet->pDebug0)
- {
- tv0=ptdet->peak;
- tv1=ptdet->decode;
- tv2=tmp;
- tv3=ptdet->dvu*32;
-
- if(indexDebug==0)
- {
- ptdet->lasttv0=ptdet->pDebug0[points-1];
- ptdet->lasttv1=ptdet->pDebug1[points-1];
- ptdet->lasttv2=ptdet->pDebug2[points-1];
- ptdet->lasttv3=ptdet->pDebug3[points-1];
- }
-
- while(indexDebug<indexNow)
- {
- ptdet->pDebug0[indexDebug]=ptdet->lasttv0;
- ptdet->pDebug1[indexDebug]=ptdet->lasttv1;
- ptdet->pDebug2[indexDebug]=ptdet->lasttv2;
- ptdet->pDebug3[indexDebug]=ptdet->lasttv3;
- indexDebug++;
- }
- ptdet->lasttv0=tv0;
- ptdet->lasttv1=tv1;
- ptdet->lasttv2=tv2;
- ptdet->lasttv3=tv3;
- }
- #endif
- indexWas=indexNow;
- ptdet->zIndex=(ptdet->zIndex + 1) % 4;
- }
- ptdet->counter-=(points2do*CTCSS_SCOUNT_MUL);
-
- #if XPMR_DEBUG0 == 1
- for(i=indexWas;i<points;i++)
- {
- ptdet->pDebug0[i]=ptdet->lasttv0;
- ptdet->pDebug1[i]=ptdet->lasttv1;
- ptdet->pDebug2[i]=ptdet->lasttv2;
- ptdet->pDebug3[i]=ptdet->lasttv3;
- }
- #endif
- }
-
- //TRACEX((" ctcss_detect() thit %i\n",thit));
-
- if(pChan->rxCtcss->BlankingTimer>0)pChan->rxCtcss->BlankingTimer-=points;
- if(pChan->rxCtcss->BlankingTimer<0)pChan->rxCtcss->BlankingTimer=0;
-
- if(thit>CTCSS_NULL && pChan->rxCtcss->decode<=CTCSS_NULL && !pChan->rxCtcss->BlankingTimer)
- {
- pChan->rxCtcss->decode=thit;
- sprintf(pChan->rxctcssfreq,"%.1f",freq_ctcss[thit]);
- TRACEC(1,("ctcss decode %i %.1f\n",thit,freq_ctcss[thit]));
- }
- else if(thit<=CTCSS_NULL && pChan->rxCtcss->decode>CTCSS_NULL)
- {
- pChan->rxCtcss->BlankingTimer=SAMPLE_RATE_NETWORK/5;
- pChan->rxCtcss->decode=CTCSS_NULL;
- strcpy(pChan->rxctcssfreq,"0");
- TRACEC(1,("ctcss decode NULL\n"));
- for(tnum=0;tnum<CTCSS_NUM_CODES;tnum++)
- {
- t_tdet *ptdet=NULL;
- ptdet=&(pChan->rxCtcss->tdet[tnum]);
- ptdet->decode=0;
- ptdet->z[0]=ptdet->z[1]=ptdet->z[2]=ptdet->z[3]=0;
- }
- }
- //TRACEX((" ctcss_detect() thit %i %i\n",thit,pChan->rxCtcss->decode));
- return(0);
-}
-/*
- TxTestTone
-*/
-static i16 TxTestTone(t_pmr_chan *pChan, i16 function)
-{
- if(function==1)
- {
- pChan->spsSigGen1->enabled=1;
- pChan->spsSigGen1->option=1;
- pChan->spsSigGen1->outputGain=(.23125*M_Q8); // to match *99 level
- pChan->spsTx->source=pChan->spsSigGen1->sink;
- }
- else
- {
- pChan->spsSigGen1->option=3;
- }
- return 0;
-}
-/*
- assumes:
- sampling rate is 48KS/s
- samples are all 16 bits
- samples are filtered and decimated by 1/6th
-*/
-t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples)
-{
- i16 i, *inputTmp;
- t_pmr_chan *pChan;
- t_pmr_sps *pSps;
- t_dec_ctcss *pDecCtcss;
-
- TRACEJ(1,("createPmrChannel(%p,%i)\n",tChan,numSamples));
-
- pChan = (t_pmr_chan *)calloc(sizeof(t_pmr_chan),1);
- if(pChan==NULL)
- {
- printf("createPmrChannel() failed\n");
- return(NULL);
- }
-
- #if XPMR_PPTP == 1
- pptp_init();
- #endif
-
- pChan->index=pmrChanIndex++;
- pChan->nSamplesTx=pChan->nSamplesRx=numSamples;
-
- pDecCtcss = (t_dec_ctcss *)calloc(sizeof(t_dec_ctcss),1);
- pChan->rxCtcss=pDecCtcss;
- pChan->rxctcssfreq[0]=0;
-
- #ifdef HAVE_XPMRX
- if(tChan->rptnum>=LSD_CHAN_MAX)tChan->rptnum=0;
- #endif
-
- if(tChan==NULL)
- {
- printf("createPmrChannel() WARNING: NULL tChan!\n");
- pChan->rxNoiseSquelchEnable=0;
- pChan->rxHpfEnable=0;
- pChan->rxDeEmpEnable=0;
- pChan->rxCenterSlicerEnable=0;
- pChan->rxCtcssDecodeEnable=0;
- pChan->rxDcsDecodeEnable=0;
-
- pChan->rxCarrierPoint = 17000;
- pChan->rxCarrierHyst = 2500;
-
- pChan->txHpfEnable=0;
- pChan->txLimiterEnable=0;
- pChan->txPreEmpEnable=0;
- pChan->txLpfEnable=1;
- pChan->txMixA=TX_OUT_VOICE;
- pChan->txMixB=TX_OUT_LSD;
- }
- else
- {
- pChan->rxDemod=tChan->rxDemod;
- pChan->rxCdType=tChan->rxCdType;
- pChan->rxSquelchPoint = tChan->rxSquelchPoint;
- pChan->rxCarrierHyst = 3000;
- pChan->rxSqVoxAdj=tChan->rxSqVoxAdj;
-
- pChan->txMod=tChan->txMod;
- pChan->txHpfEnable=1;
- pChan->txLpfEnable=1;
-
- pChan->pTxCodeDefault=tChan->pTxCodeDefault;
- pChan->pRxCodeSrc=tChan->pRxCodeSrc;
- pChan->pTxCodeSrc=tChan->pTxCodeSrc;
-
- pChan->txMixA=tChan->txMixA;
- pChan->txMixB=tChan->txMixB;
- pChan->radioDuplex=tChan->radioDuplex;
- pChan->area=tChan->area;
- pChan->rptnum=tChan->rptnum;
- pChan->idleinterval=tChan->idleinterval;
- pChan->turnoffs=tChan->turnoffs;
- pChan->b.rxpolarity=tChan->b.rxpolarity;
- pChan->b.txpolarity=tChan->b.txpolarity;
- pChan->b.dcsrxpolarity=tChan->b.dcsrxpolarity;
- pChan->b.dcstxpolarity=tChan->b.dcstxpolarity;
- pChan->b.lsdrxpolarity=tChan->b.lsdrxpolarity;
- pChan->b.lsdtxpolarity=tChan->b.lsdtxpolarity;
-
- pChan->txsettletime=tChan->txsettletime;
- pChan->tracelevel=tChan->tracelevel;
- pChan->tracetype=tChan->tracetype;
- pChan->ukey=tChan->ukey;
- pChan->name=tChan->name;
- }
-
-
- pChan->txHpfEnable=1;
- pChan->txLpfEnable=1;
-
- if(pChan->rxCdType==CD_XPMR_NOISE) pChan->rxNoiseSquelchEnable=1;
-
- if(pChan->rxDemod==RX_AUDIO_FLAT) pChan->rxDeEmpEnable=1;
-
- pChan->rxCarrierPoint=(pChan->rxSquelchPoint*32767)/100;
- pChan->rxCarrierHyst = 3000; //pChan->rxCarrierPoint/15;
-
- pChan->rxDcsDecodeEnable=0;
-
- if(pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable)
- {
- pChan->rxHpfEnable=1;
- pChan->rxCenterSlicerEnable=1;
- pChan->rxCtcssDecodeEnable=1;
- }
-
- if(pChan->txMod){
- pChan->txPreEmpEnable=1;
- pChan->txLimiterEnable=1;
- }
-
- pChan->dd.option=9;
- dedrift(pChan);
-
- TRACEF(1,("calloc buffers \n"));
-
- pChan->pRxDemod = calloc(numSamples,2);
- pChan->pRxNoise = calloc(numSamples,2);
- pChan->pRxBase = calloc(numSamples,2);
- pChan->pRxHpf = calloc(numSamples,2);
- pChan->pRxLsd = calloc(numSamples,2);
- pChan->pRxSpeaker = calloc(numSamples,2);
- pChan->pRxCtcss = calloc(numSamples,2);
- pChan->pRxDcTrack = calloc(numSamples,2);
- pChan->pRxLsdLimit = calloc(numSamples,2);
-
- pChan->pTxInput = calloc(numSamples,2);
- pChan->pTxBase = calloc(numSamples,2);
- pChan->pTxHpf = calloc(numSamples,2);
- pChan->pTxPreEmp = calloc(numSamples,2);
- pChan->pTxLimiter = calloc(numSamples,2);
- pChan->pTxLsd = calloc(numSamples,2);
- pChan->pTxLsdLpf = calloc(numSamples,2);
- pChan->pTxComposite = calloc(numSamples,2);
- pChan->pSigGen0 = calloc(numSamples,2);
- pChan->pSigGen1 = calloc(numSamples,2);
-
- pChan->prxMeasure = calloc(numSamples,2);
-
- pChan->pTxOut = calloc(numSamples,2*2*6); // output buffer
-
-#ifdef HAVE_XPMRX
- pChan->pLsdEnc = calloc(sizeof(t_encLsd),1);
-#endif
-
- #if XPMR_DEBUG0 == 1
- TRACEF(1,("configure tracing\n"));
-
- pChan->pTstTxOut = calloc(numSamples,2);
- pChan->pRxLsdCen = calloc(numSamples,2);
- pChan->prxDebug0 = calloc(numSamples,2);
- pChan->prxDebug1 = calloc(numSamples,2);
- pChan->prxDebug2 = calloc(numSamples,2);
- pChan->prxDebug3 = calloc(numSamples,2);
- pChan->ptxDebug0 = calloc(numSamples,2);
- pChan->ptxDebug1 = calloc(numSamples,2);
- pChan->ptxDebug2 = calloc(numSamples,2);
- pChan->ptxDebug3 = calloc(numSamples,2);
- pChan->pNull = calloc(numSamples,2);
-
- for(i=0;i<numSamples;i++)pChan->pNull[i]=((i%(numSamples/2))*8000)-4000;
-
- pChan->rxCtcss->pDebug0=calloc(numSamples,2);
- pChan->rxCtcss->pDebug1=calloc(numSamples,2);
- pChan->rxCtcss->pDebug2=calloc(numSamples,2);
- pChan->rxCtcss->pDebug3=calloc(numSamples,2);
-
- for(i=0;i<CTCSS_NUM_CODES;i++)
- {
- pChan->rxCtcss->tdet[i].pDebug0=calloc(numSamples,2);
- pChan->rxCtcss->tdet[i].pDebug1=calloc(numSamples,2);
- pChan->rxCtcss->tdet[i].pDebug2=calloc(numSamples,2);
- pChan->rxCtcss->tdet[i].pDebug3=calloc(numSamples,2);
- }
-
- // buffer, 2 bytes per sample, and 16 channels
- pChan->prxDebug=calloc(numSamples*16,2);
- pChan->ptxDebug=calloc(numSamples*16,2);
-
- // TSCOPE CONFIGURATION SETSCOPE configure debug traces and sources for each channel of the output
- pChan->sdbg = (t_sdbg *)calloc(sizeof(t_sdbg),1);
-
- for(i=0;i<XPMR_DEBUG_CHANS;i++)pChan->sdbg->trace[i]=-1;
-
- TRACEF(1,("pChan->tracetype = %i\n",pChan->tracetype));
-
- if(pChan->tracetype==1) // CTCSS DECODE
- {
- pChan->sdbg->source [0]=pChan->pRxDemod;
- pChan->sdbg->source [1]=pChan->pRxBase;
- pChan->sdbg->source [2]=pChan->pRxNoise;
- pChan->sdbg->trace [3]=RX_NOISE_TRIG;
- pChan->sdbg->source [4]=pChan->pRxLsd;
- pChan->sdbg->source [5]=pChan->pRxLsdCen;
- pChan->sdbg->source [6]=pChan->pRxLsdLimit;
- pChan->sdbg->source [7]=pChan->rxCtcss->tdet[3].pDebug0;
- pChan->sdbg->trace [8]=RX_CTCSS_DECODE;
- pChan->sdbg->trace [9]=RX_SMODE;
- }
- if(pChan->tracetype==2) // CTCSS DECODE
- {
- pChan->sdbg->source [0]=pChan->pRxDemod;
- pChan->sdbg->source [1]=pChan->pRxBase;
- pChan->sdbg->trace [2]=RX_NOISE_TRIG;
- pChan->sdbg->source [3]=pChan->pRxLsd;
- pChan->sdbg->source [4]=pChan->pRxLsdCen;
- pChan->sdbg->source [5]=pChan->pRxDcTrack;
- pChan->sdbg->source [6]=pChan->pRxLsdLimit;
- pChan->sdbg->source [7]=pChan->rxCtcss->tdet[3].pDebug0;
- pChan->sdbg->source [8]=pChan->rxCtcss->tdet[3].pDebug1;
- pChan->sdbg->source [9]=pChan->rxCtcss->tdet[3].pDebug2;
- pChan->sdbg->source [10]=pChan->rxCtcss->tdet[3].pDebug3;
- pChan->sdbg->trace [11]=RX_CTCSS_DECODE;
- pChan->sdbg->trace [12]=RX_SMODE;
- pChan->sdbg->trace [13]=TX_PTT_IN;
- pChan->sdbg->trace [14]=TX_PTT_OUT;
- pChan->sdbg->source [15]=pChan->pTxLsdLpf;
- }
- else if(pChan->tracetype==3) // DCS DECODE
- {
- pChan->sdbg->source [0]=pChan->pRxDemod;
- pChan->sdbg->source [1]=pChan->pRxBase;
- pChan->sdbg->trace [2]=RX_NOISE_TRIG;
- pChan->sdbg->source [3]=pChan->pRxLsd;
- pChan->sdbg->source [4]=pChan->pRxLsdCen;
- pChan->sdbg->source [5]=pChan->pRxDcTrack;
- pChan->sdbg->trace [6]=RX_DCS_CLK;
- pChan->sdbg->trace [7]=RX_DCS_DIN;
- pChan->sdbg->trace [8]=RX_DCS_DEC;
- pChan->sdbg->trace [9]=RX_SMODE;
- pChan->sdbg->trace [10]=TX_PTT_IN;
- pChan->sdbg->trace [11]=TX_PTT_OUT;
- pChan->sdbg->trace [12]=TX_LSD_CLK;
- pChan->sdbg->trace [13]=TX_LSD_DAT;
- pChan->sdbg->trace [14]=TX_LSD_GEN;
- pChan->sdbg->source [14]=pChan->pTxLsd;
- pChan->sdbg->source [15]=pChan->pTxLsdLpf;
- }
- else if(pChan->tracetype==4) // LSD DECODE
- {
- pChan->sdbg->source [0]=pChan->pRxDemod;
- pChan->sdbg->source [1]=pChan->pRxBase;
- pChan->sdbg->trace [2]=RX_NOISE_TRIG;
- pChan->sdbg->source [3]=pChan->pRxLsd;
- pChan->sdbg->source [4]=pChan->pRxLsdCen;
- pChan->sdbg->source [5]=pChan->pRxDcTrack;
- pChan->sdbg->trace [6]=RX_LSD_CLK;
- pChan->sdbg->trace [7]=RX_LSD_DAT;
- pChan->sdbg->trace [8]=RX_LSD_ERR;
- pChan->sdbg->trace [9]=RX_LSD_SYNC;
- pChan->sdbg->trace [10]=RX_SMODE;
- pChan->sdbg->trace [11]=TX_PTT_IN;
- pChan->sdbg->trace [12]=TX_PTT_OUT;
- pChan->sdbg->trace [13]=TX_LSD_CLK;
- pChan->sdbg->trace [14]=TX_LSD_DAT;
- //pChan->sdbg->trace [14]=TX_LSD_GEN;
- //pChan->sdbg->source [14]=pChan->pTxLsd;
- pChan->sdbg->source [15]=pChan->pTxLsdLpf;
- }
- else if(pChan->tracetype==5) // LSD LOGIC
- {
- pChan->sdbg->source [0]=pChan->pRxBase;
- pChan->sdbg->trace [1]=RX_NOISE_TRIG;
- pChan->sdbg->source [2]=pChan->pRxDcTrack;
- pChan->sdbg->trace [3]=RX_LSD_SYNC;
- pChan->sdbg->trace [4]=RX_SMODE;
- pChan->sdbg->trace [5]=TX_PTT_IN;
- pChan->sdbg->trace [6]=TX_PTT_OUT;
- pChan->sdbg->source [7]=pChan->pTxLsdLpf;
- }
- else if(pChan->tracetype==6)
- {
- // tx clock skew and jitter buffer
- pChan->sdbg->source [0]=pChan->pRxDemod;
- pChan->sdbg->source [5]=pChan->pTxBase;
- pChan->sdbg->trace [6]=TX_DEDRIFT_LEAD;
- pChan->sdbg->trace [7]=TX_DEDRIFT_ERR;
- pChan->sdbg->trace [8]=TX_DEDRIFT_FACTOR;
- pChan->sdbg->trace [9]=TX_DEDRIFT_DRIFT;
- }
- else if(pChan->tracetype==7)
- {
- // tx path
- pChan->sdbg->source [0]=pChan->pRxBase;
- pChan->sdbg->trace [1]=RX_NOISE_TRIG;
- pChan->sdbg->source [2]=pChan->pRxLsd;
- pChan->sdbg->trace [3]=RX_CTCSS_DECODE;
- pChan->sdbg->source [4]=pChan->pRxHpf;
-
- pChan->sdbg->trace [5]=TX_PTT_IN;
- pChan->sdbg->trace [6]=TX_PTT_OUT;
-
- pChan->sdbg->source [7]=pChan->pTxBase;
- pChan->sdbg->source [8]=pChan->pTxHpf;
- pChan->sdbg->source [9]=pChan->pTxPreEmp;
- pChan->sdbg->source [10]=pChan->pTxLimiter;
- pChan->sdbg->source [11]=pChan->pTxComposite;
- pChan->sdbg->source [12]=pChan->pTxLsdLpf;
- }
-
- for(i=0;i<XPMR_DEBUG_CHANS;i++){
- if(pChan->sdbg->trace[i]>=0)pChan->sdbg->point[pChan->sdbg->trace[i]]=i;
- }
- pChan->sdbg->mode=1;
- #endif
-
- #ifdef XPMRX_H
- // LSD GENERATOR
- pSps=pChan->spsLsdGen=createPmrSps(pChan);
- pSps->source=NULL;
- pSps->sink=pChan->pTxLsd;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->sigProc=LsdGen;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->outputGain=(.25*M_Q8);
- pSps->option=0;
- pSps->interpolate=1;
- pSps->decimate=1;
- pSps->enabled=0;
- #endif
-
- // General Purpose Function Generator
- pSps=pChan->spsSigGen1=createPmrSps(pChan);
- pSps->sink=pChan->pSigGen1;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->sigProc=SigGen;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->sampleRate=SAMPLE_RATE_NETWORK;
- pSps->freq=10000; // in increments of 0.1 Hz
- pSps->outputGain=(.25*M_Q8);
- pSps->option=0;
- pSps->interpolate=1;
- pSps->decimate=1;
- pSps->enabled=0;
-
-
- // CTCSS ENCODER
- pSps = pChan->spsSigGen0 = createPmrSps(pChan);
- pSps->sink=pChan->pTxLsd;
- pSps->sigProc=SigGen;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->sampleRate=SAMPLE_RATE_NETWORK;
- pSps->freq=1000; // in 0.1 Hz steps
- pSps->outputGain=(0.5*M_Q8);
- pSps->option=0;
- pSps->interpolate=1;
- pSps->decimate=1;
- pSps->enabled=0;
-
- // Tx LSD Low Pass Filter
- pSps=pChan->spsTxLsdLpf=createPmrSps(pChan);
- pSps->source=pChan->pTxLsd;
- pSps->sink=pChan->pTxLsdLpf;
- pSps->sigProc=pmr_gp_fir;
- pSps->enabled=0;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->decimator=pSps->decimate=1;
- pSps->interpolate=1;
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
-
- // configure the longer, lower cutoff filter by default
- pSps->ncoef=taps_fir_lpf_215_9_88;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_215_9_88;
- pSps->nx=taps_fir_lpf_215_9_88;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_215_9_88;
-
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
-
- TRACEF(1,("spsTxLsdLpf = sps \n"));
-
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-
-
- // RX Process
- TRACEF(1,("create rx\n"));
- pSps = NULL;
-
- // allocate space for first sps and set pointers
- pSps=pChan->spsRx=createPmrSps(pChan);
- pSps->source=NULL; //set when called
- pSps->sink=pChan->pRxBase;
- pSps->sigProc=pmr_rx_frontend;
- pSps->enabled=1;
- pSps->decimator=pSps->decimate=6;
- pSps->interpolate=1;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->ncoef=taps_fir_bpf_noise_1;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_3K_1;
- pSps->coef2=(void*)coef_fir_bpf_noise_1;
- pSps->nx=taps_fir_bpf_noise_1;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_coef));
- pSps->calcAdjust=(gain_fir_lpf_3K_1*256)/0x0100;
- pSps->outputGain=(1.0*M_Q8);
- pSps->discfactor=2;
- pSps->hyst=pChan->rxCarrierHyst;
- pSps->setpt=pChan->rxCarrierPoint;
- pChan->prxSquelchAdjust=&pSps->setpt;
- #if XPMR_DEBUG0 == 1
- pSps->debugBuff0=pChan->pRxDemod;
- pSps->debugBuff1=pChan->pRxNoise;
- pSps->debugBuff2=pChan->prxDebug0;
- #endif
-
-
- // allocate space for next sps and set pointers
- // Rx SubAudible Decoder Low Pass Filter
- pSps=pChan->spsRxLsd=pSps->nextSps=createPmrSps(pChan);
- pSps->source=pChan->pRxBase;
- pSps->sink=pChan->pRxLsd;
- pSps->sigProc=pmr_gp_fir;
- pSps->enabled=1;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->decimator=pSps->decimate=1;
- pSps->interpolate=1;
-
- // configure the the larger, lower cutoff filter by default
- pSps->ncoef=taps_fir_lpf_215_9_88;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_215_9_88;
- pSps->nx=taps_fir_lpf_215_9_88;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_215_9_88;
-
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- pChan->prxCtcssMeasure=pSps->sink;
- pChan->prxCtcssAdjust=&(pSps->outputGain);
-
- // CTCSS CenterSlicer
- pSps=pChan->spsRxLsdNrz=pSps->nextSps=createPmrSps(pChan);
- pSps->source=pChan->pRxLsd;
- pSps->sink=pChan->pRxDcTrack;
- pSps->buff=pChan->pRxLsdLimit;
- pSps->sigProc=CenterSlicer;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->discfactor=LSD_DFS; // centering time constant
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- pSps->setpt=4900; // ptp clamp for DC centering
- pSps->inputGainB=625; // peak output limiter clip point
- pSps->enabled=0;
-
-
- // Rx HPF
- pSps=pSps->nextSps=createPmrSps(pChan);
- pChan->spsRxHpf=pSps;
- pSps->source=pChan->pRxBase;
- pSps->sink=pChan->pRxHpf;
- pSps->sigProc=pmr_gp_fir;
- pSps->enabled=1;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->decimator=pSps->decimate=1;
- pSps->interpolate=1;
- pSps->ncoef=taps_fir_hpf_300_9_66;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_hpf_300_9_66;
- pSps->nx=taps_fir_hpf_300_9_66;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
- pSps->calcAdjust=gain_fir_hpf_300_9_66;
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- pChan->prxVoiceAdjust=&(pSps->outputGain);
- pChan->spsRxOut=pSps;
-
- // allocate space for next sps and set pointers
- // Rx DeEmp
- if(pChan->rxDeEmpEnable){
- pSps=pSps->nextSps=createPmrSps(pChan);
- pChan->spsRxDeEmp=pSps;
- pSps->source=pChan->pRxHpf;
- pSps->sink=pChan->pRxSpeaker;
- pChan->spsRxOut=pSps; // OUTPUT STRUCTURE!
- pSps->sigProc=gp_inte_00;
- pSps->enabled=1;
- pSps->nSamples=pChan->nSamplesRx;
-
- pSps->ncoef=taps_int_lpf_300_1_2;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_int_lpf_300_1_2;
-
- pSps->nx=taps_int_lpf_300_1_2;
- pSps->size_x=4;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
- pSps->calcAdjust=gain_int_lpf_300_1_2/2;
- pSps->inputGain=(1.0*M_Q8);
- pSps->outputGain=(1.0*M_Q8);
- pChan->prxVoiceMeasure=pSps->sink;
- pChan->prxVoiceAdjust=&(pSps->outputGain);
- }
-
- if(pChan->rxDelayLineEnable)
- {
- TRACEF(1,("create delayline\n"));
- pSps=pChan->spsDelayLine=pSps->nextSps=createPmrSps(pChan);
- pSps->sigProc=DelayLine;
- pSps->source=pChan->pRxSpeaker;
- pSps->sink=pChan->pRxSpeaker;
- pSps->enabled=0;
- pSps->inputGain=1*M_Q8;
- pSps->outputGain=1*M_Q8;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->buffSize=4096;
- pSps->buff=calloc(4096,2); // one second maximum
- pSps->buffLead = (SAMPLE_RATE_NETWORK*0.100);
- pSps->buffOutIndex=0;
- }
-
- if(pChan->rxCdType==CD_XPMR_VOX)
- {
- TRACEF(1,("create vox measureblock\n"));
- pChan->prxVoxMeas=calloc(pChan->nSamplesRx,2);
-
- pSps=pChan->spsRxVox=pSps->nextSps=createPmrSps(pChan);
- pSps->sigProc=MeasureBlock;
- pSps->parentChan=pChan;
- pSps->source=pChan->pRxBase;
- pSps->sink=pChan->prxVoxMeas;
- pSps->inputGain=1*M_Q8;
- pSps->outputGain=1*M_Q8;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->discfactor=3;
- if(pChan->rxSqVoxAdj==0)
- pSps->setpt=(0.011*M_Q15);
- else
- pSps->setpt=(pChan->rxSqVoxAdj);
- pSps->hyst=(pSps->setpt/10);
- pSps->enabled=1;
- }
-
- // tuning measure block
- pSps=pChan->spsMeasure=pSps->nextSps=createPmrSps(pChan);
- pSps->source=pChan->spsRx->sink;
- pSps->sink=pChan->prxMeasure;
- pSps->sigProc=MeasureBlock;
- pSps->enabled=0;
- pSps->nSamples=pChan->nSamplesRx;
- pSps->discfactor=10;
-
- pSps->nextSps=NULL; // last sps in chain RX
-
-
- // CREATE TRANSMIT CHAIN
- TRACEF(1,("create tx\n"));
- inputTmp=NULL;
- pSps = NULL;
-
- // allocate space for first sps and set pointers
-
- // Tx HPF SubAudible
- if(pChan->txHpfEnable)
- {
- pSps=createPmrSps(pChan);
- pChan->spsTx=pSps;
- pSps->source=pChan->pTxBase;
- pSps->sink=pChan->pTxHpf;
- pSps->sigProc=pmr_gp_fir;
- pSps->enabled=1;
- pSps->numChanOut=1;
- pSps->selChanOut=0;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->decimator=pSps->decimate=1;
- pSps->interpolate=1;
- pSps->ncoef=taps_fir_hpf_300_9_66;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_hpf_300_9_66;
- pSps->nx=taps_fir_hpf_300_9_66;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
- pSps->calcAdjust=gain_fir_hpf_300_9_66;
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- inputTmp=pChan->pTxHpf;
- }
-
- // Tx PreEmphasis
- if(pChan->txPreEmpEnable)
- {
- if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
- else pSps=pSps->nextSps=createPmrSps(pChan);
-
- pSps->source=inputTmp;
- pSps->sink=pChan->pTxPreEmp;
-
- pSps->sigProc=gp_diff;
- pSps->enabled=1;
- pSps->nSamples=pChan->nSamplesTx;
-
- pSps->ncoef=taps_int_hpf_4000_1_2;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_int_hpf_4000_1_2;
-
- pSps->nx=taps_int_hpf_4000_1_2;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-
- pSps->calcAdjust=gain_int_hpf_4000_1_2;
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8); // to match flat at 1KHz
- inputTmp=pSps->sink;
- }
-
- // Tx Limiter
- if(pChan->txLimiterEnable)
- {
- if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
- else pSps=pSps->nextSps=createPmrSps(pChan);
- pSps->source=inputTmp;
- pSps->sink=pChan->pTxLimiter;
- pSps->sigProc=SoftLimiter;
- pSps->enabled=1;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- pSps->setpt=12000;
- inputTmp=pSps->sink;
- }
-
- // Composite Mix of Voice and LSD
- if((pChan->txMixA==TX_OUT_COMPOSITE)||(pChan->txMixB==TX_OUT_COMPOSITE))
- {
- if(pSps==NULL)
- pSps=pChan->spsTx=createPmrSps(pChan);
- else
- pSps=pSps->nextSps=createPmrSps(pChan);
- pSps->source=inputTmp;
- pSps->sourceB=pChan->pTxLsdLpf; //asdf ??? !!! maw pTxLsdLpf
- pSps->sink=pChan->pTxComposite;
- pSps->sigProc=pmrMixer;
- pSps->enabled=1;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->inputGain=2*M_Q8;
- pSps->inputGainB=1*M_Q8/8;
- pSps->outputGain=1*M_Q8;
- pSps->setpt=0;
- inputTmp=pSps->sink;
- pChan->ptxCtcssAdjust=&pSps->inputGainB;
- }
-
- // Chan A Upsampler and Filter
- if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
- else pSps=pSps->nextSps=createPmrSps(pChan);
-
- pChan->spsTxOutA=pSps;
- if(!pChan->spsTx)pChan->spsTx=pSps;
-
- if(pChan->txMixA==TX_OUT_COMPOSITE)
- {
- pSps->source=pChan->pTxComposite;
- }
- else if(pChan->txMixA==TX_OUT_LSD)
- {
- pSps->source=pChan->pTxLsdLpf;
- }
- else if(pChan->txMixA==TX_OUT_VOICE)
- {
- pSps->source=pChan->pTxHpf;
- }
- else if (pChan->txMixA==TX_OUT_AUX)
- {
- pSps->source=inputTmp;
- }
- else
- {
- pSps->source=NULL; // maw sph asdf !!! no blow up
- pSps->source=inputTmp;
- }
-
- pSps->sink=pChan->pTxOut;
- pSps->sigProc=pmr_gp_fir;
- pSps->enabled=1;
- pSps->numChanOut=2;
- pSps->selChanOut=0;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->interpolate=6;
- pSps->ncoef=taps_fir_lpf_3K_1;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_3K_1;
- pSps->nx=taps_fir_lpf_3K_1;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
- pSps->calcAdjust=gain_fir_lpf_3K_1;
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- if(pChan->txMixA==pChan->txMixB)pSps->monoOut=1;
- else pSps->monoOut=0;
-
-
- // Chan B Upsampler and Filter
- if((pChan->txMixA!=pChan->txMixB)&&(pChan->txMixB!=TX_OUT_OFF))
- {
- if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
- else pSps=pSps->nextSps=createPmrSps(pChan);
-
- pChan->spsTxOutB=pSps;
- if(pChan->txMixB==TX_OUT_COMPOSITE)
- {
- pSps->source=pChan->pTxComposite;
- }
- else if(pChan->txMixB==TX_OUT_LSD)
- {
- pSps->source=pChan->pTxLsdLpf;
- // pChan->ptxCtcssAdjust=&pSps->inputGain;
- }
- else if(pChan->txMixB==TX_OUT_VOICE)
- {
- pSps->source=inputTmp;
- }
- else if(pChan->txMixB==TX_OUT_AUX)
- {
- pSps->source=pChan->pTxHpf;
- }
- else
- {
- pSps->source=NULL;
- }
-
- pSps->sink=pChan->pTxOut;
- pSps->sigProc=pmr_gp_fir;
- pSps->enabled=1;
- pSps->numChanOut=2;
- pSps->selChanOut=1;
- pSps->mixOut=0;
- pSps->nSamples=pChan->nSamplesTx;
- pSps->interpolate=6;
- pSps->ncoef=taps_fir_lpf_3K_1;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_3K_1;
- pSps->nx=taps_fir_lpf_3K_1;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
- pSps->calcAdjust=(gain_fir_lpf_3K_1);
- pSps->inputGain=(1*M_Q8);
- pSps->outputGain=(1*M_Q8);
- }
-
- pSps->nextSps=NULL;
-
- // Configure Coded Signaling
- code_string_parse(pChan);
-
- pChan->smode=SMODE_NULL;
- pChan->smodewas=SMODE_NULL;
- pChan->smodetime=2500;
- pChan->smodetimer=0;
- pChan->b.smodeturnoff=0;
-
- pChan->txsettletimer=0;
-
- TRACEF(1,("createPmrChannel() end\n"));
-
- return pChan;
-}
-/*
-*/
-i16 destroyPmrChannel(t_pmr_chan *pChan)
-{
- #if XPMR_DEBUG0 == 1
- i16 i;
- #endif
- t_pmr_sps *pmr_sps, *tmp_sps;
-
- TRACEF(1,("destroyPmrChannel()\n"));
-
- free(pChan->pRxDemod);
- free(pChan->pRxNoise);
- free(pChan->pRxBase);
- free(pChan->pRxHpf);
- free(pChan->pRxLsd);
- free(pChan->pRxSpeaker);
- free(pChan->pRxDcTrack);
- if(pChan->pRxLsdLimit)free(pChan->pRxLsdLimit);
- free(pChan->pTxBase);
- free(pChan->pTxHpf);
- free(pChan->pTxPreEmp);
- free(pChan->pTxLimiter);
- free(pChan->pTxLsd);
- free(pChan->pTxLsdLpf);
- if(pChan->pTxComposite)free(pChan->pTxComposite);
- free(pChan->pTxOut);
-
- if(pChan->prxMeasure)free(pChan->prxMeasure);
- if(pChan->pSigGen0)free(pChan->pSigGen0);
- if(pChan->pSigGen1)free(pChan->pSigGen1);
-
-
- #if XPMR_DEBUG0 == 1
- //if(pChan->prxDebug)free(pChan->prxDebug);
- if(pChan->ptxDebug)free(pChan->ptxDebug);
- free(pChan->prxDebug0);
- free(pChan->prxDebug1);
- free(pChan->prxDebug2);
- free(pChan->prxDebug3);
-
- free(pChan->ptxDebug0);
- free(pChan->ptxDebug1);
- free(pChan->ptxDebug2);
- free(pChan->ptxDebug3);
-
- free(pChan->rxCtcss->pDebug0);
- free(pChan->rxCtcss->pDebug1);
-
- for(i=0;i<CTCSS_NUM_CODES;i++)
- {
- free(pChan->rxCtcss->tdet[i].pDebug0);
- free(pChan->rxCtcss->tdet[i].pDebug1);
- free(pChan->rxCtcss->tdet[i].pDebug2);
- free(pChan->rxCtcss->tdet[i].pDebug3);
- }
- #endif
-
- pChan->dd.option=8;
- dedrift(pChan);
-
- free(pChan->pRxCtcss);
-
- pmr_sps=pChan->spsRx;
-
- if(pChan->sdbg)free(pChan->sdbg);
-
- while(pmr_sps)
- {
- tmp_sps = pmr_sps;
- pmr_sps = tmp_sps->nextSps;
- destroyPmrSps(tmp_sps);
- }
-
- free(pChan);
-
- return 0;
-}
-/*
-*/
-t_pmr_sps *createPmrSps(t_pmr_chan *pChan)
-{
- t_pmr_sps *pSps;
-
- TRACEF(1,("createPmrSps()\n"));
-
- pSps = (t_pmr_sps *)calloc(sizeof(t_pmr_sps),1);
-
- if(!pSps)printf("Error: createPmrSps()\n");
-
- pSps->parentChan=pChan;
- pSps->index=pChan->spsIndex++;
-
- // pSps->x=calloc(pSps->nx,pSps->size_x);
-
- return pSps;
-}
-/*
-*/
-i16 destroyPmrSps(t_pmr_sps *pSps)
-{
- TRACEJ(1,("destroyPmrSps(%i)\n",pSps->index));
-
- if(pSps->x!=NULL)free(pSps->x);
- free(pSps);
- return 0;
-}
-/*
- PmrTx - takes data from network and holds it for PmrRx
-*/
-i16 PmrTx(t_pmr_chan *pChan, i16 *input)
-{
- pChan->frameCountTx++;
-
- TRACEF(5,("PmrTx() start %i\n",pChan->frameCountTx));
-
- #if XPMR_PPTP == 99
- pptp_p2^=1;
- if(pptp_p2)ioctl(ppdrvdev,PPDRV_IOC_PINSET,LP_PIN02);
- else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,LP_PIN02);
- #endif
-
- if(pChan==NULL){
- printf("PmrTx() pChan == NULL\n");
- return 1;
- }
-
- #if XPMR_DEBUG0 == 1
- if(pChan->b.rxCapture && pChan->tracetype==5)
- {
- memcpy(pChan->pTxInput,input,pChan->nSamplesRx*2);
- }
- #endif
-
- //if(pChan->b.radioactive)pChan->dd.debug=1;
- //else pChan->dd.debug=0;
-
- dedrift_write(pChan,input);
-
- return 0;
-}
-/*
- PmrRx handles a block of data from the usb audio device
-*/
-i16 PmrRx(t_pmr_chan *pChan, i16 *input, i16 *outputrx, i16 *outputtx)
-{
- int i,hit;
- float f=0;
- t_pmr_sps *pmr_sps;
-
- TRACEC(5,("PmrRx(%p %p %p %p)\n",pChan, input, outputrx, outputtx));
-
- #if XPMR_PPTP == 1
- if(pChan->b.radioactive)
- {
- pptp_write(1,pChan->frameCountRx&0x00000001);
- }
- #endif
-
- if(pChan==NULL){
- printf("PmrRx() pChan == NULL\n");
- return 1;
- }
-
- pChan->frameCountRx++;
-
- #if XPMR_DEBUG0 == 1
- if(pChan->b.rxCapture)
- {
- //if(pChan->prxDebug)memset((void *)pChan->prxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2);
- if(pChan->ptxDebug)memset((void *)pChan->ptxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2);
- if(pChan->sdbg->buffer)
- {
- memset((void *)pChan->sdbg->buffer,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2);
- pChan->prxDebug=pChan->sdbg->buffer;
- }
- }
- #endif
-
- pmr_sps=pChan->spsRx; // first sps
- pmr_sps->source=input;
-
- if(outputrx!=NULL)pChan->spsRxOut->sink=outputrx; //last sps
-
- #if 0
- if(pChan->inputBlanking>0)
- {
- pChan->inputBlanking-=pChan->nSamplesRx;
- if(pChan->inputBlanking<0)pChan->inputBlanking=0;
- for(i=0;i<pChan->nSamplesRx*6;i++)
- input[i]=0;
- }
- #endif
-
- if( pChan->rxCpuSaver && !pChan->rxCarrierDetect &&
- pChan->smode==SMODE_NULL &&
- !pChan->txPttIn && !pChan->txPttOut)
- {
- if(!pChan->b.rxhalted)
- {
- if(pChan->spsRxHpf)pChan->spsRxHpf->enabled=0;
- if(pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=0;
- pChan->b.rxhalted=1;
- TRACEC(1,("PmrRx() rx sps halted\n"));
- }
- }
- else if(pChan->b.rxhalted)
- {
- if(pChan->spsRxHpf)pChan->spsRxHpf->enabled=1;
- if(pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=1;
- pChan->b.rxhalted=0;
- TRACEC(1,("PmrRx() rx sps un-halted\n"));
- }
-
- i=0;
- while(pmr_sps!=NULL && pmr_sps!=0)
- {
- TRACEC(5,("PmrRx() sps %i\n",i++));
- pmr_sps->sigProc(pmr_sps);
- pmr_sps = (t_pmr_sps *)(pmr_sps->nextSps);
- //pmr_sps=NULL; // sph maw
- }
-
- #define XPMR_VOX_HANGTIME 2000
-
- if(pChan->rxCdType==CD_XPMR_VOX)
- {
- if(pChan->spsRxVox->compOut)
- {
- pChan->rxVoxTimer=XPMR_VOX_HANGTIME; //VOX HangTime in ms
- }
- if(pChan->rxVoxTimer>0)
- {
- pChan->rxVoxTimer-=MS_PER_FRAME;
- pChan->rxCarrierDetect=1;
- }
- else
- {
- pChan->rxVoxTimer=0;
- pChan->rxCarrierDetect=0;
- }
- }
- else
- {
- pChan->rxCarrierDetect=!pChan->spsRx->compOut;
- }
-
- // stop and start these engines instead to eliminate falsing
- if( pChan->b.ctcssRxEnable &&
- ( (!pChan->b.rxhalted ||
- pChan->rxCtcss->decode!=CTCSS_NULL || pChan->smode==SMODE_CTCSS) &&
- (pChan->smode!=SMODE_DCS&&pChan->smode!=SMODE_LSD) )
- )
- {
- ctcss_detect(pChan);
- }
-
- #if 1
- if(pChan->txPttIn!=pChan->b.pttwas)
- {
- pChan->b.pttwas=pChan->txPttIn;
- TRACEC(1,("PmrRx() txPttIn=%i\n",pChan->b.pttwas));
- }
- #endif
-
- #ifdef XPMRX_H
- xpmrx(pChan,XXO_RXDECODE);
- #endif
-
- if(pChan->smodetimer>0 && !pChan->txPttIn)
- {
- pChan->smodetimer-=MS_PER_FRAME;
-
- if(pChan->smodetimer<=0)
- {
- pChan->smodetimer=0;
- pChan->smodewas=pChan->smode;
- pChan->smode=SMODE_NULL;
- pChan->b.smodeturnoff=1;
- TRACEC(1,("smode timeout. smode was=%i\n",pChan->smodewas));
- }
- }
-
- if(pChan->rxCtcss->decode > CTCSS_NULL &&
- (pChan->smode==SMODE_NULL||pChan->smode==SMODE_CTCSS) )
- {
- if(pChan->smode!=SMODE_CTCSS)
- {
- TRACEC(1,("smode set=%i code=%i\n",pChan->smode,pChan->rxCtcss->decode));
- pChan->smode=pChan->smodewas=SMODE_CTCSS;
- }
- pChan->smodetimer=pChan->smodetime;
- }
-
- #ifdef HAVE_XPMRX
- xpmrx(pChan,XXO_LSDCTL);
- #endif
-
- //TRACEX(("PmrRx() tx portion.\n"));
-
- // handle radio transmitter ptt input
- hit=0;
- if( !(pChan->smode==SMODE_DCS||pChan->smode==SMODE_LSD) )
- {
-
- if( pChan->txPttIn && pChan->txState==CHAN_TXSTATE_IDLE )
- {
- TRACEC(1,("txPttIn==1 from CHAN_TXSTATE_IDLE && !SMODE_LSD. codeindex=%i %i \n",pChan->rxCtcss->decode, pChan->rxCtcssMap[pChan->rxCtcss->decode] ));
- pChan->dd.b.doitnow=1;
-
- if(pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit)
- {
- if(pChan->rxCtcss->decode>CTCSS_NULL)
- {
- if(pChan->rxCtcssMap[pChan->rxCtcss->decode]!=CTCSS_RXONLY)
- {
- f=freq_ctcss[pChan->rxCtcssMap[pChan->rxCtcss->decode]];
- }
- }
- else
- {
- f=pChan->txctcssdefault_value;
- }
- TRACEC(1,("txPttIn - Start CTCSSGen %f \n",f));
- if(f)
- {
- t_pmr_sps *pSps;
-
- pChan->spsSigGen0->freq=f*10;
- pSps=pChan->spsTxLsdLpf;
- pSps->enabled=1;
-
- #if 0
- if(f>203.0)
- {
- pSps->ncoef=taps_fir_lpf_250_9_66;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_250_9_66;
- pSps->nx=taps_fir_lpf_250_9_66;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_250_9_66;
- }
- else
- {
- pSps->ncoef=taps_fir_lpf_215_9_88;
- pSps->size_coef=2;
- pSps->coef=(void*)coef_fir_lpf_215_9_88;
- pSps->nx=taps_fir_lpf_215_9_88;
- pSps->size_x=2;
- pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
- pSps->calcAdjust=gain_fir_lpf_215_9_88;
- }
- #endif
-
- pChan->spsSigGen0->option=1;
- pChan->spsSigGen0->enabled=1;
- pChan->spsSigGen0->discounterl=0;
- }
- }
- else if(pChan->smode==SMODE_NULL && pChan->txcodedefaultsmode==SMODE_CTCSS && !pChan->b.txCtcssInhibit)
- {
- TRACEC(1,("txPtt Encode txcodedefaultsmode==SMODE_CTCSS %f\n",pChan->txctcssdefault_value));
- pChan->spsSigGen0->freq=pChan->txctcssdefault_value*10;
- pChan->spsSigGen0->option=1;
- pChan->spsSigGen0->enabled=1;
- pChan->spsSigGen0->discounterl=0;
- pChan->smode=SMODE_CTCSS;
- pChan->smodetimer=pChan->smodetime;
- }
- else if(pChan->txcodedefaultsmode==SMODE_NULL||pChan->b.txCtcssInhibit)
- {
- TRACEC(1,("txPtt Encode txcodedefaultsmode==SMODE_NULL\n"));
- }
- else
- {
- printf ("ERROR: txPttIn=%i NOT HANDLED PROPERLY.\n",pChan->txPttIn);
- TRACEC(1,("ERROR: txPttIn=%i NOT HANDLED PROPERLY.\n",pChan->txPttIn));
- }
-
- pChan->txState = CHAN_TXSTATE_ACTIVE;
- pChan->txPttOut=1;
-
- pChan->txsettletimer=pChan->txsettletime;
-
- if(pChan->spsTxOutA)pChan->spsTxOutA->enabled=1;
- if(pChan->spsTxOutB)pChan->spsTxOutB->enabled=1;
- if(pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->enabled=1;
- if(pChan->txfreq)pChan->b.reprog=1;
- TRACEC(1,("PmrRx() TxOn\n"));
- }
- else if(pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE)
- {
- // pChan->smode=SMODE_CTCSS;
- pChan->smodetimer=pChan->smodetime;
- }
- else if(!pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE)
- {
- TRACEC(1,("txPttIn==0 from CHAN_TXSTATE_ACTIVE\n"));
- if(pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit)
- {
- if( pChan->txTocType==TOC_NONE || !pChan->b.ctcssTxEnable )
- {
- TRACEC(1,("Tx Off Immediate.\n"));
- pChan->spsSigGen0->option=3;
- pChan->txBufferClear=3;
- pChan->txState=CHAN_TXSTATE_FINISHING;
- }
- else if(pChan->txTocType==TOC_NOTONE)
- {
- pChan->txState=CHAN_TXSTATE_TOC;
- pChan->txHangTime=TOC_NOTONE_TIME/MS_PER_FRAME;
- pChan->spsSigGen0->option=3;
- TRACEC(1,("Tx Turn Off No Tone Start.\n"));
- }
- else
- {
- pChan->txState=CHAN_TXSTATE_TOC;
- pChan->txHangTime=0;
- pChan->spsSigGen0->option=2;
- TRACEC(1,("Tx Turn Off Phase Shift Start.\n"));
- }
- }
- else
- {
- pChan->txBufferClear=3;
- pChan->txState=CHAN_TXSTATE_FINISHING;
- TRACEC(1,("Tx Off No SMODE to Finish.\n"));
- }
- }
- else if(pChan->txState==CHAN_TXSTATE_TOC)
- {
- if( pChan->txPttIn && pChan->smode==SMODE_CTCSS )
- {
- TRACEC(1,("Tx Key During HangTime\n"));
- pChan->txState = CHAN_TXSTATE_ACTIVE;
- pChan->spsSigGen0->option=1;
- pChan->spsSigGen0->enabled=1;
- pChan->spsSigGen0->discounterl=0;
- hit=0;
- }
- else if(pChan->txHangTime)
- {
- if(--pChan->txHangTime==0)pChan->txState=CHAN_TXSTATE_FINISHING;
- }
- else if(pChan->txHangTime<=0 && pChan->spsSigGen0->state==0)
- {
- pChan->txBufferClear=3;
- pChan->txState=CHAN_TXSTATE_FINISHING;
- TRACEC(1,("Tx Off TOC.\n"));
- }
- }
- else if(pChan->txState==CHAN_TXSTATE_FINISHING)
- {
- if(--pChan->txBufferClear<=0)
- pChan->txState=CHAN_TXSTATE_COMPLETE;
- }
- else if(pChan->txState==CHAN_TXSTATE_COMPLETE)
- {
- hit=1;
- }
- } // end of if SMODE==LSD
-
- if(hit)
- {
- pChan->txPttOut=0;
- pChan->spsSigGen0->option=3;
- pChan->txState=CHAN_TXSTATE_IDLE;
- if(pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->option=3;
- if(pChan->spsTxOutA)pChan->spsTxOutA->option=3;
- if(pChan->spsTxOutB)pChan->spsTxOutB->option=3;
- if(pChan->rxfreq||pChan->txfreq)pChan->b.reprog=1;
- TRACEC(1,("Tx Off hit.\n"));
- }
-
- if(pChan->b.reprog)
- {
- pChan->b.reprog=0;
- progdtx(pChan);
- }
-
- if(pChan->txsettletimer && pChan->txPttHid )
- {
- pChan->txsettletimer-=MS_PER_FRAME;
- if(pChan->txsettletimer<0)pChan->txsettletimer=0;
- }
-
- // enable this after we know everything else is working
- if( pChan->txCpuSaver &&
- !pChan->txPttIn && !pChan->txPttOut &&
- pChan->txState==CHAN_TXSTATE_IDLE &&
- !pChan->dd.b.doitnow
- )
- {
- if(!pChan->b.txhalted)
- {
- pChan->b.txhalted=1;
- TRACEC(1,("PmrRx() tx sps halted\n"));
- }
- }
- else if(pChan->b.txhalted)
- {
- pChan->dd.b.doitnow=1;
- pChan->b.txhalted=0;
- TRACEC(1,("PmrRx() tx sps un-halted\n"));
- }
-
- if(pChan->b.txhalted)return(1);
-
- if(pChan->b.startSpecialTone)
- {
- pChan->b.startSpecialTone=0;
- pChan->spsSigGen1->option=1;
- pChan->spsSigGen1->enabled=1;
- pChan->b.doingSpecialTone=1;
- }
- else if(pChan->b.stopSpecialTone)
- {
- pChan->b.stopSpecialTone=0;
- pChan->spsSigGen1->option=0;
- pChan->b.doingSpecialTone=0;
- pChan->spsSigGen1->enabled=0;
- }
- else if(pChan->b.doingSpecialTone)
- {
- pChan->spsSigGen1->sink=outputtx;
- pChan->spsSigGen1->sigProc(pChan->spsSigGen1);
- for(i=0;i<(pChan->nSamplesTx*2*6);i+=2)outputtx[i+1]=outputtx[i];
- return 0;
- }
-
- if(pChan->spsSigGen0 && pChan->spsSigGen0->enabled )
- {
- pChan->spsSigGen0->sigProc(pChan->spsSigGen0);
- }
-
- if(pChan->spsSigGen1 && pChan->spsSigGen1->enabled)
- {
- pChan->spsSigGen1->sigProc(pChan->spsSigGen1);
- }
-
- #ifdef XPMRX_H
- pChan->spsLsdGen->sigProc(pChan->spsLsdGen); // maw sph ???
- #endif
-
- // Do Low Speed Data Low Pass Filter
- pChan->spsTxLsdLpf->sigProc(pChan->spsTxLsdLpf);
-
- // Do Voice
- pmr_sps=pChan->spsTx;
-
- // get tx data from de-drift process
- pChan->dd.option=0;
- pChan->dd.ptr=pChan->pTxBase;
- dedrift(pChan);
-
- // tx process
- if(!pChan->spsSigGen1->enabled)
- {
- pmr_sps->source=pChan->pTxBase;
- }
- else input=pmr_sps->source;
-
- if(outputtx!=NULL)
- {
- if(pChan->spsTxOutA)pChan->spsTxOutA->sink=outputtx;
- if(pChan->spsTxOutB)pChan->spsTxOutB->sink=outputtx;
- }
-
- i=0;
- while(pmr_sps!=NULL && pmr_sps!=0)
- {
- //TRACEF(1,("PmrTx() sps %i\n",i++));
- pmr_sps->sigProc(pmr_sps);
- pmr_sps = (t_pmr_sps *)(pmr_sps->nextSps);
- }
-
- //TRACEF(1,("PmrTx() - outputs \n"));
- if(pChan->txMixA==TX_OUT_OFF || !pChan->txPttOut){
- for(i=0;i<pChan->nSamplesTx*2*6;i+=2)outputtx[i]=0;
- }
-
- if(pChan->txMixB==TX_OUT_OFF || !pChan->txPttOut ){
- for(i=0;i<pChan->nSamplesTx*2*6;i+=2)outputtx[i+1]=0;
- }
-
- #if XPMR_PPTP == 1
- if( pChan->b.radioactive && pChan->b.pptp_p1!=pChan->txPttOut)
- {
- pChan->b.pptp_p1=pChan->txPttOut;
- pptp_write(0,pChan->b.pptp_p1);
- }
- #endif
-
- #if XPMR_DEBUG0 == 1
- // TRACEF(1,("PmrRx() - debug outputs \n"));
- if(pChan->b.rxCapture){
- for(i=0;i<pChan->nSamplesRx;i++)
- {
- pChan->pRxDemod[i]=input[i*2*6];
- pChan->pTstTxOut[i]=outputtx[i*2*6+0]; // txa
- //pChan->pTstTxOut[i]=outputtx[i*2*6+1]; // txb
- TSCOPE((RX_NOISE_TRIG, pChan->sdbg, i, (pChan->rxCarrierDetect*XPMR_TRACE_AMP)-XPMR_TRACE_AMP/2));
- TSCOPE((RX_CTCSS_DECODE, pChan->sdbg, i, pChan->rxCtcss->decode*(M_Q14/CTCSS_NUM_CODES)));
- TSCOPE((RX_SMODE, pChan->sdbg, i, pChan->smode*(XPMR_TRACE_AMP/4)));
- TSCOPE((TX_PTT_IN, pChan->sdbg, i, (pChan->txPttIn*XPMR_TRACE_AMP)-XPMR_TRACE_AMP/2));
- TSCOPE((TX_PTT_OUT, pChan->sdbg, i, (pChan->txPttOut*XPMR_TRACE_AMP)-XPMR_TRACE_AMP/2));
- TSCOPE((TX_DEDRIFT_LEAD, pChan->sdbg, i, pChan->dd.lead*8));
- TSCOPE((TX_DEDRIFT_ERR, pChan->sdbg, i, pChan->dd.err*16));
- TSCOPE((TX_DEDRIFT_FACTOR, pChan->sdbg, i, pChan->dd.factor*16));
- TSCOPE((TX_DEDRIFT_DRIFT, pChan->sdbg, i, pChan->dd.drift*16));
- }
- }
- #endif
-
- strace2(pChan->sdbg);
- TRACEC(5,("PmrRx() return cd=%i smode=%i txPttIn=%i txPttOut=%i \n",pChan->rxCarrierDetect,pChan->smode,pChan->txPttIn,pChan->txPttOut));
- return 0;
-}
-/*
- parallel binary programming of an RF Transceiver*/
-
-void ppbinout (u8 chan)
-{
-#if(DTX_PROG == 1)
- i32 i;
-
- if (ppdrvdev == 0)
- ppdrvdev = open("/dev/ppdrv_device", 0);
-
- if (ppdrvdev < 0)
- {
- ast_log(LOG_ERROR, "open /dev/ppdrv_ppdrvdev returned %i\n",ppdrvdev);
- return;
- }
-
- i=0;
- if(chan&0x01)i|=BIN_PROG_0;
- if(chan&0x02)i|=BIN_PROG_1;
- if(chan&0x04)i|=BIN_PROG_2;
- if(chan&0x08)i|=BIN_PROG_3;
-
- ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0);
- //ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0);
- //ioctl(ppdrvdev, PPDRV_IOC_PINSET, i );
- ioctl(ppdrvdev, PPDRV_IOC_PINSET, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0);
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, i );
-
- // ioctl(ppdrvdev, PPDRV_IOC_PINSET, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0 );
- ast_log(LOG_NOTICE, "mask=%i 0x%x\n",i,i);
-#endif
-}
-/*
- SPI Programming of an RF Transceiver
- need to add permissions check and mutex
-*/
-/*
- need to add permissions check and mutex
-*/
-void ppspiout (u32 spidata)
-{
-#if(DTX_PROG == 1)
- static char firstrun=0;
- i32 i,ii;
- u32 bitselect;
-
- if (ppdrvdev < 0)
- {
- ast_log(LOG_ERROR, "no parallel port permission ppdrvdev %i\n",ppdrvdev);
- exit(0);
- }
-
- ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX );
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX );
-
- if(firstrun==0)
- {
- firstrun=1;
- for(ii=0;ii<PP_BIT_TIME*200;ii++);
- }
- else
- {
- for(ii=0;ii<PP_BIT_TIME*4;ii++);
- }
-
- bitselect=0x00080000;
-
- for(i=0;i<(PP_REG_LEN-12);i++)
- {
- if((bitselect&spidata))
- ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_DATA );
- else
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_DATA );
-
- for(ii=0;ii<PP_BIT_TIME;ii++);
-
- ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_CLK );
- for(ii=0;ii<PP_BIT_TIME;ii++);
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK );
- for(ii=0;ii<PP_BIT_TIME;ii++);
-
- bitselect=(bitselect>>1);
- }
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA );
- ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_ENABLE );
- for(ii=0;ii<PP_BIT_TIME;ii++);
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_ENABLE );
-#endif
-}
-/*
- mutex needed
- now assumes calling thread secures permissions
- could set up a separate thread to program the radio? yuck!
-
-*/
-void progdtx(t_pmr_chan *pChan)
-{
-#if(DTX_PROG == 1)
- //static u32 progcount=0;
-
- u32 reffreq;
- u32 stepfreq;
- u32 rxiffreq;
- u32 synthfreq;
- u32 shiftreg;
- u32 tmp;
-
- TRACEC(1,("\nprogdtx() %i %i %i\n",pChan->rxfreq,pChan->txfreq,0));
-
- if (ppdrvdev == 0)
- ppdrvdev = open("/dev/ppdrv_device", 0);
-
- if (ppdrvdev < 0)
- {
- ast_log(LOG_ERROR, "open /dev/ppdrv_ppdrvdev returned %i\n",ppdrvdev);
- exit(0);
- }
-
- if(pChan->rxfreq>200000000)
- {
- reffreq=16012500;
- stepfreq=12500;
- rxiffreq=21400000;
- }
- else
- {
- reffreq=16000000;
- stepfreq=5000;
- rxiffreq=10700000;
- }
-
- shiftreg=(reffreq/stepfreq)<<1;
- shiftreg=shiftreg|0x00000001;
-
- ppspiout(shiftreg);
-
- if(pChan->txPttOut)
- synthfreq=pChan->txfreq;
- else
- synthfreq=pChan->rxfreq-rxiffreq;
-
- shiftreg=(synthfreq/stepfreq)<<1;
- tmp=(shiftreg&0xFFFFFF80)<<1;
- shiftreg=tmp+(shiftreg&0x0000007F);
-
- ppspiout(shiftreg);
-
- ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX );
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE );
-
- if(pChan->txPttOut)
- {
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_TXPWR );
- ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TX );
- if(pChan->txpower && 0) ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TXPWR );
- }
- else
- {
- ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_TX | DTX_TXPWR );
- }
-#endif
-}
-
-/* dedrift
- reconciles clock differences between the usb adapter and
- asterisk's frame rate clock
- take out all accumulated drift error on these events:
- before transmitter on
- when ptt release from mobile units detected
-*/
-void dedrift(t_pmr_chan *pChan)
-{
- TRACEC(5,("dedrift()\n"));
-
- if(pChan->dd.option==9)
- {
- TRACEF(1,("dedrift(9)\n"));
- pChan->dd.framesize=DDB_FRAME_SIZE;
- pChan->dd.frames=DDB_FRAMES_IN_BUFF;
- pChan->dd.buffersize = pChan->dd.frames * pChan->dd.framesize;
- pChan->dd.buff=calloc(DDB_FRAME_SIZE*DDB_FRAMES_IN_BUFF,2);
- pChan->dd.modulus=DDB_ERR_MODULUS;
- pChan->dd.inputindex=0;
- pChan->dd.outputindex=0;
- pChan->dd.skew = pChan->dd.lead=0;
- pChan->dd.z1=0;
- pChan->dd.debug=0;
- pChan->dd.debugcnt=0;
- pChan->dd.lock=pChan->dd.b.txlock=pChan->dd.b.rxlock=0;
- pChan->dd.initcnt=2;
- pChan->dd.timer=10000/20;
- pChan->dd.drift=0;
- pChan->dd.factor=pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
- pChan->dd.txframecnt=pChan->dd.rxframecnt=0;
- // clear the buffer too!
- return;
- }
- else if(pChan->dd.option==8)
- {
- free(pChan->dd.buff);
- pChan->dd.lock=0;
- pChan->dd.b.txlock=pChan->dd.b.rxlock=0;
- return;
- }
- else if(pChan->dd.initcnt==0)
- {
- const i32 a0 = 26231;
- const i32 a1 = 26231;
- const i32 b0 = 32768;
- const i32 b1 = -32358;
- const i32 dg = 128;
- void *vptr;
- i16 inputindex;
- i16 indextweak;
- i32 accum;
-
- inputindex = pChan->dd.inputindex;
- pChan->dd.skew = pChan->dd.txframecnt-pChan->dd.rxframecnt;
- pChan->dd.rxframecnt++;
-
- // pull data from buffer
- if( (pChan->dd.outputindex + pChan->dd.framesize) > pChan->dd.buffersize )
- {
- i16 dofirst,donext;
-
- dofirst = pChan->dd.buffersize - pChan->dd.outputindex;
- donext = pChan->dd.framesize - dofirst;
- vptr = (void*)(pChan->dd.ptr);
- memcpy(vptr,(void*)(pChan->dd.buff + pChan->dd.outputindex),dofirst*2);
- vptr=(void*)(pChan->dd.ptr + dofirst);
- memcpy(vptr,(void*)(pChan->dd.buff),donext*2);
- }
- else
- {
- memcpy(pChan->dd.ptr,(void*)(pChan->dd.buff + pChan->dd.outputindex),pChan->dd.framesize*2);
- }
-
- // compute clock error and correction factor
- if(pChan->dd.outputindex > inputindex)
- {
- pChan->dd.lead = (inputindex + pChan->dd.buffersize) - pChan->dd.outputindex;
- }
- else
- {
- pChan->dd.lead = inputindex - pChan->dd.outputindex;
- }
- pChan->dd.err = pChan->dd.lead - (pChan->dd.buffersize/2);
-
- // WinFilter, IIR Fs=50, Fc=0.1
- pChan->dd.x1 = pChan->dd.x0;
- pChan->dd.y1 = pChan->dd.y0;
- pChan->dd.x0 = pChan->dd.err;
- pChan->dd.y0 = a0 * pChan->dd.x0;
- pChan->dd.y0 += (a1 * pChan->dd.x1 - (b1 * pChan->dd.y1));
- pChan->dd.y0 /= b0;
- accum = pChan->dd.y0/dg;
-
- pChan->dd.factor=accum;
- indextweak=0;
-
- #if 1
- // event sync'd correction
- if(pChan->dd.b.doitnow)
- {
- pChan->dd.b.doitnow=0;
- indextweak=pChan->dd.factor;
- pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
- pChan->dd.timer=20000/MS_PER_FRAME;
- }
- // coarse lead adjustment if really far out of range
- else if( pChan->dd.lead >= pChan->dd.framesize*(DDB_FRAMES_IN_BUFF-2) )
- {
- pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
- indextweak += (pChan->dd.framesize*5/4);
- }
- else if(pChan->dd.lead <= pChan->dd.framesize*2 )
- {
- pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
- indextweak -= (pChan->dd.framesize*5/4);
- }
- #endif
-
- #if 1
- if(pChan->dd.timer>0)pChan->dd.timer--;
- if(pChan->dd.timer==0 && abs(pChan->dd.factor)>=16)
- {
- indextweak=pChan->dd.factor;
- pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
- pChan->dd.timer=20000/MS_PER_FRAME;
- }
- #endif
-
- #if XPMR_DEBUG0 == 1
- if(indextweak!=0)TRACEF(4,("%08i indextweak %+4i %+4i %+5i %5i %5i %5i %+4i\n",pChan->dd.rxframecnt, indextweak, pChan->dd.err, accum, inputindex, pChan->dd.outputindex, pChan->dd.lead, pChan->dd.skew));
- #endif
-
- // set the output index based on lead and clock offset
- pChan->dd.outputindex = (pChan->dd.outputindex + pChan->dd.framesize + indextweak)%pChan->dd.buffersize;
- }
-}
-/*
-*/
-void dedrift_write(t_pmr_chan *pChan, i16 *src )
-{
- void *vptr;
-
- TRACEF(5,("dedrift_write()\n"));
- vptr = pChan->dd.buff + pChan->dd.inputindex;
- memcpy(vptr, src, pChan->dd.framesize*2);
- pChan->dd.inputindex = (pChan->dd.inputindex + pChan->dd.framesize) % pChan->dd.buffersize;
- pChan->dd.txframecnt++;
- if(pChan->dd.initcnt!=0)pChan->dd.initcnt--;
- pChan->dd.accum+=pChan->dd.framesize;
-}
-
-/* end of file */
diff --git a/channels/xpmr/xpmr.h b/channels/xpmr/xpmr.h
deleted file mode 100755
index 49f5148fa..000000000
--- a/channels/xpmr/xpmr.h
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * xpmr.h - for Xelatec Private Mobile Radio Processes
- *
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- *
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-
-#ifndef XPMR_H
-#define XPMR_H 1
-
-#define XPMR_DEV 0 // when running in test mode
-
-#define XPMR_TRACE_LEVEL 0
-
-#ifdef RADIO_RTX
-#define DTX_PROG 1 // rf transceiver module
-#define XPMR_PPTP 0 // parallel port test probe
-#else
-#define DTX_PROG 0
-#define XPMR_PPTP 0
-#endif
-
-#if (DTX_PROG == 1) || XPMR_PPTP == 1
-#include <parapindriver.h>
-#endif
-
-#ifdef CHAN_USBRADIO
-#define XPMR_DEBUG0 1
-#define XPMR_TRACE 1
-#define TRACEO(level,a) { if ( o->tracelevel >= level ) {printf a;} }
-#else
-#define XPMR_DEBUG0 1
-#define XPMR_TRACE 1
-#define TRACEO(level,a)
-#endif
-
-
-#define LSD_DFS 5
-#define LSD_DFD 1
-
-#if(XPMR_DEBUG0 == 1)
-#define XPMR_DEBUG_CHANS 16
-#define TSCOPE(a) {strace a;}
-#else
-#define XPMR_DEBUG_CHANS 0
-#define TSCOPE(a)
-#endif
-
-#define XPMR_TRACE_AMP 8192
-
-// TRACEM(3,TSYS_LSD,("pmr_lsdctl_exec() RX FRAME UNPROCESSED.\n"));
-#if(XPMR_TRACE == 1)
-#define TRACEX(a) {printf a;}
-#define TRACEXL(a) {printf("%s @ %u : ",__FILE__ ,__LINE__); printf a; }
-#define TRACEXT(a) {struct timeval hack; gettimeofday(&hack,NULL); printf("%ld.",hack.tv_sec%100000); printf("%i : ",(int)hack.tv_usec); printf a; }
-#define TRACEXR(a) {printf a;}
-#define TRACEC(level,a) {if(pChan->tracelevel>=level){printf("%08i ",pChan->frameCountRx);printf a;} }
-#define TRACEF(level,a) {if(pChan->tracelevel>=level){printf a;} }
-#define TRACEJ(level,a) {if(XPMR_TRACE_LEVEL>=level){printf a;} }
-#define TRACES(level,a) {if(mySps->parentChan->tracelevel >= level){printf a;} }
-#define TRACET(level,a) {if(pChan->tracelevel>=level){printf("%08i %02i",pChan->frameCountRx,pChan->rptnum);printf a;} }
-#define TRACEXR(a) {printf a;}
-#define TRACEM(level,sys,a) {if(pChan->tracelevel>=level || (pChan->tracesys[sys])){printf a;} }
-#else
-#define TRACEX(a)
-#define TRACEXL(a)
-#define TRACEXT(a)
-#define TRACEC(level,a)
-#define TRACEF(level,a)
-#define TRACEJ(level,a)
-#define TRACES(level,a)
-#define TRACET(level,a)
-#define TRACEXR(a)
-#define TRACEM(level,sys,a)
-#endif
-
-#define i8 int8_t
-#define u8 u_int8_t
-#define i16 int16_t
-#define u16 u_int16_t
-#define i32 int32_t
-#define u32 u_int32_t
-#define i64 int64_t
-#define u64 u_int64_t
-
-#define M_Q31 0x80000000 //
-#define M_Q30 0x40000000 //
-#define M_Q29 0x20000000 //
-#define M_Q28 0x10000000 //
-#define M_Q27 0x08000000 //
-#define M_Q26 0x04000000 //
-#define M_Q25 0x02000000 //
-#define M_Q24 0x01000000 //
-#define M_Q23 0x00800000 //
-#define M_Q22 0x00400000 //
-#define M_Q21 0x00200000 // undsoweiter
-#define M_Q20 0x00100000 // 1048576
-#define M_Q19 0x00080000 // 524288
-#define M_Q18 0x00040000 // 262144
-#define M_Q17 0x00020000 // 131072
-#define M_Q16 0x00010000 // 65536
-#define M_Q15 0x00008000 // 32768
-#define M_Q14 0x00004000 // 16384
-#define M_Q13 0x00002000 // 8182
-#define M_Q12 0x00001000 // 4096
-#define M_Q11 0x00000800 // 2048
-#define M_Q10 0x00000400 // 1024
-#define M_Q9 0x00000200 // 512
-#define M_Q8 0x00000100 // 256
-#define M_Q7 0x00000080 // 128
-#define M_Q6 0x00000040 // 64
-#define M_Q5 0x00000020 // 32
-#define M_Q4 0x00000010 // 16
-#define M_Q3 0x00000008 // 16
-#define M_Q2 0x00000004 // 16
-#define M_Q1 0x00000002 // 16
-#define M_Q0 0x00000001 // 16
-
-#define RADIANS_PER_CYCLE (2*M_PI)
-
-#define SAMPLE_RATE_INPUT 48000
-#define SAMPLE_RATE_NETWORK 8000
-
-#define SAMPLES_PER_BLOCK 160
-#define MS_PER_FRAME 20
-#define SAMPLES_PER_MS 8
-
-#define CTCSS_NULL -1
-#define CTCSS_RXONLY -2
-#define CTCSS_NUM_CODES 38 // 0 - 37
-#define CTCSS_SCOUNT_MUL 100
-#define CTCSS_INTEGRATE 3932 // 32767*.120 // 120/1000 // 0.120
-#define CTCSS_INPUT_LIMIT 1000
-#define CTCSS_DETECT_POINT 1989
-#define CTCSS_HYSTERSIS 200
-
-#define CTCSS_TURN_OFF_TIME 160 // ms
-#define CTCSS_TURN_OFF_SHIFT 240 // degrees
-#define TOC_NOTONE_TIME 600 // ms
-
-#define DDB_FRAME_SIZE 160 // clock de-drift defaults
-#define DDB_FRAMES_IN_BUFF 8
-#define DDB_ERR_MODULUS 10000
-
-#define DCS_TURN_OFF_TIME 180
-
-#define NUM_TXLSD_FRAMEBUFFERS 4
-
-#define CHAN_TXSTATE_IDLE 0
-#define CHAN_TXSTATE_ACTIVE 1
-#define CHAN_TXSTATE_TOC 2
-#define CHAN_TXSTATE_HANGING 3
-#define CHAN_TXSTATE_FINISHING 4
-#define CHAN_TXSTATE_COMPLETE 5
-#define CHAN_TXSTATE_USURPED 9
-
-#define SMODE_NULL 0
-#define SMODE_CARRIER 1
-#define SMODE_CTCSS 2
-#define SMODE_DCS 3
-#define SMODE_LSD 4
-#define SMODE_MPT 5
-#define SMODE_DST 6
-#define SMODE_P25 7
-#define SMODE_MDC 8
-
-
-#define SPS_OPT_START 1
-#define SPS_OPT_STOP 2
-#define SPS_OPT_TURNOFF 3
-#define SPS_OPT_STOPNOW 4
-
-#define SPS_STAT_STOPPED 0
-#define SPS_STAT_STARTING 1
-#define SPS_STAT_RUNNING 2
-#define SPS_STAT_HALTING 3
-
-
-#define PP_BIT_TEST 6
-#define PP_REG_LEN 32
-#define PP_BIT_TIME 100000
-
-#define DTX_CLK LP_PIN02
-#define DTX_DATA LP_PIN03
-#define DTX_ENABLE LP_PIN04
-#define DTX_TX LP_PIN05 // only used on older mods
-#define DTX_TXPWR LP_PIN06 // not used
-#define DTX_TP1 LP_PIN07 // not used
-#define DTX_TP2 LP_PIN08 // not used
-
-#define BIN_PROG_0 LP_PIN06
-#define BIN_PROG_1 LP_PIN07
-#define BIN_PROG_2 LP_PIN08
-#define BIN_PROG_3 LP_PIN09
-
-#ifndef CHAN_USBRADIO
-enum {RX_AUDIO_NONE,RX_AUDIO_SPEAKER,RX_AUDIO_FLAT};
-enum {TX_AUDIO_NONE,TX_AUDIO_FLAT,TX_AUDIO_FILTERED,TX_AUDIO_PROC};
-enum {CD_IGNORE,CD_XPMR_NOISE,CD_XPMR_VOX,CD_HID,CD_HID_INVERT};
-enum {SD_IGNORE,SD_HID,SD_HID_INVERT,SD_XPMR}; // no,external,externalinvert,software
-enum {RX_KEY_CARRIER,RX_KEY_CARRIER_CODE};
-enum {TX_OUT_OFF,TX_OUT_VOICE,TX_OUT_LSD,TX_OUT_COMPOSITE,TX_OUT_AUX};
-enum {TOC_NONE,TOC_PHASE,TOC_NOTONE};
-#endif
-
-enum dbg_pts {
-
-RX_INPUT,
-RX_NOISE_AMP,
-RX_NOISE_TRIG,
-
-RX_CTCSS_LPF,
-RX_CTCSS_CENTER,
-RX_CTCSS_NRZ,
-RX_CTCSS_CLK,
-RX_CTCSS_P0,
-RX_CTCSS_P1,
-RX_CTCSS_ACCUM,
-RX_CTCSS_DVDT,
-RX_CTCSS_DECODE,
-
-RX_DCS_CENTER,
-RX_DCS_DEC,
-RX_DCS_DIN,
-RX_DCS_CLK,
-RX_DCS_DAT,
-
-RX_LSD_LPF,
-RX_LSD_CLK,
-RX_LSD_DAT,
-RX_LSD_DEC,
-
-RX_LSD_CENTER,
-RX_LSD_SYNC,
-RX_LSD_STATE,
-RX_LSD_ERR,
-RX_LSD_INTE,
-
-RX_SMODE,
-
-TX_PTT_IN,
-TX_PTT_OUT,
-
-TX_DEDRIFT_LEAD,
-TX_DEDRIFT_ERR,
-TX_DEDRIFT_FACTOR,
-TX_DEDRIFT_DRIFT,
-TX_DEDRIFT_TWIDDLE,
-
-TX_CTCSS_GEN,
-
-TX_SIGGEN_0,
-
-TX_DCS_CLK,
-TX_DCS_DAT,
-TX_DCS_LPF,
-
-TX_LSD_CLK,
-TX_LSD_DAT,
-TX_LSD_GEN,
-TX_LSD_LPF,
-
-TX_NET_INT,
-TX_VOX_HPF,
-TX_VOX_LIM,
-
-TX_VOX_LPF,
-
-TX_OUT_A,
-TX_OUT_B,
-
-NUM_DEBUG_PTS
-};
-
-typedef struct
-{
- i16 mode;
- i16 point[NUM_DEBUG_PTS];
- i16 trace[16];
- i16 scale[16];
- i16 offset[16];
- i16 buffer[16 * SAMPLES_PER_BLOCK]; // allocate for rx and tx
- i16 *source[16];
-} t_sdbg;
-
-typedef struct
-{
- i16 lock;
- i16 option; // 1 = data in, 0 = data out
- i16 debug;
- i16 debugcnt;
- i32 rxframecnt;
- i32 txframecnt;
-
- i32 skew;
-
- i16 frames;
- i16 framesize;
- i16 buffersize;
-
- i32 timer;
-
- i32 x0,x1,y0,y1;
-
- i16 inputindex;
- i16 outputindex;
- i16 lead;
- i16 err;
- i16 accum;
-
- i16 *ptr; // source or destination
- i16 *buff;
-
- i16 inputcnt;
- i16 initcnt;
-
- i32 factor;
- i32 drift;
- i32 modulus;
- i32 z1;
- struct {
- unsigned rxlock:1;
- unsigned txlock:1;
- unsigned twiddle:1;
- unsigned doitnow:1;
- }b;
-}
-t_dedrift;
-
-/*
- one structure for each ctcss tone to decode
-*/
-typedef struct
-{
- i16 counter; // counter to next sample
- i16 counterFactor; // full divisor used to increment counter
- i16 binFactor;
- i16 fudgeFactor;
- i16 peak; // peak amplitude now maw sph now
- i16 enabled;
- i16 state; // dead, running, error
- i16 zIndex; // z bucket index
- i16 z[4];
- i16 zi;
- i16 dvu;
- i16 dvd;
- i16 zd;
- i16 setpt;
- i16 hyst;
- i16 decode;
- i16 diffpeak;
- i16 debug;
-
- #if XPMR_DEBUG0 == 1
- i16 lasttv0;
- i16 lasttv1;
- i16 lasttv2;
- i16 lasttv3;
-
- i16 *pDebug0; // pointer to debug output
- i16 *pDebug1; // pointer to debug output
- i16 *pDebug2; // pointer to debug output
- i16 *pDebug3; // pointer to debug output
- #endif
-
-} t_tdet;
-
-typedef struct
-{
- i16 enabled; // if 0 none, 0xFFFF all tones, or single tone
- i16 *input; // source data
- i16 clamplitude;
- i16 center;
- i16 decode; // current ctcss decode index
- i32 BlankingTimer;
- u32 TurnOffTimer;
- i16 gain;
- i16 limit;
- i16 debugIndex;
- i16 *pDebug0;
- i16 *pDebug1;
- i16 *pDebug2;
- i16 *pDebug3;
- i16 testIndex;
- i16 multiFreq;
- i8 relax;
- t_tdet tdet[CTCSS_NUM_CODES];
-
- i8 numrxcodes;
- i16 rxCtcssMap[CTCSS_NUM_CODES];
- char *rxctcss[CTCSS_NUM_CODES]; // pointers to each tone in string above
- char *txctcss[CTCSS_NUM_CODES];
-
- i32 txctcssdefault_index;
- float txctcssdefault_value;
-
- struct{
- unsigned valid:1;
- }b;
-} t_dec_ctcss;
-
-/*
- Low Speed Data
-*/
-/*
- general purpose pmr signal processing element
-*/
-
-struct t_pmr_chan;
-
-typedef struct t_pmr_sps
-{
- i16 index; // unique to each instance
-
- i16 enabled; // enabled/disabled
-
-
- struct t_pmr_chan *parentChan;
-
- i16 *source; // source buffer
- i16 *sourceB; // source buffer B
- i16 *sink; // sink buffer
-
- i16 numChanOut; // allows output direct to interleaved buffer
- i16 selChanOut;
-
- i32 ticks;
- i32 timer;
- i32 count;
-
- void *buff; // this structure's internal buffer
-
- i16 *debugBuff0; // debug buffer
- i16 *debugBuff1; // debug buffer
- i16 *debugBuff2; // debug buffer
- i16 *debugBuff3; // debug buffer
-
- i16 nSamples; // number of samples in the buffer
-
- u32 buffSize; // buffer maximum index
- u32 buffInIndex; // index to current input point
- u32 buffOutIndex; // index to current output point
- u32 buffLead; // lead of input over output through cb
-
- i16 decimate; // decimation or interpolation factor (could be put in coef's)
- i16 interpolate;
- i16 decimator; // like the state this must be saved between calls (could be put in x's)
-
- u32 sampleRate; // in Hz for elements in this structure
- u32 freq; // in 0.1 Hz
-
- i16 measPeak; // do measure Peak
- i16 amax; // buffer amplitude maximum
- i16 amin; // buffer amplitude minimum
- i16 apeak; // buffer amplitude peak value (peak to peak)/2
- i16 setpt; // amplitude set point for amplitude comparator
- i16 hyst; // hysterysis for amplitude comparator
- i16 compOut; // amplitude comparator output
-
- i32 discounteru; // amplitude detector integrator discharge counter upper
- i32 discounterl; // amplitude detector integrator discharge counter lower
- i32 discfactor; // amplitude detector integrator discharge factor
-
- i16 err; // error condition
- i16 option; // option / request zero
- i16 state; // stopped, start, stopped assumes zero'd
-
- i16 pending;
-
- struct {
- unsigned hit:1;
- unsigned hitlast:1;
- unsigned hita:1;
- unsigned hitb:1;
- unsigned bithit:1;
- unsigned now:1;
- unsigned next:1;
- unsigned prev:1;
- unsigned clock:1;
- unsigned hold:1;
- unsigned opt1:1;
- unsigned opt2:1;
- unsigned polarity:1;
- unsigned dotting:1;
- unsigned lastbitpending:1;
- unsigned outzero:1;
- unsigned settling:1;
- unsigned syncing:1;
- }b;
-
- i16 cleared; // output buffer cleared
-
- i16 delay;
- i16 decode;
-
- i32 inputGain; // apply to input data ? in Q7.8 format
- i32 inputGainB; // apply to input data ? in Q7.8 format
- i32 outputGain; // apply to output data ? in Q7.8 format
- i16 mixOut;
- i16 monoOut;
-
- i16 filterType; // iir, fir, 1, 2, 3, 4 ...
-
- i16 (*sigProc)(struct t_pmr_sps *sps); // function to call
-
- i32 calcAdjust; // final adjustment
- i16 nx; // number of x history elements
- i16 ncoef; // number of coefficients
- i16 size_x; // size of each x history element
- i16 size_coef; // size of each coefficient
- void *x; // history registers
- void *x2; // history registers, 2nd bank
- void *coef; // coefficients
- void *coef2; // coefficients 2
-
- void *nextSps; // next Sps function
-
-} t_pmr_sps;
-
-
-struct t_dec_dcs;
-struct t_lsd_control;
-struct t_decLsd;;
-struct t_encLsd;
-
-/*
- pmr channel
-*/
-typedef struct t_pmr_chan
-{
- i16 index; // which one
- i16 devicenum; // belongs to
-
- char *name;
-
- i16 enabled; // enabled/disabled
- i16 status; // ok, error, busy, idle, initializing
-
- i16 tracelevel;
- i16 tracetype;
- u32 tracemask;
-
- i16 nSamplesRx; // max frame size
- i16 nSamplesTx;
-
- i32 inputSampleRate; // in S/s 48000
- i32 baseSampleRate; // in S/s 8000
-
- i16 inputGain;
- i16 inputOffset;
-
- i32 ticks; // time ticks
- u32 frameCountRx; // number processed
- u32 frameCountTx;
-
- i8 txframelock;
-
- i32 txHangTime;
- i32 txHangTimer;
- i32 txTurnOff;
- i16 txBufferClear;
-
- u32 txfreq;
- u32 rxfreq;
- i8 txpower;
-
- i32 txsettletime; // in samples
- i32 txsettletimer;
-
- i16 rxDC; // average DC value of input
- i16 rxSqSet; // carrier squelch threshold
- i16 rxSqHyst; // carrier squelch hysterysis
- i16 rxRssi; // current Rssi level
- i16 rxQuality; // signal quality metric
- i16 rxCarrierDetect; // carrier detect
- i16 rxCdType;
- i16 rxSqVoxAdj;
- i16 rxExtCarrierDetect;
- i32 inputBlanking; // Tx pulse eliminator
-
- i16 rxDemod; // see enum
- i16 txMod; //
-
- i16 rxNoiseSquelchEnable;
- i16 rxHpfEnable;
- i16 rxDeEmpEnable;
- i16 rxCenterSlicerEnable;
- i16 rxCtcssDecodeEnable;
- i16 rxDcsDecodeEnable;
- i16 rxDelayLineEnable;
-
- i16 txHpfEnable;
- i16 txLimiterEnable;
- i16 txPreEmpEnable;
- i16 txLpfEnable;
-
- char radioDuplex;
-
- char *pStr;
-
- // start channel signaling codes source
- char *pRxCodeSrc; // source
- char *pTxCodeSrc; // source
- char *pTxCodeDefault; // source
- // end channel signaling codes source
-
- // start signaling code info derived from source
- i16 numrxcodes;
- i16 numtxcodes;
- char *pRxCodeStr; // copied and cut up
- char **pRxCode; // pointers to subs
- char *pTxCodeStr;
- char **pTxCode;
-
- char txctcssdefault[16]; // codes from higher level
-
- char *rxctcssfreqs; // rest are derived from this
- char *txctcssfreqs;
-
- char numrxctcssfreqs;
- char numtxctcssfreqs;
-
- char *rxctcss[CTCSS_NUM_CODES]; // pointers to each tone in string above
- char *txctcss[CTCSS_NUM_CODES];
-
- i16 rxCtcssMap[CTCSS_NUM_CODES];
-
- i8 txcodedefaultsmode;
- i16 txctcssdefault_index;
- float txctcssdefault_value;
-
- char txctcssfreq[32]; // encode now
- char rxctcssfreq[32]; // decode now
- // end most of signaling code info derived from source
-
- struct t_lsd_control *pLsdCtl;
-
- i16 rptnum;
- i16 area;
- char *ukey;
- u32 idleinterval;
- char turnoffs;
-
- char pplock;
-
- t_dedrift dd;
-
- i16 dummy;
-
- i32 txScramFreq;
- i32 rxScramFreq;
-
- i16 gainVoice;
- i16 gainSubAudible;
-
- i16 txMixA; // Off, Ctcss, Voice, Composite
- i16 txMixB; // Off, Ctcss, Voice, Composite
-
- i16 rxMuting;
-
- i16 rxCpuSaver;
- i16 txCpuSaver;
-
- i8 rxSqMode; // 0 open, 1 carrier, 2 coded
-
- i8 cdMethod;
-
- i16 rxSquelchPoint;
-
- i16 rxCarrierPoint;
- i16 rxCarrierHyst;
-
- i16 txCtcssTocShift;
- i16 txCtcssTocTime;
- i8 txTocType;
-
- i16 smode; // ctcss, dcs, lsd
- i16 smodecode;
- i16 smodewas; // ctcss, dcs, lsd
- i32 smodetimer; // in ms
- i32 smodetime; // to set in ms
-
- t_dec_ctcss *rxCtcss;
- struct t_dec_dcs *decDcs;
- struct t_decLsd *decLsd;
- struct t_encLsd *pLsdEnc;
-
- i16 clamplitudeDcs;
- i16 centerDcs;
- u32 dcsBlankingTimer;
- i16 dcsDecode; // current dcs decode value
-
- i16 clamplitudeLsd;
- i16 centerLsd;
-
-
- i16 txPttIn; // from external request
- i16 txPttOut; // to radio hardware
- i16 txPttHid;
-
- i16 bandwidth; // wide/narrow
- i16 txCompand; // type
- i16 rxCompand; //
-
- i16 txEqRight; // muted, flat, pre-emp limited filtered
- i16 txEqLeft;
-
- i16 txPotRight; //
- i16 txPotLeft; //
-
- i16 rxPotRight; //
- i16 rxPotLeft; //
-
- i16 function;
-
- i16 txState; // off,settling,on,hangtime,turnoff
-
- i16 spsIndex;
-
- t_pmr_sps *spsMeasure; // measurement block
-
- t_pmr_sps *spsRx; // 1st signal processing struct
- t_pmr_sps *spsRxLsd;
- t_pmr_sps *spsRxLsdNrz;
- t_pmr_sps *spsRxDeEmp;
- t_pmr_sps *spsRxHpf;
- t_pmr_sps *spsRxVox;
- t_pmr_sps *spsDelayLine; // Last signal processing struct
- t_pmr_sps *spsRxOut; // Last signal processing struct
-
- t_pmr_sps *spsTx; // 1st signal processing struct
-
- t_pmr_sps *spsTxOutA; // Last signal processing struct
- t_pmr_sps *spsTxOutB; // Last signal processing struct
-
- t_pmr_sps *spsSigGen0; // ctcss
- t_pmr_sps *spsSigGen1; // test and other tones
- t_pmr_sps *spsLsdGen;
- t_pmr_sps *spsTxLsdLpf;
-
- // tune tweaks
-
- i32 rxVoxTimer; // Vox Hang Timer
-
- i16 *prxSquelchAdjust;
-
- // i16 *prxNoiseMeasure; // for autotune
- // i32 *prxNoiseAdjust;
-
- i16 *prxVoiceMeasure;
- i32 *prxVoiceAdjust;
-
- i16 *prxCtcssMeasure;
- i32 *prxCtcssAdjust;
-
- i16 *ptxVoiceAdjust; // from calling application
- i32 *ptxCtcssAdjust; // from calling application
-
- i32 *ptxLimiterAdjust; // from calling application
-
- struct {
- unsigned pmrNoiseSquelch:1;
- unsigned rxHpf:1;
- unsigned txHpf:1;
- unsigned txLpf:1;
- unsigned rxDeEmphasis:1;
- unsigned txPreEmphasis:1;
- unsigned startSpecialTone:1;
- unsigned stopSpecialTone:1;
- unsigned doingSpecialTone:1;
- unsigned extCarrierDetect:1;
- unsigned txCapture:1;
- unsigned rxCapture:1;
- unsigned reprog:1;
- unsigned radioactive:1;
- unsigned rxplmon:1;
- unsigned remoted:1;
- unsigned loopback:1;
- unsigned rxpolarity:1;
- unsigned txpolarity:1;
- unsigned dcsrxpolarity:1;
- unsigned dcstxpolarity:1;
- unsigned lsdrxpolarity:1;
- unsigned lsdtxpolarity:1;
- unsigned txsettling:1;
- unsigned smodeturnoff:1;
-
- unsigned ctcssRxEnable:1;
- unsigned ctcssTxEnable:1;
- unsigned dcsRxEnable:1;
- unsigned dcsTxEnable:1;
- unsigned lmrRxEnable:1;
- unsigned lmrTxEnable:1;
- unsigned mdcRxEnable:1;
- unsigned mdcTxEnable:1;
- unsigned dstRxEnable:1;
- unsigned dstTxEnable:1;
- unsigned p25RxEnable:1;
- unsigned p25TxEnable:1;
- unsigned ax25Enable:1;
-
- unsigned txCtcssInhibit:1;
-
- unsigned rxkeyed:1;
- unsigned rxhalted:1;
- unsigned txhalted:1;
- unsigned pptp_p1:1;
- unsigned pptp_p2:1;
- unsigned tuning:1;
- unsigned pttwas:1;
- }b;
-
- i16 *pRxDemod; // buffers
- i16 *pRxBase; // decimated lpf input
- i16 *pRxNoise;
- i16 *pRxLsd; // subaudible only
- i16 *pRxHpf; // subaudible removed
- i16 *pRxDeEmp; // EIA Audio
- i16 *pRxSpeaker; // EIA Audio
- i16 *pRxDcTrack; // DC Restored LSD
- i16 *pRxLsdLimit; // LSD Limited
- i16 *pRxCtcss; //
- i16 *pRxSquelch;
- i16 *prxVoxMeas;
- i16 *prxMeasure;
-
- i16 *pTxInput; // input data
- i16 *pTxBase; // input data
- i16 *pTxHpf;
- i16 *pTxPreEmp;
- i16 *pTxLimiter;
- i16 *pTxLsd;
- i16 *pTxLsdLpf;
- i16 *pTxComposite;
- i16 *pTxMod; // upsampled, low pass filtered
-
- i16 *pTxOut; //
-
- i16 *pSigGen0;
- i16 *pSigGen1;
-
- i16 *pAlt0;
- i16 *pAlt1;
-
- i16 *pNull;
-
- #if XPMR_DEBUG0 == 1
-
- i16 *pRxLsdCen;
-
- i16 *pTstTxOut;
-
- i16 *prxDebug; // consolidated debug buffer
- i16 *ptxDebug; // consolidated debug buffer
-
- i16 *prxDebug0;
- i16 *prxDebug1;
- i16 *prxDebug2;
- i16 *prxDebug3;
-
- i16 *ptxDebug0;
- i16 *ptxDebug1;
- i16 *ptxDebug2;
- i16 *ptxDebug3;
-
- #endif
-
- i16 numDebugChannels;
-
- t_sdbg *sdbg;
-
-} t_pmr_chan;
-
-/*
- function prototype declarations
-*/
-void strace(i16 point, t_sdbg *sdbg, i16 index, i16 value);
-void strace2(t_sdbg *sdbg);
-
-static i16 TxTestTone(t_pmr_chan *pChan, i16 function);
-t_pmr_chan *createPmrChannel(t_pmr_chan *tChan, i16 numSamples);
-t_pmr_sps *createPmrSps(t_pmr_chan *pChan);
-i16 destroyPmrChannel(t_pmr_chan *pChan);
-i16 destroyPmrSps(t_pmr_sps *pSps);
-i16 pmr_rx_frontend(t_pmr_sps *mySps);
-i16 pmr_gp_fir(t_pmr_sps *mySps);
-i16 pmr_gp_iir(t_pmr_sps *mySps);
-i16 gp_inte_00(t_pmr_sps *mySps);
-i16 gp_diff(t_pmr_sps *mySps);
-i16 CenterSlicer(t_pmr_sps *mySps);
-i16 ctcss_detect(t_pmr_chan *pmrChan);
-i16 SoftLimiter(t_pmr_sps *mySps);
-i16 SigGen(t_pmr_sps *mySps);
-i16 pmrMixer(t_pmr_sps *mySps);
-i16 DelayLine(t_pmr_sps *mySps);
-
-i16 PmrRx(t_pmr_chan *PmrChan, i16 *input, i16 *outputrx, i16 *outputtx );
-i16 PmrTx(t_pmr_chan *PmrChan, i16 *input);
-
-i16 string_parse(char *src, char **dest, char ***ptrs);
-i16 code_string_parse(t_pmr_chan *pChan);
-
-i16 CtcssFreqIndex(float freq);
-i16 MeasureBlock(t_pmr_sps *mySps);
-
-void dedrift (t_pmr_chan *pChan);
-void dedrift_write (t_pmr_chan *pChan, i16 *src);
-
-void ppspiout (u32 spidata);
-void progdtx (t_pmr_chan *pChan);
-void ppbinout (u8 chan);
-
-#if XPMR_PPTP == 1
-void pptp_init (void);
-void pptp_write (i16 bit, i16 state);
-#endif
-
-#endif /* ! XPMR_H */
-
-/* end of file */
-
-
-
diff --git a/channels/xpmr/xpmr_coef.h b/channels/xpmr/xpmr_coef.h
deleted file mode 100755
index 84254e884..000000000
--- a/channels/xpmr/xpmr_coef.h
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * xpmr_coef.h - for Xelatec Private Mobile Radio Processes
- *
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- *
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- * Some filter coeficients via 'WinFilter' http://www.winfilter.20m.com.
- *
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-
-#ifndef XPMR_COEF_H
-#define XMPR_COEF_H 1
-
-// frequencies in 0.1 Hz
-static const u32 dtmf_row[] =
-{
- 6970, 7700, 8520, 9410
-};
-static const u32 dtmf_col[] =
-{
- 12090, 13360, 14770, 16330
-};
-
-
-#define CTCSS_COEF_INT 120
-#define CTCSS_SAMPLE_RATE 8000
-#define TDIV(x) ((CTCSS_SAMPLE_RATE*1000/x)+5)/10
-
-#if 0
-static i32 coef_ctcss[4][5]=
-{
- // freq, divisor, integrator, filter
- {770,TDIV(770),CTCSS_COEF_INT,0,0},
- {1000,TDIV(1000),CTCSS_COEF_INT,0,0},
- {1035,TDIV(1035),CTCSS_COEF_INT,0,0},
- {0,0,0,0}
-};
-#endif
-
-static i16 coef_ctcss_div[]=
-{
-2985, // 00 067.0
-2782, // 01 071.9
-2688, // 02 074.4
-2597, // 03 077.0
-2509, // 04 079.7
-2424, // 05 082.5
-2342, // 06 085.4
-2260, // 07 088.5
-2186, // 08 091.5
-2110, // 09 094.8
-2053, // 10 097.4
-2000, // 11 100.0
-1932, // 12 103.5
-1866, // 13 107.2
-1803, // 14 110.9
-1742, // 15 114.8
-1684, // 16 118.8
-1626, // 17 123.0
-1571, // 18 127.3
-1517, // 19 131.8
-1465, // 20 136.5
-1415, // 21 141.3
-1368, // 22 146.2
-1321, // 23 151.4
-1276, // 24 156.7
-1233, // 25 162.2
-1191, // 26 167.9
-1151, // 27 173.8
-1112, // 28 179.9
-1074, // 29 186.2
-1037, // 30 192.8
-983, // 31 203.5
-949, // 32 210.7
-917, // 33 218.1
-886, // 34 225.7
-856, // 35 233.6
-827, // 36 241.8
-799 // 37 250.3
-};
-
-static float freq_ctcss[]=
-{
-067.0, // 00
-071.9, // 01
-074.4, // 02
-077.0, // 03
-079.7, // 04
-082.5, // 05
-085.4, // 06
-088.5, // 07
-091.5, // 08
-094.8, // 09
-097.4, // 10
-100.0, // 11
-103.5, // 12
-107.2, // 13
-110.9, // 14
-114.8, // 15
-118.8, // 16
-123.0, // 17
-127.3, // 18
-131.8, // 19
-136.5, // 20
-141.3, // 21
-146.2, // 22
-151.4, // 23
-156.7, // 24
-162.2, // 25
-167.9, // 26
-173.8, // 27
-179.9, // 28
-186.2, // 29
-192.8, // 30
-203.5, // 31
-210.7 , // 32
-218.1 , // 33
-225.7 , // 34
-233.6 , // 35
-241.8 , // 36
-250.3 // 37
-};
-
-/*
- noise squelch carrier detect filter
-*/
-static const int16_t taps_fir_bpf_noise_1 = 66;
-static const int32_t gain_fir_bpf_noise_1 = 65536;
-static const int16_t coef_fir_bpf_noise_1[] = {
- 139,
- -182,
- -269,
- -66,
- 56,
- 59,
- 250,
- 395,
- -80,
- -775,
- -557,
- 437,
- 779,
- 210,
- -17,
- 123,
- -692,
- -1664,
- -256,
- 2495,
- 2237,
- -1018,
- -2133,
- -478,
- -1134,
- -2711,
- 2642,
- 10453,
- 4010,
- -14385,
- -16488,
- 6954,
- 23030,
- 6954,
- -16488,
- -14385,
- 4010,
- 10453,
- 2642,
- -2711,
- -1134,
- -478,
- -2133,
- -1018,
- 2237,
- 2495,
- -256,
- -1664,
- -692,
- 123,
- -17,
- 210,
- 779,
- 437,
- -557,
- -775,
- -80,
- 395,
- 250,
- 59,
- 56,
- -66,
- -269,
- -182,
- 139,
- 257
-};
-/*
- tbd
-*/
-static const int16_t taps_fir_lpf_3K_1 = 66;
-static const int32_t gain_fir_lpf_3K_1 = 131072;
-static const int16_t coef_fir_lpf_3K_1[] = {
- 259,
- 58,
- -185,
- -437,
- -654,
- -793,
- -815,
- -696,
- -434,
- -48,
- 414,
- 886,
- 1284,
- 1523,
- 1529,
- 1254,
- 691,
- -117,
- -1078,
- -2049,
- -2854,
- -3303,
- -3220,
- -2472,
- -995,
- 1187,
- 3952,
- 7086,
- 10300,
- 13270,
- 15672,
- 17236,
- 17778,
- 17236,
- 15672,
- 13270,
- 10300,
- 7086,
- 3952,
- 1187,
- -995,
- -2472,
- -3220,
- -3303,
- -2854,
- -2049,
- -1078,
- -117,
- 691,
- 1254,
- 1529,
- 1523,
- 1284,
- 886,
- 414,
- -48,
- -434,
- -696,
- -815,
- -793,
- -654,
- -437,
- -185,
- 58,
- 259,
- 393
-};
-
-/**************************************************************
-Filter type: Low Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.250000 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_lpf_250_11_64 = 64;
-static const int32_t gain_fir_lpf_250_11_64 = 262144;
-static const int16_t coef_fir_lpf_250_11_64[] =
-{
- 366,
- -3,
- -418,
- -865,
- -1328,
- -1788,
- -2223,
- -2609,
- -2922,
- -3138,
- -3232,
- -3181,
- -2967,
- -2573,
- -1988,
- -1206,
- -228,
- 937,
- 2277,
- 3767,
- 5379,
- 7077,
- 8821,
- 10564,
- 12259,
- 13855,
- 15305,
- 16563,
- 17588,
- 18346,
- 18812,
- 18968,
- 18812,
- 18346,
- 17588,
- 16563,
- 15305,
- 13855,
- 12259,
- 10564,
- 8821,
- 7077,
- 5379,
- 3767,
- 2277,
- 937,
- -228,
- -1206,
- -1988,
- -2573,
- -2967,
- -3181,
- -3232,
- -3138,
- -2922,
- -2609,
- -2223,
- -1788,
- -1328,
- -865,
- -418,
- -3,
- 366,
- 680
-};
-
-// de-emphasis integrator 300 Hz with 8KS/s
-// a0, b1
-static const int16_t taps_int_lpf_300_1_2 = 2;
-static const int32_t gain_int_lpf_300_1_2 = 8182;
-static const int16_t coef_int_lpf_300_1_2[]={
-6878,
-25889
-};
-
-// pre-emphasis differentiator 4000 Hz with 8KS/s
-// a0,a1,b0,
-static const int16_t taps_int_hpf_4000_1_2 = 2;
-//static const int32_t gain_int_hpf_4000_1_2 = 16384; // per calculations
-static const int32_t gain_int_hpf_4000_1_2 = 13404; // hand tweaked for unity gain at 1KHz
-static const int16_t coef_int_hpf_4000_1_2[]={
-17610,
--17610,
-2454
-};
-
-
-
-
-/*
- ctcss decode filter
-*/
-/**************************************************************
-Filter type: Low Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.250000 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_lpf_250_9_66 = 66;
-static const int32_t gain_fir_lpf_250_9_66 = 262144;
-static const int16_t coef_fir_lpf_250_9_66[] =
-{
- 676,
- 364,
- -3,
- -415,
- -860,
--1320,
--1777,
--2209,
--2593,
--2904,
--3119,
--3212,
--3162,
--2949,
--2557,
--1975,
--1198,
- -226,
- 932,
- 2263,
- 3744,
- 5346,
- 7034,
- 8767,
-10499,
-12184,
-13770,
-15211,
-16462,
-17480,
-18234,
-18696,
-18852,
-18696,
-18234,
-17480,
-16462,
-15211,
-13770,
-12184,
-10499,
- 8767,
- 7034,
- 5346,
- 3744,
- 2263,
- 932,
- -226,
--1198,
--1975,
--2557,
--2949,
--3162,
--3212,
--3119,
--2904,
--2593,
--2209,
--1777,
--1320,
- -860,
- -415,
- -3,
- 364,
- 676,
- 927
-};
-/* *************************************************************
-Filter type: Low Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.215 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_lpf_215_9_88 = 88;
-static const int32_t gain_fir_lpf_215_9_88 = 524288;
-static const int16_t coef_fir_lpf_215_9_88[] = {
- 2038,
- 2049,
- 1991,
- 1859,
- 1650,
- 1363,
- 999,
- 562,
- 58,
- -502,
--1106,
--1739,
--2382,
--3014,
--3612,
--4153,
--4610,
--4959,
--5172,
--5226,
--5098,
--4769,
--4222,
--3444,
--2430,
--1176,
- 310,
- 2021,
- 3937,
- 6035,
- 8284,
-10648,
-13086,
-15550,
-17993,
-20363,
-22608,
-24677,
-26522,
-28099,
-29369,
-30299,
-30867,
-31058,
-30867,
-30299,
-29369,
-28099,
-26522,
-24677,
-22608,
-20363,
-17993,
-15550,
-13086,
-10648,
- 8284,
- 6035,
- 3937,
- 2021,
- 310,
--1176,
--2430,
--3444,
--4222,
--4769,
--5098,
--5226,
--5172,
--4959,
--4610,
--4153,
--3612,
--3014,
--2382,
--1739,
--1106,
- -502,
- 58,
- 562,
- 999,
- 1363,
- 1650,
- 1859,
- 1991,
- 2049,
- 2038,
- 1966
-};
-// end coef fir_lpf_215_9_88
-//
-/**************************************************************
-Filter type: High Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.300000 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_hpf_300_9_66 = 66;
-static const int32_t gain_fir_hpf_300_9_66 = 32768;
-static const int16_t coef_fir_hpf_300_9_66[] =
-{
- -141,
- -114,
- -77,
- -30,
- 23,
- 83,
- 147,
- 210,
- 271,
- 324,
- 367,
- 396,
- 407,
- 396,
- 362,
- 302,
- 216,
- 102,
- -36,
- -199,
- -383,
- -585,
- -798,
--1017,
--1237,
--1452,
--1653,
--1836,
--1995,
--2124,
--2219,
--2278,
-30463,
--2278,
--2219,
--2124,
--1995,
--1836,
--1653,
--1452,
--1237,
--1017,
- -798,
- -585,
- -383,
- -199,
- -36,
- 102,
- 216,
- 302,
- 362,
- 396,
- 407,
- 396,
- 367,
- 324,
- 271,
- 210,
- 147,
- 83,
- 23,
- -30,
- -77,
- -114,
- -141,
- -158
- };
-#endif /* !XPMR_COEF_H */
-/* end of file */
-
-
-
-
diff --git a/configure b/configure
index 5b792d57a..c1091113e 100755
--- a/configure
+++ b/configure
@@ -1,14 +1,14 @@
#! /bin/sh
-# From configure.ac Revision: 355621 .
+# From configure.ac Revision: 358622 .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for asterisk trunk.
+# Generated by GNU Autoconf 2.68 for asterisk trunk.
#
# Report bugs to <https://issues.asterisk.org>.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -94,6 +94,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -219,11 +220,18 @@ IFS=$as_save_IFS
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
@@ -322,7 +330,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
@@ -362,19 +370,19 @@ else
fi # as_fn_arith
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
- $as_echo "$as_me: error: $1" >&2
+ $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
@@ -536,7 +544,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -680,10 +688,6 @@ PBX_VORBIS
VORBIS_DIR
VORBIS_INCLUDE
VORBIS_LIB
-PBX_USB
-USB_DIR
-USB_INCLUDE
-USB_LIB
PBX_UNIXODBC
UNIXODBC_DIR
UNIXODBC_INCLUDE
@@ -1231,7 +1235,6 @@ with_timerfd
with_tinfo
with_tonezone
with_unixodbc
-with_usb
with_vorbis
with_vpb
with_x11
@@ -1316,8 +1319,9 @@ do
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -1362,7 +1366,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
+ as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1388,7 +1392,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
+ as_fn_error $? "invalid feature name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1592,7 +1596,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
+ as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1608,7 +1612,7 @@ do
ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
+ as_fn_error $? "invalid package name: $ac_useropt"
ac_useropt_orig=$ac_useropt
ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
case $ac_user_opts in
@@ -1638,8 +1642,8 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) as_fn_error "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information."
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
@@ -1647,7 +1651,7 @@ Try \`$0 --help' for more information."
# Reject names that are not valid shell variable names.
case $ac_envvar in #(
'' | [0-9]* | *[!_$as_cr_alnum]* )
- as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
esac
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
@@ -1657,7 +1661,7 @@ Try \`$0 --help' for more information."
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1665,13 +1669,13 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- as_fn_error "missing argument to $ac_option"
+ as_fn_error $? "missing argument to $ac_option"
fi
if test -n "$ac_unrecognized_opts"; then
case $enable_option_checking in
no) ;;
- fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
*) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
esac
fi
@@ -1694,7 +1698,7 @@ do
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1708,8 +1712,8 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
+ $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1724,9 +1728,9 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- as_fn_error "working directory cannot be determined"
+ as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- as_fn_error "pwd does not report name of working directory"
+ as_fn_error $? "pwd does not report name of working directory"
# Find the source files, if location was not specified.
@@ -1765,11 +1769,11 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1809,7 +1813,7 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
+ -q, --quiet, --silent do not print \`checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
@@ -1948,7 +1952,6 @@ Optional Packages:
--with-tinfo=PATH use Term Info files in PATH
--with-tonezone=PATH use tonezone files in PATH
--with-unixodbc=PATH use unixODBC files in PATH
- --with-usb=PATH use usb files in PATH
--with-vorbis=PATH use Vorbis files in PATH
--with-vpb=PATH use Voicetronix API files in PATH
--with-x11=PATH use X11 files in PATH
@@ -2034,9 +2037,9 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
asterisk configure trunk
-generated by GNU Autoconf 2.65
+generated by GNU Autoconf 2.68
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
@@ -2082,7 +2085,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -2108,7 +2111,7 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -2119,7 +2122,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -2132,10 +2135,10 @@ fi
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
@@ -2171,7 +2174,7 @@ if ac_fn_c_try_cpp "$LINENO"; then :
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -2194,17 +2197,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ------------------------------------------ ##
+( $as_echo "## ------------------------------------------ ##
## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
+## ------------------------------------------ ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
@@ -2213,7 +2214,7 @@ eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
@@ -2254,7 +2255,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -2268,7 +2269,7 @@ ac_fn_c_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2286,7 +2287,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
@@ -2323,7 +2324,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_compile
@@ -2349,7 +2350,7 @@ $as_echo "$ac_try_echo"; } >&5
mv -f conftest.er1 conftest.err
fi
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >/dev/null && {
+ test $ac_status = 0; } > conftest.i && {
test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
test ! -s conftest.err
}; then :
@@ -2360,7 +2361,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_cpp
@@ -2406,7 +2407,7 @@ fi
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -2419,7 +2420,7 @@ ac_fn_c_check_func ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2474,7 +2475,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
@@ -2487,7 +2488,7 @@ ac_fn_c_check_type ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
@@ -2528,7 +2529,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
@@ -2541,7 +2542,7 @@ ac_fn_c_check_member ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
$as_echo_n "checking for $2.$3... " >&6; }
-if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$4+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2585,7 +2586,7 @@ fi
eval ac_res=\$$4
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_member
@@ -2762,7 +2763,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
rm -f conftest.val
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_compute_int
@@ -2775,10 +2776,10 @@ rm -f conftest.val
ac_fn_cxx_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+ if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
@@ -2814,7 +2815,7 @@ if ac_fn_cxx_try_cpp "$LINENO"; then :
else
ac_header_preproc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }
@@ -2837,17 +2838,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( cat <<\_ASBOX
-## ------------------------------------------ ##
+( $as_echo "## ------------------------------------------ ##
## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
+## ------------------------------------------ ##"
) | sed "s/^/$as_me: WARNING: /" >&2
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
@@ -2856,7 +2855,7 @@ eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_header_mongrel
@@ -2901,7 +2900,7 @@ fi
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_link
@@ -2915,7 +2914,7 @@ ac_fn_cxx_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2933,7 +2932,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_cxx_check_header_compile
cat >config.log <<_ACEOF
@@ -2941,7 +2940,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by asterisk $as_me trunk, which was
-generated by GNU Autoconf 2.65. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -3051,11 +3050,9 @@ trap 'exit_status=$?
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ $as_echo "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
@@ -3089,11 +3086,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ $as_echo "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
@@ -3106,11 +3101,9 @@ _ASBOX
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
+ $as_echo "## ------------------- ##
## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
@@ -3124,11 +3117,9 @@ _ASBOX
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ $as_echo "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
cat confdefs.h
echo
@@ -3183,7 +3174,12 @@ _ACEOF
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
- ac_site_file1=$CONFIG_SITE
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
elif test "x$prefix" != xNONE; then
ac_site_file1=$prefix/share/config.site
ac_site_file2=$prefix/etc/config.site
@@ -3198,7 +3194,11 @@ do
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
fi
done
@@ -3278,7 +3278,7 @@ if $ac_cache_corrupted; then
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
@@ -3295,16 +3295,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# cross-compile macros
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
- for ac_t in install-sh install.sh shtool; do
- if test -f "$ac_dir/$ac_t"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/$ac_t -c"
- break 2
- fi
- done
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
done
if test -z "$ac_aux_dir"; then
- as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -3318,27 +3324,27 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then :
+if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
- as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -3356,14 +3362,14 @@ case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then :
+if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
@@ -3371,7 +3377,7 @@ fi
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -3393,16 +3399,22 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
ac_aux_dir=
for ac_dir in `pwd` "$srcdir"/`pwd`; do
- for ac_t in install-sh install.sh shtool; do
- if test -f "$ac_dir/$ac_t"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/$ac_t -c"
- break 2
- fi
- done
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
done
if test -z "$ac_aux_dir"; then
- as_fn_error "cannot find install-sh, install.sh, or shtool in \`pwd\` \"$srcdir\"/\`pwd\`" "$LINENO" 5
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \`pwd\` \"$srcdir\"/\`pwd\`" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -3448,7 +3460,7 @@ if test -n "$ac_tool_prefix"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -3492,7 +3504,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -3544,8 +3556,8 @@ fi
test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "no acceptable C compiler found in \$PATH
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3659,9 +3671,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "C compiler cannot create executables
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -3703,8 +3714,8 @@ done
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3761,9 +3772,9 @@ $as_echo "$ac_try_echo"; } >&5
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
+as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
+See \`config.log' for more details" "$LINENO" 5; }
fi
fi
fi
@@ -3774,7 +3785,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3814,8 +3825,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
@@ -3825,7 +3836,7 @@ OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -3862,7 +3873,7 @@ ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3940,7 +3951,7 @@ else
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
@@ -4049,7 +4060,7 @@ if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
+ if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
@@ -4079,7 +4090,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -4095,11 +4106,11 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -4138,7 +4149,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -4154,18 +4165,18 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
@@ -4177,7 +4188,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
@@ -4226,7 +4237,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_GREP"; then
- as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_GREP=$GREP
@@ -4240,7 +4251,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -4292,7 +4303,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
- as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
@@ -4307,7 +4318,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4424,8 +4435,7 @@ do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -4437,7 +4447,7 @@ done
ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
-if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
MINIX=yes
else
MINIX=
@@ -4459,7 +4469,7 @@ $as_echo "#define _MINIX 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+if ${ac_cv_safe_to_define___extensions__+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4655,7 +4665,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}uname; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNAME+set}" = set; then :
+if ${ac_cv_path_UNAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $UNAME in
@@ -4698,7 +4708,7 @@ if test -z "$ac_cv_path_UNAME"; then
set dummy uname; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_UNAME+set}" = set; then :
+if ${ac_cv_path_ac_pt_UNAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_UNAME in
@@ -4765,7 +4775,7 @@ then
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -4805,7 +4815,7 @@ if test -z "$ac_cv_prog_CC"; then
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -4857,7 +4867,7 @@ fi
set dummy ${ac_tool_prefix}g++; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then :
+if ${ac_cv_prog_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CXX"; then
@@ -4897,7 +4907,7 @@ if test -z "$ac_cv_prog_CXX"; then
set dummy g++; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
@@ -4949,7 +4959,7 @@ fi
set dummy ${ac_tool_prefix}ld; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LD+set}" = set; then :
+if ${ac_cv_prog_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$LD"; then
@@ -4989,7 +4999,7 @@ if test -z "$ac_cv_prog_LD"; then
set dummy ld; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LD+set}" = set; then :
+if ${ac_cv_prog_ac_ct_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_LD"; then
@@ -5041,7 +5051,7 @@ fi
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$RANLIB"; then
@@ -5081,7 +5091,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
set dummy ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_RANLIB"; then
@@ -5147,7 +5157,7 @@ if test -z "$CXX"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then :
+if ${ac_cv_prog_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CXX"; then
@@ -5191,7 +5201,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
@@ -5269,7 +5279,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5306,7 +5316,7 @@ ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then :
+if ${ac_cv_prog_cxx_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
@@ -5400,7 +5410,7 @@ if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
+ if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
@@ -5430,7 +5440,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -5446,11 +5456,11 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -5489,7 +5499,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -5505,18 +5515,18 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
@@ -5533,7 +5543,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
if test -z "$CXXCPP"; then
- if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+ if ${ac_cv_prog_CXXCPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CXXCPP needs to be expanded
@@ -5563,7 +5573,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -5579,11 +5589,11 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
break
fi
@@ -5622,7 +5632,7 @@ else
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
@@ -5638,18 +5648,18 @@ else
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.i conftest.err conftest.$ac_ext
if $ac_preproc_ok; then :
else
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
fi
ac_ext=c
@@ -5662,7 +5672,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# the developers regenerating the configure script don't have to install libtool.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then :
+if ${ac_cv_path_SED+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -5717,7 +5727,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_SED"; then
- as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
fi
else
ac_cv_path_SED=$SED
@@ -5731,7 +5741,7 @@ $as_echo "$ac_cv_path_SED" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_prog_egrep+set}" = set; then :
+if ${ac_cv_prog_egrep+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | (grep -E '(a|b)') >/dev/null 2>&1
@@ -5791,7 +5801,7 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
$as_echo_n "checking for non-GNU ld... " >&6; }
fi
-if test "${lt_cv_path_LD+set}" = set; then :
+if ${lt_cv_path_LD+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$LD"; then
@@ -5828,10 +5838,10 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
-test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+if ${lt_cv_prog_gnu_ld+:} false; then :
$as_echo_n "(cached) " >&6
else
# I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -5855,7 +5865,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -5908,7 +5918,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -6000,7 +6010,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
+if ${ac_cv_prog_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$RANLIB"; then
@@ -6040,7 +6050,7 @@ if test -z "$ac_cv_prog_RANLIB"; then
set dummy ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_RANLIB"; then
@@ -6089,7 +6099,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU make" >&5
$as_echo_n "checking for GNU make... " >&6; }
-if test "${ac_cv_GNU_MAKE+set}" = set; then :
+if ${ac_cv_GNU_MAKE+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_GNU_MAKE='Not Found' ;
@@ -6109,7 +6119,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_GNU_MAKE" >&5
$as_echo "$ac_cv_GNU_MAKE" >&6; } ;
if test "x$ac_cv_GNU_MAKE" = "xNot Found" ; then
- as_fn_error "*** Please install GNU make. It is required to build Asterisk!" "$LINENO" 5
+ as_fn_error $? "*** Please install GNU make. It is required to build Asterisk!" "$LINENO" 5
exit 1
fi
GNU_MAKE=$ac_cv_GNU_MAKE
@@ -6117,7 +6127,7 @@ GNU_MAKE=$ac_cv_GNU_MAKE
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -6169,7 +6179,7 @@ esac
done
IFS=$as_save_IFS
if test -z "$ac_cv_path_EGREP"; then
- as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
fi
else
ac_cv_path_EGREP=$EGREP
@@ -6190,7 +6200,7 @@ if test -n "$ac_tool_prefix"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$STRIP"; then
@@ -6234,7 +6244,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_STRIP"; then
@@ -6290,7 +6300,7 @@ if test -n "$ac_tool_prefix"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then :
+if ${ac_cv_prog_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AR"; then
@@ -6334,7 +6344,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
@@ -6394,7 +6404,7 @@ fi
set dummy bison; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BISON+set}" = set; then :
+if ${ac_cv_path_BISON+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BISON in
@@ -6435,7 +6445,7 @@ fi
set dummy cmp; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CMP+set}" = set; then :
+if ${ac_cv_path_CMP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CMP in
@@ -6476,7 +6486,7 @@ fi
set dummy flex; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FLEX+set}" = set; then :
+if ${ac_cv_path_FLEX+:} false; then :
$as_echo_n "(cached) " >&6
else
case $FLEX in
@@ -6517,7 +6527,7 @@ fi
set dummy grep; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $GREP in
@@ -6558,7 +6568,7 @@ fi
set dummy find; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FIND+set}" = set; then :
+if ${ac_cv_path_FIND+:} false; then :
$as_echo_n "(cached) " >&6
else
case $FIND in
@@ -6599,7 +6609,7 @@ fi
set dummy compress; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COMPRESS+set}" = set; then :
+if ${ac_cv_path_COMPRESS+:} false; then :
$as_echo_n "(cached) " >&6
else
case $COMPRESS in
@@ -6640,7 +6650,7 @@ fi
set dummy basename; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BASENAME+set}" = set; then :
+if ${ac_cv_path_BASENAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $BASENAME in
@@ -6681,7 +6691,7 @@ fi
set dummy dirname; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIRNAME+set}" = set; then :
+if ${ac_cv_path_DIRNAME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $DIRNAME in
@@ -6722,7 +6732,7 @@ fi
set dummy sh; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SHELL+set}" = set; then :
+if ${ac_cv_path_SHELL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SHELL in
@@ -6763,7 +6773,7 @@ fi
set dummy ln; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LN+set}" = set; then :
+if ${ac_cv_path_LN+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LN in
@@ -6804,7 +6814,7 @@ fi
set dummy dot; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DOT+set}" = set; then :
+if ${ac_cv_path_DOT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $DOT in
@@ -6845,7 +6855,7 @@ fi
set dummy wget; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WGET+set}" = set; then :
+if ${ac_cv_path_WGET+:} false; then :
$as_echo_n "(cached) " >&6
else
case $WGET in
@@ -6886,7 +6896,7 @@ fi
set dummy curl; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CURL+set}" = set; then :
+if ${ac_cv_path_CURL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CURL in
@@ -6927,7 +6937,7 @@ fi
set dummy rubber; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RUBBER+set}" = set; then :
+if ${ac_cv_path_RUBBER+:} false; then :
$as_echo_n "(cached) " >&6
else
case $RUBBER in
@@ -6968,7 +6978,7 @@ fi
set dummy catdvi; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CATDVI+set}" = set; then :
+if ${ac_cv_path_CATDVI+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CATDVI in
@@ -7009,7 +7019,7 @@ fi
set dummy kpsewhich; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_KPATHSEA+set}" = set; then :
+if ${ac_cv_path_KPATHSEA+:} false; then :
$as_echo_n "(cached) " >&6
else
case $KPATHSEA in
@@ -7050,7 +7060,7 @@ fi
set dummy xmllint; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XMLLINT+set}" = set; then :
+if ${ac_cv_path_XMLLINT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XMLLINT in
@@ -7091,7 +7101,7 @@ fi
set dummy xmlstarlet; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XMLSTARLET+set}" = set; then :
+if ${ac_cv_path_XMLSTARLET+:} false; then :
$as_echo_n "(cached) " >&6
else
case $XMLSTARLET in
@@ -7137,7 +7147,7 @@ else
set dummy fetch; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FETCH+set}" = set; then :
+if ${ac_cv_path_FETCH+:} false; then :
$as_echo_n "(cached) " >&6
else
case $FETCH in
@@ -7182,7 +7192,7 @@ fi
set dummy ldconfig; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LDCONFIG+set}" = set; then :
+if ${ac_cv_path_LDCONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $LDCONFIG in
@@ -7223,7 +7233,7 @@ fi
set dummy sha1sum; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SHA1SUM+set}" = set; then :
+if ${ac_cv_path_SHA1SUM+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SHA1SUM in
@@ -7264,7 +7274,7 @@ fi
set dummy openssl; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_OPENSSL+set}" = set; then :
+if ${ac_cv_path_OPENSSL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $OPENSSL in
@@ -7304,7 +7314,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison that supports parse-param" >&5
$as_echo_n "checking for bison that supports parse-param... " >&6; }
-if test "${ac_cv_path_BISON2+set}" = set; then :
+if ${ac_cv_path_BISON2+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -7358,7 +7368,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}soxmix; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_SOXMIX+set}" = set; then :
+if ${ac_cv_prog_SOXMIX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$SOXMIX"; then
@@ -7398,7 +7408,7 @@ if test -z "$ac_cv_prog_SOXMIX"; then
set dummy soxmix; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_SOXMIX+set}" = set; then :
+if ${ac_cv_prog_ac_ct_SOXMIX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_SOXMIX"; then
@@ -7457,7 +7467,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_MD5+set}" = set; then :
+if ${ac_cv_prog_MD5+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$MD5"; then
@@ -7623,7 +7633,7 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; }
set dummy pthread-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_acx_pthread_config+set}" = set; then :
+if ${ac_cv_prog_acx_pthread_config+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$acx_pthread_config"; then
@@ -7779,7 +7789,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then :
+if ${ac_cv_prog_PTHREAD_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PTHREAD_CC"; then
@@ -7865,7 +7875,7 @@ if test "${enable_dev_mode+set}" = set; then :
AST_DEVMODE=yes
AST_DEVMODE_STRICT=yes
;;
- *) as_fn_error "bad value ${enableval} for --enable-dev-mode" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value ${enableval} for --enable-dev-mode" "$LINENO" 5 ;;
esac
fi
@@ -7879,7 +7889,7 @@ if test "${enable_coverage+set}" = set; then :
enableval=$enable_coverage; case "${enableval}" in
y|ye|yes) AST_CODE_COVERAGE=yes ;;
n|no) AST_CODE_COVERAGE=no ;;
- *) as_fn_error "bad value ${enableval} for --enable-coverage" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value ${enableval} for --enable-coverage" "$LINENO" 5 ;;
esac
fi
@@ -8736,7 +8746,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
@@ -8784,7 +8794,7 @@ done
set dummy curl-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path__libcurl_config+set}" = set; then :
+if ${ac_cv_path__libcurl_config+:} false; then :
$as_echo_n "(cached) " >&6
else
case $_libcurl_config in
@@ -8826,7 +8836,7 @@ fi
set dummy curl-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path__libcurl_config+set}" = set; then :
+if ${ac_cv_path__libcurl_config+:} false; then :
$as_echo_n "(cached) " >&6
else
case $_libcurl_config in
@@ -8867,7 +8877,7 @@ fi
if test x$_libcurl_config != "x" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the version of libcurl" >&5
$as_echo_n "checking for the version of libcurl... " >&6; }
-if test "${libcurl_cv_lib_curl_version+set}" = set; then :
+if ${libcurl_cv_lib_curl_version+:} false; then :
$as_echo_n "(cached) " >&6
else
libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'`
@@ -8881,7 +8891,7 @@ $as_echo "$libcurl_cv_lib_curl_version" >&6; }
if test $_libcurl_wanted -gt 0 ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= version 7.10.1" >&5
$as_echo_n "checking for libcurl >= version 7.10.1... " >&6; }
-if test "${libcurl_cv_lib_version_ok+set}" = set; then :
+if ${libcurl_cv_lib_version_ok+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -8935,7 +8945,7 @@ $as_echo "$libcurl_cv_lib_version_ok" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcurl is usable" >&5
$as_echo_n "checking whether libcurl is usable... " >&6; }
-if test "${libcurl_cv_lib_curl_usable+set}" = set; then :
+if ${libcurl_cv_lib_curl_usable+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -8994,7 +9004,7 @@ $as_echo "$libcurl_cv_lib_curl_usable" >&6; }
LIBS="$LIBS $CURL_LIB"
ac_fn_c_check_func "$LINENO" "curl_free" "ac_cv_func_curl_free"
-if test "x$ac_cv_func_curl_free" = x""yes; then :
+if test "x$ac_cv_func_curl_free" = xyes; then :
else
@@ -10623,38 +10633,6 @@ fi
- USB_DESCRIP="usb"
- USB_OPTION="usb"
- PBX_USB=0
-
-# Check whether --with-usb was given.
-if test "${with_usb+set}" = set; then :
- withval=$with_usb;
- case ${withval} in
- n|no)
- USE_USB=no
- # -1 is a magic value used by menuselect to know that the package
- # was disabled, other than 'not found'
- PBX_USB=-1
- ;;
- y|ye|yes)
- ac_mandatory_list="${ac_mandatory_list} USB"
- ;;
- *)
- USB_DIR="${withval}"
- ac_mandatory_list="${ac_mandatory_list} USB"
- ;;
- esac
-
-fi
-
-
-
-
-
-
-
-
VORBIS_DESCRIP="Vorbis"
VORBIS_OPTION="vorbis"
PBX_VORBIS=0
@@ -10786,11 +10764,22 @@ fi
# check for basic system features and functionality before
# checking for package libraries
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
$as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then :
+if ${ac_cv_working_alloca_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -10823,7 +10812,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
$as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then :
+if ${ac_cv_func_alloca_works+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -10842,7 +10831,7 @@ else
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
+void *alloca (size_t);
# endif
# endif
# endif
@@ -10886,7 +10875,7 @@ $as_echo "#define C_ALLOCA 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then :
+if ${ac_cv_os_cray+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -10913,8 +10902,7 @@ if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define CRAY_STACKSEG_END $ac_func
@@ -10928,7 +10916,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
$as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then :
+if ${ac_cv_c_stack_direction+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -10981,7 +10969,7 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Header+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11008,8 +10996,7 @@ fi
eval ac_res=\$$as_ac_Header
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
_ACEOF
@@ -11022,7 +11009,7 @@ done
if test $ac_header_dirent = dirent.h; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11056,11 +11043,11 @@ for ac_lib in '' dir; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_opendir+set}" = set; then :
+ if ${ac_cv_search_opendir+:} false; then :
break
fi
done
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
@@ -11079,7 +11066,7 @@ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
$as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11113,11 +11100,11 @@ for ac_lib in '' x; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_opendir+set}" = set; then :
+ if ${ac_cv_search_opendir+:} false; then :
break
fi
done
-if test "${ac_cv_search_opendir+set}" = set; then :
+if ${ac_cv_search_opendir+:} false; then :
else
ac_cv_search_opendir=no
@@ -11137,7 +11124,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11249,7 +11236,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then :
+if ${ac_cv_header_sys_wait_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -11292,8 +11279,7 @@ for ac_header in arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h mall
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -11324,7 +11310,7 @@ if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
$as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -11359,8 +11345,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_TERMCAP_FOUND=yes
else
AST_TERMCAP_FOUND=no
@@ -11383,7 +11368,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
+if test "x$ac_cv_header_" = xyes; then :
TERMCAP_HEADER_FOUND=1
else
TERMCAP_HEADER_FOUND=0
@@ -11429,7 +11414,7 @@ if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
$as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -11464,8 +11449,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_TINFO_FOUND=yes
else
AST_TINFO_FOUND=no
@@ -11488,7 +11472,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
+if test "x$ac_cv_header_" = xyes; then :
TINFO_HEADER_FOUND=1
else
TINFO_HEADER_FOUND=0
@@ -11534,7 +11518,7 @@ if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcurses" >&5
$as_echo_n "checking for ${pbxfuncname} in -lcurses... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -11569,8 +11553,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_CURSES_FOUND=yes
else
AST_CURSES_FOUND=no
@@ -11593,7 +11576,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
-if test "x$ac_cv_header_curses_h" = x""yes; then :
+if test "x$ac_cv_header_curses_h" = xyes; then :
CURSES_HEADER_FOUND=1
else
CURSES_HEADER_FOUND=0
@@ -11639,7 +11622,7 @@ if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lncurses" >&5
$as_echo_n "checking for ${pbxfuncname} in -lncurses... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -11674,8 +11657,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_NCURSES_FOUND=yes
else
AST_NCURSES_FOUND=no
@@ -11698,7 +11680,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
-if test "x$ac_cv_header_curses_h" = x""yes; then :
+if test "x$ac_cv_header_curses_h" = xyes; then :
NCURSES_HEADER_FOUND=1
else
NCURSES_HEADER_FOUND=0
@@ -11735,7 +11717,7 @@ elif test "x$CURSES_LIB" != "x" ; then
elif test "x$NCURSES_LIB" != "x" ; then
EDITLINE_LIB="$NCURSES_LIB"
else
- as_fn_error "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5
+ as_fn_error $? "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5
fi
@@ -11745,7 +11727,7 @@ if test "${enable_xmldoc+set}" = set; then :
enableval=$enable_xmldoc; case "${enableval}" in
y|ye|yes) disable_xmldoc=no ;;
n|no) disable_xmldoc=yes ;;
- *) as_fn_error "bad value ${enableval} for --disable-xmldoc" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value ${enableval} for --disable-xmldoc" "$LINENO" 5 ;;
esac
else
disable_xmldoc=no
@@ -11761,7 +11743,7 @@ if test "${disable_xmldoc}" != "yes"; then
set dummy ${ac_tool_prefix}xml2-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_LIBXML2+set}" = set; then :
+if ${ac_cv_path_CONFIG_LIBXML2+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_LIBXML2 in
@@ -11805,7 +11787,7 @@ if test -z "$ac_cv_path_CONFIG_LIBXML2"; then
set dummy xml2-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_LIBXML2+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_LIBXML2+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_LIBXML2 in
@@ -11920,7 +11902,7 @@ fi
for ac_header in xlocale.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" "$ac_includes_default"
-if test "x$ac_cv_header_xlocale_h" = x""yes; then :
+if test "x$ac_cv_header_xlocale_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_XLOCALE_H 1
_ACEOF
@@ -11934,8 +11916,7 @@ for ac_header in winsock.h winsock2.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -11946,7 +11927,7 @@ done
ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_poll_h" = x""yes; then :
+if test "x$ac_cv_header_sys_poll_h" = xyes; then :
else
@@ -11965,7 +11946,7 @@ if test "$enable_largefile" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+if ${ac_cv_sys_largefile_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_sys_largefile_CC=no
@@ -12016,7 +11997,7 @@ $as_echo "$ac_cv_sys_largefile_CC" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+if ${ac_cv_sys_file_offset_bits+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
@@ -12085,7 +12066,7 @@ rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then :
+if ${ac_cv_sys_large_files+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
@@ -12158,7 +12139,7 @@ fi
# Checks for typedefs, structures, and compiler characteristics.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then :
+if ${ac_cv_header_stdbool_h+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12190,7 +12171,7 @@ else
char b[false == 0 ? 1 : -1];
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
char d[(bool) 0.5 == true ? 1 : -1];
- bool e = &s;
+ /* See body of main program for 'e'. */
char f[(_Bool) 0.0 == false ? 1 : -1];
char g[true];
char h[sizeof (_Bool)];
@@ -12201,25 +12182,6 @@ else
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
-# if defined __xlc__ || defined __GNUC__
- /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
- reported by James Lemley on 2005-10-05; see
- http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
- This test is not quite right, since xlc is allowed to
- reject this program, as the initializer for xlcbug is
- not one of the forms that C requires support for.
- However, doing the test right would require a runtime
- test, and that would make cross-compilation harder.
- Let us hope that IBM fixes the xlc bug, and also adds
- support for this kind of constant expression. In the
- meantime, this test will reject xlc, which is OK, since
- our stdbool.h substitute should suffice. We also test
- this with GCC, where it should work, to detect more
- quickly whether someone messes up the test in the
- future. */
- char digs[] = "0123456789";
- int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
-# endif
/* Catch a bug in an HP-UX C compiler. See
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
@@ -12231,6 +12193,7 @@ int
main ()
{
+ bool e = &s;
*pq |= q;
*pq |= ! q;
/* Refer to every declared value, to avoid compiler optimizations. */
@@ -12251,7 +12214,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
$as_echo "$ac_cv_header_stdbool_h" >&6; }
ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = x""yes; then :
+if test "x$ac_cv_type__Bool" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
@@ -12268,7 +12231,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12348,7 +12311,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if test "${ac_cv_type_uid_t+set}" = set; then :
+if ${ac_cv_type_uid_t+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12378,7 +12341,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
$as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then :
+if ${ac_cv_c_inline+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_c_inline=no
@@ -12421,7 +12384,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5
$as_echo_n "checking for long double with more range or precision than double... " >&6; }
-if test "${ac_cv_type_long_double_wider+set}" = set; then :
+if ${ac_cv_type_long_double_wider+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12470,7 +12433,7 @@ $as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
-if test "x$ac_cv_type_mode_t" = x""yes; then :
+if test "x$ac_cv_type_mode_t" = xyes; then :
else
@@ -12481,7 +12444,7 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = x""yes; then :
+if test "x$ac_cv_type_off_t" = xyes; then :
else
@@ -12492,7 +12455,7 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
-if test "x$ac_cv_type_pid_t" = x""yes; then :
+if test "x$ac_cv_type_pid_t" = xyes; then :
else
@@ -12503,7 +12466,7 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
else
@@ -12514,7 +12477,7 @@ _ACEOF
fi
ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
-if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then :
+if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
@@ -12526,7 +12489,7 @@ fi
ac_fn_c_check_member "$LINENO" "struct ucred" "uid" "ac_cv_member_struct_ucred_uid" "#include <sys/types.h>
#include <sys/socket.h>
"
-if test "x$ac_cv_member_struct_ucred_uid" = x""yes; then :
+if test "x$ac_cv_member_struct_ucred_uid" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_UCRED_UID 1
@@ -12537,7 +12500,7 @@ fi
ac_fn_c_check_member "$LINENO" "struct ucred" "cr_uid" "ac_cv_member_struct_ucred_cr_uid" "#include <sys/types.h>
#include <sys/socket.h>
"
-if test "x$ac_cv_member_struct_ucred_cr_uid" = x""yes; then :
+if test "x$ac_cv_member_struct_ucred_cr_uid" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_UCRED_CR_UID 1
@@ -12548,7 +12511,7 @@ fi
ac_fn_c_check_member "$LINENO" "struct sockpeercred" "uid" "ac_cv_member_struct_sockpeercred_uid" "#include <sys/types.h>
#include <sys/socket.h>
"
-if test "x$ac_cv_member_struct_sockpeercred_uid" = x""yes; then :
+if test "x$ac_cv_member_struct_sockpeercred_uid" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_SOCKPEERCRED_UID 1
@@ -12559,7 +12522,7 @@ fi
ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_ifru.ifru_hwaddr" "ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" "#include <net/if.h>
"
-if test "x$ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" = x""yes; then :
+if test "x$ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR 1
@@ -12570,7 +12533,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then :
+if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12605,7 +12568,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if test "${ac_cv_struct_tm+set}" = set; then :
+if ${ac_cv_struct_tm+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12640,7 +12603,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
$as_echo_n "checking for working volatile... " >&6; }
-if test "${ac_cv_c_volatile+set}" = set; then :
+if ${ac_cv_c_volatile+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12673,7 +12636,7 @@ $as_echo "#define volatile /**/" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
-if test "x$ac_cv_type_ptrdiff_t" = x""yes; then :
+if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PTRDIFF_T 1
@@ -12687,7 +12650,7 @@ fi
for ac_header in unistd.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
-if test "x$ac_cv_header_unistd_h" = x""yes; then :
+if test "x$ac_cv_header_unistd_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UNISTD_H 1
_ACEOF
@@ -12698,7 +12661,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
$as_echo_n "checking for working chown... " >&6; }
-if test "${ac_cv_func_chown_works+set}" = set; then :
+if ${ac_cv_func_chown_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -12751,7 +12714,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5
$as_echo_n "checking whether closedir returns void... " >&6; }
-if test "${ac_cv_func_closedir_void+set}" = set; then :
+if ${ac_cv_func_closedir_void+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -12793,7 +12756,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5
$as_echo_n "checking for error_at_line... " >&6; }
-if test "${ac_cv_lib_error_at_line+set}" = set; then :
+if ${ac_cv_lib_error_at_line+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -12829,7 +12792,7 @@ fi
for ac_header in vfork.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
-if test "x$ac_cv_header_vfork_h" = x""yes; then :
+if test "x$ac_cv_header_vfork_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_VFORK_H 1
_ACEOF
@@ -12842,8 +12805,7 @@ for ac_func in fork vfork
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -12854,7 +12816,7 @@ done
if test "x$ac_cv_func_fork" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
$as_echo_n "checking for working fork... " >&6; }
-if test "${ac_cv_func_fork_works+set}" = set; then :
+if ${ac_cv_func_fork_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -12907,7 +12869,7 @@ ac_cv_func_vfork_works=$ac_cv_func_vfork
if test "x$ac_cv_func_vfork" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
$as_echo_n "checking for working vfork... " >&6; }
-if test "${ac_cv_func_vfork_works+set}" = set; then :
+if ${ac_cv_func_vfork_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -13044,7 +13006,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_source+set}" = set; then :
+if ${ac_cv_sys_largefile_source+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
@@ -13113,7 +13075,7 @@ fi
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
$as_echo_n "checking whether $CC needs -traditional... " >&6; }
-if test "${ac_cv_prog_gcc_traditional+set}" = set; then :
+if ${ac_cv_prog_gcc_traditional+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_pattern="Autoconf.*'x'"
@@ -13158,7 +13120,7 @@ fi
# AC_FUNC_REALLOC
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
$as_echo_n "checking for working memcmp... " >&6; }
-if test "${ac_cv_func_memcmp_working+set}" = set; then :
+if ${ac_cv_func_memcmp_working+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -13226,8 +13188,7 @@ do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -13246,7 +13207,7 @@ done
for ac_func in getpagesize
do :
ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
-if test "x$ac_cv_func_getpagesize" = x""yes; then :
+if test "x$ac_cv_func_getpagesize" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GETPAGESIZE 1
_ACEOF
@@ -13256,7 +13217,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
$as_echo_n "checking for working mmap... " >&6; }
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then :
+if ${ac_cv_func_mmap_fixed_mapped+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -13424,8 +13385,7 @@ for ac_header in sys/select.h sys/socket.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
@@ -13436,7 +13396,7 @@ done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
$as_echo_n "checking types of arguments for select... " >&6; }
-if test "${ac_cv_func_select_args+set}" = set; then :
+if ${ac_cv_func_select_args+:} false; then :
$as_echo_n "(cached) " >&6
else
for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
@@ -13470,7 +13430,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
done
# Provide a safe default value.
-: ${ac_cv_func_select_args='int,int *,struct timeval *'}
+: "${ac_cv_func_select_args=int,int *,struct timeval *}"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
@@ -13496,7 +13456,7 @@ _ACEOF
rm -f conftest*
-if test "${ac_cv_func_setvbuf_reversed+set}" = set; then :
+if ${ac_cv_func_setvbuf_reversed+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_func_setvbuf_reversed=no
@@ -13505,7 +13465,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then :
+if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -13538,7 +13498,7 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
-if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
+if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
$as_echo_n "(cached) " >&6
else
rm -f conftest.sym conftest.file
@@ -13600,7 +13560,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
$as_echo_n "checking whether stat accepts an empty string... " >&6; }
-if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
+if ${ac_cv_func_stat_empty_string_bug+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -13646,7 +13606,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5
$as_echo_n "checking for working strcoll... " >&6; }
-if test "${ac_cv_func_strcoll_works+set}" = set; then :
+if ${ac_cv_func_strcoll_works+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -13686,7 +13646,7 @@ fi
for ac_func in strftime
do :
ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
-if test "x$ac_cv_func_strftime" = x""yes; then :
+if test "x$ac_cv_func_strftime" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRFTIME 1
_ACEOF
@@ -13695,7 +13655,7 @@ else
# strftime is in -lintl on SCO UNIX.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
$as_echo_n "checking for strftime in -lintl... " >&6; }
-if test "${ac_cv_lib_intl_strftime+set}" = set; then :
+if ${ac_cv_lib_intl_strftime+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -13729,7 +13689,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
$as_echo "$ac_cv_lib_intl_strftime" >&6; }
-if test "x$ac_cv_lib_intl_strftime" = x""yes; then :
+if test "x$ac_cv_lib_intl_strftime" = xyes; then :
$as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
LIBS="-lintl $LIBS"
@@ -13738,13 +13698,17 @@ fi
fi
done
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5
$as_echo_n "checking for working strnlen... " >&6; }
-if test "${ac_cv_func_strnlen_working+set}" = set; then :
+if ${ac_cv_func_strnlen_working+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
- ac_cv_func_strnlen_working=no
+ # Guess no on AIX systems, yes otherwise.
+ case "$host_os" in
+ aix*) ac_cv_func_strnlen_working=no;;
+ *) ac_cv_func_strnlen_working=yes;;
+ esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -13793,7 +13757,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5
$as_echo_n "checking for working strtod... " >&6; }
-if test "${ac_cv_func_strtod+set}" = set; then :
+if ${ac_cv_func_strtod+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "$cross_compiling" = yes; then :
@@ -13852,14 +13816,14 @@ if test $ac_cv_func_strtod = no; then
esac
ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
-if test "x$ac_cv_func_pow" = x""yes; then :
+if test "x$ac_cv_func_pow" = xyes; then :
fi
if test $ac_cv_func_pow = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5
$as_echo_n "checking for pow in -lm... " >&6; }
-if test "${ac_cv_lib_m_pow+set}" = set; then :
+if ${ac_cv_lib_m_pow+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -13893,7 +13857,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5
$as_echo "$ac_cv_lib_m_pow" >&6; }
-if test "x$ac_cv_lib_m_pow" = x""yes; then :
+if test "x$ac_cv_lib_m_pow" = xyes; then :
POW_LIB=-lm
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5
@@ -13909,7 +13873,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5
$as_echo_n "checking whether utime accepts a null argument... " >&6; }
-if test "${ac_cv_func_utime_null+set}" = set; then :
+if ${ac_cv_func_utime_null+:} false; then :
$as_echo_n "(cached) " >&6
else
rm -f conftest.data; >conftest.data
@@ -13959,13 +13923,13 @@ rm -f conftest.data
for ac_func in vprintf
do :
ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
-if test "x$ac_cv_func_vprintf" = x""yes; then :
+if test "x$ac_cv_func_vprintf" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_VPRINTF 1
_ACEOF
ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
-if test "x$ac_cv_func__doprnt" = x""yes; then :
+if test "x$ac_cv_func__doprnt" = xyes; then :
$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
@@ -13979,8 +13943,7 @@ for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -13993,7 +13956,7 @@ done
# so that AC_CHECK_FUNCS can detect functions in that library.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
$as_echo_n "checking for sqrt in -lm... " >&6; }
-if test "${ac_cv_lib_m_sqrt+set}" = set; then :
+if ${ac_cv_lib_m_sqrt+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -14027,7 +13990,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5
$as_echo "$ac_cv_lib_m_sqrt" >&6; }
-if test "x$ac_cv_lib_m_sqrt" = x""yes; then :
+if test "x$ac_cv_lib_m_sqrt" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBM 1
_ACEOF
@@ -14041,8 +14004,7 @@ for ac_func in exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint e
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -14058,8 +14020,7 @@ if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -14160,7 +14121,7 @@ LDFLAGS=${old_LDFLAGS}
rm -f conftest.dynamics
ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_poll_h" = x""yes; then :
+if test "x$ac_cv_header_sys_poll_h" = xyes; then :
HAS_POLL=1
$as_echo "#define HAVE_SYS_POLL_H 1" >>confdefs.h
@@ -14174,7 +14135,7 @@ if test "${enable_internal_poll+set}" = set; then :
enableval=$enable_internal_poll; case "${enableval}" in
y|ye|yes) HAS_POLL="";;
n|no) HAS_POLL="${HAS_POLL}" ;;
- *) as_fn_error "bad value ${enableval} for --enable-internal-poll" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value ${enableval} for --enable-internal-poll" "$LINENO" 5 ;;
esac
fi
@@ -14185,7 +14146,7 @@ if test "${enable_asteriskssl+set}" = set; then :
enableval=$enable_asteriskssl; case "${enableval}" in
y|ye|yes) AST_ASTERISKSSL=yes ;;
n|no) AST_ASTERISKSSL=no ;;
- *) as_fn_error "bad value ${enableval} for --disable-asteriskssl" "$LINENO" 5 ;;
+ *) as_fn_error $? "bad value ${enableval} for --disable-asteriskssl" "$LINENO" 5 ;;
esac
else
AST_ASTERISKSSL=yes
@@ -14199,8 +14160,7 @@ for ac_func in funopen fopencookie
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
@@ -14212,7 +14172,7 @@ done
for ac_func in inet_aton
do :
ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton"
-if test "x$ac_cv_func_inet_aton" = x""yes; then :
+if test "x$ac_cv_func_inet_aton" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_INET_ATON 1
_ACEOF
@@ -14252,7 +14212,7 @@ rm -f core conftest.err conftest.$ac_objext \
# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname_r" >&5
$as_echo_n "checking for library containing gethostbyname_r... " >&6; }
-if test "${ac_cv_search_gethostbyname_r+set}" = set; then :
+if ${ac_cv_search_gethostbyname_r+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -14286,11 +14246,11 @@ for ac_lib in '' socket nsl; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_gethostbyname_r+set}" = set; then :
+ if ${ac_cv_search_gethostbyname_r+:} false; then :
break
fi
done
-if test "${ac_cv_search_gethostbyname_r+set}" = set; then :
+if ${ac_cv_search_gethostbyname_r+:} false; then :
else
ac_cv_search_gethostbyname_r=no
@@ -14364,7 +14324,7 @@ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_fn_c_check_header_mongrel "$LINENO" "byteswap.h" "ac_cv_header_byteswap_h" "$ac_includes_default"
-if test "x$ac_cv_header_byteswap_h" = x""yes; then :
+if test "x$ac_cv_header_byteswap_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_BYTESWAP_H 1
@@ -14432,11 +14392,11 @@ if test "${cross_compiling}" = "no";
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
$as_echo_n "checking for /dev/urandom... " >&6; }
-if test "${ac_cv_file__dev_urandom+set}" = set; then :
+if ${ac_cv_file__dev_urandom+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
- as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/urandom"; then
ac_cv_file__dev_urandom=yes
else
@@ -14445,7 +14405,7 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_urandom" >&5
$as_echo "$ac_cv_file__dev_urandom" >&6; }
-if test "x$ac_cv_file__dev_urandom" = x""yes; then :
+if test "x$ac_cv_file__dev_urandom" = xyes; then :
$as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h
@@ -14842,7 +14802,7 @@ rm -f core conftest.err conftest.$ac_objext \
for ac_header in sys/thr.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "sys/thr.h" "ac_cv_header_sys_thr_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_thr_h" = x""yes; then :
+if test "x$ac_cv_header_sys_thr_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SYS_THR_H 1
_ACEOF
@@ -14974,8 +14934,8 @@ if test "${ac_cv_have_variable_fdset}x" = "0x"; then
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run test program while cross compiling
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -15997,7 +15957,7 @@ rm -f core conftest.err conftest.$ac_objext \
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_ninit" >&5
$as_echo_n "checking for library containing res_9_ninit... " >&6; }
-if test "${ac_cv_search_res_9_ninit+set}" = set; then :
+if ${ac_cv_search_res_9_ninit+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -16031,11 +15991,11 @@ for ac_lib in '' resolv; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_res_9_ninit+set}" = set; then :
+ if ${ac_cv_search_res_9_ninit+:} false; then :
break
fi
done
-if test "${ac_cv_search_res_9_ninit+set}" = set; then :
+if ${ac_cv_search_res_9_ninit+:} false; then :
else
ac_cv_search_res_9_ninit=no
@@ -16082,7 +16042,7 @@ $as_echo "#define HAVE_RES_NINIT 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_ndestroy" >&5
$as_echo_n "checking for library containing res_9_ndestroy... " >&6; }
-if test "${ac_cv_search_res_9_ndestroy+set}" = set; then :
+if ${ac_cv_search_res_9_ndestroy+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -16116,11 +16076,11 @@ for ac_lib in '' resolv; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_res_9_ndestroy+set}" = set; then :
+ if ${ac_cv_search_res_9_ndestroy+:} false; then :
break
fi
done
-if test "${ac_cv_search_res_9_ndestroy+set}" = set; then :
+if ${ac_cv_search_res_9_ndestroy+:} false; then :
else
ac_cv_search_res_9_ndestroy=no
@@ -16174,7 +16134,7 @@ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_close" >&5
$as_echo_n "checking for library containing res_9_close... " >&6; }
-if test "${ac_cv_search_res_9_close+set}" = set; then :
+if ${ac_cv_search_res_9_close+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -16208,11 +16168,11 @@ for ac_lib in '' resolv; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_res_9_close+set}" = set; then :
+ if ${ac_cv_search_res_9_close+:} false; then :
break
fi
done
-if test "${ac_cv_search_res_9_close+set}" = set; then :
+if ${ac_cv_search_res_9_close+:} false; then :
else
ac_cv_search_res_9_close=no
@@ -16414,7 +16374,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_fn_c_check_header_mongrel "$LINENO" "libkern/OSAtomic.h" "ac_cv_header_libkern_OSAtomic_h" "$ac_includes_default"
-if test "x$ac_cv_header_libkern_OSAtomic_h" = x""yes; then :
+if test "x$ac_cv_header_libkern_OSAtomic_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OSX_ATOMICS 1
@@ -16430,7 +16390,7 @@ fi
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
$as_echo_n "checking size of int... " >&6; }
-if test "${ac_cv_sizeof_int+set}" = set; then :
+if ${ac_cv_sizeof_int+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
@@ -16439,9 +16399,8 @@ else
if test "$ac_cv_type_int" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (int)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_int=0
fi
@@ -16464,7 +16423,7 @@ _ACEOF
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then :
+if ${ac_cv_sizeof_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
@@ -16473,9 +16432,8 @@ else
if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long=0
fi
@@ -16498,7 +16456,7 @@ _ACEOF
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
$as_echo_n "checking size of long long... " >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then :
+if ${ac_cv_sizeof_long_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
@@ -16507,9 +16465,8 @@ else
if test "$ac_cv_type_long_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long long)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long_long=0
fi
@@ -16532,7 +16489,7 @@ _ACEOF
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char *" >&5
$as_echo_n "checking size of char *... " >&6; }
-if test "${ac_cv_sizeof_char_p+set}" = set; then :
+if ${ac_cv_sizeof_char_p+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char *))" "ac_cv_sizeof_char_p" "$ac_includes_default"; then :
@@ -16541,9 +16498,8 @@ else
if test "$ac_cv_type_char_p" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (char *)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (char *)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_char_p=0
fi
@@ -16566,7 +16522,7 @@ _ACEOF
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then :
+if ${ac_cv_sizeof_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
@@ -16575,9 +16531,8 @@ else
if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long=0
fi
@@ -16600,7 +16555,7 @@ _ACEOF
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
$as_echo_n "checking size of long long... " >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then :
+if ${ac_cv_sizeof_long_long+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
@@ -16609,9 +16564,8 @@ else
if test "$ac_cv_type_long_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (long long)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_long_long=0
fi
@@ -16641,7 +16595,7 @@ fi
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fd_set.fds_bits" >&5
$as_echo_n "checking size of fd_set.fds_bits... " >&6; }
-if test "${ac_cv_sizeof_fd_set_fds_bits+set}" = set; then :
+if ${ac_cv_sizeof_fd_set_fds_bits+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fd_set.fds_bits))" "ac_cv_sizeof_fd_set_fds_bits" "$ac_includes_default"; then :
@@ -16650,9 +16604,8 @@ else
if test "$ac_cv_type_fd_set_fds_bits" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ as_fn_set_status 77
-as_fn_error "cannot compute sizeof (fd_set.fds_bits)
-See \`config.log' for more details." "$LINENO" 5; }; }
+as_fn_error 77 "cannot compute sizeof (fd_set.fds_bits)
+See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_fd_set_fds_bits=0
fi
@@ -16728,7 +16681,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PKGCONFIG+set}" = set; then :
+if ${ac_cv_prog_PKGCONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PKGCONFIG"; then
@@ -16768,7 +16721,7 @@ if test -z "$ac_cv_prog_PKGCONFIG"; then
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_PKGCONFIG+set}" = set; then :
+if ${ac_cv_prog_ac_ct_PKGCONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_PKGCONFIG"; then
@@ -16839,7 +16792,7 @@ if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_asound_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lasound" >&5
$as_echo_n "checking for ${pbxfuncname} in -lasound... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -16874,8 +16827,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ALSA_FOUND=yes
else
AST_ALSA_FOUND=no
@@ -16898,7 +16850,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ALSA_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then :
+if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
ALSA_HEADER_FOUND=1
else
ALSA_HEADER_FOUND=0
@@ -16945,7 +16897,7 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_bfd_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbfd" >&5
$as_echo_n "checking for ${pbxfuncname} in -lbfd... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -16980,8 +16932,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_BFD_FOUND=yes
else
AST_BFD_FOUND=no
@@ -17004,7 +16955,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${BFD_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
-if test "x$ac_cv_header_bfd_h" = x""yes; then :
+if test "x$ac_cv_header_bfd_h" = xyes; then :
BFD_HEADER_FOUND=1
else
BFD_HEADER_FOUND=0
@@ -17052,7 +17003,7 @@ if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_cap_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcap" >&5
$as_echo_n "checking for ${pbxfuncname} in -lcap... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -17087,8 +17038,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_CAP_FOUND=yes
else
AST_CAP_FOUND=no
@@ -17111,7 +17061,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${CAP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_capability_h" = x""yes; then :
+if test "x$ac_cv_header_sys_capability_h" = xyes; then :
CAP_HEADER_FOUND=1
else
CAP_HEADER_FOUND=0
@@ -17534,7 +17484,7 @@ if test "${USE_GSM}" != "no"; then
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gsm_create in -lgsm" >&5
$as_echo_n "checking for gsm_create in -lgsm... " >&6; }
-if test "${ac_cv_lib_gsm_gsm_create+set}" = set; then :
+if ${ac_cv_lib_gsm_gsm_create+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -17568,7 +17518,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsm_gsm_create" >&5
$as_echo "$ac_cv_lib_gsm_gsm_create" >&6; }
-if test "x$ac_cv_lib_gsm_gsm_create" = x""yes; then :
+if test "x$ac_cv_lib_gsm_gsm_create" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_GSM 1
@@ -17580,8 +17530,7 @@ fi
if test "x${GSM_DIR}" != "x" ; then
as_ac_Header=`$as_echo "ac_cv_header_${GSM_DIR}/include/gsm.h" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "${GSM_DIR}/include/gsm.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
GSM_HEADER_FOUND=1
else
GSM_HEADER_FOUND=0
@@ -17590,8 +17539,7 @@ fi
as_ac_Header=`$as_echo "ac_cv_header_${GSM_DIR}/include/gsm/gsm.h" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "${GSM_DIR}/include/gsm/gsm.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
GSM_GSM_HEADER_FOUND=1
else
GSM_GSM_HEADER_FOUND=0
@@ -17600,7 +17548,7 @@ fi
else
ac_fn_c_check_header_mongrel "$LINENO" "gsm.h" "ac_cv_header_gsm_h" "$ac_includes_default"
-if test "x$ac_cv_header_gsm_h" = x""yes; then :
+if test "x$ac_cv_header_gsm_h" = xyes; then :
GSM_HEADER_FOUND=1
else
GSM_HEADER_FOUND=0
@@ -17608,7 +17556,7 @@ fi
ac_fn_c_check_header_mongrel "$LINENO" "gsm/gsm.h" "ac_cv_header_gsm_gsm_h" "$ac_includes_default"
-if test "x$ac_cv_header_gsm_gsm_h" = x""yes; then :
+if test "x$ac_cv_header_gsm_gsm_h" = xyes; then :
GSM_GSM_HEADER_FOUND=1
else
GSM_GSM_HEADER_FOUND=0
@@ -17690,7 +17638,7 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_iconv_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liconv" >&5
$as_echo_n "checking for ${pbxfuncname} in -liconv... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -17725,8 +17673,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ICONV_FOUND=yes
else
AST_ICONV_FOUND=no
@@ -17749,7 +17696,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
-if test "x$ac_cv_header_iconv_h" = x""yes; then :
+if test "x$ac_cv_header_iconv_h" = xyes; then :
ICONV_HEADER_FOUND=1
else
ICONV_HEADER_FOUND=0
@@ -17796,7 +17743,7 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_iconv_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liconv" >&5
$as_echo_n "checking for ${pbxfuncname} in -liconv... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -17831,8 +17778,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ICONV_FOUND=yes
else
AST_ICONV_FOUND=no
@@ -17855,7 +17801,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
-if test "x$ac_cv_header_iconv_h" = x""yes; then :
+if test "x$ac_cv_header_iconv_h" = xyes; then :
ICONV_HEADER_FOUND=1
else
ICONV_HEADER_FOUND=0
@@ -17902,7 +17848,7 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -17937,8 +17883,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ICONV_FOUND=yes
else
AST_ICONV_FOUND=no
@@ -17961,7 +17906,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
-if test "x$ac_cv_header_iconv_h" = x""yes; then :
+if test "x$ac_cv_header_iconv_h" = xyes; then :
ICONV_HEADER_FOUND=1
else
ICONV_HEADER_FOUND=0
@@ -18009,7 +17954,7 @@ if test "x${PBX_ICAL}" != "x1" -a "${USE_ICAL}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ical_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lical" >&5
$as_echo_n "checking for ${pbxfuncname} in -lical... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -18044,8 +17989,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ICAL_FOUND=yes
else
AST_ICAL_FOUND=no
@@ -18068,7 +18012,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ICAL_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libical/ical.h" "ac_cv_header_libical_ical_h" "$ac_includes_default"
-if test "x$ac_cv_header_libical_ical_h" = x""yes; then :
+if test "x$ac_cv_header_libical_ical_h" = xyes; then :
ICAL_HEADER_FOUND=1
else
ICAL_HEADER_FOUND=0
@@ -18115,7 +18059,7 @@ if test "x${PBX_IKSEMEL}" != "x1" -a "${USE_IKSEMEL}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_iksemel_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liksemel" >&5
$as_echo_n "checking for ${pbxfuncname} in -liksemel... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -18150,8 +18094,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_IKSEMEL_FOUND=yes
else
AST_IKSEMEL_FOUND=no
@@ -18174,7 +18117,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${IKSEMEL_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "iksemel.h" "ac_cv_header_iksemel_h" "$ac_includes_default"
-if test "x$ac_cv_header_iksemel_h" = x""yes; then :
+if test "x$ac_cv_header_iksemel_h" = xyes; then :
IKSEMEL_HEADER_FOUND=1
else
IKSEMEL_HEADER_FOUND=0
@@ -18849,7 +18792,7 @@ if test "x${PBX_IODBC}" != "x1" -a "${USE_IODBC}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_iodbc_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liodbc" >&5
$as_echo_n "checking for ${pbxfuncname} in -liodbc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -18884,8 +18827,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_IODBC_FOUND=yes
else
AST_IODBC_FOUND=no
@@ -18908,7 +18850,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${IODBC_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
-if test "x$ac_cv_header_sql_h" = x""yes; then :
+if test "x$ac_cv_header_sql_h" = xyes; then :
IODBC_HEADER_FOUND=1
else
IODBC_HEADER_FOUND=0
@@ -18955,7 +18897,7 @@ if test "x${PBX_INOTIFY}" != "x1" -a "${USE_INOTIFY}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -18990,8 +18932,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_INOTIFY_FOUND=yes
else
AST_INOTIFY_FOUND=no
@@ -19014,7 +18955,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${INOTIFY_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_inotify_h" = x""yes; then :
+if test "x$ac_cv_header_sys_inotify_h" = xyes; then :
INOTIFY_HEADER_FOUND=1
else
INOTIFY_HEADER_FOUND=0
@@ -19061,7 +19002,7 @@ if test "x${PBX_JACK}" != "x1" -a "${USE_JACK}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_jack_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ljack" >&5
$as_echo_n "checking for ${pbxfuncname} in -ljack... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19096,8 +19037,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_JACK_FOUND=yes
else
AST_JACK_FOUND=no
@@ -19120,7 +19060,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${JACK_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "jack/jack.h" "ac_cv_header_jack_jack_h" "$ac_includes_default"
-if test "x$ac_cv_header_jack_jack_h" = x""yes; then :
+if test "x$ac_cv_header_jack_jack_h" = xyes; then :
JACK_HEADER_FOUND=1
else
JACK_HEADER_FOUND=0
@@ -19168,7 +19108,7 @@ if test "x${PBX_KQUEUE}" != "x1" -a "${USE_KQUEUE}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19203,8 +19143,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_KQUEUE_FOUND=yes
else
AST_KQUEUE_FOUND=no
@@ -19227,7 +19166,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KQUEUE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_event_h" = x""yes; then :
+if test "x$ac_cv_header_sys_event_h" = xyes; then :
KQUEUE_HEADER_FOUND=1
else
KQUEUE_HEADER_FOUND=0
@@ -19258,7 +19197,7 @@ fi
for ac_func in kevent64
do :
ac_fn_c_check_func "$LINENO" "kevent64" "ac_cv_func_kevent64"
-if test "x$ac_cv_func_kevent64" = x""yes; then :
+if test "x$ac_cv_func_kevent64" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_KEVENT64 1
_ACEOF
@@ -19288,7 +19227,7 @@ if test "x${PBX_LTDL}" != "x1" -a "${USE_LTDL}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ltdl_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lltdl" >&5
$as_echo_n "checking for ${pbxfuncname} in -lltdl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19323,8 +19262,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_LTDL_FOUND=yes
else
AST_LTDL_FOUND=no
@@ -19347,7 +19285,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LTDL_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default"
-if test "x$ac_cv_header_ltdl_h" = x""yes; then :
+if test "x$ac_cv_header_ltdl_h" = xyes; then :
LTDL_HEADER_FOUND=1
else
LTDL_HEADER_FOUND=0
@@ -19394,7 +19332,7 @@ if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ldap_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lldap" >&5
$as_echo_n "checking for ${pbxfuncname} in -lldap... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19429,8 +19367,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_LDAP_FOUND=yes
else
AST_LDAP_FOUND=no
@@ -19453,7 +19390,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LDAP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default"
-if test "x$ac_cv_header_ldap_h" = x""yes; then :
+if test "x$ac_cv_header_ldap_h" = xyes; then :
LDAP_HEADER_FOUND=1
else
LDAP_HEADER_FOUND=0
@@ -19500,7 +19437,7 @@ if test "x${PBX_MISDN}" != "x1" -a "${USE_MISDN}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_mISDN_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lmISDN" >&5
$as_echo_n "checking for ${pbxfuncname} in -lmISDN... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19535,8 +19472,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_MISDN_FOUND=yes
else
AST_MISDN_FOUND=no
@@ -19559,7 +19495,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${MISDN_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/mISDNlib.h" "ac_cv_header_mISDNuser_mISDNlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_mISDNuser_mISDNlib_h" = x""yes; then :
+if test "x$ac_cv_header_mISDNuser_mISDNlib_h" = xyes; then :
MISDN_HEADER_FOUND=1
else
MISDN_HEADER_FOUND=0
@@ -19607,7 +19543,7 @@ if test "x${PBX_ISDNNET}" != "x1" -a "${USE_ISDNNET}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_isdnnet_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lisdnnet" >&5
$as_echo_n "checking for ${pbxfuncname} in -lisdnnet... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19642,8 +19578,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ISDNNET_FOUND=yes
else
AST_ISDNNET_FOUND=no
@@ -19666,7 +19601,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ISDNNET_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/isdn_net.h" "ac_cv_header_mISDNuser_isdn_net_h" "$ac_includes_default"
-if test "x$ac_cv_header_mISDNuser_isdn_net_h" = x""yes; then :
+if test "x$ac_cv_header_mISDNuser_isdn_net_h" = xyes; then :
ISDNNET_HEADER_FOUND=1
else
ISDNNET_HEADER_FOUND=0
@@ -19712,7 +19647,7 @@ if test "x${PBX_SUPPSERV}" != "x1" -a "${USE_SUPPSERV}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_suppserv_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsuppserv" >&5
$as_echo_n "checking for ${pbxfuncname} in -lsuppserv... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -19747,8 +19682,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SUPPSERV_FOUND=yes
else
AST_SUPPSERV_FOUND=no
@@ -19771,7 +19705,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SUPPSERV_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/suppserv.h" "ac_cv_header_mISDNuser_suppserv_h" "$ac_includes_default"
-if test "x$ac_cv_header_mISDNuser_suppserv_h" = x""yes; then :
+if test "x$ac_cv_header_mISDNuser_suppserv_h" = xyes; then :
SUPPSERV_HEADER_FOUND=1
else
SUPPSERV_HEADER_FOUND=0
@@ -19890,7 +19824,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_fn_c_check_header_mongrel "$LINENO" "linux/mISDNdsp.h" "ac_cv_header_linux_mISDNdsp_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_mISDNdsp_h" = x""yes; then :
+if test "x$ac_cv_header_linux_mISDNdsp_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define MISDN_1_2 1
@@ -19901,7 +19835,7 @@ fi
ac_fn_c_check_member "$LINENO" "Q931_info_t" "redirect_dn" "ac_cv_member_Q931_info_t_redirect_dn" "#include <mISDNuser/mISDNlib.h>
"
-if test "x$ac_cv_member_Q931_info_t_redirect_dn" = x""yes; then :
+if test "x$ac_cv_member_Q931_info_t_redirect_dn" = xyes; then :
else
PBX_MISDN=0
@@ -19917,7 +19851,7 @@ fi
set dummy ${ac_tool_prefix}mysql_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_MYSQLCLIENT+set}" = set; then :
+if ${ac_cv_path_CONFIG_MYSQLCLIENT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_MYSQLCLIENT in
@@ -19961,7 +19895,7 @@ if test -z "$ac_cv_path_CONFIG_MYSQLCLIENT"; then
set dummy mysql_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_MYSQLCLIENT+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_MYSQLCLIENT+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_MYSQLCLIENT in
@@ -20080,7 +20014,7 @@ if test "x${PBX_NBS}" != "x1" -a "${USE_NBS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_nbs_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnbs" >&5
$as_echo_n "checking for ${pbxfuncname} in -lnbs... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -20115,8 +20049,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_NBS_FOUND=yes
else
AST_NBS_FOUND=no
@@ -20139,7 +20072,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "nbs.h" "ac_cv_header_nbs_h" "$ac_includes_default"
-if test "x$ac_cv_header_nbs_h" = x""yes; then :
+if test "x$ac_cv_header_nbs_h" = xyes; then :
NBS_HEADER_FOUND=1
else
NBS_HEADER_FOUND=0
@@ -20174,7 +20107,7 @@ fi
set dummy ${ac_tool_prefix}neon-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_NEON+set}" = set; then :
+if ${ac_cv_path_CONFIG_NEON+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_NEON in
@@ -20218,7 +20151,7 @@ if test -z "$ac_cv_path_CONFIG_NEON"; then
set dummy neon-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_NEON+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_NEON+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_NEON in
@@ -20325,7 +20258,7 @@ $as_echo "#define HAVE_NEON 1" >>confdefs.h
set dummy ${ac_tool_prefix}neon-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_NEON29+set}" = set; then :
+if ${ac_cv_path_CONFIG_NEON29+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_NEON29 in
@@ -20369,7 +20302,7 @@ if test -z "$ac_cv_path_CONFIG_NEON29"; then
set dummy neon-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_NEON29+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_NEON29+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_NEON29 in
@@ -20478,7 +20411,7 @@ $as_echo "#define HAVE_NEON29 1" >>confdefs.h
set dummy ${ac_tool_prefix}net-snmp-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_NETSNMP+set}" = set; then :
+if ${ac_cv_path_CONFIG_NETSNMP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_NETSNMP in
@@ -20522,7 +20455,7 @@ if test -z "$ac_cv_path_CONFIG_NETSNMP"; then
set dummy net-snmp-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_NETSNMP+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_NETSNMP+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_NETSNMP in
@@ -20645,7 +20578,7 @@ if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_newt_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnewt" >&5
$as_echo_n "checking for ${pbxfuncname} in -lnewt... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -20680,8 +20613,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_NEWT_FOUND=yes
else
AST_NEWT_FOUND=no
@@ -20704,7 +20636,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${NEWT_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "newt.h" "ac_cv_header_newt_h" "$ac_includes_default"
-if test "x$ac_cv_header_newt_h" = x""yes; then :
+if test "x$ac_cv_header_newt_h" = xyes; then :
NEWT_HEADER_FOUND=1
else
NEWT_HEADER_FOUND=0
@@ -20751,7 +20683,7 @@ if test "x${PBX_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_odbc_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lodbc" >&5
$as_echo_n "checking for ${pbxfuncname} in -lodbc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -20786,8 +20718,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_UNIXODBC_FOUND=yes
else
AST_UNIXODBC_FOUND=no
@@ -20810,7 +20741,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${UNIXODBC_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
-if test "x$ac_cv_header_sql_h" = x""yes; then :
+if test "x$ac_cv_header_sql_h" = xyes; then :
UNIXODBC_HEADER_FOUND=1
else
UNIXODBC_HEADER_FOUND=0
@@ -20857,7 +20788,7 @@ if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ogg_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -logg" >&5
$as_echo_n "checking for ${pbxfuncname} in -logg... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -20892,8 +20823,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_OGG_FOUND=yes
else
AST_OGG_FOUND=no
@@ -20916,7 +20846,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OGG_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
+if test "x$ac_cv_header_" = xyes; then :
OGG_HEADER_FOUND=1
else
OGG_HEADER_FOUND=0
@@ -20964,7 +20894,7 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_execinfo_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lexecinfo" >&5
$as_echo_n "checking for ${pbxfuncname} in -lexecinfo... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -20999,8 +20929,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_BKTR_FOUND=yes
else
AST_BKTR_FOUND=no
@@ -21023,7 +20952,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
-if test "x$ac_cv_header_execinfo_h" = x""yes; then :
+if test "x$ac_cv_header_execinfo_h" = xyes; then :
BKTR_HEADER_FOUND=1
else
BKTR_HEADER_FOUND=0
@@ -21070,7 +20999,7 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
$as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21105,8 +21034,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_BKTR_FOUND=yes
else
AST_BKTR_FOUND=no
@@ -21129,7 +21057,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
-if test "x$ac_cv_header_execinfo_h" = x""yes; then :
+if test "x$ac_cv_header_execinfo_h" = xyes; then :
BKTR_HEADER_FOUND=1
else
BKTR_HEADER_FOUND=0
@@ -21176,7 +21104,7 @@ if test "x${PBX_BLUETOOTH}" != "x1" -a "${USE_BLUETOOTH}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_bluetooth_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbluetooth" >&5
$as_echo_n "checking for ${pbxfuncname} in -lbluetooth... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21211,8 +21139,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_BLUETOOTH_FOUND=yes
else
AST_BLUETOOTH_FOUND=no
@@ -21235,7 +21162,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${BLUETOOTH_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default"
-if test "x$ac_cv_header_bluetooth_bluetooth_h" = x""yes; then :
+if test "x$ac_cv_header_bluetooth_bluetooth_h" = xyes; then :
BLUETOOTH_HEADER_FOUND=1
else
BLUETOOTH_HEADER_FOUND=0
@@ -21283,7 +21210,7 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
$as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21318,8 +21245,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_OSS_FOUND=yes
else
AST_OSS_FOUND=no
@@ -21342,7 +21268,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "linux/soundcard.h" "ac_cv_header_linux_soundcard_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_soundcard_h" = x""yes; then :
+if test "x$ac_cv_header_linux_soundcard_h" = xyes; then :
OSS_HEADER_FOUND=1
else
OSS_HEADER_FOUND=0
@@ -21388,7 +21314,7 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
$as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21423,8 +21349,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_OSS_FOUND=yes
else
AST_OSS_FOUND=no
@@ -21447,7 +21372,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_soundcard_h" = x""yes; then :
+if test "x$ac_cv_header_sys_soundcard_h" = xyes; then :
OSS_HEADER_FOUND=1
else
OSS_HEADER_FOUND=0
@@ -21493,7 +21418,7 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
$as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21528,8 +21453,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_OSS_FOUND=yes
else
AST_OSS_FOUND=no
@@ -21552,7 +21476,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "soundcard.h" "ac_cv_header_soundcard_h" "$ac_includes_default"
-if test "x$ac_cv_header_soundcard_h" = x""yes; then :
+if test "x$ac_cv_header_soundcard_h" = xyes; then :
OSS_HEADER_FOUND=1
else
OSS_HEADER_FOUND=0
@@ -21587,7 +21511,7 @@ if test "${USE_PGSQL}" != "no"; then
set dummy ${ac_tool_prefix}pg_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PG_CONFIG in
@@ -21630,7 +21554,7 @@ if test -z "$ac_cv_path_PG_CONFIG"; then
set dummy pg_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PG_CONFIG in
@@ -21699,7 +21623,7 @@ $as_echo "$as_me: *** including --without-postgres" >&6;}
set dummy ${ac_tool_prefix}pg_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PG_CONFIG+set}" = set; then :
+if ${ac_cv_path_PG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PG_CONFIG in
@@ -21742,7 +21666,7 @@ if test -z "$ac_cv_path_PG_CONFIG"; then
set dummy pg_config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then :
+if ${ac_cv_path_ac_pt_PG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PG_CONFIG in
@@ -21812,7 +21736,7 @@ $as_echo "$as_me: *** including --without-postgres" >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQescapeStringConn in -lpq" >&5
$as_echo_n "checking for PQescapeStringConn in -lpq... " >&6; }
-if test "${ac_cv_lib_pq_PQescapeStringConn+set}" = set; then :
+if ${ac_cv_lib_pq_PQescapeStringConn+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21846,7 +21770,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQescapeStringConn" >&5
$as_echo "$ac_cv_lib_pq_PQescapeStringConn" >&6; }
-if test "x$ac_cv_lib_pq_PQescapeStringConn" = x""yes; then :
+if test "x$ac_cv_lib_pq_PQescapeStringConn" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PGSQL 1
@@ -21928,7 +21852,7 @@ if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_popt_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpopt" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpopt... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -21963,8 +21887,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_POPT_FOUND=yes
else
AST_POPT_FOUND=no
@@ -21987,7 +21910,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${POPT_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "popt.h" "ac_cv_header_popt_h" "$ac_includes_default"
-if test "x$ac_cv_header_popt_h" = x""yes; then :
+if test "x$ac_cv_header_popt_h" = xyes; then :
POPT_HEADER_FOUND=1
else
POPT_HEADER_FOUND=0
@@ -22034,7 +21957,7 @@ if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_portaudio_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lportaudio" >&5
$as_echo_n "checking for ${pbxfuncname} in -lportaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22069,8 +21992,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PORTAUDIO_FOUND=yes
else
AST_PORTAUDIO_FOUND=no
@@ -22093,7 +22015,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "portaudio.h" "ac_cv_header_portaudio_h" "$ac_includes_default"
-if test "x$ac_cv_header_portaudio_h" = x""yes; then :
+if test "x$ac_cv_header_portaudio_h" = xyes; then :
PORTAUDIO_HEADER_FOUND=1
else
PORTAUDIO_HEADER_FOUND=0
@@ -22140,7 +22062,7 @@ if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22175,8 +22097,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_FOUND=yes
else
AST_PRI_FOUND=no
@@ -22199,7 +22120,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_HEADER_FOUND=1
else
PRI_HEADER_FOUND=0
@@ -22245,7 +22166,7 @@ if test "x${PBX_PRI_L2_PERSISTENCE}" != "x1" -a "${USE_PRI_L2_PERSISTENCE}" != "
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22280,8 +22201,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_L2_PERSISTENCE_FOUND=yes
else
AST_PRI_L2_PERSISTENCE_FOUND=no
@@ -22304,7 +22224,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_L2_PERSISTENCE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_L2_PERSISTENCE_HEADER_FOUND=1
else
PRI_L2_PERSISTENCE_HEADER_FOUND=0
@@ -22350,7 +22270,7 @@ if test "x${PBX_PRI_DATETIME_SEND}" != "x1" -a "${USE_PRI_DATETIME_SEND}" != "no
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22385,8 +22305,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_DATETIME_SEND_FOUND=yes
else
AST_PRI_DATETIME_SEND_FOUND=no
@@ -22409,7 +22328,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_DATETIME_SEND_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_DATETIME_SEND_HEADER_FOUND=1
else
PRI_DATETIME_SEND_HEADER_FOUND=0
@@ -22455,7 +22374,7 @@ if test "x${PBX_PRI_MWI_V2}" != "x1" -a "${USE_PRI_MWI_V2}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22490,8 +22409,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_MWI_V2_FOUND=yes
else
AST_PRI_MWI_V2_FOUND=no
@@ -22514,7 +22432,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_MWI_V2_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_MWI_V2_HEADER_FOUND=1
else
PRI_MWI_V2_HEADER_FOUND=0
@@ -22560,7 +22478,7 @@ if test "x${PBX_PRI_DISPLAY_TEXT}" != "x1" -a "${USE_PRI_DISPLAY_TEXT}" != "no";
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22595,8 +22513,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_DISPLAY_TEXT_FOUND=yes
else
AST_PRI_DISPLAY_TEXT_FOUND=no
@@ -22619,7 +22536,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_DISPLAY_TEXT_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_DISPLAY_TEXT_HEADER_FOUND=1
else
PRI_DISPLAY_TEXT_HEADER_FOUND=0
@@ -22665,7 +22582,7 @@ if test "x${PBX_PRI_MWI}" != "x1" -a "${USE_PRI_MWI}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22700,8 +22617,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_MWI_FOUND=yes
else
AST_PRI_MWI_FOUND=no
@@ -22724,7 +22640,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_MWI_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_MWI_HEADER_FOUND=1
else
PRI_MWI_HEADER_FOUND=0
@@ -22770,7 +22686,7 @@ if test "x${PBX_PRI_MCID}" != "x1" -a "${USE_PRI_MCID}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22805,8 +22721,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_MCID_FOUND=yes
else
AST_PRI_MCID_FOUND=no
@@ -22829,7 +22744,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_MCID_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_MCID_HEADER_FOUND=1
else
PRI_MCID_HEADER_FOUND=0
@@ -22875,7 +22790,7 @@ if test "x${PBX_PRI_CALL_WAITING}" != "x1" -a "${USE_PRI_CALL_WAITING}" != "no";
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -22910,8 +22825,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_CALL_WAITING_FOUND=yes
else
AST_PRI_CALL_WAITING_FOUND=no
@@ -22934,7 +22848,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_CALL_WAITING_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_CALL_WAITING_HEADER_FOUND=1
else
PRI_CALL_WAITING_HEADER_FOUND=0
@@ -22980,7 +22894,7 @@ if test "x${PBX_PRI_AOC_EVENTS}" != "x1" -a "${USE_PRI_AOC_EVENTS}" != "no"; the
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23015,8 +22929,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_AOC_EVENTS_FOUND=yes
else
AST_PRI_AOC_EVENTS_FOUND=no
@@ -23039,7 +22952,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_AOC_EVENTS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_AOC_EVENTS_HEADER_FOUND=1
else
PRI_AOC_EVENTS_HEADER_FOUND=0
@@ -23085,7 +22998,7 @@ if test "x${PBX_PRI_TRANSFER}" != "x1" -a "${USE_PRI_TRANSFER}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23120,8 +23033,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_TRANSFER_FOUND=yes
else
AST_PRI_TRANSFER_FOUND=no
@@ -23144,7 +23056,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_TRANSFER_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_TRANSFER_HEADER_FOUND=1
else
PRI_TRANSFER_HEADER_FOUND=0
@@ -23190,7 +23102,7 @@ if test "x${PBX_PRI_CCSS}" != "x1" -a "${USE_PRI_CCSS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23225,8 +23137,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_CCSS_FOUND=yes
else
AST_PRI_CCSS_FOUND=no
@@ -23249,7 +23160,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_CCSS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_CCSS_HEADER_FOUND=1
else
PRI_CCSS_HEADER_FOUND=0
@@ -23295,7 +23206,7 @@ if test "x${PBX_PRI_HANGUP_FIX}" != "x1" -a "${USE_PRI_HANGUP_FIX}" != "no"; the
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23330,8 +23241,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_HANGUP_FIX_FOUND=yes
else
AST_PRI_HANGUP_FIX_FOUND=no
@@ -23354,7 +23264,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_HANGUP_FIX_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_HANGUP_FIX_HEADER_FOUND=1
else
PRI_HANGUP_FIX_HEADER_FOUND=0
@@ -23400,7 +23310,7 @@ if test "x${PBX_PRI_SUBADDR}" != "x1" -a "${USE_PRI_SUBADDR}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23435,8 +23345,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_SUBADDR_FOUND=yes
else
AST_PRI_SUBADDR_FOUND=no
@@ -23459,7 +23368,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_SUBADDR_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_SUBADDR_HEADER_FOUND=1
else
PRI_SUBADDR_HEADER_FOUND=0
@@ -23505,7 +23414,7 @@ if test "x${PBX_PRI_CALL_HOLD}" != "x1" -a "${USE_PRI_CALL_HOLD}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23540,8 +23449,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_CALL_HOLD_FOUND=yes
else
AST_PRI_CALL_HOLD_FOUND=no
@@ -23564,7 +23472,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_CALL_HOLD_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_CALL_HOLD_HEADER_FOUND=1
else
PRI_CALL_HOLD_HEADER_FOUND=0
@@ -23610,7 +23518,7 @@ if test "x${PBX_PRI_CALL_REROUTING}" != "x1" -a "${USE_PRI_CALL_REROUTING}" != "
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23645,8 +23553,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_CALL_REROUTING_FOUND=yes
else
AST_PRI_CALL_REROUTING_FOUND=no
@@ -23669,7 +23576,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_CALL_REROUTING_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_CALL_REROUTING_HEADER_FOUND=1
else
PRI_CALL_REROUTING_HEADER_FOUND=0
@@ -23715,7 +23622,7 @@ if test "x${PBX_PRI_SETUP_KEYPAD}" != "x1" -a "${USE_PRI_SETUP_KEYPAD}" != "no";
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23750,8 +23657,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_SETUP_KEYPAD_FOUND=yes
else
AST_PRI_SETUP_KEYPAD_FOUND=no
@@ -23774,7 +23680,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_KEYPAD_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_SETUP_KEYPAD_HEADER_FOUND=1
else
PRI_SETUP_KEYPAD_HEADER_FOUND=0
@@ -23824,7 +23730,7 @@ if test "x${PBX_PRI_PROG_W_CAUSE}" != "x1" -a "${USE_PRI_PROG_W_CAUSE}" != "no";
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23859,8 +23765,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_PROG_W_CAUSE_FOUND=yes
else
AST_PRI_PROG_W_CAUSE_FOUND=no
@@ -23883,7 +23788,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_PROG_W_CAUSE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_PROG_W_CAUSE_HEADER_FOUND=1
else
PRI_PROG_W_CAUSE_HEADER_FOUND=0
@@ -23929,7 +23834,7 @@ if test "x${PBX_PRI_INBANDDISCONNECT}" != "x1" -a "${USE_PRI_INBANDDISCONNECT}"
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -23964,8 +23869,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_INBANDDISCONNECT_FOUND=yes
else
AST_PRI_INBANDDISCONNECT_FOUND=no
@@ -23988,7 +23892,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_INBANDDISCONNECT_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_INBANDDISCONNECT_HEADER_FOUND=1
else
PRI_INBANDDISCONNECT_HEADER_FOUND=0
@@ -24034,7 +23938,7 @@ if test "x${PBX_PRI_SERVICE_MESSAGES}" != "x1" -a "${USE_PRI_SERVICE_MESSAGES}"
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24069,8 +23973,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_SERVICE_MESSAGES_FOUND=yes
else
AST_PRI_SERVICE_MESSAGES_FOUND=no
@@ -24093,7 +23996,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_SERVICE_MESSAGES_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_SERVICE_MESSAGES_HEADER_FOUND=1
else
PRI_SERVICE_MESSAGES_HEADER_FOUND=0
@@ -24139,7 +24042,7 @@ if test "x${PBX_PRI_REVERSE_CHARGE}" != "x1" -a "${USE_PRI_REVERSE_CHARGE}" != "
as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
$as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24174,8 +24077,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_PRI_REVERSE_CHARGE_FOUND=yes
else
AST_PRI_REVERSE_CHARGE_FOUND=no
@@ -24198,7 +24100,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${PRI_REVERSE_CHARGE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
-if test "x$ac_cv_header_libpri_h" = x""yes; then :
+if test "x$ac_cv_header_libpri_h" = xyes; then :
PRI_REVERSE_CHARGE_HEADER_FOUND=1
else
PRI_REVERSE_CHARGE_HEADER_FOUND=0
@@ -24246,7 +24148,7 @@ if test "x${PBX_RESAMPLE}" != "x1" -a "${USE_RESAMPLE}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_resample_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lresample" >&5
$as_echo_n "checking for ${pbxfuncname} in -lresample... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24281,8 +24183,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_RESAMPLE_FOUND=yes
else
AST_RESAMPLE_FOUND=no
@@ -24305,7 +24206,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${RESAMPLE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libresample.h" "ac_cv_header_libresample_h" "$ac_includes_default"
-if test "x$ac_cv_header_libresample_h" = x""yes; then :
+if test "x$ac_cv_header_libresample_h" = xyes; then :
RESAMPLE_HEADER_FOUND=1
else
RESAMPLE_HEADER_FOUND=0
@@ -24414,7 +24315,7 @@ if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
$as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24449,8 +24350,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SPANDSP_FOUND=yes
else
AST_SPANDSP_FOUND=no
@@ -24473,7 +24373,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
-if test "x$ac_cv_header_spandsp_h" = x""yes; then :
+if test "x$ac_cv_header_spandsp_h" = xyes; then :
SPANDSP_HEADER_FOUND=1
else
SPANDSP_HEADER_FOUND=0
@@ -24524,7 +24424,7 @@ if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
$as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24559,8 +24459,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SPANDSP_FOUND=yes
else
AST_SPANDSP_FOUND=no
@@ -24583,7 +24482,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
-if test "x$ac_cv_header_spandsp_h" = x""yes; then :
+if test "x$ac_cv_header_spandsp_h" = xyes; then :
SPANDSP_HEADER_FOUND=1
else
SPANDSP_HEADER_FOUND=0
@@ -24631,7 +24530,7 @@ if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ss7_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lss7" >&5
$as_echo_n "checking for ${pbxfuncname} in -lss7... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24666,8 +24565,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SS7_FOUND=yes
else
AST_SS7_FOUND=no
@@ -24690,7 +24588,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SS7_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libss7.h" "ac_cv_header_libss7_h" "$ac_includes_default"
-if test "x$ac_cv_header_libss7_h" = x""yes; then :
+if test "x$ac_cv_header_libss7_h" = xyes; then :
SS7_HEADER_FOUND=1
else
SS7_HEADER_FOUND=0
@@ -24737,7 +24635,7 @@ if test "x${PBX_OPENR2}" != "x1" -a "${USE_OPENR2}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_openr2_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopenr2" >&5
$as_echo_n "checking for ${pbxfuncname} in -lopenr2... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -24772,8 +24670,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_OPENR2_FOUND=yes
else
AST_OPENR2_FOUND=no
@@ -24796,7 +24693,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OPENR2_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "openr2.h" "ac_cv_header_openr2_h" "$ac_includes_default"
-if test "x$ac_cv_header_openr2_h" = x""yes; then :
+if test "x$ac_cv_header_openr2_h" = xyes; then :
OPENR2_HEADER_FOUND=1
else
OPENR2_HEADER_FOUND=0
@@ -24841,8 +24738,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test "${PWLIBDIR:-unset}" != "unset" ; then
as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/version.h" | $as_tr_sh`
ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/version.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
HAS_PWLIB=1
fi
@@ -24852,8 +24748,7 @@ if test "${HAS_PWLIB:-unset}" = "unset" ; then
if test "${OPENH323DIR:-unset}" != "unset"; then
as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/../pwlib/version.h" | $as_tr_sh`
ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/../pwlib/version.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
HAS_PWLIB=1
fi
@@ -24864,8 +24759,7 @@ fi
else
as_ac_Header=`$as_echo "ac_cv_header_${HOME}/pwlib/include/ptlib.h" | $as_tr_sh`
ac_fn_cxx_check_header_mongrel "$LINENO" "${HOME}/pwlib/include/ptlib.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
HAS_PWLIB=1
fi
@@ -24874,7 +24768,7 @@ fi
PWLIBDIR="${HOME}/pwlib"
else
ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/local/include/ptlib.h" "ac_cv_header__usr_local_include_ptlib_h" "$ac_includes_default"
-if test "x$ac_cv_header__usr_local_include_ptlib_h" = x""yes; then :
+if test "x$ac_cv_header__usr_local_include_ptlib_h" = xyes; then :
HAS_PWLIB=1
fi
@@ -24884,7 +24778,7 @@ fi
set dummy ptlib-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PTLIB_CONFIG+set}" = set; then :
+if ${ac_cv_path_PTLIB_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PTLIB_CONFIG in
@@ -24936,7 +24830,7 @@ fi
PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`"
else
ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/include/ptlib.h" "ac_cv_header__usr_include_ptlib_h" "$ac_includes_default"
-if test "x$ac_cv_header__usr_include_ptlib_h" = x""yes; then :
+if test "x$ac_cv_header__usr_include_ptlib_h" = xyes; then :
HAS_PWLIB=1
fi
@@ -24946,7 +24840,7 @@ fi
set dummy ptlib-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PTLIB_CONFIG+set}" = set; then :
+if ${ac_cv_path_PTLIB_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PTLIB_CONFIG in
@@ -25277,8 +25171,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test "${OPENH323DIR:-unset}" != "unset" ; then
as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/version.h" | $as_tr_sh`
ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/version.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
HAS_OPENH323=1
fi
@@ -25287,8 +25180,7 @@ fi
if test "${HAS_OPENH323:-unset}" = "unset" ; then
as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/../openh323/version.h" | $as_tr_sh`
ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/../openh323/version.h" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1
fi
@@ -25300,8 +25192,7 @@ fi
as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/include/h323.h" | $as_tr_sh`
ac_fn_cxx_check_header_compile "$LINENO" "${OPENH323DIR}/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
else
OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}"
@@ -25315,8 +25206,7 @@ fi
as_ac_Header=`$as_echo "ac_cv_header_${HOME}/openh323/include/h323.h" | $as_tr_sh`
ac_fn_cxx_check_header_compile "$LINENO" "${HOME}/openh323/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
"
-eval as_val=\$$as_ac_Header
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
HAS_OPENH323=1
fi
@@ -25329,7 +25219,7 @@ fi
CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}"
ac_fn_cxx_check_header_compile "$LINENO" "/usr/local/include/openh323/h323.h" "ac_cv_header__usr_local_include_openh323_h323_h" "#include <ptlib.h>
"
-if test "x$ac_cv_header__usr_local_include_openh323_h323_h" = x""yes; then :
+if test "x$ac_cv_header__usr_local_include_openh323_h323_h" = xyes; then :
HAS_OPENH323=1
fi
@@ -25348,7 +25238,7 @@ fi
CPPFLAGS="${CPPFLAGS} -I/usr/include/openh323 -I${PWLIB_INCDIR}"
ac_fn_cxx_check_header_compile "$LINENO" "/usr/include/openh323/h323.h" "ac_cv_header__usr_include_openh323_h323_h" "#include <ptlib.h>
"
-if test "x$ac_cv_header__usr_include_openh323_h323_h" = x""yes; then :
+if test "x$ac_cv_header__usr_include_openh323_h323_h" = xyes; then :
HAS_OPENH323=1
fi
@@ -25590,7 +25480,7 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.1" >&5
$as_echo_n "checking for ${pbxfuncname} in -llua5.1... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -25625,8 +25515,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_LUA_FOUND=yes
else
AST_LUA_FOUND=no
@@ -25649,7 +25538,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default"
-if test "x$ac_cv_header_lua5_1_lua_h" = x""yes; then :
+if test "x$ac_cv_header_lua5_1_lua_h" = xyes; then :
LUA_HEADER_FOUND=1
else
LUA_HEADER_FOUND=0
@@ -25704,7 +25593,7 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_lua_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua" >&5
$as_echo_n "checking for ${pbxfuncname} in -llua... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -25739,8 +25628,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_LUA_FOUND=yes
else
AST_LUA_FOUND=no
@@ -25763,7 +25651,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
-if test "x$ac_cv_header_lua_h" = x""yes; then :
+if test "x$ac_cv_header_lua_h" = xyes; then :
LUA_HEADER_FOUND=1
else
LUA_HEADER_FOUND=0
@@ -25810,7 +25698,7 @@ if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_radiusclient-ng_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lradiusclient-ng" >&5
$as_echo_n "checking for ${pbxfuncname} in -lradiusclient-ng... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -25845,8 +25733,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_RADIUS_FOUND=yes
else
AST_RADIUS_FOUND=no
@@ -25869,7 +25756,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "radiusclient-ng.h" "ac_cv_header_radiusclient_ng_h" "$ac_includes_default"
-if test "x$ac_cv_header_radiusclient_ng_h" = x""yes; then :
+if test "x$ac_cv_header_radiusclient_ng_h" = xyes; then :
RADIUS_HEADER_FOUND=1
else
RADIUS_HEADER_FOUND=0
@@ -25916,7 +25803,7 @@ if test "x${PBX_COROSYNC}" != "x1" -a "${USE_COROSYNC}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_cpg_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcpg" >&5
$as_echo_n "checking for ${pbxfuncname} in -lcpg... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -25951,8 +25838,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_COROSYNC_FOUND=yes
else
AST_COROSYNC_FOUND=no
@@ -25975,7 +25861,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${COROSYNC_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "corosync/cpg.h" "ac_cv_header_corosync_cpg_h" "$ac_includes_default"
-if test "x$ac_cv_header_corosync_cpg_h" = x""yes; then :
+if test "x$ac_cv_header_corosync_cpg_h" = xyes; then :
COROSYNC_HEADER_FOUND=1
else
COROSYNC_HEADER_FOUND=0
@@ -26022,7 +25908,7 @@ if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeex" >&5
$as_echo_n "checking for ${pbxfuncname} in -lspeex... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26057,8 +25943,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SPEEX_FOUND=yes
else
AST_SPEEX_FOUND=no
@@ -26081,7 +25966,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SPEEX_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
-if test "x$ac_cv_header_speex_speex_h" = x""yes; then :
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
SPEEX_HEADER_FOUND=1
else
SPEEX_HEADER_FOUND=0
@@ -26129,7 +26014,7 @@ if test "x${PBX_SPEEX_PREPROCESS}" != "x1" -a "${USE_SPEEX_PREPROCESS}" != "no";
as_ac_Lib=`$as_echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeex" >&5
$as_echo_n "checking for ${pbxfuncname} in -lspeex... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26164,8 +26049,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SPEEX_PREPROCESS_FOUND=yes
else
AST_SPEEX_PREPROCESS_FOUND=no
@@ -26188,7 +26072,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SPEEX_PREPROCESS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
-if test "x$ac_cv_header_speex_speex_h" = x""yes; then :
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
SPEEX_PREPROCESS_HEADER_FOUND=1
else
SPEEX_PREPROCESS_HEADER_FOUND=0
@@ -26238,7 +26122,7 @@ if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_speexdsp_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeexdsp" >&5
$as_echo_n "checking for ${pbxfuncname} in -lspeexdsp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26273,8 +26157,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SPEEXDSP_FOUND=yes
else
AST_SPEEXDSP_FOUND=no
@@ -26297,7 +26180,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SPEEXDSP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
-if test "x$ac_cv_header_speex_speex_h" = x""yes; then :
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
SPEEXDSP_HEADER_FOUND=1
else
SPEEXDSP_HEADER_FOUND=0
@@ -26349,7 +26232,7 @@ if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_sqlite_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite" >&5
$as_echo_n "checking for ${pbxfuncname} in -lsqlite... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26384,8 +26267,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SQLITE_FOUND=yes
else
AST_SQLITE_FOUND=no
@@ -26408,7 +26290,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SQLITE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sqlite.h" "ac_cv_header_sqlite_h" "$ac_includes_default"
-if test "x$ac_cv_header_sqlite_h" = x""yes; then :
+if test "x$ac_cv_header_sqlite_h" = xyes; then :
SQLITE_HEADER_FOUND=1
else
SQLITE_HEADER_FOUND=0
@@ -26455,7 +26337,7 @@ if test "x${PBX_SQLITE3}" != "x1" -a "${USE_SQLITE3}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_sqlite3_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite3" >&5
$as_echo_n "checking for ${pbxfuncname} in -lsqlite3... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26490,8 +26372,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SQLITE3_FOUND=yes
else
AST_SQLITE3_FOUND=no
@@ -26514,7 +26395,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SQLITE3_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
-if test "x$ac_cv_header_sqlite3_h" = x""yes; then :
+if test "x$ac_cv_header_sqlite3_h" = xyes; then :
SQLITE3_HEADER_FOUND=1
else
SQLITE3_HEADER_FOUND=0
@@ -26569,7 +26450,7 @@ if test "x${PBX_CRYPTO}" != "x1" -a "${USE_CRYPTO}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_crypto_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypto" >&5
$as_echo_n "checking for ${pbxfuncname} in -lcrypto... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26604,8 +26485,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_CRYPTO_FOUND=yes
else
AST_CRYPTO_FOUND=no
@@ -26628,7 +26508,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "openssl/aes.h" "ac_cv_header_openssl_aes_h" "$ac_includes_default"
-if test "x$ac_cv_header_openssl_aes_h" = x""yes; then :
+if test "x$ac_cv_header_openssl_aes_h" = xyes; then :
CRYPTO_HEADER_FOUND=1
else
CRYPTO_HEADER_FOUND=0
@@ -26677,7 +26557,7 @@ if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_ssl_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lssl" >&5
$as_echo_n "checking for ${pbxfuncname} in -lssl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26712,8 +26592,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_OPENSSL_FOUND=yes
else
AST_OPENSSL_FOUND=no
@@ -26736,7 +26615,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${OPENSSL_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
-if test "x$ac_cv_header_openssl_ssl_h" = x""yes; then :
+if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
OPENSSL_HEADER_FOUND=1
else
OPENSSL_HEADER_FOUND=0
@@ -26782,7 +26661,7 @@ then
osptk_saved_cppflags="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
ac_fn_c_check_header_mongrel "$LINENO" "osp/osp.h" "ac_cv_header_osp_osp_h" "$ac_includes_default"
-if test "x$ac_cv_header_osp_osp_h" = x""yes; then :
+if test "x$ac_cv_header_osp_osp_h" = xyes; then :
osptk_header_found=yes
else
osptk_header_found=no
@@ -26797,7 +26676,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSPPInit in -losptk" >&5
$as_echo_n "checking for OSPPInit in -losptk... " >&6; }
-if test "${ac_cv_lib_osptk_OSPPInit+set}" = set; then :
+if ${ac_cv_lib_osptk_OSPPInit+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26831,7 +26710,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_osptk_OSPPInit" >&5
$as_echo "$ac_cv_lib_osptk_OSPPInit" >&6; }
-if test "x$ac_cv_lib_osptk_OSPPInit" = x""yes; then :
+if test "x$ac_cv_lib_osptk_OSPPInit" = xyes; then :
osptk_library_found=yes
else
osptk_library_found=no
@@ -26848,8 +26727,8 @@ $as_echo_n "checking if OSP Toolkit version is compatible with app_osplookup...
if test "$cross_compiling" = yes; then :
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run test program while cross compiling
-See \`config.log' for more details." "$LINENO" 5; }
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -26915,7 +26794,7 @@ if test "x${PBX_SRTP}" != "x1" -a "${USE_SRTP}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_srtp_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsrtp" >&5
$as_echo_n "checking for ${pbxfuncname} in -lsrtp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -26950,8 +26829,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SRTP_FOUND=yes
else
AST_SRTP_FOUND=no
@@ -26974,7 +26852,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SRTP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "srtp/srtp.h" "ac_cv_header_srtp_srtp_h" "$ac_includes_default"
-if test "x$ac_cv_header_srtp_srtp_h" = x""yes; then :
+if test "x$ac_cv_header_srtp_srtp_h" = xyes; then :
SRTP_HEADER_FOUND=1
else
SRTP_HEADER_FOUND=0
@@ -27071,7 +26949,7 @@ fi
set dummy ${ac_tool_prefix}gmime-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_GMIME+set}" = set; then :
+if ${ac_cv_path_CONFIG_GMIME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_GMIME in
@@ -27115,7 +26993,7 @@ if test -z "$ac_cv_path_CONFIG_GMIME"; then
set dummy gmime-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_GMIME+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_GMIME+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_GMIME in
@@ -27250,7 +27128,7 @@ if test "x${PBX_HOARD}" != "x1" -a "${USE_HOARD}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_hoard_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lhoard" >&5
$as_echo_n "checking for ${pbxfuncname} in -lhoard... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -27285,8 +27163,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_HOARD_FOUND=yes
else
AST_HOARD_FOUND=no
@@ -27309,7 +27186,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${HOARD_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
-if test "x$ac_cv_header_" = x""yes; then :
+if test "x$ac_cv_header_" = xyes; then :
HOARD_HEADER_FOUND=1
else
HOARD_HEADER_FOUND=0
@@ -27356,7 +27233,7 @@ if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_sybdb_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsybdb" >&5
$as_echo_n "checking for ${pbxfuncname} in -lsybdb... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -27391,8 +27268,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_FREETDS_FOUND=yes
else
AST_FREETDS_FOUND=no
@@ -27415,7 +27291,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${FREETDS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "sybdb.h" "ac_cv_header_sybdb_h" "$ac_includes_default"
-if test "x$ac_cv_header_sybdb_h" = x""yes; then :
+if test "x$ac_cv_header_sybdb_h" = xyes; then :
FREETDS_HEADER_FOUND=1
else
FREETDS_HEADER_FOUND=0
@@ -27444,7 +27320,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tone_zone_find_by_num in -ltonezone" >&5
$as_echo_n "checking for tone_zone_find_by_num in -ltonezone... " >&6; }
-if test "${ac_cv_lib_tonezone_tone_zone_find_by_num+set}" = set; then :
+if ${ac_cv_lib_tonezone_tone_zone_find_by_num+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -27478,7 +27354,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tonezone_tone_zone_find_by_num" >&5
$as_echo "$ac_cv_lib_tonezone_tone_zone_find_by_num" >&6; }
-if test "x$ac_cv_lib_tonezone_tone_zone_find_by_num" = x""yes; then :
+if test "x$ac_cv_lib_tonezone_tone_zone_find_by_num" = xyes; then :
tonezone_does_not_need_lm=yes
else
tonezone_does_not_need_lm=no
@@ -27509,7 +27385,7 @@ if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_tonezone_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltonezone" >&5
$as_echo_n "checking for ${pbxfuncname} in -ltonezone... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -27544,8 +27420,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_TONEZONE_FOUND=yes
else
AST_TONEZONE_FOUND=no
@@ -27568,7 +27443,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "dahdi/tonezone.h" "ac_cv_header_dahdi_tonezone_h" "$ac_includes_default"
-if test "x$ac_cv_header_dahdi_tonezone_h" = x""yes; then :
+if test "x$ac_cv_header_dahdi_tonezone_h" = xyes; then :
TONEZONE_HEADER_FOUND=1
else
TONEZONE_HEADER_FOUND=0
@@ -27595,112 +27470,6 @@ fi
-
-if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "no"; then
- pbxlibdir=""
- # if --with-USB=DIR has been specified, use it.
- if test "x${USB_DIR}" != "x"; then
- if test -d ${USB_DIR}/lib; then
- pbxlibdir="-L${USB_DIR}/lib"
- else
- pbxlibdir="-L${USB_DIR}"
- fi
- fi
- pbxfuncname="usb_init"
- if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
- AST_USB_FOUND=yes
- else
- ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
- CFLAGS="${CFLAGS} "
- as_ac_Lib=`$as_echo "ac_cv_lib_usb_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lusb" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lusb... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lusb ${pbxlibdir} $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- eval "$as_ac_Lib=yes"
-else
- eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
- AST_USB_FOUND=yes
-else
- AST_USB_FOUND=no
-fi
-
- CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
- fi
-
- # now check for the header.
- if test "${AST_USB_FOUND}" = "yes"; then
- USB_LIB="${pbxlibdir} -lusb "
- # if --with-USB=DIR has been specified, use it.
- if test "x${USB_DIR}" != "x"; then
- USB_INCLUDE="-I${USB_DIR}/include"
- fi
- USB_INCLUDE="${USB_INCLUDE} "
- if test "xusb.h" = "x" ; then # no header, assume found
- USB_HEADER_FOUND="1"
- else # check for the header
- ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
- CPPFLAGS="${CPPFLAGS} ${USB_INCLUDE}"
- ac_fn_c_check_header_mongrel "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default"
-if test "x$ac_cv_header_usb_h" = x""yes; then :
- USB_HEADER_FOUND=1
-else
- USB_HEADER_FOUND=0
-fi
-
-
- CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
- fi
- if test "x${USB_HEADER_FOUND}" = "x0" ; then
- USB_LIB=""
- USB_INCLUDE=""
- else
- if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
- USB_LIB=""
- fi
- PBX_USB=1
- cat >>confdefs.h <<_ACEOF
-#define HAVE_USB 1
-_ACEOF
-
- fi
- fi
-fi
-
-
-
if test "${OSARCH}" = "OpenBSD";
then
@@ -27723,7 +27492,7 @@ if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
$as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -27758,8 +27527,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_VORBIS_FOUND=yes
else
AST_VORBIS_FOUND=no
@@ -27782,7 +27550,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
-if test "x$ac_cv_header_vorbis_codec_h" = x""yes; then :
+if test "x$ac_cv_header_vorbis_codec_h" = xyes; then :
VORBIS_HEADER_FOUND=1
else
VORBIS_HEADER_FOUND=0
@@ -27829,7 +27597,7 @@ if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
$as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -27864,8 +27632,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_VORBIS_FOUND=yes
else
AST_VORBIS_FOUND=no
@@ -27888,7 +27655,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
-if test "x$ac_cv_header_vorbis_codec_h" = x""yes; then :
+if test "x$ac_cv_header_vorbis_codec_h" = xyes; then :
VORBIS_HEADER_FOUND=1
else
VORBIS_HEADER_FOUND=0
@@ -28051,7 +27818,7 @@ if test "x${PBX_ZLIB}" != "x1" -a "${USE_ZLIB}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_z_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lz" >&5
$as_echo_n "checking for ${pbxfuncname} in -lz... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -28086,8 +27853,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_ZLIB_FOUND=yes
else
AST_ZLIB_FOUND=no
@@ -28110,7 +27876,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${ZLIB_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_zlib_h" = x""yes; then :
+if test "x$ac_cv_header_zlib_h" = xyes; then :
ZLIB_HEADER_FOUND=1
else
ZLIB_HEADER_FOUND=0
@@ -28169,7 +27935,7 @@ rm -f core conftest.err conftest.$ac_objext \
fi
ac_fn_c_check_header_mongrel "$LINENO" "h323.h" "ac_cv_header_h323_h" "$ac_includes_default"
-if test "x$ac_cv_header_h323_h" = x""yes; then :
+if test "x$ac_cv_header_h323_h" = xyes; then :
PBX_H323=1
else
PBX_H323=0
@@ -28179,7 +27945,7 @@ fi
ac_fn_c_check_header_mongrel "$LINENO" "linux/compiler.h" "ac_cv_header_linux_compiler_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_compiler_h" = x""yes; then :
+if test "x$ac_cv_header_linux_compiler_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LINUX_COMPILER_H 1
@@ -28196,7 +27962,7 @@ ac_fn_c_check_header_compile "$LINENO" "linux/ixjuser.h" "ac_cv_header_linux_ixj
#endif
"
-if test "x$ac_cv_header_linux_ixjuser_h" = x""yes; then :
+if test "x$ac_cv_header_linux_ixjuser_h" = xyes; then :
PBX_IXJUSER=1
else
PBX_IXJUSER=0
@@ -28307,7 +28073,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
set dummy ${ac_tool_prefix}sdl-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_SDL+set}" = set; then :
+if ${ac_cv_path_CONFIG_SDL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CONFIG_SDL in
@@ -28351,7 +28117,7 @@ if test -z "$ac_cv_path_CONFIG_SDL"; then
set dummy sdl-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_SDL+set}" = set; then :
+if ${ac_cv_path_ac_pt_CONFIG_SDL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CONFIG_SDL in
@@ -28469,7 +28235,7 @@ if test "x${PBX_SDL_IMAGE}" != "x1" -a "${USE_SDL_IMAGE}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_SDL_image_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lSDL_image" >&5
$as_echo_n "checking for ${pbxfuncname} in -lSDL_image... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -28504,8 +28270,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_SDL_IMAGE_FOUND=yes
else
AST_SDL_IMAGE_FOUND=no
@@ -28528,7 +28293,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SDL_IMAGE_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "SDL_image.h" "ac_cv_header_SDL_image_h" "$ac_includes_default"
-if test "x$ac_cv_header_SDL_image_h" = x""yes; then :
+if test "x$ac_cv_header_SDL_image_h" = xyes; then :
SDL_IMAGE_HEADER_FOUND=1
else
SDL_IMAGE_HEADER_FOUND=0
@@ -28574,7 +28339,7 @@ if test "x${PBX_FFMPEG}" != "x1" -a "${USE_FFMPEG}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_avcodec_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lavcodec" >&5
$as_echo_n "checking for ${pbxfuncname} in -lavcodec... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -28609,8 +28374,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_FFMPEG_FOUND=yes
else
AST_FFMPEG_FOUND=no
@@ -28633,7 +28397,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${FFMPEG_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "ffmpeg/avcodec.h" "ac_cv_header_ffmpeg_avcodec_h" "$ac_includes_default"
-if test "x$ac_cv_header_ffmpeg_avcodec_h" = x""yes; then :
+if test "x$ac_cv_header_ffmpeg_avcodec_h" = xyes; then :
FFMPEG_HEADER_FOUND=1
else
FFMPEG_HEADER_FOUND=0
@@ -28662,7 +28426,7 @@ fi
# possible places for video4linux version 1
ac_fn_c_check_header_mongrel "$LINENO" "linux/videodev.h" "ac_cv_header_linux_videodev_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_videodev_h" = x""yes; then :
+if test "x$ac_cv_header_linux_videodev_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_VIDEODEV_H 1
@@ -28693,7 +28457,7 @@ if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_X11_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lX11" >&5
$as_echo_n "checking for ${pbxfuncname} in -lX11... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -28728,8 +28492,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_X11_FOUND=yes
else
AST_X11_FOUND=no
@@ -28752,7 +28515,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${X11_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_Xlib_h" = x""yes; then :
+if test "x$ac_cv_header_X11_Xlib_h" = xyes; then :
X11_HEADER_FOUND=1
else
X11_HEADER_FOUND=0
@@ -28802,7 +28565,7 @@ if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
as_ac_Lib=`$as_echo "ac_cv_lib_X11_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lX11" >&5
$as_echo_n "checking for ${pbxfuncname} in -lX11... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
+if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -28837,8 +28600,7 @@ fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
-eval as_val=\$$as_ac_Lib
- if test "x$as_val" = x""yes; then :
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_X11_FOUND=yes
else
AST_X11_FOUND=no
@@ -28861,7 +28623,7 @@ fi
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${X11_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_Xlib_h" = x""yes; then :
+if test "x$ac_cv_header_X11_Xlib_h" = xyes; then :
X11_HEADER_FOUND=1
else
X11_HEADER_FOUND=0
@@ -28897,11 +28659,11 @@ if test "${cross_compiling}" = "no";
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /sbin/launchd" >&5
$as_echo_n "checking for /sbin/launchd... " >&6; }
-if test "${ac_cv_file__sbin_launchd+set}" = set; then :
+if ${ac_cv_file__sbin_launchd+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
- as_fn_error "cannot check for file existence when cross compiling" "$LINENO" 5
+ as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/sbin/launchd"; then
ac_cv_file__sbin_launchd=yes
else
@@ -28910,7 +28672,7 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__sbin_launchd" >&5
$as_echo "$ac_cv_file__sbin_launchd" >&6; }
-if test "x$ac_cv_file__sbin_launchd" = x""yes; then :
+if test "x$ac_cv_file__sbin_launchd" = xyes; then :
$as_echo "#define HAVE_SBIN_LAUNCHD 1" >>confdefs.h
@@ -29576,10 +29338,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -29595,6 +29368,7 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -29610,7 +29384,7 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -29711,6 +29485,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -29756,19 +29531,19 @@ export LANGUAGE
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
+# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
- $as_echo "$as_me: error: $1" >&2
+ $as_echo "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
@@ -29964,7 +29739,7 @@ $as_echo X"$as_dir" |
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
@@ -30018,7 +29793,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by asterisk $as_me trunk, which was
-generated by GNU Autoconf 2.65. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -30080,10 +29855,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
asterisk config.status trunk
-configured by $0, generated by GNU Autoconf 2.65,
+configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -30100,11 +29875,16 @@ ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=*)
+ --*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -30126,6 +29906,7 @@ do
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
esac
as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
@@ -30138,7 +29919,7 @@ do
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
- as_fn_error "ambiguous option: \`$1'
+ as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
$as_echo "$ac_cs_usage"; exit ;;
@@ -30147,7 +29928,7 @@ Try \`$0 --help' for more information.";;
ac_cs_silent=: ;;
# This is an error.
- -*) as_fn_error "unrecognized option: \`$1'
+ -*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
@@ -30201,7 +29982,7 @@ do
"makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;;
"channels/h323/Makefile") CONFIG_FILES="$CONFIG_FILES channels/h323/Makefile" ;;
- *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
@@ -30223,9 +30004,10 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
@@ -30233,12 +30015,13 @@ $debug ||
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -30255,12 +30038,12 @@ if test "x$ac_cr" = x; then
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\r'
+ ac_cs_awk_cr='\\r'
else
ac_cs_awk_cr=$ac_cr
fi
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
@@ -30269,18 +30052,18 @@ _ACEOF
echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
echo "_ACEOF"
} >conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
. ./conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -30288,7 +30071,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
@@ -30336,7 +30119,7 @@ t delim
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
@@ -30368,21 +30151,29 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || as_fn_error "could not setup config files machinery" "$LINENO" 5
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
s/^[^=]*=[ ]*$//
}'
fi
@@ -30394,7 +30185,7 @@ fi # test -n "$CONFIG_FILES"
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
@@ -30406,11 +30197,11 @@ _ACEOF
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
- ac_t=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_t"; then
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
break
elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
@@ -30495,7 +30286,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- as_fn_error "could not setup config headers machinery" "$LINENO" 5
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
@@ -30508,7 +30299,7 @@ do
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -30527,7 +30318,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -30536,7 +30327,7 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
@@ -30562,8 +30353,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -30693,23 +30484,24 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
+which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
+which seems to be undefined. Please make sure it is defined" >&2;}
- rm -f "$tmp/stdin"
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
@@ -30718,21 +30510,21 @@ which seems to be undefined. Please make sure it is defined." >&2;}
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
- mv "$tmp/config.h" "$ac_file" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
- || as_fn_error "could not create -" "$LINENO" 5
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
@@ -30747,7 +30539,7 @@ _ACEOF
ac_clean_files=$ac_clean_files_save
test $ac_write_fail = 0 ||
- as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
# configure is writing to config.log, and then calls config.status.
@@ -30768,7 +30560,7 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || as_fn_exit $?
+ $ac_cs_success || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
diff --git a/configure.ac b/configure.ac
index ff1181c65..d276a6ff0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -468,7 +468,6 @@ AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
-AST_EXT_LIB_SETUP([USB], [usb], [usb])
AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
AST_EXT_LIB_SETUP([X11], [X11], [x11])
@@ -2096,8 +2095,6 @@ fi
AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
-AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
-
if test "${OSARCH}" = "OpenBSD";
then
AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile -logg])
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 816159082..6ba9d6527 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -836,19 +836,19 @@
/* Define to 1 if you have the `strtoq' function. */
#undef HAVE_STRTOQ
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
-/* Define to 1 if `uid' is member of `struct sockpeercred'. */
+/* Define to 1 if `uid' is a member of `struct sockpeercred'. */
#undef HAVE_STRUCT_SOCKPEERCRED_UID
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
-/* Define to 1 if `cr_uid' is member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_CR_UID
-/* Define to 1 if `uid' is member of `struct ucred'. */
+/* Define to 1 if `uid' is a member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_UID
/* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -992,9 +992,6 @@
/* Define to 1 if you have the `unsetenv' function. */
#undef HAVE_UNSETENV
-/* Define to 1 if you have the usb library. */
-#undef HAVE_USB
-
/* Define to 1 if you have the `utime' function. */
#undef HAVE_UTIME
@@ -1129,6 +1126,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
/* Define to the version of this package. */
#undef PACKAGE_VERSION
diff --git a/makeopts.in b/makeopts.in
index fea95ff46..008ecd9b4 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -268,9 +268,6 @@ CRYPTO_LIB=@CRYPTO_LIB@
TONEZONE_INCLUDE=@TONEZONE_INCLUDE@
TONEZONE_LIB=@TONEZONE_LIB@
-USB_INCLUDE=@USB_INCLUDE@
-USB_LIB=@USB_LIB@
-
UNIXODBC_INCLUDE=@UNIXODBC_INCLUDE@
UNIXODBC_LIB=@UNIXODBC_LIB@