Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dlublink/asterisk
  • bunk/asterisk
  • jasper-guest/asterisk
3 results
Show changes
Commits on Source (7)
Showing
with 1946 additions and 1026 deletions
16.10.0 16.12.0
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,77 @@ ...@@ -12,6 +12,77 @@
=== ===
============================================================================== ==============================================================================
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 16.11.0 to Asterisk 16.12.0 ----------
------------------------------------------------------------------------------
AMI
------------------
* You can now specify an optional 'Content-Type' as an argument for the Asterisk
SendText manager action.
res_pjsip
------------------
* Added a new PJSIP system setting called disable_rport.
Default is no to keep support working as before.
If it is false (default) it adds the 'rport' parameter in the outgoing request message.
If it is true it does not add the 'rport' parameter in the outgoing request message.
This is a system option, but working as a global option.
res_sorcery_memory_cache
------------------
* The SorceryMemoryCacheExpireObject AMI action and CLI
command allow expiring of a specific object within the
sorcery memory cache. This is done by removing the
object from the cache with the expectation that the
cache will then re-populate the object when it is next
needed.
For full backend caching this does not occur. The cache
won't repopulate until an entire refresh is done resulting
in the possibility that objects are missing until that
time.
The AMI action and CLI command will now not allow
expiring of an object if the cache is configured as a
full backend cache. Instead you must use either the
SorceryMemoryCacheExpire or SorceryMemoryCachePopulate
AMI actions or their associated CLI commands.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 16.10.0 to Asterisk 16.11.0 ----------
------------------------------------------------------------------------------
res_ari_channels
------------------
* When creating a channel in ARI using the create call
you can now specify dialplan variables to be set as part
of the same operation.
res_pjsip_logger
------------------
* The PJSIP packet logger now has the following CLI commands:
pjsip set logger pcap <filename>
When used this will create a pcap file containing the incoming
and outgoing SIP packets, in unencrypted form.
pjsip set logger console <on / off>
This allows you to toggle logging to console on and off.
pjsip set logger host <IP/subnet mask> add
This allows you to add an additional IP address or subnet
mask to logging, allowing you to log multiple instead of
just a single IP address or all traffic.
The normal "pjsip set logger host" CLI command has also been
expanded to allow subnet masks as well.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
--- Functionality changes from Asterisk 16.9.0 to Asterisk 16.10.0 ----------- --- Functionality changes from Asterisk 16.9.0 to Asterisk 16.10.0 -----------
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
......
This diff is collapsed.
...@@ -63,6 +63,7 @@ else ...@@ -63,6 +63,7 @@ else
endif endif
OPTIMIZE?=-O3 OPTIMIZE?=-O3
ifneq ($(findstring darwin,$(OSARCH)),) ifneq ($(findstring darwin,$(OSARCH)),)
ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6) ifeq ($(shell if test `/usr/bin/sw_vers -productVersion | cut -c4` -gt 5; then echo 6; else echo 0; fi),6)
# Snow Leopard/Lion has an issue with this optimization flag on large files (like chan_sip) # Snow Leopard/Lion has an issue with this optimization flag on large files (like chan_sip)
...@@ -70,15 +71,15 @@ ifneq ($(findstring darwin,$(OSARCH)),) ...@@ -70,15 +71,15 @@ ifneq ($(findstring darwin,$(OSARCH)),)
endif endif
endif endif
# gcc version 8.2.1 and above must have partial-inlining disabled to avoid documented bug. ifeq ($(CC),gcc)
# We must handle cross-compiling and clang so make sure the compiler version string has "gcc" # gcc version 8.2.1 and above must have partial-inlining disabled in order
# somewhere in it before testing the version. # to avoid a documented bug. Sort to make the lowest version number come
CC_VERS_STRING=$(shell $(CC) --version | grep -i gcc) # first. If it's the specified version then the current gcc version is equal
ifneq ($(CC_VERS_STRING),) # to or greater, so add the custom optimization rule.
GCC_VER_GTE821:=$(shell expr `echo '$(CC_VERS_STRING)' | cut -d ' ' -f 3 | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \>= 80201) gcc_versions=$(shell printf "%s\n" $$(gcc -dumpversion) 8.2.1 | sort -n)
ifeq ($(GCC_VER_GTE821),1) ifeq ($(firstword $(gcc_versions)),8.2.1)
OPTIMIZE+=-fno-partial-inlining OPTIMIZE+=-fno-partial-inlining
endif endif
endif endif
ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_CODE_COVERAGE),no) ifeq ($(findstring DONT_OPTIMIZE,$(MENUSELECT_CFLAGS))$(AST_CODE_COVERAGE),no)
......
...@@ -132,7 +132,8 @@ struct mbl_pvt { ...@@ -132,7 +132,8 @@ struct mbl_pvt {
int rfcomm_socket; /* rfcomm socket descriptor */ int rfcomm_socket; /* rfcomm socket descriptor */
char rfcomm_buf[256]; char rfcomm_buf[256];
char io_buf[CHANNEL_FRAME_SIZE + AST_FRIENDLY_OFFSET]; char io_buf[CHANNEL_FRAME_SIZE + AST_FRIENDLY_OFFSET];
struct ast_smoother *smoother; /* our smoother, for making 48 byte frames */ struct ast_smoother *bt_out_smoother; /* our bt_out_smoother, for making 48 byte frames */
struct ast_smoother *bt_in_smoother; /* our smoother, for making "normal" CHANNEL_FRAME_SIZEed byte frames */
int sco_socket; /* sco socket descriptor */ int sco_socket; /* sco socket descriptor */
pthread_t monitor_thread; /* monitor thread handle */ pthread_t monitor_thread; /* monitor thread handle */
int timeout; /*!< used to set the timeout for rfcomm data (may be used in the future) */ int timeout; /*!< used to set the timeout for rfcomm data (may be used in the future) */
...@@ -856,7 +857,8 @@ static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, struct cidinf ...@@ -856,7 +857,8 @@ static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, struct cidinf
else else
pvt->do_alignment_detection = 0; pvt->do_alignment_detection = 0;
ast_smoother_reset(pvt->smoother, DEVICE_FRAME_SIZE); ast_smoother_reset(pvt->bt_out_smoother, DEVICE_FRAME_SIZE);
ast_smoother_reset(pvt->bt_in_smoother, CHANNEL_FRAME_SIZE);
ast_dsp_digitreset(pvt->dsp); ast_dsp_digitreset(pvt->dsp);
chn = ast_channel_alloc(1, state, chn = ast_channel_alloc(1, state,
...@@ -1131,23 +1133,27 @@ static struct ast_frame *mbl_read(struct ast_channel *ast) ...@@ -1131,23 +1133,27 @@ static struct ast_frame *mbl_read(struct ast_channel *ast)
pvt->fr.delivery.tv_usec = 0; pvt->fr.delivery.tv_usec = 0;
pvt->fr.data.ptr = pvt->io_buf + AST_FRIENDLY_OFFSET; pvt->fr.data.ptr = pvt->io_buf + AST_FRIENDLY_OFFSET;
if ((r = read(pvt->sco_socket, pvt->fr.data.ptr, DEVICE_FRAME_SIZE)) == -1) { do {
if (errno != EAGAIN && errno != EINTR) { if ((r = read(pvt->sco_socket, pvt->fr.data.ptr, DEVICE_FRAME_SIZE)) == -1) {
ast_debug(1, "[%s] read error %d, going to wait for new connection\n", pvt->id, errno); if (errno != EAGAIN && errno != EINTR) {
close(pvt->sco_socket); ast_debug(1, "[%s] read error %d, going to wait for new connection\n", pvt->id, errno);
pvt->sco_socket = -1; close(pvt->sco_socket);
ast_channel_set_fd(ast, 0, -1); pvt->sco_socket = -1;
ast_channel_set_fd(ast, 0, -1);
}
goto e_return;
} }
goto e_return;
}
pvt->fr.datalen = r; pvt->fr.datalen = r;
pvt->fr.samples = r / 2; pvt->fr.samples = r / 2;
if (pvt->do_alignment_detection) if (pvt->do_alignment_detection)
do_alignment_detection(pvt, pvt->fr.data.ptr, r); do_alignment_detection(pvt, pvt->fr.data.ptr, r);
fr = ast_dsp_process(ast, pvt->dsp, &pvt->fr); ast_smoother_feed(pvt->bt_in_smoother, &pvt->fr);
fr = ast_smoother_read(pvt->bt_in_smoother);
} while (fr == NULL);
fr = ast_dsp_process(ast, pvt->dsp, fr);
ast_mutex_unlock(&pvt->lock); ast_mutex_unlock(&pvt->lock);
...@@ -1174,9 +1180,9 @@ static int mbl_write(struct ast_channel *ast, struct ast_frame *frame) ...@@ -1174,9 +1180,9 @@ static int mbl_write(struct ast_channel *ast, struct ast_frame *frame)
CHANNEL_DEADLOCK_AVOIDANCE(ast); CHANNEL_DEADLOCK_AVOIDANCE(ast);
} }
ast_smoother_feed(pvt->smoother, frame); ast_smoother_feed(pvt->bt_out_smoother, frame);
while ((f = ast_smoother_read(pvt->smoother))) { while ((f = ast_smoother_read(pvt->bt_out_smoother))) {
sco_write(pvt->sco_socket, f->data.ptr, f->datalen); sco_write(pvt->sco_socket, f->data.ptr, f->datalen);
} }
...@@ -4530,16 +4536,22 @@ static struct mbl_pvt *mbl_load_device(struct ast_config *cfg, const char *cat) ...@@ -4530,16 +4536,22 @@ static struct mbl_pvt *mbl_load_device(struct ast_config *cfg, const char *cat)
pvt->ring_sched_id = -1; pvt->ring_sched_id = -1;
pvt->has_sms = 1; pvt->has_sms = 1;
/* setup the smoother */ /* setup the bt_out_smoother */
if (!(pvt->smoother = ast_smoother_new(DEVICE_FRAME_SIZE))) { if (!(pvt->bt_out_smoother = ast_smoother_new(DEVICE_FRAME_SIZE))) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up frame smoother.\n", cat); ast_log(LOG_ERROR, "Skipping device %s. Error setting up frame bt_out_smoother.\n", cat);
goto e_free_pvt; goto e_free_pvt;
} }
/* setup the bt_in_smoother */
if (!(pvt->bt_in_smoother = ast_smoother_new(CHANNEL_FRAME_SIZE))) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up frame bt_in_smoother.\n", cat);
goto e_free_bt_out_smoother;
}
/* setup the dsp */ /* setup the dsp */
if (!(pvt->dsp = ast_dsp_new())) { if (!(pvt->dsp = ast_dsp_new())) {
ast_log(LOG_ERROR, "Skipping device %s. Error setting up dsp for dtmf detection.\n", cat); ast_log(LOG_ERROR, "Skipping device %s. Error setting up dsp for dtmf detection.\n", cat);
goto e_free_smoother; goto e_free_bt_in_smoother;
} }
/* setup the scheduler */ /* setup the scheduler */
...@@ -4599,8 +4611,10 @@ e_free_sched: ...@@ -4599,8 +4611,10 @@ e_free_sched:
ast_sched_context_destroy(pvt->sched); ast_sched_context_destroy(pvt->sched);
e_free_dsp: e_free_dsp:
ast_dsp_free(pvt->dsp); ast_dsp_free(pvt->dsp);
e_free_smoother: e_free_bt_in_smoother:
ast_smoother_free(pvt->smoother); ast_smoother_free(pvt->bt_in_smoother);
e_free_bt_out_smoother:
ast_smoother_free(pvt->bt_out_smoother);
e_free_pvt: e_free_pvt:
ast_free(pvt); ast_free(pvt);
e_return: e_return:
...@@ -4732,7 +4746,8 @@ static int unload_module(void) ...@@ -4732,7 +4746,8 @@ static int unload_module(void)
ast_free(pvt->hfp); ast_free(pvt->hfp);
} }
ast_smoother_free(pvt->smoother); ast_smoother_free(pvt->bt_out_smoother);
ast_smoother_free(pvt->bt_in_smoother);
ast_dsp_free(pvt->dsp); ast_dsp_free(pvt->dsp);
ast_sched_context_destroy(pvt->sched); ast_sched_context_destroy(pvt->sched);
ast_free(pvt); ast_free(pvt);
......
...@@ -737,6 +737,10 @@ static int decodeOctets ...@@ -737,6 +737,10 @@ static int decodeOctets
nbits -= 8; nbits -= 8;
} }
if (nbits <= 0) {
return ASN_OK;
}
/* Copy last partial byte */ /* Copy last partial byte */
if (nbits >= rshift) { if (nbits >= rshift) {
...@@ -752,7 +756,7 @@ static int decodeOctets ...@@ -752,7 +756,7 @@ static int decodeOctets
pctxt->buffer.bitOffset = 8 - nbitsInLastOctet; pctxt->buffer.bitOffset = 8 - nbitsInLastOctet;
} }
else if (nbits > 0) { /* nbits < rshift */ else { /* nbits > 0 && nbits < rshift */
pbuffer[i] = pbuffer[i] =
pctxt->buffer.data[pctxt->buffer.byteIndex] << lshift; pctxt->buffer.data[pctxt->buffer.byteIndex] << lshift;
pctxt->buffer.bitOffset = rshift - nbits; pctxt->buffer.bitOffset = rshift - nbits;
...@@ -832,8 +836,8 @@ int decodeOpenType ...@@ -832,8 +836,8 @@ int decodeOpenType
int decodeSemiConsInteger (OOCTXT* pctxt, ASN1INT* pvalue, ASN1INT lower) int decodeSemiConsInteger (OOCTXT* pctxt, ASN1INT* pvalue, ASN1INT lower)
{ {
signed char b; signed char b = 0;
unsigned char ub; unsigned char ub = 0;
ASN1UINT nbytes; ASN1UINT nbytes;
int stat; int stat;
......
...@@ -389,7 +389,7 @@ int ooSocketAccept (OOSOCKET socket, OOSOCKET *pNewSocket, ...@@ -389,7 +389,7 @@ int ooSocketAccept (OOSOCKET socket, OOSOCKET *pNewSocket,
if (destAddr != 0) { if (destAddr != 0) {
if ((host = ast_sockaddr_stringify_addr(&addr)) != NULL) if ((host = ast_sockaddr_stringify_addr(&addr)) != NULL)
strncpy(destAddr, host, strlen(host)); memcpy(destAddr, host, strlen(host) + 1);
} }
if (destPort != 0) if (destPort != 0)
*destPort = ast_sockaddr_port(&addr); *destPort = ast_sockaddr_port(&addr);
......
...@@ -454,7 +454,7 @@ int ooAcceptH225Connection() ...@@ -454,7 +454,7 @@ int ooAcceptH225Connection()
call->callToken); call->callToken);
if (remoteIP[0]) { if (remoteIP[0]) {
strncpy(call->remoteIP, remoteIP, strlen(remoteIP)); memcpy(call->remoteIP, remoteIP, strlen(remoteIP) + 1);
} }
ast_mutex_unlock(&call->Lock); ast_mutex_unlock(&call->Lock);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
<replacement>res_fax</replacement> <replacement>res_fax</replacement>
***/ ***/
/* Needed for spandsp headers */
#define ASTMM_LIBC ASTMM_IGNORE
#include "asterisk.h" #include "asterisk.h"
#include <string.h> #include <string.h>
......
...@@ -449,6 +449,7 @@ ...@@ -449,6 +449,7 @@
#define OSP_SIZE_UUID ((unsigned int)16) /* UUID size */ #define OSP_SIZE_UUID ((unsigned int)16) /* UUID size */
#define OSP_SIZE_UUIDSTR ((unsigned int)36) /* UUID string size */ #define OSP_SIZE_UUIDSTR ((unsigned int)36) /* UUID string size */
#define OSP_SIZE_QOSSTR ((unsigned int)1024) /* QoS string buffer size */ #define OSP_SIZE_QOSSTR ((unsigned int)1024) /* QoS string buffer size */
#define OSP_SIZE_OUTSTR ((unsigned int)288) /* OSP out size for osp_convert_inout */
/* Call ID Type*/ /* Call ID Type*/
#define OSP_CALLID_UNDEF ((unsigned int)0) /* Undefined */ #define OSP_CALLID_UNDEF ((unsigned int)0) /* Undefined */
...@@ -1089,8 +1090,8 @@ static int osp_validate_token( ...@@ -1089,8 +1090,8 @@ static int osp_validate_token(
int res; int res;
int tokenlen; int tokenlen;
unsigned char tokenstr[OSP_SIZE_TOKSTR]; unsigned char tokenstr[OSP_SIZE_TOKSTR];
char src[OSP_SIZE_NORSTR]; char src[OSP_SIZE_OUTSTR];
char dest[OSP_SIZE_NORSTR]; char dest[OSP_SIZE_OUTSTR];
unsigned int authorised; unsigned int authorised;
unsigned int dummy = 0; unsigned int dummy = 0;
int error; int error;
...@@ -1518,14 +1519,14 @@ static int osp_lookup( ...@@ -1518,14 +1519,14 @@ static int osp_lookup(
char* tmp; char* tmp;
unsigned int tokenlen; unsigned int tokenlen;
char token[OSP_SIZE_TOKSTR]; char token[OSP_SIZE_TOKSTR];
char src[OSP_SIZE_NORSTR]; char src[OSP_SIZE_OUTSTR];
char dev[OSP_SIZE_NORSTR]; char dev[OSP_SIZE_OUTSTR];
char host[OSP_SIZE_NORSTR]; char host[OSP_SIZE_OUTSTR];
unsigned int i, type; unsigned int i, type;
struct osp_callid callid; struct osp_callid callid;
unsigned int callidnum; unsigned int callidnum;
OSPT_CALL_ID* callids[OSP_CALLID_MAXNUM]; OSPT_CALL_ID* callids[OSP_CALLID_MAXNUM];
char dest[OSP_SIZE_NORSTR]; char dest[OSP_SIZE_OUTSTR];
const char* preferred[2] = { NULL }; const char* preferred[2] = { NULL };
unsigned int dummy = 0; unsigned int dummy = 0;
OSPEFAILREASON reason; OSPEFAILREASON reason;
......
...@@ -1546,8 +1546,6 @@ struct callattempt { ...@@ -1546,8 +1546,6 @@ struct callattempt {
struct ast_channel *chan; struct ast_channel *chan;
char interface[256]; /*!< An Asterisk dial string (not a channel name) */ char interface[256]; /*!< An Asterisk dial string (not a channel name) */
int metric; int metric;
time_t lastcall;
struct call_queue *lastqueue;
struct member *member; struct member *member;
/*! Saved connected party info from an AST_CONTROL_CONNECTED_LINE. */ /*! Saved connected party info from an AST_CONTROL_CONNECTED_LINE. */
struct ast_party_connected_line connected; struct ast_party_connected_line connected;
...@@ -4389,42 +4387,43 @@ static int member_status_available(int status) ...@@ -4389,42 +4387,43 @@ static int member_status_available(int status)
*/ */
static int can_ring_entry(struct queue_ent *qe, struct callattempt *call) static int can_ring_entry(struct queue_ent *qe, struct callattempt *call)
{ {
struct member *memberp = call->member;
int wrapuptime; int wrapuptime;
if (call->member->paused) { if (memberp->paused) {
ast_debug(1, "%s paused, can't receive call\n", call->interface); ast_debug(1, "%s paused, can't receive call\n", call->interface);
return 0; return 0;
} }
if (!call->member->ringinuse && !member_status_available(call->member->status)) { if (!memberp->ringinuse && !member_status_available(memberp->status)) {
ast_debug(1, "%s not available, can't receive call\n", call->interface); ast_debug(1, "%s not available, can't receive call\n", call->interface);
return 0; return 0;
} }
if (call->lastqueue) { if (memberp->lastqueue) {
wrapuptime = get_wrapuptime(call->lastqueue, call->member); wrapuptime = get_wrapuptime(memberp->lastqueue, memberp);
} else { } else {
wrapuptime = get_wrapuptime(qe->parent, call->member); wrapuptime = get_wrapuptime(qe->parent, memberp);
} }
if (wrapuptime && time(NULL) - call->lastcall < wrapuptime) { if (wrapuptime && (time(NULL) - memberp->lastcall) < wrapuptime) {
ast_debug(1, "Wrapuptime not yet expired on queue %s for %s\n", ast_debug(1, "Wrapuptime not yet expired on queue %s for %s\n",
(call->lastqueue ? call->lastqueue->name : qe->parent->name), (memberp->lastqueue ? memberp->lastqueue->name : qe->parent->name),
call->interface); call->interface);
return 0; return 0;
} }
if (use_weight && compare_weight(qe->parent, call->member)) { if (use_weight && compare_weight(qe->parent, memberp)) {
ast_debug(1, "Priority queue delaying call to %s:%s\n", ast_debug(1, "Priority queue delaying call to %s:%s\n",
qe->parent->name, call->interface); qe->parent->name, call->interface);
return 0; return 0;
} }
if (!call->member->ringinuse) { if (!memberp->ringinuse) {
struct member *mem; struct member *mem;
ao2_lock(pending_members); ao2_lock(pending_members);
mem = ao2_find(pending_members, call->member, mem = ao2_find(pending_members, memberp,
OBJ_SEARCH_OBJECT | OBJ_NOLOCK); OBJ_SEARCH_OBJECT | OBJ_NOLOCK);
if (mem) { if (mem) {
/* /*
...@@ -4442,8 +4441,8 @@ static int can_ring_entry(struct queue_ent *qe, struct callattempt *call) ...@@ -4442,8 +4441,8 @@ static int can_ring_entry(struct queue_ent *qe, struct callattempt *call)
* If not found add it to the container so another queue * If not found add it to the container so another queue
* won't attempt to call this member at the same time. * won't attempt to call this member at the same time.
*/ */
ast_debug(3, "Add %s to pending_members\n", call->member->membername); ast_debug(3, "Add %s to pending_members\n", memberp->membername);
ao2_link(pending_members, call->member); ao2_link(pending_members, memberp);
ao2_unlock(pending_members); ao2_unlock(pending_members);
/* /*
...@@ -4451,10 +4450,10 @@ static int can_ring_entry(struct queue_ent *qe, struct callattempt *call) ...@@ -4451,10 +4450,10 @@ static int can_ring_entry(struct queue_ent *qe, struct callattempt *call)
* because the device state and extension state callbacks may * because the device state and extension state callbacks may
* not have updated the status yet. * not have updated the status yet.
*/ */
if (!member_status_available(get_queue_member_status(call->member))) { if (!member_status_available(get_queue_member_status(memberp))) {
ast_debug(1, "%s actually not available, can't receive call\n", ast_debug(1, "%s actually not available, can't receive call\n",
call->interface); call->interface);
pending_members_remove(call->member); pending_members_remove(memberp);
return 0; return 0;
} }
} }
...@@ -6452,6 +6451,33 @@ static void handle_hangup(void *userdata, struct stasis_subscription *sub, ...@@ -6452,6 +6451,33 @@ static void handle_hangup(void *userdata, struct stasis_subscription *sub,
remove_stasis_subscriptions(queue_data); remove_stasis_subscriptions(queue_data);
} }
static void handle_masquerade(void *userdata, struct stasis_subscription *sub,
struct stasis_message *msg)
{
struct queue_stasis_data *queue_data = userdata;
struct ast_channel_blob *channel_blob = stasis_message_data(msg);
const char *new_channel_id;
new_channel_id = ast_json_string_get(ast_json_object_get(channel_blob->blob, "newchanneluniqueid"));
ao2_lock(queue_data);
if (queue_data->dying) {
ao2_unlock(queue_data);
return;
}
if (!strcmp(channel_blob->snapshot->uniqueid, queue_data->caller_uniqueid)) {
ast_debug(1, "Replacing caller channel %s with %s due to masquerade\n", queue_data->caller_uniqueid, new_channel_id);
ast_string_field_set(queue_data, caller_uniqueid, new_channel_id);
} else if (!strcmp(channel_blob->snapshot->uniqueid, queue_data->member_uniqueid)) {
ast_debug(1, "Replacing member channel %s with %s due to masquerade\n", queue_data->member_uniqueid, new_channel_id);
ast_string_field_set(queue_data, member_uniqueid, new_channel_id);
}
ao2_unlock(queue_data);
}
/*! /*!
* \internal * \internal
* \brief Callback for all stasis channel events * \brief Callback for all stasis channel events
...@@ -6525,6 +6551,8 @@ static int setup_stasis_subs(struct queue_ent *qe, struct ast_channel *peer, str ...@@ -6525,6 +6551,8 @@ static int setup_stasis_subs(struct queue_ent *qe, struct ast_channel *peer, str
handle_local_optimization_end, queue_data); handle_local_optimization_end, queue_data);
stasis_message_router_add(queue_data->channel_router, ast_channel_hangup_request_type(), stasis_message_router_add(queue_data->channel_router, ast_channel_hangup_request_type(),
handle_hangup, queue_data); handle_hangup, queue_data);
stasis_message_router_add(queue_data->channel_router, ast_channel_masquerade_type(),
handle_masquerade, queue_data);
stasis_message_router_set_default(queue_data->channel_router, stasis_message_router_set_default(queue_data->channel_router,
queue_channel_cb, queue_data); queue_channel_cb, queue_data);
...@@ -6828,9 +6856,7 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a ...@@ -6828,9 +6856,7 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
tmp->block_connected_update = block_connected_line; tmp->block_connected_update = block_connected_line;
tmp->stillgoing = 1; tmp->stillgoing = 1;
tmp->member = cur;/* Place the reference for cur into callattempt. */ tmp->member = cur; /* Place the reference for cur into callattempt. */
tmp->lastcall = cur->lastcall;
tmp->lastqueue = cur->lastqueue;
ast_copy_string(tmp->interface, cur->interface, sizeof(tmp->interface)); ast_copy_string(tmp->interface, cur->interface, sizeof(tmp->interface));
/* Calculate the metric for the appropriate strategy. */ /* Calculate the metric for the appropriate strategy. */
if (!calc_metric(qe->parent, cur, x++, qe, tmp)) { if (!calc_metric(qe->parent, cur, x++, qe, tmp)) {
...@@ -6839,9 +6865,6 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a ...@@ -6839,9 +6865,6 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
hung up XXX */ hung up XXX */
tmp->q_next = outgoing; tmp->q_next = outgoing;
outgoing = tmp; outgoing = tmp;
/* If this line is up, don't try anybody else */
if (outgoing->chan && (ast_channel_state(outgoing->chan) == AST_STATE_UP))
break;
} else { } else {
callattempt_free(tmp); callattempt_free(tmp);
} }
......
...@@ -313,13 +313,14 @@ static void gosub_release_frame(struct ast_channel *chan, struct gosub_stack_fra ...@@ -313,13 +313,14 @@ static void gosub_release_frame(struct ast_channel *chan, struct gosub_stack_fra
static struct gosub_stack_frame *gosub_allocate_frame(const char *context, const char *extension, int priority, int in_subroutine, unsigned char arguments) static struct gosub_stack_frame *gosub_allocate_frame(const char *context, const char *extension, int priority, int in_subroutine, unsigned char arguments)
{ {
struct gosub_stack_frame *new = NULL; struct gosub_stack_frame *new = NULL;
int len_extension = strlen(extension), len_context = strlen(context); int len_extension = strlen(extension) + 1;
int len_context = strlen(context) + 1;
if ((new = ast_calloc(1, sizeof(*new) + 2 + len_extension + len_context))) { if ((new = ast_calloc(1, sizeof(*new) + len_extension + len_context))) {
AST_LIST_HEAD_INIT_NOLOCK(&new->varshead); AST_LIST_HEAD_INIT_NOLOCK(&new->varshead);
strcpy(new->extension, extension); ast_copy_string(new->extension, extension, len_extension);
new->context = new->extension + len_extension + 1; new->context = new->extension + len_extension;
strcpy(new->context, context); ast_copy_string(new->context, context, len_context);
new->priority = priority; new->priority = priority;
new->in_subroutine = in_subroutine ? 1 : 0; new->in_subroutine = in_subroutine ? 1 : 0;
new->arguments = arguments; new->arguments = arguments;
......
...@@ -274,7 +274,7 @@ static struct ast_stream_topology *stream_echo_topology_alloc( ...@@ -274,7 +274,7 @@ static struct ast_stream_topology *stream_echo_topology_alloc(
* cloning the same stream. * cloning the same stream.
*/ */
ast_stream_set_state(stream, n == num ? ast_stream_set_state(stream, n == num ?
AST_STREAM_STATE_SENDRECV : AST_STREAM_STATE_RECVONLY); AST_STREAM_STATE_SENDRECV : AST_STREAM_STATE_SENDONLY);
} while (--n); } while (--n);
} }
......
...@@ -1234,10 +1234,12 @@ static int inprocess_cmp_fn(void *obj, void *arg, int flags) ...@@ -1234,10 +1234,12 @@ static int inprocess_cmp_fn(void *obj, void *arg, int flags)
   
static int inprocess_count(const char *context, const char *mailbox, int delta) static int inprocess_count(const char *context, const char *mailbox, int delta)
{ {
struct inprocess *i, *arg = ast_alloca(sizeof(*arg) + strlen(context) + strlen(mailbox) + 2); int context_len = strlen(context) + 1;
arg->context = arg->mailbox + strlen(mailbox) + 1; int mailbox_len = strlen(mailbox) + 1;
strcpy(arg->mailbox, mailbox); /* SAFE */ struct inprocess *i, *arg = ast_alloca(sizeof(*arg) + context_len + mailbox_len);
strcpy(arg->context, context); /* SAFE */ arg->context = arg->mailbox + mailbox_len;
ast_copy_string(arg->mailbox, mailbox, mailbox_len); /* SAFE */
ast_copy_string(arg->context, context, context_len); /* SAFE */
ao2_lock(inprocess_container); ao2_lock(inprocess_container);
if ((i = ao2_find(inprocess_container, arg, 0))) { if ((i = ao2_find(inprocess_container, arg, 0))) {
int ret = ast_atomic_fetchadd_int(&i->count, delta); int ret = ast_atomic_fetchadd_int(&i->count, delta);
...@@ -1248,13 +1250,13 @@ static int inprocess_count(const char *context, const char *mailbox, int delta) ...@@ -1248,13 +1250,13 @@ static int inprocess_count(const char *context, const char *mailbox, int delta)
if (delta < 0) { if (delta < 0) {
ast_log(LOG_WARNING, "BUG: ref count decrement on non-existing object???\n"); ast_log(LOG_WARNING, "BUG: ref count decrement on non-existing object???\n");
} }
if (!(i = ao2_alloc(sizeof(*i) + strlen(context) + strlen(mailbox) + 2, NULL))) { if (!(i = ao2_alloc(sizeof(*i) + context_len + mailbox_len, NULL))) {
ao2_unlock(inprocess_container); ao2_unlock(inprocess_container);
return 0; return 0;
} }
i->context = i->mailbox + strlen(mailbox) + 1; i->context = i->mailbox + mailbox_len;
strcpy(i->mailbox, mailbox); /* SAFE */ ast_copy_string(i->mailbox, mailbox, mailbox_len); /* SAFE */
strcpy(i->context, context); /* SAFE */ ast_copy_string(i->context, context, context_len); /* SAFE */
i->count = delta; i->count = delta;
ao2_link(inprocess_container, i); ao2_link(inprocess_container, i);
ao2_unlock(inprocess_container); ao2_unlock(inprocess_container);
...@@ -13350,13 +13352,15 @@ static int handle_subscribe(void *datap) ...@@ -13350,13 +13352,15 @@ static int handle_subscribe(void *datap)
unsigned int len; unsigned int len;
struct mwi_sub *mwi_sub; struct mwi_sub *mwi_sub;
struct mwi_sub_task *p = datap; struct mwi_sub_task *p = datap;
size_t context_len;
   
len = sizeof(*mwi_sub) + 1; len = sizeof(*mwi_sub) + 1;
if (!ast_strlen_zero(p->mailbox)) if (!ast_strlen_zero(p->mailbox))
len += strlen(p->mailbox); len += strlen(p->mailbox);
   
context_len = strlen(p->context) + 1; /* Allow for seperator */
if (!ast_strlen_zero(p->context)) if (!ast_strlen_zero(p->context))
len += strlen(p->context) + 1; /* Allow for seperator */ len += context_len;
   
if (!(mwi_sub = ast_calloc(1, len))) if (!(mwi_sub = ast_calloc(1, len)))
return -1; return -1;
...@@ -13367,7 +13371,7 @@ static int handle_subscribe(void *datap) ...@@ -13367,7 +13371,7 @@ static int handle_subscribe(void *datap)
   
if (!ast_strlen_zero(p->context)) { if (!ast_strlen_zero(p->context)) {
strcat(mwi_sub->mailbox, "@"); strcat(mwi_sub->mailbox, "@");
strcat(mwi_sub->mailbox, p->context); ast_copy_string(mwi_sub->mailbox, p->context, context_len);
} }
   
AST_RWLIST_WRLOCK(&mwi_subs); AST_RWLIST_WRLOCK(&mwi_subs);
...@@ -13856,8 +13860,8 @@ static struct alias_mailbox_mapping *alias_mailbox_mapping_create(const char *al ...@@ -13856,8 +13860,8 @@ static struct alias_mailbox_mapping *alias_mailbox_mapping_create(const char *al
} }
mapping->alias = mapping->buf; mapping->alias = mapping->buf;
mapping->mailbox = mapping->buf + from_len; mapping->mailbox = mapping->buf + from_len;
strcpy(mapping->alias, alias); /* Safe */ ast_copy_string(mapping->alias, alias, from_len); /* Safe */
strcpy(mapping->mailbox, mailbox); /* Safe */ ast_copy_string(mapping->mailbox, mailbox, to_len); /* Safe */
   
return mapping; return mapping;
} }
...@@ -14826,6 +14830,12 @@ exit_vmsayname_test: ...@@ -14826,6 +14830,12 @@ exit_vmsayname_test:
return res ? AST_TEST_FAIL : AST_TEST_PASS; return res ? AST_TEST_FAIL : AST_TEST_PASS;
} }
   
struct test_files {
char dir[256];
char file[256];
char txtfile[256];
};
AST_TEST_DEFINE(test_voicemail_msgcount) AST_TEST_DEFINE(test_voicemail_msgcount)
{ {
int i, j, res = AST_TEST_PASS, syserr; int i, j, res = AST_TEST_PASS, syserr;
...@@ -14835,11 +14845,8 @@ AST_TEST_DEFINE(test_voicemail_msgcount) ...@@ -14835,11 +14845,8 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
#ifdef IMAP_STORAGE #ifdef IMAP_STORAGE
struct ast_channel *chan = NULL; struct ast_channel *chan = NULL;
#endif #endif
struct { /* Using ast_alloca instead of just declaring tmp as an array is a workaround for a GCC 10 issue with -Wrestrict */
char dir[256]; struct test_files *tmp = ast_alloca(sizeof(struct test_files) * 3);
char file[256];
char txtfile[256];
} tmp[3];
char syscmd[256]; char syscmd[256];
const char origweasels[] = "tt-weasels"; const char origweasels[] = "tt-weasels";
const char testcontext[] = "test"; const char testcontext[] = "test";
......
...@@ -367,7 +367,7 @@ static void send_message(const char *msg_name, char *conf_name, struct ast_json ...@@ -367,7 +367,7 @@ static void send_message(const char *msg_name, char *conf_name, struct ast_json
char *json; char *json;
int rc = 0; int rc = 0;
struct ast_frame f; struct ast_frame f;
struct ast_bridge_channel *bridge_chan; RAII_VAR(struct ast_bridge_channel *, bridge_chan, NULL, ao2_cleanup);
bridge_chan = ast_channel_get_bridge_channel(chan); bridge_chan = ast_channel_get_bridge_channel(chan);
if (!bridge_chan) { if (!bridge_chan) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -886,8 +886,6 @@ static struct ast_stream_topology *native_rtp_request_stream_topology_update( ...@@ -886,8 +886,6 @@ static struct ast_stream_topology *native_rtp_request_stream_topology_update(
if (audio_formats) { if (audio_formats) {
for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) { for (i = 0; i < ast_stream_topology_get_count(new_topology); ++i) {
struct ast_format_cap *joint;
stream = ast_stream_topology_get_stream(new_topology, i); stream = ast_stream_topology_get_stream(new_topology, i);
if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO || if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_AUDIO ||
...@@ -895,16 +893,8 @@ static struct ast_stream_topology *native_rtp_request_stream_topology_update( ...@@ -895,16 +893,8 @@ static struct ast_stream_topology *native_rtp_request_stream_topology_update(
continue; continue;
} }
joint = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT); /* We haven't actually modified audio_formats so this is safe */
if (!joint) { ast_stream_set_formats(stream, (struct ast_format_cap *)audio_formats);
continue;
}
ast_format_cap_append_from_cap(joint, ast_stream_get_formats(stream),
AST_MEDIA_TYPE_AUDIO);
ast_format_cap_append_from_cap(joint, audio_formats, AST_MEDIA_TYPE_AUDIO);
ast_stream_set_formats(stream, joint);
ao2_ref(joint, -1);
} }
} }
......