summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--apps/app_confbridge.c274
-rw-r--r--apps/app_followme.c28
-rw-r--r--apps/confbridge/conf_chan_announce.c30
-rw-r--r--apps/confbridge/include/confbridge.h12
-rw-r--r--channels/chan_iax2.c16
-rw-r--r--include/asterisk/ari.h3
-rw-r--r--include/asterisk/astmm.h26
-rw-r--r--include/asterisk/channel.h6
-rw-r--r--include/asterisk/chanvars.h2
-rw-r--r--include/asterisk/config.h2
-rw-r--r--include/asterisk/hashtab.h14
-rw-r--r--include/asterisk/heap.h4
-rw-r--r--include/asterisk/http.h1
-rw-r--r--include/asterisk/res_fax.h22
-rw-r--r--include/asterisk/strings.h6
-rw-r--r--include/asterisk/utils.h200
-rw-r--r--main/astobj2.c12
-rw-r--r--main/bridge_basic.c2
-rw-r--r--main/ccss.c4
-rw-r--r--main/chanvars.c4
-rw-r--r--main/config.c4
-rw-r--r--main/datastore.c6
-rw-r--r--main/hashtab.c40
-rw-r--r--main/heap.c14
-rw-r--r--main/http.c2
-rw-r--r--main/stringfields.c4
-rw-r--r--main/strings.c4
-rw-r--r--main/utils.c2
-rw-r--r--res/res_ari.c16
-rw-r--r--res/res_fax.c109
-rw-r--r--res/res_odbc_transaction.c1
-rw-r--r--res/res_pjsip/pjsip_configuration.c4
-rw-r--r--res/res_pjsip_refer.c7
-rw-r--r--res/res_pjsip_t38.c14
-rw-r--r--res/res_rtp_multicast.c7
-rw-r--r--tests/test_ari.c8
-rw-r--r--third-party/pjproject/patches/0003-r5403-pjsip_IPV6_V6ONLY.patch13
-rw-r--r--utils/check_expr.c4
-rw-r--r--utils/extconf.c68
40 files changed, 591 insertions, 406 deletions
diff --git a/CHANGES b/CHANGES
index 1cfa7eb7c..542b814ab 100644
--- a/CHANGES
+++ b/CHANGES
@@ -181,6 +181,8 @@ chan_iax2
seconds. Setting this to a higher value may help in lagged networks or those
experiencing high packet loss.
+ * Plaintext auth mode is deprecated and removed from possible default modes.
+
chan_rtp (was chan_multicast_rtp)
------------------
* Added unicast RTP support and renamed chan_multicast_rtp to chan_rtp.
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index 82204c48f..d5cbc4159 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -71,6 +71,7 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/stasis_bridges.h"
#include "asterisk/json.h"
#include "asterisk/format_cache.h"
+#include "asterisk/taskprocessor.h"
/*** DOCUMENTATION
<application name="ConfBridge" language="en_US">
@@ -962,6 +963,59 @@ static void handle_video_on_exit(struct confbridge_conference *conference, struc
ao2_unlock(conference);
}
+struct hangup_data
+{
+ struct confbridge_conference *conference;
+ ast_mutex_t lock;
+ ast_cond_t cond;
+ int hungup;
+};
+
+/*!
+ * \brief Hang up the announcer channel
+ *
+ * This hangs up the announcer channel in the conference. This
+ * runs in the playback queue taskprocessor since we do not want
+ * to hang up the channel while it's trying to play an announcement.
+ *
+ * This task is performed synchronously, so there is no need to
+ * perform any cleanup on the passed-in data.
+ *
+ * \param data A hangup_data structure
+ * \return 0
+ */
+static int hangup_playback(void *data)
+{
+ struct hangup_data *hangup = data;
+
+ ast_autoservice_stop(hangup->conference->playback_chan);
+
+ ast_hangup(hangup->conference->playback_chan);
+ hangup->conference->playback_chan = NULL;
+
+ ast_mutex_lock(&hangup->lock);
+ hangup->hungup = 1;
+ ast_cond_signal(&hangup->cond);
+ ast_mutex_unlock(&hangup->lock);
+
+ return 0;
+}
+
+static void hangup_data_init(struct hangup_data *hangup, struct confbridge_conference *conference)
+{
+ ast_mutex_init(&hangup->lock);
+ ast_cond_init(&hangup->cond, NULL);
+
+ hangup->conference = conference;
+ hangup->hungup = 0;
+}
+
+static void hangup_data_destroy(struct hangup_data *hangup)
+{
+ ast_mutex_destroy(&hangup->lock);
+ ast_cond_destroy(&hangup->cond);
+}
+
/*!
* \brief Destroy a conference bridge
*
@@ -976,9 +1030,22 @@ static void destroy_conference_bridge(void *obj)
ast_debug(1, "Destroying conference bridge '%s'\n", conference->name);
if (conference->playback_chan) {
- conf_announce_channel_depart(conference->playback_chan);
- ast_hangup(conference->playback_chan);
- conference->playback_chan = NULL;
+ if (conference->playback_queue) {
+ struct hangup_data hangup;
+ hangup_data_init(&hangup, conference);
+ ast_taskprocessor_push(conference->playback_queue, hangup_playback, &hangup);
+
+ ast_mutex_lock(&hangup.lock);
+ while (!hangup.hungup) {
+ ast_cond_wait(&hangup.cond, &hangup.lock);
+ }
+ ast_mutex_unlock(&hangup.lock);
+ hangup_data_destroy(&hangup);
+ } else {
+ /* Playback queue is not yet allocated. Just hang up the channel straight */
+ ast_hangup(conference->playback_chan);
+ conference->playback_chan = NULL;
+ }
}
/* Destroying a conference bridge is simple, all we have to do is destroy the bridging object */
@@ -992,7 +1059,7 @@ static void destroy_conference_bridge(void *obj)
ast_free(conference->record_filename);
conf_bridge_profile_destroy(&conference->b_profile);
- ast_mutex_destroy(&conference->playback_lock);
+ ast_taskprocessor_unreference(conference->playback_queue);
}
/*! \brief Call the proper join event handler for the user for the conference bridge's current state
@@ -1273,6 +1340,72 @@ void conf_ended(struct confbridge_conference *conference)
}
/*!
+ * \internal
+ * \brief Allocate playback channel for a conference.
+ * \pre expects conference to be locked before calling this function
+ */
+static int alloc_playback_chan(struct confbridge_conference *conference)
+{
+ struct ast_format_cap *cap;
+ char taskprocessor_name[AST_TASKPROCESSOR_MAX_NAME + 1];
+
+ cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
+ if (!cap) {
+ return -1;
+ }
+ ast_format_cap_append(cap, ast_format_slin, 0);
+ conference->playback_chan = ast_request("CBAnn", cap, NULL, NULL,
+ conference->name, NULL);
+ ao2_ref(cap, -1);
+ if (!conference->playback_chan) {
+ return -1;
+ }
+
+ /* To make sure playback_chan has the same language as the bridge */
+ ast_channel_lock(conference->playback_chan);
+ ast_channel_language_set(conference->playback_chan, conference->b_profile.language);
+ ast_channel_unlock(conference->playback_chan);
+
+ ast_debug(1, "Created announcer channel '%s' to conference bridge '%s'\n",
+ ast_channel_name(conference->playback_chan), conference->name);
+
+ ast_taskprocessor_build_name(taskprocessor_name, sizeof(taskprocessor_name),
+ "Confbridge/%s", conference->name);
+ conference->playback_queue = ast_taskprocessor_get(taskprocessor_name, TPS_REF_DEFAULT);
+ if (!conference->playback_queue) {
+ ast_hangup(conference->playback_chan);
+ conference->playback_chan = NULL;
+ return -1;
+ }
+ return 0;
+}
+
+/*!
+ * \brief Push the announcer channel into the bridge
+ *
+ * This runs in the playback queue taskprocessor.
+ *
+ * \param data A confbridge_conference
+ * \retval 0 Success
+ * \retval -1 Failed to push the channel to the bridge
+ */
+static int push_announcer(void *data)
+{
+ struct confbridge_conference *conference = data;
+
+ if (conf_announce_channel_push(conference->playback_chan)) {
+ ast_hangup(conference->playback_chan);
+ conference->playback_chan = NULL;
+ ao2_cleanup(conference);
+ return -1;
+ }
+
+ ast_autoservice_start(conference->playback_chan);
+ ao2_cleanup(conference);
+ return 0;
+}
+
+/*!
* \brief Join a conference bridge
*
* \param conference_name The conference name
@@ -1317,9 +1450,6 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
return NULL;
}
- /* Setup lock for playback channel */
- ast_mutex_init(&conference->playback_lock);
-
/* Setup for the record channel */
conference->record_filename = ast_str_create(RECORD_FILENAME_INITIAL_SPACE);
if (!conference->record_filename) {
@@ -1364,6 +1494,22 @@ static struct confbridge_conference *join_conference_bridge(const char *conferen
/* Set the initial state to EMPTY */
conference->state = CONF_STATE_EMPTY;
+ if (alloc_playback_chan(conference)) {
+ ao2_unlink(conference_bridges, conference);
+ ao2_ref(conference, -1);
+ ao2_unlock(conference_bridges);
+ ast_log(LOG_ERROR, "Could not allocate announcer channel for conference '%s'\n", conference_name);
+ return NULL;
+ }
+
+ if (ast_taskprocessor_push(conference->playback_queue, push_announcer, ao2_bump(conference))) {
+ ao2_unlink(conference_bridges, conference);
+ ao2_ref(conference, -1);
+ ao2_unlock(conference_bridges);
+ ast_log(LOG_ERROR, "Could not add announcer channel for conference '%s' bridge\n", conference_name);
+ return NULL;
+ }
+
if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_CONFERENCE)) {
ao2_lock(conference);
conf_start_record(conference);
@@ -1484,67 +1630,105 @@ static void leave_conference(struct confbridge_user *user)
user->conference = NULL;
}
+struct playback_task_data {
+ struct confbridge_conference *conference;
+ const char *filename;
+ int say_number;
+ int playback_finished;
+ ast_mutex_t lock;
+ ast_cond_t cond;
+};
+
/*!
- * \internal
- * \brief Allocate playback channel for a conference.
- * \pre expects conference to be locked before calling this function
+ * \brief Play an announcement into a confbridge
+ *
+ * This runs in the playback queue taskprocessor. This ensures that
+ * all playbacks are handled in sequence and do not play over top one
+ * another.
+ *
+ * This task runs synchronously so there is no need for performing any
+ * sort of cleanup on the input parameter.
+ *
+ * \param data A playback_task_data
+ * \return 0
*/
-static int alloc_playback_chan(struct confbridge_conference *conference)
+static int playback_task(void *data)
{
- struct ast_format_cap *cap;
+ struct playback_task_data *ptd = data;
- cap = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
- if (!cap) {
- return -1;
+ /* Don't try to play if the playback channel has been hung up */
+ if (!ptd->conference->playback_chan) {
+ goto end;
}
- ast_format_cap_append(cap, ast_format_slin, 0);
- conference->playback_chan = ast_request("CBAnn", cap, NULL, NULL,
- conference->name, NULL);
- ao2_ref(cap, -1);
- if (!conference->playback_chan) {
- return -1;
+
+ ast_autoservice_stop(ptd->conference->playback_chan);
+
+ /* The channel is all under our control, in goes the prompt */
+ if (!ast_strlen_zero(ptd->filename)) {
+ ast_stream_and_wait(ptd->conference->playback_chan, ptd->filename, "");
+ } else if (ptd->say_number >= 0) {
+ ast_say_number(ptd->conference->playback_chan, ptd->say_number, "",
+ ast_channel_language(ptd->conference->playback_chan), NULL);
}
+ ast_autoservice_start(ptd->conference->playback_chan);
- /* To make sure playback_chan has the same language of that profile */
- ast_channel_lock(conference->playback_chan);
- ast_channel_language_set(conference->playback_chan, conference->b_profile.language);
- ast_channel_unlock(conference->playback_chan);
+end:
+ ast_mutex_lock(&ptd->lock);
+ ptd->playback_finished = 1;
+ ast_cond_signal(&ptd->cond);
+ ast_mutex_unlock(&ptd->lock);
- ast_debug(1, "Created announcer channel '%s' to conference bridge '%s'\n",
- ast_channel_name(conference->playback_chan), conference->name);
return 0;
}
+static void playback_task_data_init(struct playback_task_data *ptd, struct confbridge_conference *conference,
+ const char *filename, int say_number)
+{
+ ast_mutex_init(&ptd->lock);
+ ast_cond_init(&ptd->cond, NULL);
+
+ ptd->filename = filename;
+ ptd->say_number = say_number;
+ ptd->conference = conference;
+ ptd->playback_finished = 0;
+}
+
+static void playback_task_data_destroy(struct playback_task_data *ptd)
+{
+ ast_mutex_destroy(&ptd->lock);
+ ast_cond_destroy(&ptd->cond);
+}
+
static int play_sound_helper(struct confbridge_conference *conference, const char *filename, int say_number)
{
+ struct playback_task_data ptd;
+
/* Do not waste resources trying to play files that do not exist */
if (!ast_strlen_zero(filename) && !sound_file_exists(filename)) {
return 0;
}
- ast_mutex_lock(&conference->playback_lock);
- if (!conference->playback_chan && alloc_playback_chan(conference)) {
- ast_mutex_unlock(&conference->playback_lock);
- return -1;
- }
- if (conf_announce_channel_push(conference->playback_chan)) {
- ast_mutex_unlock(&conference->playback_lock);
+ playback_task_data_init(&ptd, conference, filename, say_number);
+ if (ast_taskprocessor_push(conference->playback_queue, playback_task, &ptd)) {
+ if (!ast_strlen_zero(filename)) {
+ ast_log(LOG_WARNING, "Unable to play file '%s' to conference %s\n",
+ filename, conference->name);
+ } else {
+ ast_log(LOG_WARNING, "Unable to say number '%d' to conference %s\n",
+ say_number, conference->name);
+ }
+ playback_task_data_destroy(&ptd);
return -1;
}
- /* The channel is all under our control, in goes the prompt */
- if (!ast_strlen_zero(filename)) {
- ast_stream_and_wait(conference->playback_chan, filename, "");
- } else if (say_number >= 0) {
- ast_say_number(conference->playback_chan, say_number, "",
- ast_channel_language(conference->playback_chan), NULL);
+ /* Wait for the playback to complete */
+ ast_mutex_lock(&ptd.lock);
+ while (!ptd.playback_finished) {
+ ast_cond_wait(&ptd.cond, &ptd.lock);
}
+ ast_mutex_unlock(&ptd.lock);
- ast_debug(1, "Departing announcer channel '%s' from conference bridge '%s'\n",
- ast_channel_name(conference->playback_chan), conference->name);
- conf_announce_channel_depart(conference->playback_chan);
-
- ast_mutex_unlock(&conference->playback_lock);
+ playback_task_data_destroy(&ptd);
return 0;
}
diff --git a/apps/app_followme.c b/apps/app_followme.c
index a955843bc..938e63ec4 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -316,9 +316,17 @@ static struct call_followme *alloc_profile(const char *fmname)
ast_mutex_init(&f->lock);
ast_copy_string(f->name, fmname, sizeof(f->name));
- f->moh[0] = '\0';
- f->context[0] = '\0';
+ AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
+ AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
+ AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
+ return f;
+}
+
+static void init_profile(struct call_followme *f, int activate)
+{
f->enable_callee_prompt = enable_callee_prompt;
+ f->context[0] = '\0';
+ ast_copy_string(f->moh, defaultmoh, sizeof(f->moh));
ast_copy_string(f->takecall, takecall, sizeof(f->takecall));
ast_copy_string(f->nextindp, nextindp, sizeof(f->nextindp));
ast_copy_string(f->callfromprompt, callfromprompt, sizeof(f->callfromprompt));
@@ -327,16 +335,9 @@ static struct call_followme *alloc_profile(const char *fmname)
ast_copy_string(f->plsholdprompt, plsholdprompt, sizeof(f->plsholdprompt));
ast_copy_string(f->statusprompt, statusprompt, sizeof(f->statusprompt));
ast_copy_string(f->sorryprompt, sorryprompt, sizeof(f->sorryprompt));
- AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
- AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
- AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
- return f;
-}
-
-static void init_profile(struct call_followme *f)
-{
- f->active = 1;
- ast_copy_string(f->moh, defaultmoh, sizeof(f->moh));
+ if (activate) {
+ f->active = 1;
+ }
}
@@ -518,7 +519,7 @@ static int reload_followme(int reload)
if (!new)
ast_mutex_lock(&f->lock);
/* Re-initialize the profile */
- init_profile(f);
+ init_profile(f, 1);
free_numbers(f);
var = ast_variable_browse(cfg, cat);
while (var) {
@@ -1248,6 +1249,7 @@ static struct call_followme *find_realtime(const char *name)
ast_free(str);
return NULL;
}
+ init_profile(new_follower, 0);
for (v = var; v; v = v->next) {
if (!strcasecmp(v->name, "active")) {
diff --git a/apps/confbridge/conf_chan_announce.c b/apps/confbridge/conf_chan_announce.c
index ff3049908..4060b99c4 100644
--- a/apps/confbridge/conf_chan_announce.c
+++ b/apps/confbridge/conf_chan_announce.c
@@ -143,31 +143,6 @@ struct ast_channel_tech *conf_announce_get_tech(void)
return &announce_tech;
}
-void conf_announce_channel_depart(struct ast_channel *chan)
-{
- struct announce_pvt *p = ast_channel_tech_pvt(chan);
-
- if (!p) {
- return;
- }
-
- ao2_ref(p, +1);
- ao2_lock(p);
- if (!ast_test_flag(&p->base, AST_UNREAL_CARETAKER_THREAD)) {
- ao2_unlock(p);
- ao2_ref(p, -1);
- return;
- }
- ast_clear_flag(&p->base, AST_UNREAL_CARETAKER_THREAD);
- chan = p->base.chan;
- ao2_unlock(p);
- ao2_ref(p, -1);
- if (chan) {
- ast_bridge_depart(chan);
- ast_channel_unref(chan);
- }
-}
-
int conf_announce_channel_push(struct ast_channel *ast)
{
struct ast_bridge_features *features;
@@ -186,20 +161,17 @@ int conf_announce_channel_push(struct ast_channel *ast)
if (!chan) {
return -1;
}
- ast_channel_ref(chan);
}
features = ast_bridge_features_new();
if (!features) {
- ast_channel_unref(chan);
return -1;
}
ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE);
/* Impart the output channel into the bridge */
if (ast_bridge_impart(p->bridge, chan, NULL, features,
- AST_BRIDGE_IMPART_CHAN_DEPARTABLE)) {
- ast_channel_unref(chan);
+ AST_BRIDGE_IMPART_CHAN_INDEPENDENT)) {
return -1;
}
ao2_lock(p);
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 5ae042113..5d71a63bc 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -228,9 +228,9 @@ struct confbridge_conference {
struct ast_channel *record_chan; /*!< Channel used for recording the conference */
struct ast_str *record_filename; /*!< Recording filename. */
struct ast_str *orig_rec_file; /*!< Previous b_profile.rec_file. */
- ast_mutex_t playback_lock; /*!< Lock used for playback channel */
AST_LIST_HEAD_NOLOCK(, confbridge_user) active_list; /*!< List of users participating in the conference bridge */
AST_LIST_HEAD_NOLOCK(, confbridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */
+ struct ast_taskprocessor *playback_queue; /*!< Queue for playing back bridge announcements and managing the announcer channel */
};
extern struct ao2_container *conference_bridges;
@@ -610,16 +610,6 @@ struct ast_channel_tech *conf_record_get_tech(void);
struct ast_channel_tech *conf_announce_get_tech(void);
/*!
- * \brief Remove the announcer channel from the conference.
- * \since 12.0.0
- *
- * \param chan Either channel in the announcer channel pair.
- *
- * \return Nothing
- */
-void conf_announce_channel_depart(struct ast_channel *chan);
-
-/*!
* \brief Push the announcer channel into the conference.
* \since 12.0.0
*
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 456ba8f1e..04cdad1e4 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -7997,7 +7997,7 @@ static int check_access(int callno, struct ast_sockaddr *addr, struct iax_ies *i
* Set authmethods to the last known authmethod used by the system
* Set a fake secret, it's not looked at, just required to attempt authentication.
* Set authrej so the AUTHREP is rejected without even looking at its contents */
- iaxs[callno]->authmethods = last_authmethod ? last_authmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+ iaxs[callno]->authmethods = last_authmethod ? last_authmethod : IAX_AUTH_MD5;
ast_string_field_set(iaxs[callno], secret, "badsecret");
iaxs[callno]->authrej = 1;
if (!ast_strlen_zero(iaxs[callno]->username)) {
@@ -9192,7 +9192,7 @@ static int registry_authrequest(int callno)
* peer does not exist, and vice-versa.
* Therefore, we use whatever the last peer used (which may vary over the
* course of a server, which should leak minimal information). */
- sentauthmethod = p ? p->authmethods : last_authmethod ? last_authmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+ sentauthmethod = p ? p->authmethods : last_authmethod ? last_authmethod : IAX_AUTH_MD5;
if (!p) {
iaxs[callno]->authmethods = sentauthmethod;
}
@@ -12870,6 +12870,9 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
}
} else if (!strcasecmp(v->name, "auth")) {
peer->authmethods = get_auth_methods(v->value);
+ if (peer->authmethods & IAX_AUTH_PLAINTEXT) {
+ ast_log(LOG_WARNING, "Auth method for peer '%s' is set to deprecated 'plaintext' at line %d of iax.conf\n", peer->name, v->lineno);
+ }
} else if (!strcasecmp(v->name, "encryption")) {
peer->encmethods |= get_encrypt_methods(v->value);
if (!peer->encmethods) {
@@ -13040,7 +13043,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
}
}
if (!peer->authmethods)
- peer->authmethods = IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT;
+ peer->authmethods = IAX_AUTH_MD5;
ast_clear_flag64(peer, IAX_DELME);
}
@@ -13189,6 +13192,9 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
}
} else if (!strcasecmp(v->name, "auth")) {
user->authmethods = get_auth_methods(v->value);
+ if (user->authmethods & IAX_AUTH_PLAINTEXT) {
+ ast_log(LOG_WARNING, "Auth method for user '%s' is set to deprecated 'plaintext' at line %d of iax.conf\n", user->name, v->lineno);
+ }
} else if (!strcasecmp(v->name, "encryption")) {
user->encmethods |= get_encrypt_methods(v->value);
if (!user->encmethods) {
@@ -13321,13 +13327,13 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
}
if (!user->authmethods) {
if (!ast_strlen_zero(user->secret)) {
- user->authmethods = IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT;
+ user->authmethods = IAX_AUTH_MD5;
if (!ast_strlen_zero(user->inkeys))
user->authmethods |= IAX_AUTH_RSA;
} else if (!ast_strlen_zero(user->inkeys)) {
user->authmethods = IAX_AUTH_RSA;
} else {
- user->authmethods = IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT;
+ user->authmethods = IAX_AUTH_MD5;
}
}
ast_clear_flag64(user, IAX_DELME);
diff --git a/include/asterisk/ari.h b/include/asterisk/ari.h
index 79b9516eb..4019e94e3 100644
--- a/include/asterisk/ari.h
+++ b/include/asterisk/ari.h
@@ -146,10 +146,11 @@ void ast_ari_invoke(struct ast_tcptls_session_instance *ser,
* for unit testing.
*
* \param uri Requested URI, relative to the docs path.
+ * \param prefix prefix that prefixes all http requests
* \param headers HTTP headers.
* \param[out] response RESTful HTTP response.
*/
-void ast_ari_get_docs(const char *uri, struct ast_variable *headers, struct ast_ari_response *response);
+void ast_ari_get_docs(const char *uri, const char *prefix, struct ast_variable *headers, struct ast_ari_response *response);
/*! \brief Abstraction for reading/writing JSON to a WebSocket */
struct ast_ari_websocket_session;
diff --git a/include/asterisk/astmm.h b/include/asterisk/astmm.h
index 83c34bed3..e129dc034 100644
--- a/include/asterisk/astmm.h
+++ b/include/asterisk/astmm.h
@@ -174,35 +174,11 @@ void __ast_mm_init_phase_2(void);
#endif
-/* Provide our own definitions */
-
-#define ast_calloc(a,b) \
- __ast_calloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_calloc_cache(a,b) \
- __ast_calloc_cache(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_malloc(a) \
- __ast_malloc(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
+/* Provide our own definition for ast_free */
#define ast_free(a) \
__ast_free(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define ast_realloc(a,b) \
- __ast_realloc(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_strdup(a) \
- __ast_strdup(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_strndup(a,b) \
- __ast_strndup(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_asprintf(a, b, c...) \
- __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, a, b, c)
-
-#define ast_vasprintf(a,b,c) \
- __ast_vasprintf(a,b,c,__FILE__, __LINE__, __PRETTY_FUNCTION__)
-
#endif /* !STANDALONE */
#else
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 14bd32c07..3293dd77b 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -2549,7 +2549,11 @@ static inline int ast_fdisset(struct pollfd *pfds, int fd, int maximum, int *sta
return 0;
}
-/*! \brief Retrieves the current T38 state of a channel */
+/*!
+ * \brief Retrieves the current T38 state of a channel
+ *
+ * \note Absolutely _NO_ channel locks should be held before calling this function.
+ */
static inline enum ast_t38_state ast_channel_get_t38_state(struct ast_channel *chan)
{
enum ast_t38_state state = T38_STATE_UNAVAILABLE;
diff --git a/include/asterisk/chanvars.h b/include/asterisk/chanvars.h
index 3693e2a3a..2040c7b65 100644
--- a/include/asterisk/chanvars.h
+++ b/include/asterisk/chanvars.h
@@ -35,7 +35,7 @@ AST_LIST_HEAD_NOLOCK(varshead, ast_var_t);
struct varshead *ast_var_list_create(void);
void ast_var_list_destroy(struct varshead *head);
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
struct ast_var_t *_ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function);
#define ast_var_assign(a,b) _ast_var_assign(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 287635a8e..4944a3af2 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -907,7 +907,7 @@ void ast_category_destroy(struct ast_category *cat);
struct ast_variable *ast_category_detach_variables(struct ast_category *cat);
void ast_category_rename(struct ast_category *cat, const char *name);
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *function, int lineno);
#define ast_variable_new(name, value, filename) _ast_variable_new(name, value, filename, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#else
diff --git a/include/asterisk/hashtab.h b/include/asterisk/hashtab.h
index 17eff7048..cfe035b28 100644
--- a/include/asterisk/hashtab.h
+++ b/include/asterisk/hashtab.h
@@ -251,7 +251,7 @@ unsigned int ast_hashtab_hash_short(const short num);
* \param hash a func ptr to do the hashing
* \param do_locking use locks to guarantee safety of iterators/insertion/deletion -- real simpleminded right now
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab * _ast_hashtab_create(int initial_buckets,
int (*compare)(const void *a, const void *b),
int (*resize)(struct ast_hashtab *),
@@ -294,7 +294,7 @@ void ast_hashtab_destroy( struct ast_hashtab *tab, void (*objdestroyfunc)(void *
* \retval 1 on success
* \retval 0 if there's a problem
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func);
#define ast_hashtab_insert_immediate(a,b) _ast_hashtab_insert_immediate(a, b, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -311,7 +311,7 @@ int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj);
* \retval 1 on success
* \retval 0 if there's a problem
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h, const char *file, int lineno, const char *func);
#define ast_hashtab_insert_immediate_bucket(a,b,c) _ast_hashtab_insert_immediate_bucket(a, b, c, __FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -324,7 +324,7 @@ int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj
* \retval 1 on success
* \retval 0 if there's a problem, or it's already there.
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func);
#define ast_hashtab_insert_safe(a,b) _ast_hashtab_insert_safe(a,b,__FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -362,7 +362,7 @@ int ast_hashtab_size( struct ast_hashtab *tab);
int ast_hashtab_capacity( struct ast_hashtab *tab);
/*! \brief Return a copy of the hash table */
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab *_ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj), const char *file, int lineno, const char *func);
#define ast_hashtab_dup(a,b) _ast_hashtab_dup(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
@@ -370,7 +370,7 @@ struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_fun
#endif
/*! \brief Gives an iterator to hastable */
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
#define ast_hashtab_start_traversal(a) _ast_hashtab_start_traversal(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
@@ -395,7 +395,7 @@ void *ast_hashtab_remove_this_object(struct ast_hashtab *tab, void *obj);
/* ------------------ */
/*! \brief Gives an iterator to hastable */
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_write_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
#define ast_hashtab_start_write_traversal(a) _ast_hashtab_start_write_traversal(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
diff --git a/include/asterisk/heap.h b/include/asterisk/heap.h
index a868ac589..728327936 100644
--- a/include/asterisk/heap.h
+++ b/include/asterisk/heap.h
@@ -97,7 +97,7 @@ typedef int (*ast_heap_cmp_fn)(void *elm1, void *elm2);
* \return An instance of a max heap
* \since 1.6.1
*/
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
struct ast_heap *_ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn,
ssize_t index_offset, const char *file, int lineno, const char *func);
#define ast_heap_create(a,b,c) _ast_heap_create(a,b,c,__FILE__,__LINE__,__PRETTY_FUNCTION__)
@@ -126,7 +126,7 @@ struct ast_heap *ast_heap_destroy(struct ast_heap *h);
* \retval non-zero failure
* \since 1.6.1
*/
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
int _ast_heap_push(struct ast_heap *h, void *elm, const char *file, int lineno, const char *func);
#define ast_heap_push(a,b) _ast_heap_push(a,b,__FILE__,__LINE__,__PRETTY_FUNCTION__)
#else
diff --git a/include/asterisk/http.h b/include/asterisk/http.h
index bb8973dce..d5f54cc65 100644
--- a/include/asterisk/http.h
+++ b/include/asterisk/http.h
@@ -101,6 +101,7 @@ struct ast_http_uri {
AST_LIST_ENTRY(ast_http_uri) entry;
const char *description;
const char *uri;
+ const char *prefix;
ast_http_callback callback;
unsigned int has_subtree:1;
/*! Structure is malloc'd */
diff --git a/include/asterisk/res_fax.h b/include/asterisk/res_fax.h
index 5119bfa6c..e88d8002f 100644
--- a/include/asterisk/res_fax.h
+++ b/include/asterisk/res_fax.h
@@ -20,16 +20,16 @@
#ifndef _ASTERISK_RES_FAX_H
#define _ASTERISK_RES_FAX_H
-#include <asterisk.h>
-#include <asterisk/lock.h>
-#include <asterisk/linkedlists.h>
-#include <asterisk/module.h>
-#include <asterisk/utils.h>
-#include <asterisk/options.h>
-#include <asterisk/frame.h>
-#include <asterisk/cli.h>
-#include <asterisk/stringfields.h>
-#include <asterisk/manager.h>
+#include "asterisk.h"
+#include "asterisk/lock.h"
+#include "asterisk/linkedlists.h"
+#include "asterisk/module.h"
+#include "asterisk/utils.h"
+#include "asterisk/options.h"
+#include "asterisk/frame.h"
+#include "asterisk/cli.h"
+#include "asterisk/stringfields.h"
+#include "asterisk/manager.h"
/*! \brief capabilities for res_fax to locate a fax technology module */
enum ast_fax_capabilities {
@@ -187,6 +187,8 @@ struct ast_fax_session_details {
int faxdetect_timeout;
/*! flags used for fax detection */
int faxdetect_flags;
+ /*! Non-zero if T.38 is negotiated */
+ int is_t38_negotiated;
};
struct ast_fax_tech;
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 2ca75a69c..eb5b4e43c 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -616,7 +616,7 @@ int ast_regex_string_to_regex_pattern(const char *regex_string, struct ast_str *
* \note The result of this function is dynamically allocated memory, and must
* be free()'d after it is no longer needed.
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
#define ast_str_create(a) _ast_str_create(a,__FILE__,__LINE__,__PRETTY_FUNCTION__)
AST_INLINE_API(
struct ast_str * attribute_malloc _ast_str_create(size_t init_len,
@@ -771,7 +771,7 @@ char *ast_str_truncate(struct ast_str *buf, ssize_t len),
/*!
* Make space in a new string (e.g. to read in data from a file)
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
AST_INLINE_API(
int _ast_str_make_space(struct ast_str **buf, size_t new_len, const char *file, int lineno, const char *function),
{
@@ -964,7 +964,7 @@ enum {
* through calling one of the other functions or macros defined in this
* file.
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int __attribute__((format(printf, 4, 0))) __ast_debug_str_helper(struct ast_str **buf, ssize_t max_len,
int append, const char *fmt, va_list ap, const char *file, int lineno, const char *func);
#define __ast_str_helper(a,b,c,d,e) __ast_debug_str_helper(a,b,c,d,e,__FILE__,__LINE__,__PRETTY_FUNCTION__)
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index c3df4779f..9789d34ee 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -533,19 +533,8 @@ long int ast_random(void);
ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file)
#endif
-/*!
- * \brief A wrapper for malloc()
- *
- * ast_malloc() is a wrapper for malloc() that will generate an Asterisk log
- * message in the case that the allocation fails.
- *
- * The argument and return value are the same as malloc()
- */
-#define ast_malloc(len) \
- _ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
AST_INLINE_API(
-void * attribute_malloc _ast_malloc(size_t len, const char *file, int lineno, const char *func),
+void * attribute_malloc __ast_malloc(size_t len, const char *file, int lineno, const char *func),
{
void *p;
@@ -559,19 +548,8 @@ void * attribute_malloc _ast_malloc(size_t len, const char *file, int lineno, co
}
)
-/*!
- * \brief A wrapper for calloc()
- *
- * ast_calloc() is a wrapper for calloc() that will generate an Asterisk log
- * message in the case that the allocation fails.
- *
- * The arguments and return value are the same as calloc()
- */
-#define ast_calloc(num, len) \
- _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
AST_INLINE_API(
-void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func),
+void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func),
{
void *p;
@@ -585,6 +563,98 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
}
)
+AST_INLINE_API(
+void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
+{
+ void *newp;
+
+ DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
+
+ if (!(newp = realloc(p, len))) {
+ MALLOC_FAILURE_MSG;
+ }
+
+ return newp;
+}
+)
+
+AST_INLINE_API(
+char * attribute_malloc __ast_strdup(const char *str, const char *file, int lineno, const char *func),
+{
+ char *newstr = NULL;
+
+ DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
+
+ if (str) {
+ if (!(newstr = strdup(str))) {
+ MALLOC_FAILURE_MSG;
+ }
+ }
+
+ return newstr;
+}
+)
+
+AST_INLINE_API(
+char * attribute_malloc __ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
+{
+ char *newstr = NULL;
+
+ DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
+
+ if (str) {
+ if (!(newstr = strndup(str, len))) {
+ MALLOC_FAILURE_MSG;
+ }
+ }
+
+ return newstr;
+}
+)
+
+int __attribute__((format(printf, 5, 6)))
+ __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...);
+
+AST_INLINE_API(
+__attribute__((format(printf, 2, 0)))
+int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, int lineno, const char *func),
+{
+ int res;
+
+ DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, -1);
+
+ if ((res = vasprintf(ret, fmt, ap)) == -1) {
+ MALLOC_FAILURE_MSG;
+ }
+
+ return res;
+}
+)
+
+#endif /* AST_DEBUG_MALLOC */
+
+/*!
+ * \brief A wrapper for malloc()
+ *
+ * ast_malloc() is a wrapper for malloc() that will generate an Asterisk log
+ * message in the case that the allocation fails.
+ *
+ * The argument and return value are the same as malloc()
+ */
+#define ast_malloc(len) \
+ __ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
+/*!
+ * \brief A wrapper for calloc()
+ *
+ * ast_calloc() is a wrapper for calloc() that will generate an Asterisk log
+ * message in the case that the allocation fails.
+ *
+ * The arguments and return value are the same as calloc()
+ */
+#define ast_calloc(num, len) \
+ __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+
/*!
* \brief A wrapper for calloc() for use in cache pools
*
@@ -596,7 +666,7 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
* The arguments and return value are the same as calloc()
*/
#define ast_calloc_cache(num, len) \
- _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief A wrapper for realloc()
@@ -607,22 +677,7 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
* The arguments and return value are the same as realloc()
*/
#define ast_realloc(p, len) \
- _ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-AST_INLINE_API(
-void * attribute_malloc _ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
-{
- void *newp;
-
- DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
-
- if (!(newp = realloc(p, len))) {
- MALLOC_FAILURE_MSG;
- }
-
- return newp;
-}
-)
+ __ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief A wrapper for strdup()
@@ -637,24 +692,7 @@ void * attribute_malloc _ast_realloc(void *p, size_t len, const char *file, int
* The argument and return value are the same as strdup()
*/
#define ast_strdup(str) \
- _ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-AST_INLINE_API(
-char * attribute_malloc _ast_strdup(const char *str, const char *file, int lineno, const char *func),
-{
- char *newstr = NULL;
-
- DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
-
- if (str) {
- if (!(newstr = strdup(str))) {
- MALLOC_FAILURE_MSG;
- }
- }
-
- return newstr;
-}
-)
+ __ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief A wrapper for strndup()
@@ -669,24 +707,7 @@ char * attribute_malloc _ast_strdup(const char *str, const char *file, int linen
* The arguments and return value are the same as strndup()
*/
#define ast_strndup(str, len) \
- _ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-AST_INLINE_API(
-char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
-{
- char *newstr = NULL;
-
- DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, NULL);
-
- if (str) {
- if (!(newstr = strndup(str, len))) {
- MALLOC_FAILURE_MSG;
- }
- }
-
- return newstr;
-}
-)
+ __ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief A wrapper for asprintf()
@@ -697,10 +718,7 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
* The arguments and return value are the same as asprintf()
*/
#define ast_asprintf(ret, fmt, ...) \
- _ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
-
-int __attribute__((format(printf, 5, 6)))
- _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...);
+ __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, (ret), (fmt), __VA_ARGS__)
/*!
* \brief A wrapper for vasprintf()
@@ -711,25 +729,7 @@ int __attribute__((format(printf, 5, 6)))
* The arguments and return value are the same as vasprintf()
*/
#define ast_vasprintf(ret, fmt, ap) \
- _ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
-
-AST_INLINE_API(
-__attribute__((format(printf, 5, 0)))
-int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
-{
- int res;
-
- DEBUG_CHAOS_RETURN(DEBUG_CHAOS_ALLOC_CHANCE, -1);
-
- if ((res = vasprintf(ret, fmt, ap)) == -1) {
- MALLOC_FAILURE_MSG;
- }
-
- return res;
-}
-)
-
-#endif /* AST_DEBUG_MALLOC */
+ __ast_vasprintf((ret), (fmt), (ap), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
\brief call __builtin_alloca to ensure we get gcc builtin semantics
diff --git a/main/astobj2.c b/main/astobj2.c
index ed91577be..5c92f263f 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -591,11 +591,7 @@ void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned in
switch (options & AO2_ALLOC_OPT_LOCK_MASK) {
case AO2_ALLOC_OPT_LOCK_MUTEX:
-#if defined(__AST_DEBUG_MALLOC)
obj_mutex = __ast_calloc(1, sizeof(*obj_mutex) + data_size, file, line, func);
-#else
- obj_mutex = ast_calloc(1, sizeof(*obj_mutex) + data_size);
-#endif
if (obj_mutex == NULL) {
return NULL;
}
@@ -604,11 +600,7 @@ void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned in
obj = (struct astobj2 *) &obj_mutex->priv_data;
break;
case AO2_ALLOC_OPT_LOCK_RWLOCK:
-#if defined(__AST_DEBUG_MALLOC)
obj_rwlock = __ast_calloc(1, sizeof(*obj_rwlock) + data_size, file, line, func);
-#else
- obj_rwlock = ast_calloc(1, sizeof(*obj_rwlock) + data_size);
-#endif
if (obj_rwlock == NULL) {
return NULL;
}
@@ -617,11 +609,7 @@ void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned in
obj = (struct astobj2 *) &obj_rwlock->priv_data;
break;
case AO2_ALLOC_OPT_LOCK_NOLOCK:
-#if defined(__AST_DEBUG_MALLOC)
obj = __ast_calloc(1, sizeof(*obj) + data_size, file, line, func);
-#else
- obj = ast_calloc(1, sizeof(*obj) + data_size);
-#endif
if (obj == NULL) {
return NULL;
}
diff --git a/main/bridge_basic.c b/main/bridge_basic.c
index 8d7fbae70..6c411fbaf 100644
--- a/main/bridge_basic.c
+++ b/main/bridge_basic.c
@@ -3088,7 +3088,9 @@ static int attach_framehook(struct attended_transfer_properties *props, struct a
ao2_ref(props, +1);
target_interface.data = props;
+ ast_channel_lock(channel);
props->target_framehook_id = ast_framehook_attach(channel, &target_interface);
+ ast_channel_unlock(channel);
if (props->target_framehook_id == -1) {
ao2_ref(props, -1);
return -1;
diff --git a/main/ccss.c b/main/ccss.c
index 307f71b96..13831b719 100644
--- a/main/ccss.c
+++ b/main/ccss.c
@@ -682,11 +682,7 @@ void ast_cc_default_config_params(struct ast_cc_config_params *params)
struct ast_cc_config_params *__ast_cc_config_params_init(const char *file, int line, const char *function)
{
-#if defined(__AST_DEBUG_MALLOC)
struct ast_cc_config_params *params = __ast_malloc(sizeof(*params), file, line, function);
-#else
- struct ast_cc_config_params *params = ast_malloc(sizeof(*params));
-#endif
if (!params) {
return NULL;
diff --git a/main/chanvars.c b/main/chanvars.c
index dc97df773..d7922522c 100644
--- a/main/chanvars.c
+++ b/main/chanvars.c
@@ -35,7 +35,7 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/strings.h"
#include "asterisk/utils.h"
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
struct ast_var_t *_ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function)
#else
struct ast_var_t *ast_var_assign(const char *name, const char *value)
@@ -45,7 +45,7 @@ struct ast_var_t *ast_var_assign(const char *name, const char *value)
int name_len = strlen(name) + 1;
int value_len = strlen(value) + 1;
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
if (!(var = __ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char), file, lineno, function))) {
#else
if (!(var = ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char)))) {
diff --git a/main/config.c b/main/config.c
index 599270384..6162149b1 100644
--- a/main/config.c
+++ b/main/config.c
@@ -283,7 +283,7 @@ struct ast_config_include {
static void ast_variable_destroy(struct ast_variable *doomed);
static void ast_includes_destroy(struct ast_config_include *incls);
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *func, int lineno)
#else
struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename)
@@ -300,7 +300,7 @@ struct ast_variable *ast_variable_new(const char *name, const char *value, const
}
if (
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
(variable = __ast_calloc(1, fn_len + name_len + val_len + sizeof(*variable), file, lineno, func))
#else
(variable = ast_calloc(1, fn_len + name_len + val_len + sizeof(*variable)))
diff --git a/main/datastore.c b/main/datastore.c
index c2bba4190..e536d601b 100644
--- a/main/datastore.c
+++ b/main/datastore.c
@@ -47,15 +47,9 @@ struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *inf
return NULL;
}
-#if defined(__AST_DEBUG_MALLOC)
if (!(datastore = __ast_calloc(1, sizeof(*datastore), file, line, function))) {
return NULL;
}
-#else
- if (!(datastore = ast_calloc(1, sizeof(*datastore)))) {
- return NULL;
- }
-#endif
datastore->info = info;
diff --git a/main/hashtab.c b/main/hashtab.c
index 5d54fb7aa..3719c2ad4 100644
--- a/main/hashtab.c
+++ b/main/hashtab.c
@@ -44,7 +44,7 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/hashtab.h"
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
static void _ast_hashtab_resize(struct ast_hashtab *tab, const char *file, int lineno, const char *func);
#define ast_hashtab_resize(a) _ast_hashtab_resize(a,__FILE__, __LINE__, __PRETTY_FUNCTION__)
#else
@@ -219,7 +219,7 @@ unsigned int ast_hashtab_hash_short(const short x)
}
struct ast_hashtab *
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
_ast_hashtab_create
#else
ast_hashtab_create
@@ -230,14 +230,14 @@ ast_hashtab_create
int (*newsize)(struct ast_hashtab *tab),
unsigned int (*hash)(const void *obj),
int do_locking
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
, const char *file, int lineno, const char *function
#endif
)
{
struct ast_hashtab *ht;
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
if (!(ht = __ast_calloc(1, sizeof(*ht), file, lineno, function)))
#else
if (!(ht = ast_calloc(1, sizeof(*ht))))
@@ -247,7 +247,7 @@ ast_hashtab_create
while (!ast_is_prime(initial_buckets)) /* make sure this is prime */
initial_buckets++;
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
if (!(ht->array = __ast_calloc(initial_buckets, sizeof(*(ht->array)), file, lineno, function))) {
#else
if (!(ht->array = ast_calloc(initial_buckets, sizeof(*(ht->array))))) {
@@ -275,7 +275,7 @@ ast_hashtab_create
return ht;
}
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab *_ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj), const char *file, int lineno, const char *func)
#else
struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_func)(const void *obj))
@@ -288,7 +288,7 @@ struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_fun
return NULL;
if (!(ht->array =
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(tab->hash_tab_size, sizeof(*(ht->array)), file, lineno, func)
#else
ast_calloc(tab->hash_tab_size, sizeof(*(ht->array)))
@@ -316,7 +316,7 @@ struct ast_hashtab *ast_hashtab_dup(struct ast_hashtab *tab, void *(*obj_dup_fun
while (b) {
void *newobj = (*obj_dup_func)(b->object);
if (newobj)
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
_ast_hashtab_insert_immediate_bucket(ht, newobj, i, file, lineno, func);
#else
ast_hashtab_insert_immediate_bucket(ht, newobj, i);
@@ -427,7 +427,7 @@ void ast_hashtab_destroy(struct ast_hashtab *tab, void (*objdestroyfunc)(void *o
}
}
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func)
#else
int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj)
@@ -444,7 +444,7 @@ int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj)
h = (*tab->hash)(obj) % tab->hash_tab_size;
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
res = _ast_hashtab_insert_immediate_bucket(tab, obj, h, file, lineno, func);
#else
res = ast_hashtab_insert_immediate_bucket(tab, obj, h);
@@ -456,7 +456,7 @@ int ast_hashtab_insert_immediate(struct ast_hashtab *tab, const void *obj)
return res;
}
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h, const char *file, int lineno, const char *func)
#else
int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj, unsigned int h)
@@ -475,7 +475,7 @@ int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj
tab->largest_bucket_size = c + 1;
if (!(b =
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, sizeof(*b), file, lineno, func)
#else
ast_calloc(1, sizeof(*b))
@@ -498,7 +498,7 @@ int ast_hashtab_insert_immediate_bucket(struct ast_hashtab *tab, const void *obj
return 1;
}
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int _ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj, const char *file, int lineno, const char *func)
#else
int ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj)
@@ -514,7 +514,7 @@ int ast_hashtab_insert_safe(struct ast_hashtab *tab, const void *obj)
ast_rwlock_wrlock(&tab->lock);
if (!ast_hashtab_lookup_bucket(tab, obj, &bucket)) {
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int ret2 = _ast_hashtab_insert_immediate_bucket(tab, obj, bucket, file, lineno, func);
#else
int ret2 = ast_hashtab_insert_immediate_bucket(tab, obj, bucket);
@@ -637,7 +637,7 @@ int ast_hashtab_capacity( struct ast_hashtab *tab)
/* the insert operation calls this, and is wrlock'd when it does. */
/* if you want to call it, you should set the wrlock yourself */
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
static void _ast_hashtab_resize(struct ast_hashtab *tab, const char *file, int lineno, const char *func)
#else
static void ast_hashtab_resize(struct ast_hashtab *tab)
@@ -660,7 +660,7 @@ static void ast_hashtab_resize(struct ast_hashtab *tab)
}
free(tab->array);
if (!(tab->array =
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(newsize, sizeof(*(tab->array)), file, lineno, func)
#else
ast_calloc(newsize, sizeof(*(tab->array)))
@@ -691,7 +691,7 @@ static void ast_hashtab_resize(struct ast_hashtab *tab)
}
}
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func)
#else
struct ast_hashtab_iter *ast_hashtab_start_traversal(struct ast_hashtab *tab)
@@ -701,7 +701,7 @@ struct ast_hashtab_iter *ast_hashtab_start_traversal(struct ast_hashtab *tab)
struct ast_hashtab_iter *it;
if (!(it =
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, sizeof(*it), file, lineno, func)
#else
ast_calloc(1, sizeof(*it))
@@ -718,7 +718,7 @@ struct ast_hashtab_iter *ast_hashtab_start_traversal(struct ast_hashtab *tab)
}
/* use this function to get a write lock */
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
struct ast_hashtab_iter *_ast_hashtab_start_write_traversal(struct ast_hashtab *tab, const char *file, int lineno, const char *func)
#else
struct ast_hashtab_iter *ast_hashtab_start_write_traversal(struct ast_hashtab *tab)
@@ -728,7 +728,7 @@ struct ast_hashtab_iter *ast_hashtab_start_write_traversal(struct ast_hashtab *t
struct ast_hashtab_iter *it;
if (!(it =
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, sizeof(*it), file, lineno, func)
#else
ast_calloc(1, sizeof(*it))
diff --git a/main/heap.c b/main/heap.c
index 29f069b30..73280fedc 100644
--- a/main/heap.c
+++ b/main/heap.c
@@ -111,7 +111,7 @@ int ast_heap_verify(struct ast_heap *h)
return 0;
}
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
struct ast_heap *_ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_fn,
ssize_t index_offset, const char *file, int lineno, const char *func)
#else
@@ -131,7 +131,7 @@ struct ast_heap *ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_f
}
if (!(h =
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, sizeof(*h), file, lineno, func)
#else
ast_calloc(1, sizeof(*h))
@@ -145,7 +145,7 @@ struct ast_heap *ast_heap_create(unsigned int init_height, ast_heap_cmp_fn cmp_f
h->avail_len = (1 << init_height) - 1;
if (!(h->heap =
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
__ast_calloc(1, h->avail_len * sizeof(void *), file, lineno, func)
#else
ast_calloc(1, h->avail_len * sizeof(void *))
@@ -176,7 +176,7 @@ struct ast_heap *ast_heap_destroy(struct ast_heap *h)
* \brief Add a row of additional storage for the heap.
*/
static int grow_heap(struct ast_heap *h
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
, const char *file, int lineno, const char *func
#endif
)
@@ -184,7 +184,7 @@ static int grow_heap(struct ast_heap *h
void **new_heap;
size_t new_len = h->avail_len * 2 + 1;
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
new_heap = __ast_realloc(h->heap, new_len * sizeof(void *), file, lineno, func);
#else
new_heap = ast_realloc(h->heap, new_len * sizeof(void *));
@@ -244,14 +244,14 @@ static int bubble_up(struct ast_heap *h, int i)
return i;
}
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
int _ast_heap_push(struct ast_heap *h, void *elm, const char *file, int lineno, const char *func)
#else
int ast_heap_push(struct ast_heap *h, void *elm)
#endif
{
if (h->cur_len == h->avail_len && grow_heap(h
-#ifdef MALLOC_DEBUG
+#ifdef __AST_DEBUG_MALLOC
, file, lineno, func
#endif
)) {
diff --git a/main/http.c b/main/http.c
index bc23e6e56..da564da20 100644
--- a/main/http.c
+++ b/main/http.c
@@ -671,6 +671,8 @@ int ast_http_uri_link(struct ast_http_uri *urih)
AST_RWLIST_WRLOCK(&uris);
+ urih->prefix = prefix;
+
if ( AST_RWLIST_EMPTY(&uris) || strlen(AST_RWLIST_FIRST(&uris)->uri) <= len ) {
AST_RWLIST_INSERT_HEAD(&uris, urih, entry);
AST_RWLIST_UNLOCK(&uris);
diff --git a/main/stringfields.c b/main/stringfields.c
index e82b49b98..25c584462 100644
--- a/main/stringfields.c
+++ b/main/stringfields.c
@@ -60,11 +60,7 @@ static size_t optimal_alloc_size(size_t size)
static void *calloc_wrapper(unsigned int num_structs, size_t struct_size,
const char *file, int lineno, const char *func)
{
-#if defined(__AST_DEBUG_MALLOC)
return __ast_calloc(num_structs, struct_size, file, lineno, func);
-#else
- return ast_calloc(num_structs, struct_size);
-#endif
}
/*! \brief add a new block to the pool.
diff --git a/main/strings.c b/main/strings.c
index b9c88dea5..e62eb9aad 100644
--- a/main/strings.c
+++ b/main/strings.c
@@ -53,7 +53,7 @@ ASTERISK_REGISTER_FILE()
* ast_str_append_va(...)
*/
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
int __ast_debug_str_helper(struct ast_str **buf, ssize_t max_len,
int append, const char *fmt, va_list ap, const char *file, int lineno, const char *function)
#else
@@ -112,7 +112,7 @@ int __ast_str_helper(struct ast_str **buf, ssize_t max_len,
}
if (
-#if (defined(MALLOC_DEBUG) && !defined(STANDALONE))
+#ifdef __AST_DEBUG_MALLOC
_ast_str_make_space(buf, need, file, lineno, function)
#else
ast_str_make_space(buf, need)
diff --git a/main/utils.c b/main/utils.c
index 1d2aa0b27..73b1c8703 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -2369,7 +2369,7 @@ int ast_parse_digest(const char *digest, struct ast_http_digest *d, int request,
}
#ifndef __AST_DEBUG_MALLOC
-int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...)
+int __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...)
{
int res;
va_list ap;
diff --git a/res/res_ari.c b/res/res_ari.c
index 0cc1ee7b0..eb15a88b8 100644
--- a/res/res_ari.c
+++ b/res/res_ari.c
@@ -579,7 +579,7 @@ void ast_ari_invoke(struct ast_tcptls_session_instance *ser,
}
}
-void ast_ari_get_docs(const char *uri, struct ast_variable *headers,
+void ast_ari_get_docs(const char *uri, const char *prefix, struct ast_variable *headers,
struct ast_ari_response *response)
{
RAII_VAR(struct ast_str *, absolute_path_builder, NULL, ast_free);
@@ -685,9 +685,15 @@ void ast_ari_get_docs(const char *uri, struct ast_variable *headers,
}
}
if (host != NULL) {
- ast_json_object_set(
- obj, "basePath",
- ast_json_stringf("http://%s/ari", host->value));
+ if (prefix != NULL && strlen(prefix) > 0) {
+ ast_json_object_set(
+ obj, "basePath",
+ ast_json_stringf("http://%s%s/ari", host->value,prefix));
+ } else {
+ ast_json_object_set(
+ obj, "basePath",
+ ast_json_stringf("http://%s/ari", host->value));
+ }
} else {
/* Without the host, we don't have the basePath */
ast_json_object_del(obj, "basePath");
@@ -969,7 +975,7 @@ static int ast_ari_callback(struct ast_tcptls_session_instance *ser,
ast_ari_response_error(&response, 405, "Method Not Allowed", "Unsupported method");
} else {
/* Skip the api-docs prefix */
- ast_ari_get_docs(strchr(uri, '/') + 1, headers, &response);
+ ast_ari_get_docs(strchr(uri, '/') + 1, urih->prefix, headers, &response);
}
} else {
/* Other RESTful resources */
diff --git a/res/res_fax.c b/res/res_fax.c
index c301aff31..a2e179323 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -641,6 +641,7 @@ static void fixup_callback(void *data, struct ast_channel *old_chan, struct ast_
struct ast_fax_session_details *new_details = find_or_create_details(new_chan);
ast_framehook_detach(old_chan, old_details->gateway_id);
+ new_details->is_t38_negotiated = old_details->is_t38_negotiated;
fax_gateway_attach(new_chan, new_details);
ao2_cleanup(new_details);
}
@@ -1439,6 +1440,7 @@ static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_de
static void set_channel_variables(struct ast_channel *chan, struct ast_fax_session_details *details)
{
char buf[10];
+
pbx_builtin_setvar_helper(chan, "FAXSTATUS", S_OR(details->result, NULL));
pbx_builtin_setvar_helper(chan, "FAXERROR", S_OR(details->error, NULL));
pbx_builtin_setvar_helper(chan, "FAXSTATUSSTRING", S_OR(details->resultstr, NULL));
@@ -1447,7 +1449,7 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi
pbx_builtin_setvar_helper(chan, "FAXBITRATE", S_OR(details->transfer_rate, NULL));
pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", S_OR(details->resolution, NULL));
- if (ast_channel_get_t38_state(chan) == T38_STATE_NEGOTIATED) {
+ if (details->is_t38_negotiated) {
pbx_builtin_setvar_helper(chan, "FAXMODE", "T38");
} else {
pbx_builtin_setvar_helper(chan, "FAXMODE", "audio");
@@ -1656,6 +1658,7 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
ast_string_field_set(details, result, "");
ast_string_field_set(details, resultstr, "");
ast_string_field_set(details, error, "");
+ details->is_t38_negotiated = t38negotiated;
set_channel_variables(chan, details);
if (fax->tech->start_session(fax) < 0) {
@@ -1706,12 +1709,18 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
* do T.38 as well
*/
t38_parameters_fax_to_ast(&t38_parameters, &details->our_t38_parameters);
- t38_parameters.request_response = (details->caps & AST_FAX_TECH_T38) ? AST_T38_NEGOTIATED : AST_T38_REFUSED;
+ if (details->caps & AST_FAX_TECH_T38) {
+ details->is_t38_negotiated = 1;
+ t38_parameters.request_response = AST_T38_NEGOTIATED;
+ } else {
+ t38_parameters.request_response = AST_T38_REFUSED;
+ }
ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, &t38_parameters, sizeof(t38_parameters));
break;
case AST_T38_NEGOTIATED:
t38_parameters_ast_to_fax(&details->their_t38_parameters, parameters);
t38negotiated = 1;
+ details->is_t38_negotiated = 1;
break;
default:
break;
@@ -2880,11 +2889,17 @@ static struct fax_gateway *fax_gateway_new(struct ast_channel *chan, struct ast_
return gateway;
}
-/*! \brief Create a fax session and start T.30<->T.38 gateway mode
+/*!
+ * \brief Create a fax session and start T.30<->T.38 gateway mode
+ *
* \param gateway a fax gateway object
* \param details fax session details
* \param chan active channel
- * \return 0 on error 1 on success*/
+ *
+ * \pre chan is locked on entry
+ *
+ * \return 0 on error 1 on success
+ */
static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session_details *details, struct ast_channel *chan)
{
struct ast_fax_session *s;
@@ -2896,6 +2911,7 @@ static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session
ast_string_field_set(details, result, "FAILED");
ast_string_field_set(details, resultstr, "error starting gateway session");
ast_string_field_set(details, error, "INIT_ERROR");
+ details->is_t38_negotiated = 0;
set_channel_variables(chan, details);
report_fax_status(chan, details, "No Available Resource");
ast_log(LOG_ERROR, "Can't create a FAX session, gateway attempt failed.\n");
@@ -2916,6 +2932,7 @@ static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session
ast_string_field_set(details, result, "FAILED");
ast_string_field_set(details, resultstr, "error starting gateway session");
ast_string_field_set(details, error, "INIT_ERROR");
+ details->is_t38_negotiated = 0;
set_channel_variables(chan, details);
return -1;
}
@@ -2928,6 +2945,7 @@ static int fax_gateway_start(struct fax_gateway *gateway, struct ast_fax_session
return 0;
}
+/*! \pre chan is locked on entry */
static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, struct ast_channel *chan, struct ast_frame *f)
{
struct ast_frame *fp;
@@ -2960,12 +2978,14 @@ static struct ast_frame *fax_gateway_request_t38(struct fax_gateway *gateway, st
gateway->t38_state = T38_STATE_NEGOTIATING;
gateway->timeout_start = ast_tvnow();
+ details->is_t38_negotiated = 0;
details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
ast_debug(1, "requesting T.38 for gateway session for %s\n", ast_channel_name(chan));
return fp;
}
+/*! \pre chan is locked on entry */
static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *active, struct ast_frame *f)
{
struct ast_channel *other = (active == chan) ? peer : chan;
@@ -2981,8 +3001,14 @@ static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, str
}
if (gateway->detected_v21) {
+ enum ast_t38_state state_other;
+
destroy_v21_sessions(gateway);
- if (ast_channel_get_t38_state(other) == T38_STATE_UNKNOWN) {
+
+ ast_channel_unlock(chan);
+ state_other = ast_channel_get_t38_state(other);
+ ast_channel_lock(chan);
+ if (state_other == T38_STATE_UNKNOWN) {
ast_debug(1, "detected v21 preamble from %s\n", ast_channel_name(active));
return fax_gateway_request_t38(gateway, chan, f);
} else {
@@ -2993,21 +3019,29 @@ static struct ast_frame *fax_gateway_detect_v21(struct fax_gateway *gateway, str
return f;
}
-static int fax_gateway_indicate_t38(struct ast_channel *chan, struct ast_channel *active, struct ast_control_t38_parameters *control_params)
+/*! \pre chan is locked on entry */
+static void fax_gateway_indicate_t38(struct ast_channel *chan, struct ast_channel *active, struct ast_control_t38_parameters *control_params)
{
if (active == chan) {
- return ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
+ ast_channel_unlock(chan);
+ ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
+ ast_channel_lock(chan);
} else {
- return ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
+ ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
}
}
-/*! \brief T38 Gateway Negotiate t38 parameters
+/*!
+ * \brief T38 Gateway Negotiate t38 parameters
+ *
* \param gateway gateway object
* \param chan channel running the gateway
* \param peer channel im bridged too
* \param active channel the frame originated on
* \param f the control frame to process
+ *
+ * \pre chan is locked on entry
+ *
* \return processed control frame or null frame
*/
static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, struct ast_channel *chan, struct ast_channel *peer, struct ast_channel *active, struct ast_frame *f)
@@ -3015,6 +3049,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
struct ast_control_t38_parameters *control_params = f->data.ptr;
struct ast_channel *other = (active == chan) ? peer : chan;
struct ast_fax_session_details *details;
+ enum ast_t38_state state_other;
if (f->datalen != sizeof(struct ast_control_t38_parameters)) {
/* invalaid AST_CONTROL_T38_PARAMETERS frame, we can't
@@ -3037,9 +3072,11 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
}
if (control_params->request_response == AST_T38_REQUEST_NEGOTIATE) {
- enum ast_t38_state state = ast_channel_get_t38_state(other);
+ ast_channel_unlock(chan);
+ state_other = ast_channel_get_t38_state(other);
+ ast_channel_lock(chan);
- if (state == T38_STATE_UNKNOWN) {
+ if (state_other == T38_STATE_UNKNOWN) {
/* we detected a request to negotiate T.38 and the
* other channel appears to support T.38, we'll pass
* the request through and only step in if the other
@@ -3048,10 +3085,11 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
gateway->t38_state = T38_STATE_UNKNOWN;
gateway->timeout_start = ast_tvnow();
+ details->is_t38_negotiated = 0;
details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
ao2_ref(details, -1);
return f;
- } else if (state == T38_STATE_UNAVAILABLE || state == T38_STATE_REJECTED) {
+ } else if (state_other == T38_STATE_UNAVAILABLE || state_other == T38_STATE_REJECTED) {
/* the other channel does not support T.38, we need to
* step in here */
ast_debug(1, "%s is attempting to negotiate T.38 but %s does not support it\n", ast_channel_name(active), ast_channel_name(other));
@@ -3063,12 +3101,14 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
if (fax_gateway_start(gateway, details, chan)) {
ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
gateway->t38_state = T38_STATE_REJECTED;
+ details->is_t38_negotiated = 0;
control_params->request_response = AST_T38_REFUSED;
ast_framehook_detach(chan, details->gateway_id);
details->gateway_id = -1;
} else {
gateway->t38_state = T38_STATE_NEGOTIATED;
+ details->is_t38_negotiated = chan == active;
control_params->request_response = AST_T38_NEGOTIATED;
report_fax_status(chan, details, "T.38 Negotiated");
}
@@ -3086,6 +3126,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
t38_parameters_ast_to_fax(&details->their_t38_parameters, control_params);
gateway->t38_state = T38_STATE_UNKNOWN;
gateway->timeout_start = ast_tvnow();
+ details->is_t38_negotiated = 0;
details->gateway_timeout = FAX_GATEWAY_TIMEOUT;
ast_debug(1, "%s is attempting to negotiate T.38 after we already sent a negotiation request based on v21 preamble detection\n", ast_channel_name(active));
@@ -3108,6 +3149,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
ast_string_field_set(details, result, "SUCCESS");
ast_string_field_set(details, resultstr, "no gateway necessary");
ast_string_field_set(details, error, "NATIVE_T38");
+ details->is_t38_negotiated = 1;
set_channel_variables(chan, details);
ast_debug(1, "%s is attempting to negotiate T.38 after we already negotiated T.38 with %s, disabling the gateway\n", ast_channel_name(active), ast_channel_name(other));
@@ -3122,11 +3164,15 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
&& control_params->request_response == AST_T38_REFUSED) {
ast_debug(1, "unable to negotiate T.38 on %s for fax gateway\n", ast_channel_name(active));
+ details->is_t38_negotiated = 0;
/* our request to negotiate T.38 was refused, if the other
* channel supports T.38, they might still reinvite and save
* the day. Otherwise disable the gateway. */
- if (ast_channel_get_t38_state(other) == T38_STATE_UNKNOWN) {
+ ast_channel_unlock(chan);
+ state_other = ast_channel_get_t38_state(other);
+ ast_channel_lock(chan);
+ if (state_other == T38_STATE_UNKNOWN) {
gateway->t38_state = T38_STATE_UNAVAILABLE;
} else {
ast_framehook_detach(chan, details->gateway_id);
@@ -3150,11 +3196,13 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
if (fax_gateway_start(gateway, details, chan)) {
ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
gateway->t38_state = T38_STATE_NEGOTIATING;
+ details->is_t38_negotiated = 0;
control_params->request_response = AST_T38_REQUEST_TERMINATE;
fax_gateway_indicate_t38(chan, active, control_params);
} else {
gateway->t38_state = T38_STATE_NEGOTIATED;
+ details->is_t38_negotiated = chan == active;
report_fax_status(chan, details, "T.38 Negotiated");
}
@@ -3170,14 +3218,16 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
t38_parameters_fax_to_ast(control_params, &details->our_t38_parameters);
if (fax_gateway_start(gateway, details, chan)) {
- ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(active), ast_channel_name(other));
+ ast_log(LOG_ERROR, "error starting T.38 gateway for T.38 channel %s and G.711 channel %s\n", ast_channel_name(other), ast_channel_name(active));
gateway->t38_state = T38_STATE_REJECTED;
+ details->is_t38_negotiated = 0;
control_params->request_response = AST_T38_REFUSED;
ast_framehook_detach(chan, details->gateway_id);
details->gateway_id = -1;
} else {
gateway->t38_state = T38_STATE_NEGOTIATED;
+ details->is_t38_negotiated = chan == other;
control_params->request_response = AST_T38_NEGOTIATED;
}
@@ -3193,6 +3243,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
details->gateway_id = -1;
gateway->t38_state = T38_STATE_REJECTED;
+ details->is_t38_negotiated = 0;
control_params->request_response = AST_T38_TERMINATED;
fax_gateway_indicate_t38(chan, active, control_params);
@@ -3208,6 +3259,7 @@ static struct ast_frame *fax_gateway_detect_t38(struct fax_gateway *gateway, str
ast_string_field_set(details, result, "SUCCESS");
ast_string_field_set(details, resultstr, "no gateway necessary");
ast_string_field_set(details, error, "NATIVE_T38");
+ details->is_t38_negotiated = 1;
set_channel_variables(chan, details);
ao2_ref(details, -1);
@@ -3250,7 +3302,8 @@ static void fax_gateway_framehook_destroy(void *data)
ao2_ref(gateway, -1);
}
-/*! \brief T.30<->T.38 gateway framehook.
+/*!
+ * \brief T.30<->T.38 gateway framehook.
*
* Intercept packets on bridged channels and determine if a T.38 gateway is
* required. If a gateway is required, start a gateway and handle T.38
@@ -3261,6 +3314,8 @@ static void fax_gateway_framehook_destroy(void *data)
* \param event framehook event
* \param data framehook data (struct fax_gateway *)
*
+ * \pre chan is locked on entry
+ *
* \return processed frame or NULL when f is NULL or a null frame
*/
static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data)
@@ -3323,8 +3378,16 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
}
if (!gateway->bridged) {
+ enum ast_t38_state state_chan;
+ enum ast_t38_state state_peer;
+
+ ast_channel_unlock(chan);
+ state_chan = ast_channel_get_t38_state(chan);
+ state_peer = ast_channel_get_t38_state(peer);
+ ast_channel_lock(chan);
+
/* don't start a gateway if neither channel can handle T.38 */
- if (ast_channel_get_t38_state(chan) == T38_STATE_UNAVAILABLE && ast_channel_get_t38_state(peer) == T38_STATE_UNAVAILABLE) {
+ if (state_chan == T38_STATE_UNAVAILABLE && state_peer == T38_STATE_UNAVAILABLE) {
ast_debug(1, "not starting gateway for %s and %s; neither channel supports T.38\n", ast_channel_name(chan), ast_channel_name(peer));
ast_framehook_detach(chan, gateway->framehook);
details->gateway_id = -1;
@@ -3332,6 +3395,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
ast_string_field_set(details, result, "FAILED");
ast_string_field_set(details, resultstr, "neither channel supports T.38");
ast_string_field_set(details, error, "T38_NEG_ERROR");
+ details->is_t38_negotiated = 0;
set_channel_variables(chan, details);
return f;
}
@@ -3376,6 +3440,7 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
ast_string_field_set(details, result, "FAILED");
ast_string_field_build(details, resultstr, "no fax activity after %d ms", details->gateway_timeout);
ast_string_field_set(details, error, "TIMEOUT");
+ details->is_t38_negotiated = 0;
set_channel_variables(chan, details);
return f;
}
@@ -3491,9 +3556,9 @@ static int fax_gateway_attach(struct ast_channel *chan, struct ast_fax_session_d
.disable_inheritance = 1, /* Masquerade inheritance is handled through the datastore fixup */
};
- if (global_fax_debug) {
- details->option.debug = AST_FAX_OPTFLAG_TRUE;
- }
+ if (global_fax_debug) {
+ details->option.debug = AST_FAX_OPTFLAG_TRUE;
+ }
ast_string_field_set(details, result, "SUCCESS");
ast_string_field_set(details, resultstr, "gateway operation started successfully");
@@ -3506,6 +3571,7 @@ static int fax_gateway_attach(struct ast_channel *chan, struct ast_fax_session_d
ast_string_field_set(details, result, "FAILED");
ast_string_field_set(details, resultstr, "error initializing gateway session");
ast_string_field_set(details, error, "INIT_ERROR");
+ details->is_t38_negotiated = 0;
set_channel_variables(chan, details);
report_fax_status(chan, details, "No Available Resource");
return -1;
@@ -3521,6 +3587,7 @@ static int fax_gateway_attach(struct ast_channel *chan, struct ast_fax_session_d
ast_string_field_set(details, result, "FAILED");
ast_string_field_set(details, resultstr, "error attaching gateway to channel");
ast_string_field_set(details, error, "INIT_ERROR");
+ details->is_t38_negotiated = 0;
set_channel_variables(chan, details);
return -1;
}
@@ -4509,7 +4576,9 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
ast_log(LOG_WARNING, "Attempt to attach a T.38 gateway on channel (%s) with gateway already running.\n", ast_channel_name(chan));
}
} else if (ast_false(val)) {
+ ast_channel_lock(chan);
ast_framehook_detach(chan, details->gateway_id);
+ ast_channel_unlock(chan);
details->gateway_id = -1;
} else {
ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
@@ -4561,7 +4630,9 @@ static int acf_faxopt_write(struct ast_channel *chan, const char *cmd, char *dat
ast_log(LOG_WARNING, "Attempt to attach a FAX detect on channel (%s) with FAX detect already running.\n", ast_channel_name(chan));
}
} else if (ast_false(val)) {
+ ast_channel_lock(chan);
ast_framehook_detach(chan, details->faxdetect_id);
+ ast_channel_unlock(chan);
details->faxdetect_id = -1;
} else {
ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
diff --git a/res/res_odbc_transaction.c b/res/res_odbc_transaction.c
index 569fcb267..dd6ee30e5 100644
--- a/res/res_odbc_transaction.c
+++ b/res/res_odbc_transaction.c
@@ -26,6 +26,7 @@
#include "asterisk/module.h"
/*** MODULEINFO
+ <depend>generic_odbc</depend>
<support_level>core</support_level>
***/
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 3bced1180..23aa522ce 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -963,7 +963,9 @@ static int dtls_handler(const struct aco_option *opt,
{
struct ast_sip_endpoint *endpoint = obj;
char *name = ast_strdupa(var->name);
- char *front, *back, *buf = name;
+ char *front = NULL;
+ char *back = NULL;
+ char *buf = name;
/* strip out underscores in the name */
front = strtok_r(buf, "_", &back);
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 1043a1e24..19367bf32 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -607,7 +607,10 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
ao2_ref(refer->progress, +1);
/* If we can't attach a frame hook for whatever reason send a notification of success immediately */
- if ((refer->progress->framehook = ast_framehook_attach(chan, &hook)) < 0) {
+ ast_channel_lock(chan);
+ refer->progress->framehook = ast_framehook_attach(chan, &hook);
+ ast_channel_unlock(chan);
+ if (refer->progress->framehook < 0) {
struct refer_progress_notification *notification = refer_progress_notification_alloc(refer->progress, 200,
PJSIP_EVSUB_STATE_TERMINATED);
@@ -638,7 +641,9 @@ static void refer_blind_callback(struct ast_channel *chan, struct transfer_chann
refer_progress_notify(notification);
}
+ ast_channel_lock(chan);
ast_framehook_detach(chan, refer->progress->framehook);
+ ast_channel_unlock(chan);
ao2_cleanup(refer->progress);
}
diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 76720acee..150336a08 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -501,25 +501,27 @@ static void t38_attach_framehook(struct ast_sip_session *session)
return;
}
- /* Skip attaching the framehook if the T.38 datastore already exists for the channel */
ast_channel_lock(session->channel);
- if ((datastore = ast_channel_datastore_find(session->channel, &t38_framehook_datastore, NULL))) {
+
+ /* Skip attaching the framehook if the T.38 datastore already exists for the channel */
+ datastore = ast_channel_datastore_find(session->channel, &t38_framehook_datastore,
+ NULL);
+ if (datastore) {
ast_channel_unlock(session->channel);
return;
}
- ast_channel_unlock(session->channel);
framehook_id = ast_framehook_attach(session->channel, &hook);
if (framehook_id < 0) {
- ast_log(LOG_WARNING, "Could not attach T.38 Frame hook to channel, T.38 will be unavailable on '%s'\n",
+ ast_log(LOG_WARNING, "Could not attach T.38 Frame hook, T.38 will be unavailable on '%s'\n",
ast_channel_name(session->channel));
+ ast_channel_unlock(session->channel);
return;
}
- ast_channel_lock(session->channel);
datastore = ast_datastore_alloc(&t38_framehook_datastore, NULL);
if (!datastore) {
- ast_log(LOG_ERROR, "Could not attach T.38 Frame hook to channel, T.38 will be unavailable on '%s'\n",
+ ast_log(LOG_ERROR, "Could not alloc T.38 Frame hook datastore, T.38 will be unavailable on '%s'\n",
ast_channel_name(session->channel));
ast_framehook_detach(session->channel, framehook_id);
ast_channel_unlock(session->channel);
diff --git a/res/res_rtp_multicast.c b/res/res_rtp_multicast.c
index 5a7b26b6a..fce492659 100644
--- a/res/res_rtp_multicast.c
+++ b/res/res_rtp_multicast.c
@@ -143,7 +143,7 @@ struct ast_multicast_rtp_options *ast_multicast_rtp_create_options(const char *t
mcast_options = ast_calloc(1, sizeof(*mcast_options)
+ strlen(type)
- + strlen(options) + 2);
+ + strlen(S_OR(options, "")) + 2);
if (!mcast_options) {
return NULL;
}
@@ -155,8 +155,9 @@ struct ast_multicast_rtp_options *ast_multicast_rtp_create_options(const char *t
mcast_options->type = pos;
pos += strlen(type) + 1;
- /* Safe */
- strcpy(pos, options);
+ if (!ast_strlen_zero(options)) {
+ strcpy(pos, options); /* Safe */
+ }
mcast_options->options = pos;
if (ast_app_parse_options(multicast_rtp_options, &mcast_options->opts,
diff --git a/tests/test_ari.c b/tests/test_ari.c
index efec810e1..da889ec45 100644
--- a/tests/test_ari.c
+++ b/tests/test_ari.c
@@ -218,7 +218,7 @@ AST_TEST_DEFINE(get_docs)
response = response_alloc();
headers = ast_variable_new("Host", "stasis.asterisk.org", __FILE__);
- ast_ari_get_docs("resources.json", headers, response);
+ ast_ari_get_docs("resources.json", "", headers, response);
ast_test_validate(test, 200 == response->response_code);
/* basePath should be relative to the Host header */
@@ -248,7 +248,7 @@ AST_TEST_DEFINE(get_docs_nohost)
}
response = response_alloc();
- ast_ari_get_docs("resources.json", headers, response);
+ ast_ari_get_docs("resources.json", "", headers, response);
ast_test_validate(test, 200 == response->response_code);
/* basePath should be relative to the Host header */
@@ -275,7 +275,7 @@ AST_TEST_DEFINE(get_docs_notfound)
}
response = response_alloc();
- ast_ari_get_docs("i-am-not-a-resource.json", headers, response);
+ ast_ari_get_docs("i-am-not-a-resource.json", "", headers, response);
ast_test_validate(test, 404 == response->response_code);
return AST_TEST_PASS;
@@ -298,7 +298,7 @@ AST_TEST_DEFINE(get_docs_hackerz)
}
response = response_alloc();
- ast_ari_get_docs("../../../../sbin/asterisk", headers, response);
+ ast_ari_get_docs("../../../../sbin/asterisk", "", headers, response);
ast_test_validate(test, 404 == response->response_code);
return AST_TEST_PASS;
diff --git a/third-party/pjproject/patches/0003-r5403-pjsip_IPV6_V6ONLY.patch b/third-party/pjproject/patches/0003-r5403-pjsip_IPV6_V6ONLY.patch
new file mode 100644
index 000000000..b324b53f4
--- /dev/null
+++ b/third-party/pjproject/patches/0003-r5403-pjsip_IPV6_V6ONLY.patch
@@ -0,0 +1,13 @@
+--- a/pjlib/src/pj/sock_bsd.c
++++ b/pjlib/src/pj/sock_bsd.c
+@@ -539,6 +539,10 @@
+ pj_sock_setsockopt(*sock, pj_SOL_SOCKET(), pj_SO_NOSIGPIPE(),
+ &val, sizeof(val));
+ }
++ if (af != PJ_AF_INET) { /* Linux Kernel 2.4.21; June 2003 */
++ pj_sock_setsockopt(*sock, PJ_SOL_IPV6, IPV6_V6ONLY,
++ &val, sizeof(val));
++ }
+ #if defined(PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT) && \
+ PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0
+ if (type == pj_SOCK_DGRAM()) {
diff --git a/utils/check_expr.c b/utils/check_expr.c
index f29363c91..36ff13202 100644
--- a/utils/check_expr.c
+++ b/utils/check_expr.c
@@ -42,9 +42,9 @@ enum ast_lock_type {
#define MALLOC_FAILURE_MSG \
ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file);
-void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func);
+void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func);
-void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func)
+void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func)
{
void *p;
diff --git a/utils/extconf.c b/utils/extconf.c
index 8588d1a28..d035e12c0 100644
--- a/utils/extconf.c
+++ b/utils/extconf.c
@@ -684,41 +684,6 @@ int ast_channel_trylock(struct ast_channel *chan);
#define ast_free free
#define ast_free_ptr free
-#define MALLOC_FAILURE_MSG \
- ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file);
-
-/*!
- * \brief A wrapper for malloc()
- *
- * ast_malloc() is a wrapper for malloc() that will generate an Asterisk log
- * message in the case that the allocation fails.
- *
- * The argument and return value are the same as malloc()
- */
-#define ast_malloc(len) \
- _ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_calloc(num, len) \
- _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_calloc_cache(num, len) \
- _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_realloc(p, len) \
- _ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_strdup(str) \
- _ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_strndup(str, len) \
- _ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
-#define ast_asprintf(ret, fmt, ...) \
- _ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
-
-#define ast_vasprintf(ret, fmt, ap) \
- _ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
-
struct ast_flags { /* stolen from utils.h */
unsigned int flags;
};
@@ -743,6 +708,7 @@ struct ast_flags { /* stolen from utils.h */
#define MALLOC_FAILURE_MSG \
ast_log(LOG_ERROR, "Memory Allocation Failure in function %s at line %d of %s\n", func, lineno, file);
+
/*!
* \brief A wrapper for malloc()
*
@@ -752,10 +718,10 @@ struct ast_flags { /* stolen from utils.h */
* The argument and return value are the same as malloc()
*/
#define ast_malloc(len) \
- _ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void * attribute_malloc _ast_malloc(size_t len, const char *file, int lineno, const char *func),
+void * attribute_malloc __ast_malloc(size_t len, const char *file, int lineno, const char *func),
{
void *p;
@@ -775,10 +741,10 @@ void * attribute_malloc _ast_malloc(size_t len, const char *file, int lineno, co
* The arguments and return value are the same as calloc()
*/
#define ast_calloc(num, len) \
- _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func),
+void * attribute_malloc __ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func),
{
void *p;
@@ -800,7 +766,7 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
* The arguments and return value are the same as calloc()
*/
#define ast_calloc_cache(num, len) \
- _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
/*!
* \brief A wrapper for realloc()
@@ -811,10 +777,10 @@ void * attribute_malloc _ast_calloc(size_t num, size_t len, const char *file, in
* The arguments and return value are the same as realloc()
*/
#define ast_realloc(p, len) \
- _ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void * attribute_malloc _ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
+void * attribute_malloc __ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
{
void *newp;
@@ -838,10 +804,10 @@ void * attribute_malloc _ast_realloc(void *p, size_t len, const char *file, int
* The argument and return value are the same as strdup()
*/
#define ast_strdup(str) \
- _ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-char * attribute_malloc _ast_strdup(const char *str, const char *file, int lineno, const char *func),
+char * attribute_malloc __ast_strdup(const char *str, const char *file, int lineno, const char *func),
{
char *newstr = NULL;
@@ -867,10 +833,10 @@ char * attribute_malloc _ast_strdup(const char *str, const char *file, int linen
* The arguments and return value are the same as strndup()
*/
#define ast_strndup(str, len) \
- _ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+ __ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
+char * attribute_malloc __ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
{
char *newstr = NULL;
@@ -892,11 +858,11 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
* The arguments and return value are the same as asprintf()
*/
#define ast_asprintf(ret, fmt, ...) \
- _ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
+ __ast_asprintf(__FILE__, __LINE__, __PRETTY_FUNCTION__, (ret), (fmt), __VA_ARGS__)
AST_INLINE_API(
__attribute__((format(printf, 5, 6)))
-int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...),
+int __ast_asprintf(const char *file, int lineno, const char *func, char **ret, const char *fmt, ...),
{
int res;
va_list ap;
@@ -919,11 +885,11 @@ int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, co
* The arguments and return value are the same as vasprintf()
*/
#define ast_vasprintf(ret, fmt, ap) \
- _ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
+ __ast_vasprintf((ret), (fmt), (ap), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-__attribute__((format(printf, 5, 0)))
-int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
+__attribute__((format(printf, 2, 0)))
+int __ast_vasprintf(char **ret, const char *fmt, va_list ap, const char *file, int lineno, const char *func),
{
int res;