[asterisk-commits] russell: branch russell/events r87461 - in /team/russell/events: ./ apps/ cha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 29 17:05:01 CDT 2007
Author: russell
Date: Mon Oct 29 17:05:00 2007
New Revision: 87461
URL: http://svn.digium.com/view/asterisk?view=rev&rev=87461
Log:
resolve, reset
Added:
team/russell/events/funcs/func_dialgroup.c
- copied unchanged from r87428, trunk/funcs/func_dialgroup.c
Modified:
team/russell/events/ (props changed)
team/russell/events/UPGRADE.txt
team/russell/events/apps/app_meetme.c
team/russell/events/apps/app_queue.c
team/russell/events/apps/app_record.c
team/russell/events/apps/app_voicemail.c
team/russell/events/channels/chan_misdn.c
team/russell/events/channels/chan_sip.c
team/russell/events/configure
team/russell/events/configure.ac
team/russell/events/funcs/func_cut.c
team/russell/events/funcs/func_odbc.c
team/russell/events/funcs/func_realtime.c
team/russell/events/funcs/func_strings.c
team/russell/events/include/asterisk/autoconfig.h.in
team/russell/events/include/asterisk/lock.h
team/russell/events/main/astmm.c
team/russell/events/main/rtp.c
team/russell/events/main/utils.c
Propchange: team/russell/events/
------------------------------------------------------------------------------
automerge = *
Propchange: team/russell/events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/russell/events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/russell/events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 29 17:05:00 2007
@@ -1,1 +1,1 @@
-/trunk:1-87244
+/trunk:1-87459
Modified: team/russell/events/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/russell/events/UPGRADE.txt?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/UPGRADE.txt (original)
+++ team/russell/events/UPGRADE.txt Mon Oct 29 17:05:00 2007
@@ -79,6 +79,11 @@
these functions in any location where you desire to ensure that only one
channel is executing that path at any one time.
+Dialplan Functions:
+
+* QUEUE_MEMBER_COUNT() has been deprecated in favor of the QUEUE_MEMBER() function. For
+ more information, issue a "show function QUEUE_MEMBER" from the CLI.
+
CDR:
* The cdr_sqlite module has been marked as deprecated in favor of
Modified: team/russell/events/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_meetme.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/apps/app_meetme.c (original)
+++ team/russell/events/apps/app_meetme.c Mon Oct 29 17:05:00 2007
@@ -1803,7 +1803,7 @@
x = 1;
ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
}
- if (!(dsp = ast_dsp_new())) {
+ if (!(confflags & CONFFLAG_MONITOR) && !(dsp = ast_dsp_new())) {
ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
res = -1;
}
@@ -2060,7 +2060,7 @@
if (user->talk.actual)
ast_frame_adjust_volume(f, user->talk.actual);
- {
+ if (!(confflags & CONFFLAG_MONITOR)) {
int totalsilence;
if (user->talking == -1)
Modified: team/russell/events/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_queue.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/apps/app_queue.c (original)
+++ team/russell/events/apps/app_queue.c Mon Oct 29 17:05:00 2007
@@ -4033,6 +4033,67 @@
struct call_queue *q, tmpq;
struct member *m;
struct ao2_iterator mem_iter;
+ char *queuename, *option;
+
+ buf[0] = '\0';
+
+ if (ast_strlen_zero(data)) {
+ ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
+ return -1;
+ }
+
+ queuename = data;
+ if ((option = strchr(data, ',')))
+ *option++ = '\0';
+ else
+ option = "logged";
+
+ ast_copy_string(tmpq.name, queuename, sizeof(tmpq.name));
+
+ if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
+ ao2_lock(q);
+ if(!strcasecmp(option, "logged")) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
+ /* Count the agents who are logged in and presently answering calls */
+ if ((m->status != AST_DEVICE_UNAVAILABLE) && (m->status != AST_DEVICE_INVALID)) {
+ count++;
+ }
+ ao2_ref(m, -1);
+ }
+ } else if(!strcasecmp(option, "free")) {
+ mem_iter = ao2_iterator_init(q->members, 0);
+ while ((m = ao2_iterator_next(&mem_iter))) {
+ /* Count the agents who are logged in and presently answering calls */
+ if ((m->status == AST_DEVICE_NOT_INUSE) && (!m->paused)) {
+ count++;
+ }
+ ao2_ref(m, -1);
+ }
+ } else /* must be "count" */
+ count = q->membercount;
+ ao2_unlock(q);
+ queue_unref(q);
+ } else
+ ast_log(LOG_WARNING, "queue %s was not found\n", data);
+
+ snprintf(buf, len, "%d", count);
+
+ return 0;
+}
+
+static int queue_function_qac_dep(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
+{
+ int count = 0;
+ struct call_queue *q, tmpq;
+ struct member *m;
+ struct ao2_iterator mem_iter;
+ static int depflag = 1;
+ if(depflag)
+ {
+ depflag = 0;
+ ast_log(LOG_NOTICE, "The function QUEUE_MEMBER_COUNT has been deprecated in favor of the QUEUE_MEMBER function and will not be in further releases.\n");
+ }
buf[0] = '\0';
@@ -4062,6 +4123,7 @@
return 0;
}
+
static int queue_function_queuewaitingcount(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
@@ -4156,12 +4218,26 @@
};
static struct ast_custom_function queuemembercount_function = {
+ .name = "QUEUE_MEMBER",
+ .synopsis = "Count number of members answering a queue",
+ .syntax = "QUEUE_MEMBER(<queuename>, <option>)",
+ .desc =
+"Returns the number of members currently associated with the specified queue.\n"
+"One of three options may be passed to determine the count returned:\n"
+ "\"logged\" - Returns the number of logged-in members for the specified queue\n"
+ "\"free\" - Returns the number of logged-in members for the specified queue available to take a call\n"
+ "\"count\" - Returns the total number of members for the specified queue\n",
+ .read = queue_function_qac,
+};
+
+static struct ast_custom_function queuemembercount_dep = {
.name = "QUEUE_MEMBER_COUNT",
.synopsis = "Count number of members answering a queue",
.syntax = "QUEUE_MEMBER_COUNT(<queuename>)",
.desc =
-"Returns the number of members currently associated with the specified queue.\n",
- .read = queue_function_qac,
+"Returns the number of members currently associated with the specified queue.\n\n"
+"This function has been deprecated in favor of the QUEUE_MEMBER function\n",
+ .read = queue_function_qac_dep,
};
static struct ast_custom_function queuewaitingcount_function = {
@@ -5132,6 +5208,7 @@
res |= ast_unregister_application(app);
res |= ast_custom_function_unregister(&queuevar_function);
res |= ast_custom_function_unregister(&queuemembercount_function);
+ res |= ast_custom_function_unregister(&queuemembercount_dep);
res |= ast_custom_function_unregister(&queuememberlist_function);
res |= ast_custom_function_unregister(&queuewaitingcount_function);
@@ -5190,6 +5267,7 @@
res |= ast_manager_register("QueueLog", EVENT_FLAG_AGENT, manager_queue_log_custom, "Adds custom entry in queue_log");
res |= ast_custom_function_register(&queuevar_function);
res |= ast_custom_function_register(&queuemembercount_function);
+ res |= ast_custom_function_register(&queuemembercount_dep);
res |= ast_custom_function_register(&queuememberlist_function);
res |= ast_custom_function_register(&queuewaitingcount_function);
if (!(device_state_sub = ast_event_subscribe(AST_EVENT_DEVICE_STATE, device_state_cb, NULL, AST_EVENT_IE_END)))
Modified: team/russell/events/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_record.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/apps/app_record.c (original)
+++ team/russell/events/apps/app_record.c Mon Oct 29 17:05:00 2007
@@ -117,7 +117,7 @@
int ioflags;
int waitres;
struct ast_silence_generator *silgen = NULL;
- struct ast_flags flags;
+ struct ast_flags flags = { 0, };
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename);
AST_APP_ARG(silence);
Modified: team/russell/events/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/apps/app_voicemail.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/apps/app_voicemail.c (original)
+++ team/russell/events/apps/app_voicemail.c Mon Oct 29 17:05:00 2007
@@ -69,7 +69,6 @@
#include <errno.h>
#include <unistd.h>
#include <string.h>
-#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/stat.h>
Modified: team/russell/events/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_misdn.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/channels/chan_misdn.c (original)
+++ team/russell/events/channels/chan_misdn.c Mon Oct 29 17:05:00 2007
@@ -452,13 +452,17 @@
static void print_facility(struct FacParm *fac, struct misdn_bchannel *bc)
{
switch (fac->Function) {
+#ifdef HAVE_MISDN_FAC_RESULT
case Fac_RESULT:
chan_misdn_log(0, bc->port," --> Received RESULT Operation\n");
break;
+#endif
+#ifdef HAVE_MISDN_FAC_ERROR
case Fac_ERROR:
chan_misdn_log(0, bc->port," --> Received Error Operation\n");
chan_misdn_log(0, bc->port," --> Value:%d Error:%s\n",fac->u.ERROR.errorValue, fac->u.ERROR.error);
break;
+#endif
case Fac_CD:
chan_misdn_log(1,bc->port," --> calldeflect to: %s, screened: %s\n", fac->u.CDeflection.DeflectedToNumber,
fac->u.CDeflection.PresentationAllowed ? "yes" : "no");
@@ -4908,8 +4912,10 @@
print_facility(&(bc->fac_in), bc);
switch (bc->fac_in.Function) {
+#ifdef HAVE_MISDN_FAC_RESULT
case Fac_RESULT:
break;
+#endif
case Fac_CD:
if (ch) {
struct ast_channel *bridged = ast_bridged_channel(ch->ast);
@@ -4946,7 +4952,9 @@
}
break;
case Fac_None:
+#ifdef HAVE_MISDN_FAC_ERROR
case Fac_ERROR:
+#endif
break;
default:
chan_misdn_log(0, bc->port," --> not yet handled: facility type:%p\n", bc->fac_in.Function);
Modified: team/russell/events/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_sip.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/channels/chan_sip.c (original)
+++ team/russell/events/channels/chan_sip.c Mon Oct 29 17:05:00 2007
@@ -4111,6 +4111,7 @@
INVITE, but do set an autodestruct just in case we never get it. */
needdestroy = 0;
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+ p->invitestate = INV_CANCELLED;
}
if ( p->initid != -1 ) {
/* channel still up - reverse dec of inUse counter
@@ -4123,6 +4124,7 @@
transmit_response_reliable(p, res, &p->initreq);
else
transmit_response_reliable(p, "603 Declined", &p->initreq);
+ p->invitestate = INV_TERMINATED;
}
} else { /* Call is in UP state, send BYE */
if (!p->pendinginvite) {
@@ -15560,7 +15562,16 @@
check_via(p, req);
sip_alreadygone(p);
- p->invitestate = INV_CANCELLED;
+
+ /* At this point, we could have cancelled the invite at the same time
+ as the other side sends a CANCEL. Our final reply with error code
+ might not have been received by the other side before the CANCEL
+ was sent, so let's just give up retransmissions and waiting for
+ ACK on our error code. The call is hanging up any way. */
+ if (p->invitestate == INV_TERMINATED)
+ __sip_pretend_ack(p);
+ else
+ p->invitestate = INV_CANCELLED;
if (p->owner && p->owner->_state == AST_STATE_UP) {
/* This call is up, cancel is ignored, we need a bye */
Modified: team/russell/events/configure
URL: http://svn.digium.com/view/asterisk/team/russell/events/configure?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/configure (original)
+++ team/russell/events/configure Mon Oct 29 17:05:00 2007
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 83619 .
+# From configure.ac Revision: 85635 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61.
#
@@ -39713,6 +39713,144 @@
fi
fi
+
+ if test "x${PBX_MISDN_FAC_RESULT}" != "x1" -a "${USE_MISDN_FAC_RESULT}" != "no"; then
+ { echo "$as_me:$LINENO: checking for Fac_RESULT in mISDNuser/suppserv.h" >&5
+echo $ECHO_N "checking for Fac_RESULT in mISDNuser/suppserv.h... $ECHO_C" >&6; }
+ saved_cppflags="${CPPFLAGS}"
+ if test "x${MISDN_FAC_RESULT_DIR}" != "x"; then
+ MISDN_FAC_RESULT_INCLUDE="-I${MISDN_FAC_RESULT_DIR}/include"
+ fi
+ CPPFLAGS="${CPPFLAGS} ${MISDN_FAC_RESULT_INCLUDE}"
+
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <mISDNuser/suppserv.h>
+int
+main ()
+{
+int foo = Fac_RESULT;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ PBX_MISDN_FAC_RESULT=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MISDN_FAC_RESULT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MISDN_FAC_RESULT_VERSION
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="${saved_cppflags}"
+ fi
+
+
+ if test "x${PBX_MISDN_FAC_ERROR}" != "x1" -a "${USE_MISDN_FAC_ERROR}" != "no"; then
+ { echo "$as_me:$LINENO: checking for Fac_ERROR in mISDNuser/suppserv.h" >&5
+echo $ECHO_N "checking for Fac_ERROR in mISDNuser/suppserv.h... $ECHO_C" >&6; }
+ saved_cppflags="${CPPFLAGS}"
+ if test "x${MISDN_FAC_ERROR_DIR}" != "x"; then
+ MISDN_FAC_ERROR_INCLUDE="-I${MISDN_FAC_ERROR_DIR}/include"
+ fi
+ CPPFLAGS="${CPPFLAGS} ${MISDN_FAC_ERROR_INCLUDE}"
+
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <mISDNuser/suppserv.h>
+int
+main ()
+{
+int foo = Fac_ERROR;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ PBX_MISDN_FAC_ERROR=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MISDN_FAC_ERROR 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MISDN_FAC_ERROR_VERSION
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CPPFLAGS="${saved_cppflags}"
+ fi
+
if test "${ac_cv_header_linux_mISDNdsp_h+set}" = set; then
{ echo "$as_me:$LINENO: checking for linux/mISDNdsp.h" >&5
echo $ECHO_N "checking for linux/mISDNdsp.h... $ECHO_C" >&6; }
@@ -44789,7 +44927,7 @@
pbxlibdir="-L${SS7_DIR}"
fi
fi
- pbxfuncname="ss7_new"
+ pbxfuncname="isup_cqr"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_SS7_FOUND=yes
else
Modified: team/russell/events/configure.ac
URL: http://svn.digium.com/view/asterisk/team/russell/events/configure.ac?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/configure.ac (original)
+++ team/russell/events/configure.ac Mon Oct 29 17:05:00 2007
@@ -785,6 +785,8 @@
if test "${PBX_MISDN}" = 1; then
AST_EXT_LIB_CHECK([ISDNNET], [isdnnet], [init_manager], [mISDNuser/isdn_net.h], [-lmISDN -lpthread])
AST_EXT_LIB_CHECK([SUPPSERV], [suppserv], [encodeFac], [mISDNuser/suppserv.h])
+ AST_C_DEFINE_CHECK([MISDN_FAC_RESULT], [Fac_RESULT], [mISDNuser/suppserv.h])
+ AST_C_DEFINE_CHECK([MISDN_FAC_ERROR], [Fac_ERROR], [mISDNuser/suppserv.h])
AC_CHECK_HEADER([linux/mISDNdsp.h], [AC_DEFINE_UNQUOTED([MISDN_1_2], 1, [Build chan_misdn for mISDN 1.2 or later.])])
fi
@@ -883,7 +885,7 @@
AST_EXT_LIB_CHECK([PRI], [pri], [pri_keypad_facility], [libpri.h])
-AST_EXT_LIB_CHECK([SS7], [ss7], [isup_set_charge], [libss7.h])
+AST_EXT_LIB_CHECK([SS7], [ss7], [isup_cqr], [libss7.h])
if test "${USE_PWLIB}" != "no"; then
if test -n "${PWLIB_DIR}"; then
Modified: team/russell/events/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/funcs/func_cut.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/funcs/func_cut.c (original)
+++ team/russell/events/funcs/func_cut.c Mon Oct 29 17:05:00 2007
@@ -126,7 +126,7 @@
);
memset(buffer, 0, buflen);
-
+
parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -235,6 +235,9 @@
{
int ret = -1;
+ if (chan)
+ ast_autoservice_start(chan);
+
switch (cut_internal(chan, data, buf, len)) {
case ERROR_NOARG:
ast_log(LOG_ERROR, "Syntax: CUT(<varname>,<char-delim>,<range-spec>) - missing argument!\n");
@@ -251,6 +254,9 @@
default:
ast_log(LOG_ERROR, "Unknown internal error\n");
}
+
+ if (chan)
+ ast_autoservice_stop(chan);
return ret;
}
Modified: team/russell/events/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/funcs/func_odbc.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/funcs/func_odbc.c (original)
+++ team/russell/events/funcs/func_odbc.c Mon Oct 29 17:05:00 2007
@@ -139,7 +139,7 @@
struct odbc_obj *obj = NULL;
struct acf_odbc_query *query;
char *t, buf[2048]="", varname[15];
- int i, dsn;
+ int i, dsn, bogus_chan = 0;
AST_DECLARE_APP_ARGS(values,
AST_APP_ARG(field)[100];
);
@@ -162,12 +162,24 @@
return -1;
}
+ if (!chan) {
+ if ((chan = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Bogus/func_odbc")))
+ bogus_chan = 1;
+ }
+
+ if (chan)
+ ast_autoservice_start(chan);
+
/* Parse our arguments */
t = value ? ast_strdupa(value) : "";
if (!s || !t) {
ast_log(LOG_ERROR, "Out of memory\n");
AST_LIST_UNLOCK(&queries);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return -1;
}
@@ -232,6 +244,11 @@
if (obj)
ast_odbc_release_obj(obj);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
+
return 0;
}
@@ -240,7 +257,7 @@
struct odbc_obj *obj = NULL;
struct acf_odbc_query *query;
char sql[2048] = "", varname[15], colnames[2048] = "", rowcount[12] = "-1";
- int res, x, y, buflen = 0, escapecommas, rowlimit = 1, dsn;
+ int res, x, y, buflen = 0, escapecommas, rowlimit = 1, dsn, bogus_chan = 0;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(field)[100];
);
@@ -265,6 +282,14 @@
return -1;
}
+ if (!chan) {
+ if ((chan = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Bogus/func_odbc")))
+ bogus_chan = 1;
+ }
+
+ if (chan)
+ ast_autoservice_start(chan);
+
AST_STANDARD_APP_ARGS(args, s);
for (x = 0; x < args.argc; x++) {
snprintf(varname, sizeof(varname), "ARG%d", x + 1);
@@ -306,6 +331,10 @@
if (obj)
ast_odbc_release_obj(obj);
pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return -1;
}
@@ -316,6 +345,10 @@
SQLFreeHandle (SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return -1;
}
@@ -333,6 +366,10 @@
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return res1;
}
@@ -380,6 +417,10 @@
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
pbx_builtin_setvar_helper(chan, "ODBCROWS", rowcount);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return -1;
}
resultset = tmp;
@@ -456,6 +497,10 @@
SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return -1;
}
odbc_store->data = resultset;
@@ -464,6 +509,10 @@
SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
+ if (chan)
+ ast_autoservice_stop(chan);
+ if (bogus_chan)
+ ast_channel_free(chan);
return 0;
}
Modified: team/russell/events/funcs/func_realtime.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/funcs/func_realtime.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/funcs/func_realtime.c (original)
+++ team/russell/events/funcs/func_realtime.c Mon Oct 29 17:05:00 2007
@@ -71,9 +71,14 @@
if (!args.delim2)
args.delim2 = "=";
+ if (chan)
+ ast_autoservice_start(chan);
+
head = ast_load_realtime_all(args.family, args.fieldmatch, args.value, NULL);
if (!head)
+ if (chan)
+ ast_autoservice_stop(chan);
return -1;
resultslen = 0;
@@ -87,6 +92,9 @@
for (var = head; var; var = var->next)
ast_str_append(&out, 0, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
ast_copy_string(buf, out->str, len);
+
+ if (chan)
+ ast_autoservice_stop(chan);
return 0;
}
@@ -106,6 +114,9 @@
return -1;
}
+ if (chan)
+ ast_autoservice_start(chan);
+
AST_STANDARD_APP_ARGS(args, data);
res = ast_update_realtime(args.family, args.fieldmatch, args.value, args.field, (char *)value, NULL);
@@ -113,6 +124,9 @@
if (res < 0) {
ast_log(LOG_WARNING, "Failed to update. Check the debug log for possible data repository related entries.\n");
}
+
+ if (chan)
+ ast_autoservice_stop(chan);
return 0;
}
Modified: team/russell/events/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/funcs/func_strings.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/funcs/func_strings.c (original)
+++ team/russell/events/funcs/func_strings.c Mon Oct 29 17:05:00 2007
@@ -57,6 +57,9 @@
char delim[2] = "";
size_t delim_used;
+ if (chan)
+ ast_autoservice_start(chan);
+
AST_STANDARD_APP_ARGS(args, parse);
if (args.delim) {
ast_get_encoded_char(args.delim, delim, &delim_used);
@@ -75,6 +78,9 @@
fieldcount = 1;
}
snprintf(buf, len, "%d", fieldcount);
+
+ if (chan)
+ ast_autoservice_stop(chan);
return 0;
}
@@ -255,13 +261,19 @@
if (!var || !value2)
return -1;
+ if (chan)
+ ast_autoservice_start(chan);
+
if (!strcmp(cmd, "HASH")) {
const char *var2 = pbx_builtin_getvar_helper(chan, "~ODBCFIELDS~");
origvar = var;
if (var2)
var = ast_strdupa(var2);
- else
+ else {
+ if (chan)
+ ast_autoservice_stop(chan);
return -1;
+ }
ishash = 1;
}
@@ -297,6 +309,9 @@
}
}
}
+
+ if (chan)
+ ast_autoservice_stop(chan);
return 0;
}
@@ -726,7 +741,11 @@
return -1;
}
+ if (chan)
+ ast_autoservice_start(chan);
pbx_substitute_variables_helper(chan, data, buf, len - 1);
+ if (chan)
+ ast_autoservice_stop(chan);
return 0;
}
Modified: team/russell/events/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/autoconfig.h.in?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/include/asterisk/autoconfig.h.in (original)
+++ team/russell/events/include/asterisk/autoconfig.h.in Mon Oct 29 17:05:00 2007
@@ -432,6 +432,18 @@
/* Define this to indicate the ${MISDN_DESCRIP} library */
#undef HAVE_MISDN
+
+/* Define if your system has the MISDN_FAC_ERROR headers. */
+#undef HAVE_MISDN_FAC_ERROR
+
+/* Define MISDN_FAC_ERROR headers version */
+#undef HAVE_MISDN_FAC_ERROR_VERSION
+
+/* Define if your system has the MISDN_FAC_RESULT headers. */
+#undef HAVE_MISDN_FAC_RESULT
+
+/* Define MISDN_FAC_RESULT headers version */
+#undef HAVE_MISDN_FAC_RESULT_VERSION
/* Define to indicate the ${MISDN_DESCRIP} library version */
#undef HAVE_MISDN_VERSION
Modified: team/russell/events/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/lock.h?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/include/asterisk/lock.h (original)
+++ team/russell/events/include/asterisk/lock.h Mon Oct 29 17:05:00 2007
@@ -167,17 +167,17 @@
memset(&empty_mutex, 0, sizeof(empty_mutex));
}
-static inline void reentrancy_lock_cs(ast_mutex_t *p_ast_mutex)
+static inline void ast_reentrancy_lock(ast_mutex_t *p_ast_mutex)
{
pthread_mutex_lock(&p_ast_mutex->reentr_mutex);
}
-static inline void reentrancy_unlock_cs(ast_mutex_t *p_ast_mutex)
+static inline void ast_reentrancy_unlock(ast_mutex_t *p_ast_mutex)
{
pthread_mutex_unlock(&p_ast_mutex->reentr_mutex);
}
-static inline void init_reentrancy_cs(ast_mutex_t *p_ast_mutex)
+static inline void ast_reentrancy_init(ast_mutex_t *p_ast_mutex)
{
int i;
static pthread_mutexattr_t reentr_attr;
@@ -225,7 +225,7 @@
}
#endif
- init_reentrancy_cs(t);
+ ast_reentrancy_init(t);
t->track = track;
return pthread_mutex_init(&t->mutex, attr);
@@ -272,10 +272,10 @@
case EBUSY:
__ast_mutex_logger("%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
filename, lineno, func, mutex_name);
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
__ast_mutex_logger("%s line %d (%s): Error: '%s' was locked here.\n",
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
break;
}
@@ -286,13 +286,13 @@
else
t->mutex = PTHREAD_MUTEX_INIT_VALUE;
#endif
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
t->file[0] = filename;
t->lineno[0] = lineno;
t->func[0] = func;
t->reentrancy = 0;
t->thread[0] = 0;
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
delete_reentrancy_cs(t);
return res;
@@ -335,11 +335,11 @@
if ((current - seconds) && (!((current - seconds) % 5))) {
__ast_mutex_logger("%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
filename, lineno, func, (int)(current - seconds), mutex_name);
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
t->file[t->reentrancy-1], t->lineno[t->reentrancy-1],
t->func[t->reentrancy-1], mutex_name);
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
}
usleep(200);
}
@@ -356,7 +356,7 @@
#endif /* DETECT_DEADLOCKS */
if (!res) {
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy < AST_MAX_REENTRANCY) {
t->file[t->reentrancy] = filename;
t->lineno[t->reentrancy] = lineno;
@@ -367,7 +367,7 @@
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
filename, lineno, func, mutex_name);
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_mark_lock_acquired();
} else {
@@ -401,7 +401,7 @@
ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
if (!(res = pthread_mutex_trylock(&t->mutex))) {
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy < AST_MAX_REENTRANCY) {
t->file[t->reentrancy] = filename;
t->lineno[t->reentrancy] = lineno;
@@ -412,7 +412,7 @@
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
filename, lineno, func, mutex_name);
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_mark_lock_acquired();
} else if (t->track) {
@@ -437,7 +437,7 @@
}
#endif
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy && (t->thread[t->reentrancy-1] != pthread_self())) {
__ast_mutex_logger("%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
filename, lineno, func, mutex_name);
@@ -458,7 +458,7 @@
t->func[t->reentrancy] = NULL;
t->thread[t->reentrancy] = 0;
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_remove_lock_info(&t->mutex);
@@ -511,7 +511,7 @@
}
#endif
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy && (t->thread[t->reentrancy-1] != pthread_self())) {
__ast_mutex_logger("%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
filename, lineno, func, mutex_name);
@@ -532,7 +532,7 @@
t->func[t->reentrancy] = NULL;
t->thread[t->reentrancy] = 0;
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_remove_lock_info(&t->mutex);
@@ -542,7 +542,7 @@
filename, lineno, func, strerror(res));
DO_THREAD_CRASH;
} else {
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy < AST_MAX_REENTRANCY) {
t->file[t->reentrancy] = filename;
t->lineno[t->reentrancy] = lineno;
@@ -553,7 +553,7 @@
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
filename, lineno, func, mutex_name);
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
@@ -577,7 +577,7 @@
}
#endif
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy && (t->thread[t->reentrancy-1] != pthread_self())) {
__ast_mutex_logger("%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
filename, lineno, func, mutex_name);
@@ -598,7 +598,7 @@
t->func[t->reentrancy] = NULL;
t->thread[t->reentrancy] = 0;
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_remove_lock_info(&t->mutex);
@@ -608,7 +608,7 @@
filename, lineno, func, strerror(res));
DO_THREAD_CRASH;
} else {
- reentrancy_lock_cs(t);
+ ast_reentrancy_lock(t);
if (t->reentrancy < AST_MAX_REENTRANCY) {
t->file[t->reentrancy] = filename;
t->lineno[t->reentrancy] = lineno;
@@ -619,7 +619,7 @@
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
filename, lineno, func, mutex_name);
}
- reentrancy_unlock_cs(t);
+ ast_reentrancy_unlock(t);
if (t->track)
ast_store_lock_info(AST_MUTEX, filename, lineno, func, mutex_name, &t->mutex);
Modified: team/russell/events/main/astmm.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/astmm.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/main/astmm.c (original)
+++ team/russell/events/main/astmm.c Mon Oct 29 17:05:00 2007
@@ -84,7 +84,6 @@
/*! Tracking this mutex will cause infinite recursion, as the mutex tracking
* code allocates memory */
AST_MUTEX_DEFINE_STATIC_NOTRACKING(reglock);
-AST_MUTEX_DEFINE_STATIC(showmemorylock);
#define astmm_log(...) \
do { \
@@ -333,7 +332,7 @@
if (a->argc > 3)
fn = a->argv[3];
- ast_mutex_lock(&showmemorylock);
+ ast_mutex_lock(®lock);
for (x = 0; x < SOME_PRIME; x++) {
for (reg = regions[x]; reg; reg = reg->next) {
if (!fn || !strcasecmp(fn, reg->file) || !strcasecmp(fn, "anomolies")) {
@@ -359,7 +358,7 @@
}
}
}
- ast_mutex_unlock(&showmemorylock);
+ ast_mutex_unlock(®lock);
if (cache_len)
ast_cli(a->fd, "%d bytes allocated (%d in caches) in %d allocations\n", len, cache_len, count);
Modified: team/russell/events/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/rtp.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/main/rtp.c (original)
+++ team/russell/events/main/rtp.c Mon Oct 29 17:05:00 2007
@@ -1111,7 +1111,8 @@
length &= 0xffff;
if ((i + length) > packetwords) {
- ast_log(LOG_WARNING, "RTCP Read too short\n");
+ if (option_debug || rtpdebug)
+ ast_log(LOG_DEBUG, "RTCP Read too short\n");
return &ast_null_frame;
}
Modified: team/russell/events/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/utils.c?view=diff&rev=87461&r1=87460&r2=87461
==============================================================================
--- team/russell/events/main/utils.c (original)
+++ team/russell/events/main/utils.c Mon Oct 29 17:05:00 2007
@@ -749,6 +749,9 @@
lock_info->thread_name);
pthread_mutex_lock(&lock_info->lock);
for (i = 0; str && i < lock_info->num_locks; i++) {
+ int j;
+ ast_mutex_t *lock;
+
ast_str_append(&str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n",
lock_info->locks[i].pending > 0 ? "Waiting for " :
lock_info->locks[i].pending < 0 ? "Tried and failed to get " : "", i,
@@ -758,6 +761,18 @@
lock_info->locks[i].func, lock_info->locks[i].lock_name,
lock_info->locks[i].lock_addr,
lock_info->locks[i].times_locked);
+
+ if (!lock_info->locks[i].pending)
+ continue;
+
+ lock = lock_info->locks[i].lock_addr;
+
+ ast_reentrancy_lock(lock);
+ for (j = 0; str && j < lock->reentrancy; j++) {
+ ast_str_append(&str, 0, "=== --- ---> Locked Here: %s line %d (%s)\n",
+ lock->file[j], lock->lineno[j], lock->func[j]);
+ }
+ ast_reentrancy_unlock(lock);
}
pthread_mutex_unlock(&lock_info->lock);
if (!str)
@@ -997,6 +1012,8 @@
if ((e > work) && (*(e-1) == '\\')) {
memmove(e - 1, e, strlen(e) + 1);
work = e;
+ } else {
+ work = e + 1;
}
}
More information about the asterisk-commits
mailing list