[asterisk-commits] oej: branch oej/danishtimestamps-1.8 r426057 - in /team/oej/danishtimestamps-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 20 10:14:26 CDT 2014
Author: oej
Date: Mon Oct 20 10:14:07 2014
New Revision: 426057
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426057
Log:
I guess I forgot. Forgive me Automerge. Won't happen again.
Added:
team/oej/danishtimestamps-1.8/doc/aelparse.8
- copied unchanged from r425985, branches/1.8/doc/aelparse.8
team/oej/danishtimestamps-1.8/doc/smsq.8
- copied unchanged from r425985, branches/1.8/doc/smsq.8
team/oej/danishtimestamps-1.8/tests/test_callerid.c
- copied unchanged from r425985, branches/1.8/tests/test_callerid.c
Modified:
team/oej/danishtimestamps-1.8/ (props changed)
team/oej/danishtimestamps-1.8/LICENSE
team/oej/danishtimestamps-1.8/Makefile
team/oej/danishtimestamps-1.8/UPGRADE.txt
team/oej/danishtimestamps-1.8/addons/chan_ooh323.c
team/oej/danishtimestamps-1.8/addons/ooh323c/src/decode.c
team/oej/danishtimestamps-1.8/addons/ooh323c/src/ooq931.c
team/oej/danishtimestamps-1.8/addons/ooh323c/src/printHandler.c
team/oej/danishtimestamps-1.8/apps/app_dial.c
team/oej/danishtimestamps-1.8/apps/app_meetme.c
team/oej/danishtimestamps-1.8/apps/app_queue.c
team/oej/danishtimestamps-1.8/apps/app_speech_utils.c
team/oej/danishtimestamps-1.8/apps/app_stack.c
team/oej/danishtimestamps-1.8/apps/app_voicemail.c
team/oej/danishtimestamps-1.8/channels/chan_dahdi.c
team/oej/danishtimestamps-1.8/channels/chan_sip.c
team/oej/danishtimestamps-1.8/channels/sig_pri.c
team/oej/danishtimestamps-1.8/channels/sig_pri.h
team/oej/danishtimestamps-1.8/configs/chan_dahdi.conf.sample
team/oej/danishtimestamps-1.8/configs/sip.conf.sample
team/oej/danishtimestamps-1.8/configure
team/oej/danishtimestamps-1.8/configure.ac
team/oej/danishtimestamps-1.8/contrib/scripts/refcounter.py
team/oej/danishtimestamps-1.8/contrib/scripts/safe_asterisk
team/oej/danishtimestamps-1.8/doc/asterisk.8
team/oej/danishtimestamps-1.8/funcs/func_config.c
team/oej/danishtimestamps-1.8/funcs/func_frame_trace.c
team/oej/danishtimestamps-1.8/funcs/func_uri.c
team/oej/danishtimestamps-1.8/include/asterisk/app.h
team/oej/danishtimestamps-1.8/include/asterisk/config.h
team/oej/danishtimestamps-1.8/include/asterisk/utils.h
team/oej/danishtimestamps-1.8/main/app.c
team/oej/danishtimestamps-1.8/main/astobj2.c
team/oej/danishtimestamps-1.8/main/callerid.c
team/oej/danishtimestamps-1.8/main/channel.c
team/oej/danishtimestamps-1.8/main/cli.c
team/oej/danishtimestamps-1.8/main/config.c
team/oej/danishtimestamps-1.8/main/editline/readline.c
team/oej/danishtimestamps-1.8/main/features.c
team/oej/danishtimestamps-1.8/main/file.c
team/oej/danishtimestamps-1.8/main/manager.c
team/oej/danishtimestamps-1.8/main/pbx.c
team/oej/danishtimestamps-1.8/main/tcptls.c
team/oej/danishtimestamps-1.8/main/utils.c
team/oej/danishtimestamps-1.8/pbx/pbx_lua.c
team/oej/danishtimestamps-1.8/res/res_calendar_ews.c
team/oej/danishtimestamps-1.8/res/res_fax.c
team/oej/danishtimestamps-1.8/res/res_jabber.c
team/oej/danishtimestamps-1.8/res/res_musiconhold.c
team/oej/danishtimestamps-1.8/sounds/Makefile
team/oej/danishtimestamps-1.8/sounds/sounds.xml
team/oej/danishtimestamps-1.8/tests/test_aoc.c
team/oej/danishtimestamps-1.8/tests/test_astobj2.c
team/oej/danishtimestamps-1.8/tests/test_astobj2_thrash.c
team/oej/danishtimestamps-1.8/tests/test_event.c
team/oej/danishtimestamps-1.8/tests/test_hashtab_thrash.c
team/oej/danishtimestamps-1.8/tests/test_logger.c
team/oej/danishtimestamps-1.8/tests/test_utils.c
Propchange: team/oej/danishtimestamps-1.8/
------------------------------------------------------------------------------
automerge = Is-there-life-off-net?
Propchange: team/oej/danishtimestamps-1.8/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 20 10:14:07 2014
@@ -1,1 +1,1 @@
-/branches/1.8:1-417743
+/branches/1.8:1-426056
Modified: team/oej/danishtimestamps-1.8/LICENSE
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/LICENSE?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/LICENSE (original)
+++ team/oej/danishtimestamps-1.8/LICENSE Mon Oct 20 10:14:07 2014
@@ -25,7 +25,7 @@
would strongly encourage you to make the same exception that we do).
Specific permission is also granted to link Asterisk with OpenSSL, OpenH323
-and/or the UW IMAP Toolkit and distribute the resulting binary files.
+UniMRCP, and/or the UW IMAP Toolkit and distribute the resulting binary files.
In addition, Asterisk implements two management/control protocols: the
Asterisk Manager Interface (AMI) and the Asterisk Gateway Interface
Modified: team/oej/danishtimestamps-1.8/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/Makefile?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/Makefile (original)
+++ team/oej/danishtimestamps-1.8/Makefile Mon Oct 20 10:14:07 2014
@@ -539,7 +539,7 @@
fi
badshell:
-ifneq ($(findstring ~,$(DESTDIR)),)
+ifneq ($(filter ~%,$(DESTDIR)),)
@echo "Your shell doesn't do ~ expansion when expected (specifically, when doing \"make install DESTDIR=~/path\")."
@echo "Try replacing ~ with \$$HOME, as in \"make install DESTDIR=\$$HOME/path\"."
@exit 1
Modified: team/oej/danishtimestamps-1.8/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/UPGRADE.txt?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/UPGRADE.txt (original)
+++ team/oej/danishtimestamps-1.8/UPGRADE.txt Mon Oct 20 10:14:07 2014
@@ -18,6 +18,23 @@
===
===========================================================
+from 1.8.31.0 to 1.8.31.1:
+
+* Due to the POODLE vulnerability (see
+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3566), the
+ default TLS method for TLS clients will no longer allow SSLv3. As
+ SSLv2 was already deprecated, it is no longer allowed by default as
+ well. TLS servers no longer allow SSLv2 or SSLv3 connections. This
+ affects the chan_sip channel driver, AMI, and the Asterisk HTTP server.
+
+* The res_jabber resource module no longer uses SSLv3 to connect to an
+ XMPP server. It will now only use TLSv1 or later methods.
+
+from 1.8.28.2 to 1.8.29.0:
+* Added the inband_on_setup_ack compatibility option to chan_dahdi.conf to
+ deal with switches that don't send an inband progress indication in the
+ SETUP ACKNOWLEDGE message.
+
from 1.8.28.0 to 1.8.28.1:
* Added http.conf session_inactivity timer option to close HTTP connections
that aren't doing anything.
Modified: team/oej/danishtimestamps-1.8/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/addons/chan_ooh323.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/addons/chan_ooh323.c (original)
+++ team/oej/danishtimestamps-1.8/addons/chan_ooh323.c Mon Oct 20 10:14:07 2014
@@ -455,7 +455,7 @@
if (ch) {
manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate",
"Channel: %s\r\nChanneltype: %s\r\n"
- "CallRef: %d\r\n", ch->name, "OOH323", i->call_reference);
+ "CallRef: %u\r\n", ch->name, "OOH323", i->call_reference);
}
} else
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
@@ -1111,7 +1111,7 @@
ast_channel_lock(ast);
if (!p->alertsent) {
if (gH323Debug) {
- ast_debug(1, "Sending forced ringback for %s, res = %d\n",
+ ast_debug(1, "Sending forced ringback for %s, res = %u\n",
callToken, ooManualRingback(callToken));
} else {
ooManualRingback(callToken);
@@ -1166,7 +1166,7 @@
p->lastrtptx = time(NULL);
if (f->frametype == AST_FRAME_MODEM) {
- ast_debug(1, "Send UDPTL %d/%d len %d for %s\n",
+ ast_debug(1, "Send UDPTL %u/%d len %d for %s\n",
f->frametype, f->subclass.integer, f->datalen, ast->name);
if (p->udptl)
res = ast_udptl_write(p->udptl, f);
@@ -1211,7 +1211,7 @@
ast_mutex_unlock(&p->lock);
return 0;
} else {
- ast_log(LOG_WARNING, "Can't send %d type frames with OOH323 write\n",
+ ast_log(LOG_WARNING, "Can't send %u type frames with OOH323 write\n",
f->frametype);
ast_mutex_unlock(&p->lock);
return 0;
@@ -1270,7 +1270,7 @@
if (ast->_state != AST_STATE_UP) {
if (!p->progsent) {
if (gH323Debug)
- ast_log(LOG_DEBUG,"Sending manual progress for %s, res = %d\n", callToken,
+ ast_log(LOG_DEBUG,"Sending manual progress for %s, res = %u\n", callToken,
ooManualProgress(callToken));
else
ooManualProgress(callToken);
@@ -1282,7 +1282,7 @@
if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
if (!p->alertsent) {
if (gH323Debug) {
- ast_debug(1, "Sending manual ringback for %s, res = %d\n",
+ ast_debug(1, "Sending manual ringback for %s, res = %u\n",
callToken,
ooManualRingback(callToken));
} else {
@@ -2087,7 +2087,7 @@
ast_queue_control(c, AST_CONTROL_ANSWER);
ast_channel_unlock(p->owner);
manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
- "CallRef: %d\r\n", c->name, "OOH323", p->call_reference);
+ "CallRef: %u\r\n", c->name, "OOH323", p->call_reference);
}
ast_mutex_unlock(&p->lock);
@@ -2724,7 +2724,7 @@
gContext);
} else if (!strcasecmp(v->name, "rtptimeout")) {
gRTPTimeout = atoi(v->value);
- if (gRTPTimeout <= 0)
+ if (gRTPTimeout < 0)
gRTPTimeout = 60;
} else if (!strcasecmp(v->name, "tos")) {
if (sscanf(v->value, "%30i", &format) == 1)
@@ -2916,7 +2916,7 @@
ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ",
ast_cdr_flags2str(peer->amaflags));
ast_cli(a->fd, "%-15.15s%s\n", "IP:Port: ", ip_port);
- ast_cli(a->fd, "%-15.15s%d\n", "OutgoingLimit: ", peer->outgoinglimit);
+ ast_cli(a->fd, "%-15.15s%u\n", "OutgoingLimit: ", peer->outgoinglimit);
ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", peer->rtptimeout);
if (peer->rtpmaskstr[0])
ast_cli(a->fd, "%-15.15s%s\n", "rtpmask: ", peer->rtpmaskstr);
@@ -3062,7 +3062,7 @@
ast_cdr_flags2str(user->amaflags));
ast_cli(a->fd, "%-15.15s%s\n", "Context: ", user->context);
ast_cli(a->fd, "%-15.15s%d\n", "IncomingLimit: ", user->incominglimit);
- ast_cli(a->fd, "%-15.15s%d\n", "InUse: ", user->inUse);
+ ast_cli(a->fd, "%-15.15s%u\n", "InUse: ", user->inUse);
ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", user->rtptimeout);
if (user->rtpmaskstr[0])
ast_cli(a->fd, "%-15.15s%s\n", "rtpmask: ", user->rtpmaskstr);
@@ -3317,7 +3317,7 @@
/* Make sure we can register our OOH323 channel type */
if (ast_channel_register(&ooh323_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
ast_rtp_glue_register(&ooh323_rtp);
ast_udptl_proto_register(&ooh323_udptl);
@@ -3327,7 +3327,7 @@
if (OO_OK != ooH323EpInitialize(OO_CALLMODE_AUDIOCALL, gLogFile)) {
ast_log(LOG_ERROR, "Failed to initialize OOH323 endpoint-"
"OOH323 Disabled\n");
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
if (gIsGateway)
@@ -3427,7 +3427,7 @@
restart_monitor();
} else {
ast_log(LOG_ERROR, "Can't load ooh323 config file, OOH323 Disabled\n");
- return AST_MODULE_LOAD_FAILURE;
+ return AST_MODULE_LOAD_DECLINE;
}
return 0;
@@ -4319,7 +4319,7 @@
break;
case 5:
f = ast_udptl_read(p->udptl); /* UDPTL t.38 data */
- if (gH323Debug) ast_debug(1, "Got UDPTL %d/%d len %d for %s\n",
+ if (gH323Debug) ast_debug(1, "Got UDPTL %u/%d len %d for %s\n",
f->frametype, f->subclass.integer, f->datalen, ast->name);
p->lastrtprx = time(NULL);
break;
Modified: team/oej/danishtimestamps-1.8/addons/ooh323c/src/decode.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/addons/ooh323c/src/decode.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/addons/ooh323c/src/decode.c (original)
+++ team/oej/danishtimestamps-1.8/addons/ooh323c/src/decode.c Mon Oct 20 10:14:07 2014
@@ -425,7 +425,7 @@
if (pctxt->flags & ASN1FASTCOPY) {
/* check is it possible to do optimized decoding */
- ASN1OCTET bit;
+ ASN1OCTET bit = 0;
ASN1UINT byteIndex = pctxt->buffer.byteIndex; /* save byte index */
ASN1USINT bitOffset = pctxt->buffer.bitOffset; /* save bit offset */
@@ -499,7 +499,7 @@
if (pctxt->flags & ASN1FASTCOPY) {
/* check if it is possible to do optimized decoding */
- ASN1OCTET bit;
+ ASN1OCTET bit = 0;
ASN1UINT byteIndex = pctxt->buffer.byteIndex; /* save byte index */
ASN1USINT bitOffset = pctxt->buffer.bitOffset; /* save bit offset */
Modified: team/oej/danishtimestamps-1.8/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/addons/ooh323c/src/ooq931.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/addons/ooh323c/src/ooq931.c (original)
+++ team/oej/danishtimestamps-1.8/addons/ooh323c/src/ooq931.c Mon Oct 20 10:14:07 2014
@@ -317,7 +317,7 @@
strcpy(buf, "Escape");
break;
default:
- sprintf(buf, "<%u>", messageType);
+ sprintf(buf, "<%d>", messageType);
}
return buf;
}
@@ -358,7 +358,7 @@
strcpy(buf, "User-User");
break;
default:
- sprintf(buf, "0x%02x", number);
+ sprintf(buf, "0x%02x", (unsigned)number);
}
return buf;
}
@@ -369,8 +369,8 @@
unsigned int i;
printf("Q.931 Message:\n");
- printf(" protocolDiscriminator: %i\n", q931msg->protocolDiscriminator);
- printf(" callReference: %i\n", q931msg->callReference);
+ printf(" protocolDiscriminator: %u\n", q931msg->protocolDiscriminator);
+ printf(" callReference: %u\n", q931msg->callReference);
printf(" from: %s\n", (q931msg->fromDestination ?
"destination" : "originator"));
printf(" messageType: %s (0x%X)\n\n",
@@ -380,9 +380,9 @@
for(i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) {
Q931InformationElement *ie = (Q931InformationElement*) curNode->data;
int length = (ie->length >= 0) ? ie->length : -ie->length;
- printf(" IE[%i] (offset 0x%X):\n", i, ie->offset);
+ printf(" IE[%u] (offset 0x%X):\n", i, (unsigned)ie->offset);
printf(" discriminator: %s (0x%X)\n",
- ooQ931GetIEName(ie->discriminator, buf), ie->discriminator);
+ ooQ931GetIEName(ie->discriminator, buf), (unsigned)ie->discriminator);
printf(" data length: %i\n", length);
curNode = curNode->next;
Modified: team/oej/danishtimestamps-1.8/addons/ooh323c/src/printHandler.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/addons/ooh323c/src/printHandler.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/addons/ooh323c/src/printHandler.c (original)
+++ team/oej/danishtimestamps-1.8/addons/ooh323c/src/printHandler.c Mon Oct 20 10:14:07 2014
@@ -268,7 +268,7 @@
if (bufsiz > 1) buffer[1] = '\0';
for (i = 0; i < numocts; i++) {
if (i < bufsiz - 1) {
- sprintf (lbuf, "%02x", data[i]);
+ sprintf (lbuf, "%02x", (unsigned)data[i]);
strcat (&buffer[(i*2)+1], lbuf);
}
else break;
Modified: team/oej/danishtimestamps-1.8/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/apps/app_dial.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/apps/app_dial.c (original)
+++ team/oej/danishtimestamps-1.8/apps/app_dial.c Mon Oct 20 10:14:07 2014
@@ -1203,7 +1203,7 @@
ast_channel_unlock(in);
}
- do_forward(o, &num, peerflags, single, caller_entertained, to,
+ do_forward(o, &num, peerflags, single, caller_entertained, &orig,
forced_clid, stored_clid);
if (single && o->chan
Modified: team/oej/danishtimestamps-1.8/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/apps/app_meetme.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/apps/app_meetme.c (original)
+++ team/oej/danishtimestamps-1.8/apps/app_meetme.c Mon Oct 20 10:14:07 2014
@@ -2825,7 +2825,7 @@
if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) {
calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]);
- ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit);
+ ast_verb(3, "Setting call duration limit to %u seconds.\n", calldurationlimit);
}
if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) {
@@ -3863,12 +3863,12 @@
break;
default:
ast_debug(1,
- "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n",
+ "Got ignored control frame on channel %s, f->frametype=%u,f->subclass=%d\n",
chan->name, f->frametype, f->subclass.integer);
}
} else {
ast_debug(1,
- "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n",
+ "Got unrecognized frame on channel %s, f->frametype=%u,f->subclass=%d\n",
chan->name, f->frametype, f->subclass.integer);
}
ast_frfree(f);
@@ -6639,7 +6639,7 @@
ast_cond_destroy(&cond);
ast_autoservice_stop(chan);
if (!trunk_ref->trunk->chan) {
- ast_debug(1, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan);
+ ast_debug(1, "Trunk didn't get created. chan: %lx\n", (unsigned long) trunk_ref->trunk->chan);
pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION");
sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
trunk_ref->chan = NULL;
Modified: team/oej/danishtimestamps-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/apps/app_queue.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/apps/app_queue.c (original)
+++ team/oej/danishtimestamps-1.8/apps/app_queue.c Mon Oct 20 10:14:07 2014
@@ -4573,6 +4573,7 @@
/* No need to lock the channels because they are already locked in ast_do_masquerade */
if ((datastore = ast_channel_datastore_find(old_chan, &queue_transfer_info, NULL))) {
ast_channel_datastore_remove(old_chan, datastore);
+ /* Datastore is freed in try_calling() */
} else {
ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
}
@@ -5445,6 +5446,7 @@
}
if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
ast_channel_datastore_remove(qe->chan, tds);
+ /* tds was added by setup_transfer_datastore() and is freed below. */
}
ast_channel_unlock(qe->chan);
update_queue(qe->parent, member, callcompletedinsl, (time(NULL) - callstart));
Modified: team/oej/danishtimestamps-1.8/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/apps/app_speech_utils.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/apps/app_speech_utils.c (original)
+++ team/oej/danishtimestamps-1.8/apps/app_speech_utils.c Mon Oct 20 10:14:07 2014
@@ -289,13 +289,44 @@
return NULL;
}
+ ast_channel_lock(chan);
datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
+ ast_channel_unlock(chan);
if (datastore == NULL) {
return NULL;
}
speech = datastore->data;
return speech;
+}
+
+/*!
+ * \internal
+ * \brief Destroy the speech datastore on the given channel.
+ *
+ * \param chan Channel to destroy speech datastore.
+ *
+ * \retval 0 on success.
+ * \retval -1 not found.
+ */
+static int speech_datastore_destroy(struct ast_channel *chan)
+{
+ struct ast_datastore *datastore;
+ int res;
+
+ ast_channel_lock(chan);
+ datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
+ if (datastore) {
+ ast_channel_datastore_remove(chan, datastore);
+ }
+ ast_channel_unlock(chan);
+ if (datastore) {
+ ast_datastore_free(datastore);
+ res = 0;
+ } else {
+ res = -1;
+ }
+ return res;
}
/* Helper function to find a specific speech recognition result by number and nbest alternative */
@@ -519,7 +550,9 @@
}
pbx_builtin_setvar_helper(chan, "ERROR", NULL);
datastore->data = speech;
+ ast_channel_lock(chan);
ast_channel_datastore_add(chan, datastore);
+ ast_channel_unlock(chan);
return 0;
}
@@ -662,7 +695,6 @@
int oldreadformat = AST_FORMAT_SLINEAR;
char dtmf[AST_MAX_EXTENSION] = "";
struct timeval start = { 0, 0 }, current;
- struct ast_datastore *datastore = NULL;
char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL;
struct ast_flags options = { 0 };
@@ -891,11 +923,7 @@
/* See if it was because they hung up */
if (done == 3) {
- /* Destroy speech structure */
- ast_speech_destroy(speech);
- datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
- if (datastore != NULL)
- ast_channel_datastore_remove(chan, datastore);
+ speech_datastore_destroy(chan);
} else {
/* Channel is okay so restore read format */
ast_set_read_format(chan, oldreadformat);
@@ -908,22 +936,10 @@
/*! \brief SpeechDestroy() Dialplan Application */
static int speech_destroy(struct ast_channel *chan, const char *data)
{
- int res = 0;
- struct ast_speech *speech = find_speech(chan);
- struct ast_datastore *datastore = NULL;
-
- if (speech == NULL)
- return -1;
-
- /* Destroy speech structure */
- ast_speech_destroy(speech);
-
- datastore = ast_channel_datastore_find(chan, &speech_datastore, NULL);
- if (datastore != NULL) {
- ast_channel_datastore_remove(chan, datastore);
- }
-
- return res;
+ if (!chan) {
+ return -1;
+ }
+ return speech_datastore_destroy(chan);
}
static int unload_module(void)
Modified: team/oej/danishtimestamps-1.8/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/danishtimestamps-1.8/apps/app_stack.c?view=diff&rev=426057&r1=426056&r2=426057
==============================================================================
--- team/oej/danishtimestamps-1.8/apps/app_stack.c (original)
+++ team/oej/danishtimestamps-1.8/apps/app_stack.c Mon Oct 20 10:14:07 2014
@@ -26,7 +26,7 @@
*/
/*** MODULEINFO
- <use>res_agi</use>
+ <use type="module">res_agi</use>
<support_level>core</support_level>
***/
@@ -205,10 +205,10 @@
</agi>
***/
-static const char * const app_gosub = "Gosub";
-static const char * const app_gosubif = "GosubIf";
-static const char * const app_return = "Return";
-static const char * const app_pop = "StackPop";
+static const char app_gosub[] = "Gosub";
+static const char app_gosubif[] = "GosubIf";
+static const char app_return[] = "Return";
+static const char app_pop[] = "StackPop";
static void gosub_free(void *data);
@@ -223,10 +223,13 @@
unsigned char arguments;
struct varshead varshead;
int priority;
- unsigned int is_agi:1;
+ /*! TRUE if the return location marks the end of a special routine. */
+ unsigned int is_special:1;
char *context;
char extension[0];
};
+
+AST_LIST_HEAD(gosub_stack_list, gosub_stack_frame);
static int frame_set_var(struct ast_channel *chan, struct gosub_stack_frame *frame, const char *var, const char *value)
{
@@ -296,8 +299,9 @@
static void gosub_free(void *data)
{
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist = data;
+ struct gosub_stack_list *oldlist = data;
struct gosub_stack_frame *oldframe;
+
AST_LIST_LOCK(oldlist);
while ((oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries))) {
gosub_release_frame(NULL, oldframe);
@@ -311,7 +315,8 @@
{
struct ast_datastore *stack_store;
struct gosub_stack_frame *oldframe;
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ struct gosub_stack_list *oldlist;
+ int res = 0;
ast_channel_lock(chan);
if (!(stack_store = ast_channel_datastore_find(chan, &stack_info, NULL))) {
@@ -322,23 +327,30 @@
oldlist = stack_store->data;
AST_LIST_LOCK(oldlist);
- oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries);
- AST_LIST_UNLOCK(oldlist);
-
+ oldframe = AST_LIST_FIRST(oldlist);
if (oldframe) {
- gosub_release_frame(chan, oldframe);
+ if (oldframe->is_special) {
+ ast_debug(1, "%s attempted to pop special return location.\n", app_pop);
+
+ /* Abort the special routine dialplan execution. Dialplan programming error. */
+ res = -1;
+ } else {
+ AST_LIST_REMOVE_HEAD(oldlist, entries);
+ gosub_release_frame(chan, oldframe);
+ }
} else {
ast_debug(1, "%s called with an empty gosub stack\n", app_pop);
}
- ast_channel_unlock(chan);
- return 0;
+ AST_LIST_UNLOCK(oldlist);
+ ast_channel_unlock(chan);
+ return res;
}
static int return_exec(struct ast_channel *chan, const char *data)
{
struct ast_datastore *stack_store;
struct gosub_stack_frame *oldframe;
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ struct gosub_stack_list *oldlist;
const char *retval = data;
int res = 0;
@@ -358,12 +370,24 @@
ast_log(LOG_ERROR, "Return without Gosub: stack is empty\n");
ast_channel_unlock(chan);
return -1;
- } else if (oldframe->is_agi) {
- /* Exit from AGI */
+ }
+ if (oldframe->is_special) {
+ /* Exit from special routine. */
res = -1;
}
- ast_explicit_goto(chan, oldframe->context, oldframe->extension, oldframe->priority);
+ /*
+ * We cannot use ast_explicit_goto() because we MUST restore
+ * what was there before. Channels that do not have a PBX may
+ * not have the context or exten set.
+ */
+ ast_copy_string(chan->context, oldframe->context, sizeof(chan->context));
+ ast_copy_string(chan->exten, oldframe->extension, sizeof(chan->exten));
+ if (ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP)) {
+ --oldframe->priority;
+ }
+ chan->priority = oldframe->priority;
+
gosub_release_frame(chan, oldframe);
/* Set a return value, if any */
@@ -372,10 +396,96 @@
return res;
}
+/*!
+ * \internal
+ * \brief Add missing context and/or exten to Gosub application argument string.
+ * \since 1.8.30.0
+ * \since 11.0
+ *
+ * \param chan Channel to obtain context/exten.
+ * \param args Gosub application argument string.
+ *
+ * \details
+ * Fills in the optional context and exten from the given channel.
+ * Convert: [[context,]exten,]priority[(arg1[,...][,argN])]
+ * To: context,exten,priority[(arg1[,...][,argN])]
+ *
+ * \retval expanded Gosub argument string on success. Must be freed.
+ * \retval NULL on error.
+ *
+ * \note The parsing needs to be kept in sync with the
+ * gosub_exec() argument format.
+ */
+static const char *expand_gosub_args(struct ast_channel *chan, const char *args)
+{
+ int len;
+ char *parse;
+ char *label;
+ char *new_args;
+ const char *context;
+ const char *exten;
+ const char *pri;
+
+ /* Separate the context,exten,pri from the optional routine arguments. */
+ parse = ast_strdupa(args);
+ label = strsep(&parse, "(");
+ if (parse) {
+ char *endparen;
+
+ endparen = strrchr(parse, ')');
+ if (endparen) {
+ *endparen = '\0';
+ } else {
+ ast_log(LOG_WARNING, "Ouch. No closing paren: '%s'?\n", args);
+ }
+ }
+
+ /* Split context,exten,pri */
+ context = strsep(&label, ",");
+ exten = strsep(&label, ",");
+ pri = strsep(&label, ",");
+ if (!exten) {
+ /* Only a priority in this one */
+ pri = context;
+ exten = NULL;
+ context = NULL;
+ } else if (!pri) {
+ /* Only an extension and priority in this one */
+ pri = exten;
+ exten = context;
+ context = NULL;
+ }
+
+ ast_channel_lock(chan);
+ if (ast_strlen_zero(exten)) {
+ exten = chan->exten;
+ }
+ if (ast_strlen_zero(context)) {
+ context = chan->context;
+ }
+ len = strlen(context) + strlen(exten) + strlen(pri) + 3;
+ if (!ast_strlen_zero(parse)) {
+ len += 2 + strlen(parse);
+ }
+ new_args = ast_malloc(len);
+ if (new_args) {
+ if (ast_strlen_zero(parse)) {
+ snprintf(new_args, len, "%s,%s,%s", context, exten, pri);
+ } else {
+ snprintf(new_args, len, "%s,%s,%s(%s)", context, exten, pri, parse);
+ }
+ }
+ ast_channel_unlock(chan);
+
+ ast_debug(4, "Gosub args:%s new_args:%s\n", args, new_args ? new_args : "");
+
+ return new_args;
+}
+
static int gosub_exec(struct ast_channel *chan, const char *data)
{
struct ast_datastore *stack_store;
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ struct gosub_stack_list *oldlist;
struct gosub_stack_frame *newframe;
struct gosub_stack_frame *lastframe;
char argname[15];
@@ -565,7 +675,7 @@
static int local_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct ast_datastore *stack_store;
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ struct gosub_stack_list *oldlist;
struct gosub_stack_frame *frame;
struct ast_var_t *variables;
@@ -605,7 +715,7 @@
static int local_write(struct ast_channel *chan, const char *cmd, char *var, const char *value)
{
struct ast_datastore *stack_store;
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ struct gosub_stack_list *oldlist;
struct gosub_stack_frame *frame;
if (!chan) {
@@ -683,7 +793,7 @@
static int stackpeek_read(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **str, ssize_t len)
{
struct ast_datastore *stack_store;
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ struct gosub_stack_list *oldlist;
struct gosub_stack_frame *frame;
int n;
AST_DECLARE_APP_ARGS(args,
@@ -756,6 +866,7 @@
break;
default:
ast_log(LOG_ERROR, "Unknown argument '%s' to STACK_PEEK\n", args.which);
+ break;
}
AST_LIST_UNLOCK(oldlist);
@@ -769,11 +880,206 @@
.read2 = stackpeek_read,
};
+/*!
+ * \internal
+ * \brief Pop stack frames until remove a special return location.
+ * \since 1.8.30.0
+ * \since 11.0
+ *
+ * \param chan Channel to balance stack on.
+ *
+ * \note The channel is already locked when called.
+ *
+ * \return Nothing
+ */
+static void balance_stack(struct ast_channel *chan)
+{
+ struct ast_datastore *stack_store;
+ struct gosub_stack_list *oldlist;
+ struct gosub_stack_frame *oldframe;
+ int found;
+
+ stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+ if (!stack_store) {
+ ast_log(LOG_WARNING, "No %s stack allocated.\n", app_gosub);
+ return;
+ }
+
+ oldlist = stack_store->data;
+ AST_LIST_LOCK(oldlist);
+ do {
+ oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries);
+ if (!oldframe) {
+ break;
+ }
+ found = oldframe->is_special;
+ gosub_release_frame(chan, oldframe);
+ } while (!found);
+ AST_LIST_UNLOCK(oldlist);
+}
+
+/*!
+ * \internal
+ * \brief Run a subroutine on a channel.
+ * \since 1.8.30.0
+ * \since 11.0
+ *
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
+ *
+ * \param chan Channel to execute subroutine on.
+ * \param sub_args Gosub application argument string.
+ * \param ignore_hangup TRUE if a hangup does not stop execution of the routine.
+ *
+ * \retval 0 success
+ * \retval -1 on error
+ */
+static int gosub_run(struct ast_channel *chan, const char *sub_args, int ignore_hangup)
+{
+ const char *saved_context;
+ const char *saved_exten;
+ int saved_priority;
+ int saved_hangup_flags;
+ int saved_autoloopflag;
+ int res;
+
+ ast_channel_lock(chan);
+
+ ast_verb(3, "%s Internal %s(%s) start\n", chan->name, app_gosub, sub_args);
+
+ /* Save non-hangup softhangup flags. */
+ saved_hangup_flags = chan->_softhangup
+ & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE);
+ if (saved_hangup_flags) {
+ chan->_softhangup &= ~(AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE);
+ }
+
+ /* Save autoloop flag */
+ saved_autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
+ ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
+
+ /* Save current dialplan location */
+ saved_context = ast_strdupa(chan->context);
+ saved_exten = ast_strdupa(chan->exten);
+ saved_priority = chan->priority;
+
+ ast_debug(4, "%s Original location: %s,%s,%d\n", chan->name,
+ saved_context, saved_exten, saved_priority);
+
+ ast_channel_unlock(chan);
+ res = gosub_exec(chan, sub_args);
+ ast_debug(4, "%s exited with status %d\n", app_gosub, res);
+ ast_channel_lock(chan);
+ if (!res) {
+ struct ast_datastore *stack_store;
+
+ /* Mark the return location as special. */
+ stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+ if (!stack_store) {
+ /* Should never happen! */
+ ast_log(LOG_ERROR, "No %s stack!\n", app_gosub);
+ res = -1;
+ } else {
+ struct gosub_stack_list *oldlist;
+ struct gosub_stack_frame *cur;
+
+ oldlist = stack_store->data;
+ cur = AST_LIST_FIRST(oldlist);
+ cur->is_special = 1;
+ }
+ }
+ if (!res) {
+ int found = 0; /* set if we find at least one match */
+
+ /*
+ * Run gosub body autoloop.
+ *
+ * Note that this loop is inverted from the normal execution
+ * loop because we just executed the Gosub application as the
+ * first extension of the autoloop.
+ */
+ do {
+ /* Check for hangup. */
+ if (chan->_softhangup & AST_SOFTHANGUP_UNBRIDGE) {
+ saved_hangup_flags |= AST_SOFTHANGUP_UNBRIDGE;
+ chan->_softhangup &= ~AST_SOFTHANGUP_UNBRIDGE;
+ }
+ if (ast_check_hangup(chan)) {
+ if (chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO) {
+ ast_log(LOG_ERROR, "%s An async goto just messed up our execution location.\n",
+ chan->name);
+ break;
+ }
+ if (!ignore_hangup) {
+ break;
+ }
+ }
+
+ /* Next dialplan priority. */
+ ++chan->priority;
+
+ ast_channel_unlock(chan);
+ res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority,
+ S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL),
+ &found, 1);
+ ast_channel_lock(chan);
+ } while (!res);
+ if (found && res) {
+ /* Something bad happened, or a hangup has been requested. */
+ ast_debug(1, "Spawn extension (%s,%s,%d) exited with %d on '%s'\n",
+ chan->context, chan->exten, chan->priority, res, chan->name);
+ ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n",
+ chan->context, chan->exten, chan->priority, chan->name);
+ }
+
+ /* Did the routine return? */
+ if (chan->priority == saved_priority
+ && !strcmp(chan->context, saved_context)
+ && !strcmp(chan->exten, saved_exten)) {
+ ast_verb(3, "%s Internal %s(%s) complete GOSUB_RETVAL=%s\n",
+ chan->name, app_gosub, sub_args,
+ S_OR(pbx_builtin_getvar_helper(chan, "GOSUB_RETVAL"), ""));
+ } else {
+ ast_log(LOG_NOTICE, "%s Abnormal '%s(%s)' exit. Popping routine return locations.\n",
+ chan->name, app_gosub, sub_args);
+ balance_stack(chan);
+ pbx_builtin_setvar_helper(chan, "GOSUB_RETVAL", "");
+ }
+
+ /* We executed the requested subroutine to the best of our ability. */
+ res = 0;
+ }
+
+ ast_debug(4, "%s Ending location: %s,%s,%d\n", chan->name,
+ chan->context, chan->exten, chan->priority);
+
+ /* Restore dialplan location */
+ if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
+ ast_copy_string(chan->context, saved_context, sizeof(chan->context));
+ ast_copy_string(chan->exten, saved_exten, sizeof(chan->exten));
+ chan->priority = saved_priority;
+ }
+
+ /* Restore autoloop flag */
+ ast_set2_flag(chan, saved_autoloopflag, AST_FLAG_IN_AUTOLOOP);
+
+ /* Restore non-hangup softhangup flags. */
+ if (saved_hangup_flags) {
+ ast_softhangup_nolock(chan, saved_hangup_flags);
+ }
+
+ ast_channel_unlock(chan);
+
+ return res;
+}
+
static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char * const *argv)
{
- int old_priority, priority;
- char old_context[AST_MAX_CONTEXT], old_extension[AST_MAX_EXTENSION];
- struct ast_app *theapp;
+ int res;
+ int priority;
+ int old_autoloopflag;
+ int old_priority;
+ const char *old_context;
+ const char *old_extension;
char *gosub_args;
if (argc < 4 || argc > 5) {
@@ -797,78 +1103,122 @@
return RESULT_FAILURE;
}
+ if (argc == 5) {
+ if (ast_asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority, argv[4]) < 0) {
+ gosub_args = NULL;
+ }
+ } else {
+ if (ast_asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority) < 0) {
+ gosub_args = NULL;
+ }
+ }
+ if (!gosub_args) {
+ ast_agi_send(agi->fd, chan, "503 result=-2 Memory allocation failure\n");
+ return RESULT_FAILURE;
+ }
+
+ ast_channel_lock(chan);
+
+ ast_verb(3, "%s AGI %s(%s) start\n", chan->name, app_gosub, gosub_args);
+
+ /* Save autoloop flag */
+ old_autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
+ ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
+
/* Save previous location, since we're going to change it */
- ast_copy_string(old_context, chan->context, sizeof(old_context));
- ast_copy_string(old_extension, chan->exten, sizeof(old_extension));
+ old_context = ast_strdupa(chan->context);
+ old_extension = ast_strdupa(chan->exten);
old_priority = chan->priority;
- if (!(theapp = pbx_findapp("Gosub"))) {
- ast_log(LOG_ERROR, "Gosub() cannot be found in the list of loaded applications\n");
- ast_agi_send(agi->fd, chan, "503 result=-2 Gosub is not loaded\n");
- return RESULT_FAILURE;
- }
-
- /* Apparently, if you run ast_pbx_run on a channel that already has a pbx
- * structure, you need to add 1 to the priority to get it to go to the
- * right place. But if it doesn't have a pbx structure, then leaving off
- * the 1 is the right thing to do. See how this code differs when we
- * call a Gosub for the CALLEE channel in Dial or Queue.
- */
- if (argc == 5) {
- if (ast_asprintf(&gosub_args, "%s,%s,%d(%s)", argv[1], argv[2], priority + (chan->pbx ? 1 : 0), argv[4]) < 0) {
- gosub_args = NULL;
- }
- } else {
- if (ast_asprintf(&gosub_args, "%s,%s,%d", argv[1], argv[2], priority + (chan->pbx ? 1 : 0)) < 0) {
- gosub_args = NULL;
- }
- }
-
- if (gosub_args) {
- int res;
-
- ast_debug(1, "Trying gosub with arguments '%s'\n", gosub_args);
-
- if ((res = pbx_exec(chan, theapp, gosub_args)) == 0) {
- struct ast_pbx *pbx = chan->pbx;
- struct ast_pbx_args args;
- struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
- AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+ ast_debug(4, "%s Original location: %s,%s,%d\n", chan->name,
+ old_context, old_extension, old_priority);
+ ast_channel_unlock(chan);
+
+ res = gosub_exec(chan, gosub_args);
+ if (!res) {
+ struct ast_datastore *stack_store;
+
+ /* Mark the return location as special. */
+ ast_channel_lock(chan);
+ stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+ if (!stack_store) {
+ /* Should never happen! */
+ ast_log(LOG_ERROR, "No %s stack!\n", app_gosub);
+ res = -1;
+ } else {
+ struct gosub_stack_list *oldlist;
struct gosub_stack_frame *cur;
- if (!stack_store) {
- ast_log(LOG_WARNING, "No GoSub stack remaining after AGI GoSub execution.\n");
[... 2773 lines stripped ...]
More information about the asterisk-commits
mailing list