[asterisk-commits] branch oej/rtcp r11978 - in /team/oej/rtcp: ./
apps/ build_tools/ cdr/ channe...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Mar 6 02:09:04 MST 2006
Author: oej
Date: Mon Mar 6 03:08:16 2006
New Revision: 11978
URL: http://svn.digium.com/view/asterisk?rev=11978&view=rev
Log:
Updates
Added:
team/oej/rtcp/configs/res_snmp.conf.sample
- copied unchanged from r11751, trunk/configs/res_snmp.conf.sample
team/oej/rtcp/doc/asterisk-mib.txt
- copied unchanged from r11751, trunk/doc/asterisk-mib.txt
team/oej/rtcp/doc/digium-mib.txt
- copied unchanged from r11751, trunk/doc/digium-mib.txt
team/oej/rtcp/doc/snmp.txt
- copied unchanged from r11751, trunk/doc/snmp.txt
team/oej/rtcp/funcs/func_curl.c
- copied unchanged from r11751, trunk/funcs/func_curl.c
team/oej/rtcp/res/res_snmp.c
- copied unchanged from r11751, trunk/res/res_snmp.c
team/oej/rtcp/res/snmp/
- copied from r11751, trunk/res/snmp/
team/oej/rtcp/res/snmp/agent.c
- copied unchanged from r11751, trunk/res/snmp/agent.c
team/oej/rtcp/res/snmp/agent.h
- copied unchanged from r11751, trunk/res/snmp/agent.h
Removed:
team/oej/rtcp/apps/app_curl.c
Modified:
team/oej/rtcp/ (props changed)
team/oej/rtcp/CREDITS
team/oej/rtcp/Makefile
team/oej/rtcp/README
team/oej/rtcp/UPGRADE.txt
team/oej/rtcp/apps/Makefile
team/oej/rtcp/apps/app_directed_pickup.c
team/oej/rtcp/apps/app_meetme.c
team/oej/rtcp/apps/app_rpt.c
team/oej/rtcp/apps/app_sayunixtime.c
team/oej/rtcp/apps/app_skel.c
team/oej/rtcp/apps/app_sms.c
team/oej/rtcp/apps/app_voicemail.c
team/oej/rtcp/asterisk.c
team/oej/rtcp/asterisk.sgml
team/oej/rtcp/build_tools/make_build_h
team/oej/rtcp/build_tools/make_svn_branch_name
team/oej/rtcp/cdr.c
team/oej/rtcp/cdr/cdr_csv.c
team/oej/rtcp/cdr/cdr_manager.c
team/oej/rtcp/cdr/cdr_odbc.c
team/oej/rtcp/cdr/cdr_pgsql.c
team/oej/rtcp/cdr/cdr_tds.c
team/oej/rtcp/channel.c
team/oej/rtcp/channels/Makefile
team/oej/rtcp/channels/chan_iax2.c
team/oej/rtcp/channels/chan_misdn.c
team/oej/rtcp/channels/chan_sip.c
team/oej/rtcp/channels/chan_vpb.c
team/oej/rtcp/channels/misdn/Makefile
team/oej/rtcp/channels/misdn/isdn_lib.c
team/oej/rtcp/channels/misdn/isdn_msg_parser.c
team/oej/rtcp/channels/misdn_config.c
team/oej/rtcp/cli.c
team/oej/rtcp/codecs/gsm/Makefile
team/oej/rtcp/configs/cdr.conf.sample
team/oej/rtcp/configs/iax.conf.sample
team/oej/rtcp/configs/misdn.conf.sample
team/oej/rtcp/configs/sip.conf.sample
team/oej/rtcp/doc/00README.1st
team/oej/rtcp/doc/enum.txt
team/oej/rtcp/doc/misdn.txt
team/oej/rtcp/formats/format_h264.c
team/oej/rtcp/formats/format_pcm.c
team/oej/rtcp/formats/format_pcm_alaw.c
team/oej/rtcp/formats/msgsm.h
team/oej/rtcp/frame.c
team/oej/rtcp/funcs/Makefile
team/oej/rtcp/funcs/func_cdr.c
team/oej/rtcp/funcs/func_enum.c
team/oej/rtcp/funcs/func_odbc.c
team/oej/rtcp/funcs/func_strings.c
team/oej/rtcp/include/asterisk/cdr.h
team/oej/rtcp/include/asterisk/linkedlists.h
team/oej/rtcp/include/asterisk/logger.h
team/oej/rtcp/include/asterisk/sha1.h
team/oej/rtcp/include/asterisk/strings.h
team/oej/rtcp/indications.c
team/oej/rtcp/io.c
team/oej/rtcp/jitterbuf.c
team/oej/rtcp/jitterbuf.h
team/oej/rtcp/loader.c
team/oej/rtcp/logger.c
team/oej/rtcp/pbx/pbx_dundi.c
team/oej/rtcp/res/Makefile
team/oej/rtcp/res/res_agi.c
team/oej/rtcp/res/res_config_odbc.c
team/oej/rtcp/res/res_features.c
team/oej/rtcp/res/res_monitor.c
team/oej/rtcp/res/res_osp.c
team/oej/rtcp/rtp.c
team/oej/rtcp/say.c
team/oej/rtcp/translate.c
team/oej/rtcp/utils.c
Propchange: team/oej/rtcp/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/rtcp/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/rtcp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Mar 6 03:08:16 2006
@@ -1,1 +1,1 @@
-/trunk:1-10652
+/trunk:1-11776
Modified: team/oej/rtcp/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/CREDITS?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/CREDITS (original)
+++ team/oej/rtcp/CREDITS Mon Mar 6 03:08:16 2006
@@ -59,8 +59,8 @@
Jayson Vantuyl - Manager protocol changes, various other bugs.
jvantuyl at computingedge.net
Thorsten Lockert - OpenBSD, FreeBSD ports, making MacOS X port run on 10.3,
- dialplan include verification, route lookup on OpenBSD, various other
- bugs. tholo at sigmasoft.com
+ dialplan include verification, route lookup on OpenBSD, SNMP agent
+ support (res_snmp), various other bugs. tholo at sigmasoft.com
Brian West - ODBC support and Bug Marshaling
Josh Roberson - chan_zap reload support, Advanced Voicemail Features, other misc. patches,
and Bug Marshalling. - josh at asteriasgi.com, http://www.asteriasgi.com
Modified: team/oej/rtcp/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/Makefile?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/Makefile (original)
+++ team/oej/rtcp/Makefile Mon Mar 6 03:08:16 2006
@@ -32,6 +32,8 @@
OSARCH=$(CROSS_ARCH)
OSREV=$(CROSS_REV)
endif
+
+PWD=$(shell pwd)
# Remember the MAKELEVEL at the top
MAKETOPLEVEL?=$(MAKELEVEL)
@@ -222,17 +224,22 @@
MPG123TARG=linux
endif
-PWD=$(shell pwd)
GREP=grep
+ID=id
ifeq ($(OSARCH),SunOS)
GREP=/usr/xpg4/bin/grep
M4=/usr/local/bin/m4
+ ID=/usr/xpg4/bin/id
endif
INCLUDE+=-Iinclude -I../include
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
ASTCFLAGS+=$(OPTIMIZE)
+ASTCFLAGS+=# -Werror -Wunused
+ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
+ASTCFLAGS+= -Wno-pointer-sign
+endif
ASTOBJ=-o asterisk
ifeq ($(findstring BSD,$(OSARCH)),BSD)
@@ -549,7 +556,7 @@
$(MAKE) -C stdtime clean
datafiles: all
- if [ x`whoami` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
+ if [ x`$(ID) -un` = xroot ]; then sh build_tools/mkpkgconfig $(DESTDIR)/usr/lib/pkgconfig; fi
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/digits
mkdir -p $(DESTDIR)$(ASTVARLIBDIR)/sounds/priv-callerintros
for x in sounds/digits/*.gsm; do \
Modified: team/oej/rtcp/README
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/README?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/README (original)
+++ team/oej/rtcp/README Mon Mar 6 03:08:16 2006
@@ -67,7 +67,7 @@
In order to discover new features to use, please check the configuration
examples in the /configs directory of the source code distribution.
To discover the major new features of Asterisk 1.2, please visit
-http://www.astricon.net/asterisk1-2/
+http://edvina.net/asterisk1-2/
* NEW INSTALLATIONS
Modified: team/oej/rtcp/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/UPGRADE.txt?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/UPGRADE.txt (original)
+++ team/oej/rtcp/UPGRADE.txt Mon Mar 6 03:08:16 2006
@@ -37,6 +37,9 @@
functions. You are encouraged to move towards the associated dialplan
function, as these variables will be removed in a future release.
+* The CDR-CSV variables uniqueid, userfield, and basing time on GMT are now
+ adjustable from cdr.conf, instead of recompiling.
+
Functions:
* The function ${CHECK_MD5()} has been deprecated in favor of using an
@@ -47,10 +50,8 @@
modules.conf file then you will need to explicitly load the modules that
contain the functions you want to use.
-* The ENUMLOOKUP() function no longer supplies a default zone for searching; instead,
- it uses the default zone(s) defined in enum.conf. In addition, when the 'c'
- option (for counting the number of records is specified), but the lookup fails
- to match any records, the returned value will now be "0" instead of blank.
+* The ENUMLOOKUP() function with the 'c' option (for counting the number of records),
+ but the lookup fails to match any records, the returned value will now be "0" instead of blank.
The SIP channel:
Modified: team/oej/rtcp/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/apps/Makefile?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/apps/Makefile (original)
+++ team/oej/rtcp/apps/Makefile Mon Mar 6 03:08:16 2006
@@ -30,14 +30,6 @@
ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/osp/osp.h $(CROSS_COMPILE_TARGET)/usr/include/osp/osp.h),)
MODS:=$(filter-out app_osplookup.so,$(MODS))
-endif
-
-ifneq ($(shell if [[ 0x`$(CROSS_COMPILE_BIN)curl-config --vernum` -ge 0x70907 ]]; then echo "OK" ; fi),)
- CURLLIBS:=$(shell $(CROSS_COMPILE_BIN)curl-config --libs)
-endif
-
-ifeq (${CURLLIBS},)
- MODS:=$(filter-out app_curl.so,$(MODS))
endif
ifneq (${WITH_SMDI},)
@@ -83,9 +75,6 @@
uninstall:
-app_curl.so: app_curl.o
- $(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
-
look: look.c
$(CC) -pipe -O6 -g look.c -o look -lncurses
Modified: team/oej/rtcp/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/apps/app_directed_pickup.c?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/apps/app_directed_pickup.c (original)
+++ team/oej/rtcp/apps/app_directed_pickup.c Mon Mar 6 03:08:16 2006
@@ -82,7 +82,7 @@
origin = ast_get_channel_by_exten_locked(exten, context);
if (origin) {
ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
- sizeof(workspace), 0);
+ sizeof(workspace), 0, 0);
if (tmp) {
/* We have a possible channel... now we need to find it! */
target = ast_get_channel_by_name_locked(tmp);
Modified: team/oej/rtcp/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/apps/app_meetme.c?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/apps/app_meetme.c (original)
+++ team/oej/rtcp/apps/app_meetme.c Mon Mar 6 03:08:16 2006
@@ -1558,7 +1558,7 @@
if (!user->listen.actual &&
((confflags & CONFFLAG_MONITOR) ||
(user->adminflags & ADMINFLAG_MUTED) ||
- (user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
+ (!user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
)) {
int index;
for (index=0;index<AST_FRAME_BITS;index++)
Modified: team/oej/rtcp/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/oej/rtcp/apps/app_rpt.c?rev=11978&r1=11977&r2=11978&view=diff
==============================================================================
--- team/oej/rtcp/apps/app_rpt.c (original)
+++ team/oej/rtcp/apps/app_rpt.c Mon Mar 6 03:08:16 2006
@@ -20,8 +20,8 @@
/*! \file
*
* \brief Radio Repeater / Remote Base program
- * version 0.39 12/19/05
- *
+ * version 0.42 02/25/06
+ *
* \author Jim Dixon, WB6NIL <jim at lambdatel.com>
*
* \note Serious contributions by Steve RoDgers, WA6ZFT <hwstar at rodgers.sdcoxmail.com>
@@ -107,6 +107,9 @@
/* maximum digits in DTMF buffer, and seconds after * for DTMF command timeout */
#define MAXDTMF 32
+#define MAXMACRO 2048
+#define MACROTIME 100
+#define MACROPTIME 500
#define DTMF_TIMEOUT 3
#define DISC_TIME 10000 /* report disc after 10 seconds of no connect */
@@ -123,6 +126,7 @@
#define NODES "nodes"
#define MEMORY "memory"
+#define MACRO "macro"
#define FUNCTIONS "functions"
#define TELEMETRY "telemetry"
#define MORSE "morse"
@@ -147,7 +151,7 @@
enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
CONNECTED,CONNFAIL,STATUS,TIMEOUT,ID1, STATS_TIME,
STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH,
- TAILMSG};
+ TAILMSG, MACRO_NOTFOUND, MACRO_BUSY};
enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
@@ -206,7 +210,7 @@
#include "asterisk/say.h"
#include "asterisk/localtime.h"
-static char *tdesc = "Radio Repeater / Remote Base version 0.39 12/19/2005";
+static char *tdesc = "Radio Repeater / Remote Base version 0.42 02/25/2006";
static char *app = "Rpt";
@@ -247,7 +251,7 @@
" available to the phone user.\n"
"\n";
-static int debug = 0; /* Set this >0 for extra debug output */
+static int debug = 0; /* FIXME Set this >0 for extra debug output */
static int nrpts = 0;
char *discstr = "!!DISCONNECT!!";
@@ -256,6 +260,7 @@
struct ast_config *cfg;
+STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
#define MSWAIT 200
@@ -362,15 +367,16 @@
char tonotify;
char enable;
char dtmfbuf[MAXDTMF];
+ char macrobuf[MAXMACRO];
char rem_dtmfbuf[MAXDTMF];
char cmdnode[50];
struct ast_channel *rxchannel,*txchannel;
struct ast_channel *pchannel,*txpchannel, *remchannel;
struct rpt_tele tele;
pthread_t rpt_call_thread,rpt_thread;
- time_t rem_dtmf_time,dtmf_time_rem;
+ time_t dtmf_time,rem_dtmf_time,dtmf_time_rem;
int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer,tmsgtimer;
- int mustid;
+ int mustid,tailid;
int politeid;
int dtmfidx,rem_dtmfidx;
long retxtimer;
@@ -390,6 +396,7 @@
char funcchar;
char endchar;
char stopgen;
+ int macro_longest;
int phone_longestfunc;
int dphone_longestfunc;
int link_longestfunc;
@@ -403,8 +410,197 @@
int tailmessagen;
time_t disgorgetime;
time_t lastthreadrestarttime;
+ long macrotimer;
+ char *macro;
+ char *startupmacro;
+ char *memory;
char nobusyout;
} rpt_vars[MAXRPTS];
+
+
+#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 */
/*
* CLI extensions
@@ -412,15 +608,32 @@
/* Debug mode */
static int rpt_do_debug(int fd, int argc, char *argv[]);
+static int rpt_do_dump(int fd, int argc, char *argv[]);
+static int rpt_do_frog(int fd, int argc, char *argv[]);
static char debug_usage[] =
"Usage: rpt debug level {0-7}\n"
" Enables debug messages in app_rpt\n";
-
+
+static char dump_usage[] =
+"Usage: rpt dump <nodename>\n"
+" Dumps struct debug info to log\n";
+
+static char frog_usage[] =
+"Usage: frog [warp_factor]\n"
+" Performs frog-in-a-blender calculations (Jacobsen Corollary)\n";
+
static struct ast_cli_entry cli_debug =
- { { "rpt", "debug", "level" }, rpt_do_debug, "Enable app_rpt debugging", debug_usage };
-
-
+ { { "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_frog =
+ { { "frog" }, rpt_do_frog,
+ "Perform frog-in-a-blender calculations", frog_usage };
/*
* Telemetry defaults
@@ -460,6 +673,7 @@
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);
/*
* Function table
*/
@@ -470,7 +684,8 @@
{"autopatchdn", function_autopatchdn},
{"ilink", function_ilink},
{"status", function_status},
- {"remote", function_remote}
+ {"remote", function_remote},
+ {"macro", function_macro}
} ;
static int finddelim(char *str,char *strp[])
@@ -542,8 +757,49 @@
debug = newlevel;
return RESULT_SUCCESS;
}
+
+/*
+* Dump rpt struct debugging onto console
+*/
-
+static int rpt_do_dump(int fd, int argc, char *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;
+}
+
+/*
+* Perform frong-in-a-blender calculations (Jacobsen Corollary)
+*/
+
+static int rpt_do_frog(int fd, int argc, char *argv[])
+{
+ double warpone = 75139293848.398696166028333356763;
+ double warpfactor = 1.0;
+
+ if (argc > 2) return RESULT_SHOWUSAGE;
+ if ((argc > 1) && (sscanf(argv[1],"%lf",&warpfactor) != 1))
+ return RESULT_SHOWUSAGE;
+
+ ast_cli(fd, "A frog in a blender with a base diameter of 3 inches going\n");
+ ast_cli(fd, "%lf RPM will be travelling at warp factor %lf,\n",
+ warpfactor * warpfactor * warpfactor * warpone,warpfactor);
+ ast_cli(fd,"based upon the Jacobsen Frog Corollary.\n");
+ return RESULT_FAILURE;
+}
static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration, int amplitude)
{
@@ -1028,35 +1284,37 @@
time_t t;
struct tm localtm;
-
/* get a pointer to myrpt */
myrpt = mytele->rpt;
/* Snag copies of a few key myrpt variables */
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
+ insque((struct qelem *)mytele, (struct qelem *)myrpt->tele.next); /* Moved from rpt_telemetry() */
nodename = ast_strdupa(myrpt->name);
ident = ast_strdupa(myrpt->ident);
- ast_mutex_unlock(&myrpt->lock);
-
+ rpt_mutex_unlock(&myrpt->lock);
/* allocate a pseudo-channel thru asterisk */
- if (!(mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL)))
+ mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
+ if (!mychannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
remque((struct qelem *)mytele);
- ast_mutex_unlock(&myrpt->lock);
+ ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
+ rpt_mutex_unlock(&myrpt->lock);
free(mytele);
pthread_exit(NULL);
}
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
mytele->chan = mychannel; /* Save a copy of the channel so we can access it externally if need be */
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
/* make a conference for the tx */
ci.chan = 0;
- /* If there's an ID queued, only connect the ID audio to the local tx conference so
- linked systems can't hear it */
+ /* If there's an ID queued, or tail message queued, */
+ /* 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)) ?
myrpt->txconf : myrpt->conf);
@@ -1065,9 +1323,10 @@
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
remque((struct qelem *)mytele);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
+ ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
free(mytele);
ast_hangup(mychannel);
pthread_exit(NULL);
@@ -1110,6 +1369,16 @@
wait_interval(myrpt, DLY_TELEM, mychannel);
res = telem_lookup(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", mychannel->language);
+ break;
+ case MACRO_BUSY:
+ /* wait a little bit */
+ wait_interval(myrpt, DLY_TELEM, mychannel);
+ res = ast_streamfile(mychannel, "rpt/macro_busy", mychannel->language);
+ break;
case UNKEY:
/*
@@ -1117,9 +1386,9 @@
*/
x = get_wait_interval(myrpt, DLY_UNKEY);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->unkeytocttimer = x; /* Must be protected as it is changed below */
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
/*
* If there's one already queued, don't do another
@@ -1129,12 +1398,12 @@
unkeys_queued = 0;
if (tlist != &myrpt->tele)
{
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
while(tlist != &myrpt->tele){
if (tlist->mode == UNKEY) unkeys_queued++;
tlist = tlist->next;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
}
if( unkeys_queued > 1){
imdone = 1;
@@ -1143,7 +1412,6 @@
/* Wait for the telemetry timer to expire */
/* Periodically check the timer since it can be re-initialized above */
-
while(myrpt->unkeytocttimer)
{
int ctint;
@@ -1152,15 +1420,14 @@
else
ctint = myrpt->unkeytocttimer;
ast_safe_sleep(mychannel, ctint);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
if(myrpt->unkeytocttimer < ctint)
myrpt->unkeytocttimer = 0;
else
myrpt->unkeytocttimer -= ctint;
- ast_mutex_unlock(&myrpt->lock);
- }
-
-
+ 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
@@ -1176,7 +1443,7 @@
l = myrpt->links.next;
if (l != &myrpt->links)
{
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
while(l != &myrpt->links)
{
if (l->name[0] == '0')
@@ -1191,7 +1458,7 @@
}
l = l->next;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
}
if (haslink)
{
@@ -1217,7 +1484,6 @@
if(res)
ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);
}
-
if (hasremote && (!myrpt->cmdnode[0]))
{
/* set for all to hear */
@@ -1228,9 +1494,10 @@
if (ioctl(mychannel->fds[0],ZT_SETCONF,&ci) == -1)
{
ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
remque((struct qelem *)mytele);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
+ ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
free(mytele);
ast_hangup(mychannel);
pthread_exit(NULL);
@@ -1301,7 +1568,7 @@
hastx = 0;
linkbase.next = &linkbase;
linkbase.prev = &linkbase;
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
/* make our own list of links */
l = myrpt->links.next;
while(l != &myrpt->links)
@@ -1310,12 +1577,14 @@
{
l = l->next;
continue;
- }
- if (!(m = ast_malloc(sizeof(*m))))
+ }
+ m = malloc(sizeof(struct rpt_link));
+ if (!m)
{
- ast_mutex_lock(&myrpt->lock);
+ ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", mychannel->name);
remque((struct qelem *)mytele);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
+ ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
free(mytele);
ast_hangup(mychannel);
pthread_exit(NULL);
@@ -1325,7 +1594,7 @@
insque((struct qelem *)m,(struct qelem *)linkbase.next);
l = l->next;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
res = ast_streamfile(mychannel, "rpt/node", mychannel->language);
if (!res)
res = ast_waitstream(mychannel, "");
@@ -1534,7 +1803,7 @@
}
}
ast_stopstream(mychannel);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
if (mytele->mode == TAILMSG)
{
if (!res)
@@ -1548,9 +1817,20 @@
}
}
remque((struct qelem *)mytele);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
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);
}
@@ -1558,16 +1838,21 @@
{
struct rpt_tele *tele;
struct rpt_link *mylink = (struct rpt_link *) data;
+int res;
pthread_attr_t attr;
-
- if (!(tele = ast_calloc(1, sizeof(*tele))))
- {
+
+ tele = 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;
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
if((mode == CONNFAIL) || (mode == REMDISC) || (mode == CONNECTED)){
memset(&tele->mylink,0,sizeof(struct rpt_link));
if (mylink){
@@ -1578,11 +1863,12 @@
strncpy(tele->param, (char *) data, TELEPARAMSIZE - 1);
tele->param[TELEPARAMSIZE - 1] = 0;
}
- insque((struct qelem *)tele,(struct qelem *)myrpt->tele.next);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
+ res = ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
+ if(res < 0)
+ ast_log(LOG_WARNING, "Could not create telemetry thread: %s",strerror(res));
return;
}
@@ -1597,7 +1883,8 @@
myrpt->mydtmf = 0;
/* allocate a pseudo-channel thru asterisk */
- if (!(mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL)))
+ mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
+ if (!mychannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
pthread_exit(NULL);
@@ -1615,7 +1902,8 @@
pthread_exit(NULL);
}
/* allocate a pseudo-channel thru asterisk */
- if (!(genchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL)))
+ genchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
+ if (!genchannel)
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
ast_hangup(mychannel);
@@ -1681,9 +1969,9 @@
{
ast_hangup(mychannel);
ast_hangup(genchannel);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->callmode = 0;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
pthread_exit(NULL);
}
}
@@ -1694,9 +1982,9 @@
{
ast_hangup(mychannel);
ast_hangup(genchannel);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->callmode = 0;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
pthread_exit(NULL);
}
@@ -1730,23 +2018,23 @@
ast_log(LOG_WARNING, "Unable to start PBX!!\n");
ast_hangup(mychannel);
ast_hangup(genchannel);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->callmode = 0;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
pthread_exit(NULL);
}
usleep(10000);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->callmode = 3;
while(myrpt->callmode)
{
if ((!mychannel->pbx) && (myrpt->callmode != 4))
{
myrpt->callmode = 4;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
/* start congestion tone */
tone_zone_play_tone(genchannel->fds[0],ZT_TONE_CONGESTION);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
}
if (myrpt->mydtmf)
{
@@ -1757,22 +2045,22 @@
wf.data = NULL;
wf.datalen = 0;
wf.samples = 0;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
ast_write(genchannel,&wf);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->mydtmf = 0;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
usleep(MSWAIT * 1000);
- ast_mutex_lock(&myrpt->lock);
- }
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
+ }
+ rpt_mutex_unlock(&myrpt->lock);
tone_zone_play_tone(genchannel->fds[0],-1);
if (mychannel->pbx) ast_softhangup(mychannel,AST_SOFTHANGUP_DEV);
ast_hangup(genchannel);
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
myrpt->callmode = 0;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
pthread_exit(NULL);
}
@@ -1857,7 +2145,7 @@
s = tmp;
s1 = strsep(&s,",");
s2 = strsep(&s,",");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
l = myrpt->links.next;
/* try to find this one in queue */
while(l != &myrpt->links){
@@ -1877,7 +2165,7 @@
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
l->retries = MAX_RETRIES + 1;
l->disced = 1;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
wf.frametype = AST_FRAME_TEXT;
wf.subclass = 0;
wf.offset = 0;
@@ -1894,7 +2182,7 @@
rpt_telemetry(myrpt, COMPLETE, NULL);
return DC_COMPLETE;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
return DC_COMPLETE;
case 2: /* Link Monitor */
if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
@@ -1909,7 +2197,7 @@
s = tmp;
s1 = strsep(&s,",");
s2 = strsep(&s,",");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
l = myrpt->links.next;
/* try to find this one in queue */
while(l != &myrpt->links){
@@ -1928,24 +2216,27 @@
{
/* if already in this mode, just ignore */
if ((!l->mode) || (!l->chan)) {
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt,REMALREADY,NULL);
return DC_COMPLETE;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
if (l->chan) ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
l->retries = MAX_RETRIES + 1;
l->disced = 2;
modechange = 1;
} else
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
- /* establish call in monitor mode */
- if (!(l = ast_calloc(1, sizeof(*l)))) {
+ /* establish call in monitor mode */
+ l = malloc(sizeof(struct rpt_link));
+ if (!l){
+ ast_log(LOG_WARNING, "Unable to malloc\n");
return DC_ERROR;
}
/* zero the silly thing */
+ memset((char *)l,0,sizeof(struct rpt_link));
snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
tele = strchr(deststr,'/');
if (!tele){
@@ -1981,7 +2272,8 @@
return DC_ERROR;
}
/* allocate a pseudo-channel thru asterisk */
- if (!(l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL))) {
+ l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
+ if (!l->pchan){
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
ast_hangup(l->chan);
free(l);
@@ -2002,10 +2294,10 @@
free(l);
return DC_ERROR;
}
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
/* insert at end of queue */
insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt,COMPLETE,NULL);
return DC_COMPLETE;
case 3: /* Link transceive */
@@ -2021,7 +2313,7 @@
s = tmp;
s1 = strsep(&s,",");
s2 = strsep(&s,",");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
l = myrpt->links.next;
/* try to find this one in queue */
while(l != &myrpt->links){
@@ -2039,22 +2331,26 @@
if (l != &myrpt->links){
/* if already in this mode, just ignore */
if ((l->mode) || (!l->chan)) {
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt, REMALREADY, NULL);
return DC_COMPLETE;
}
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
if (l->chan) ast_softhangup(l->chan, AST_SOFTHANGUP_DEV);
l->retries = MAX_RETRIES + 1;
l->disced = 2;
modechange = 1;
} else
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
/* establish call in tranceive mode */
- if (!(l = ast_calloc(1, sizeof(*l)))) {
+ l = malloc(sizeof(struct rpt_link));
+ if (!l){
+ ast_log(LOG_WARNING, "Unable to malloc\n");
return(DC_ERROR);
}
+ /* zero the silly thing */
+ memset((char *)l,0,sizeof(struct rpt_link));
l->mode = 1;
l->outbound = 1;
strncpy(l->name, digitbuf, MAXNODESTR - 1);
@@ -2092,7 +2388,8 @@
return DC_ERROR;
}
/* allocate a pseudo-channel thru asterisk */
- if (!(l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL))) {
+ l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
+ if (!l->pchan){
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
ast_hangup(l->chan);
free(l);
@@ -2113,10 +2410,10 @@
free(l);
return DC_ERROR;
}
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
/* insert at end of queue */
insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt,COMPLETE,NULL);
return DC_COMPLETE;
case 4: /* Enter Command Mode */
@@ -2141,10 +2438,10 @@
break;
}
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
strcpy(myrpt->lastlinknode,digitbuf);
strncpy(myrpt->cmdnode, digitbuf, sizeof(myrpt->cmdnode) - 1);
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
rpt_telemetry(myrpt, REMGO, NULL);
return DC_COMPLETE;
@@ -2186,7 +2483,7 @@
if(debug)
printf("@@@@ Autopatch up\n");
- ast_mutex_lock(&myrpt->lock);
+ rpt_mutex_lock(&myrpt->lock);
/* if on call, force * into current audio stream */
@@ -2194,13 +2491,13 @@
myrpt->mydtmf = myrpt->funcchar;
}
if (myrpt->callmode){
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
return DC_COMPLETE;
}
myrpt->callmode = 1;
myrpt->cidx = 0;
myrpt->exten[myrpt->cidx] = 0;
- ast_mutex_unlock(&myrpt->lock);
+ rpt_mutex_unlock(&myrpt->lock);
pthread_attr_init(&attr);
[... 6736 lines stripped ...]
More information about the asterisk-commits
mailing list