[asterisk-commits] coreyfarrell: trunk r432834 - in /trunk: ./ apps/ apps/confbridge/ channels/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 12 20:12:40 CDT 2015
Author: coreyfarrell
Date: Thu Mar 12 20:12:35 2015
New Revision: 432834
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432834
Log:
Logger: Convert 'struct ast_callid' to unsigned int.
Switch logger callid's from AO2 objects to simple integers.
This helps in two ways. Copying integers is faster than
referencing AO2 objects, so this will result in a small
reduction in logger overhead. This also erases the possibility
of an infinate loop caused by an invalid callid in
threadstorage.
ASTERISK-24833 #comment Committed callid conversion to trunk.
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4466/
Modified:
trunk/UPGRADE.txt
trunk/apps/app_mixmonitor.c
trunk/apps/confbridge/conf_chan_announce.c
trunk/channels/chan_bridge_media.c
trunk/channels/chan_dahdi.c
trunk/channels/chan_iax2.c
trunk/channels/chan_motif.c
trunk/channels/chan_sip.c
trunk/channels/sig_analog.c
trunk/channels/sig_pri.c
trunk/channels/sig_ss7.c
trunk/channels/sip/dialplan_functions.c
trunk/channels/sip/include/dialog.h
trunk/channels/sip/include/sip.h
trunk/include/asterisk/bridge.h
trunk/include/asterisk/bridge_channel.h
trunk/include/asterisk/channel.h
trunk/include/asterisk/core_unreal.h
trunk/include/asterisk/logger.h
trunk/main/autoservice.c
trunk/main/bridge.c
trunk/main/bridge_basic.c
trunk/main/bridge_channel.c
trunk/main/channel.c
trunk/main/channel_internal_api.c
trunk/main/cli.c
trunk/main/core_local.c
trunk/main/core_unreal.c
trunk/main/dial.c
trunk/main/features.c
trunk/main/logger.c
trunk/main/pbx.c
trunk/res/ari/resource_bridges.c
Modified: trunk/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/UPGRADE.txt?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Thu Mar 12 20:12:35 2015
@@ -31,5 +31,11 @@
ring-ring-ring pattern would exceed the pattern limits and stop
Caller-ID detection.
+Core:
+
+Logging:
+ - The first callid created is now 1 instead of 0. The value 0
+ is now reserved to represent a lack of callid.
+
===========================================================
===========================================================
Modified: trunk/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Thu Mar 12 20:12:35 2015
@@ -295,12 +295,12 @@
struct mixmonitor {
struct ast_audiohook audiohook;
- struct ast_callid *callid;
char *filename;
char *filename_read;
char *filename_write;
char *post_process;
char *name;
+ ast_callid callid;
unsigned int flags;
struct ast_autochan *autochan;
struct mixmonitor_ds *mixmonitor_ds;
@@ -545,9 +545,6 @@
/* clean stringfields */
ast_string_field_free_memory(mixmonitor);
- if (mixmonitor->callid) {
- ast_callid_unref(mixmonitor->callid);
- }
ast_free(mixmonitor);
}
}
Modified: trunk/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/confbridge/conf_chan_announce.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/apps/confbridge/conf_chan_announce.c (original)
+++ trunk/apps/confbridge/conf_chan_announce.c Thu Mar 12 20:12:35 2015
@@ -103,7 +103,7 @@
ao2_ref(pvt->bridge, +1);
chan = ast_unreal_new_channels(&pvt->base, conf_announce_get_tech(),
- AST_STATE_UP, AST_STATE_UP, NULL, NULL, assignedids, requestor, NULL);
+ AST_STATE_UP, AST_STATE_UP, NULL, NULL, assignedids, requestor, 0);
if (chan) {
ast_answer(pvt->base.owner);
ast_answer(pvt->base.chan);
Modified: trunk/channels/chan_bridge_media.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_bridge_media.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/chan_bridge_media.c (original)
+++ trunk/channels/chan_bridge_media.c Thu Mar 12 20:12:35 2015
@@ -118,8 +118,8 @@
const struct ast_channel *requestor, const char *data, struct ast_channel_tech *tech, const char *role)
{
struct ast_channel *chan;
-
- RAII_VAR(struct ast_callid *, callid, NULL, ast_callid_cleanup);
+ ast_callid callid;
+
RAII_VAR(struct ast_unreal_pvt *, pvt, NULL, ao2_cleanup);
if (!(pvt = ast_unreal_alloc(sizeof(*pvt), ast_unreal_destructor, cap))) {
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Thu Mar 12 20:12:35 2015
@@ -2232,13 +2232,13 @@
*
* \param callid_created value returned from ast_callid_threadstorage_auto()
*/
-static struct ast_channel *dahdi_new_callid_clean(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, struct ast_callid *callid, int callid_created);
-
-static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, struct ast_callid *callid);
+static struct ast_channel *dahdi_new_callid_clean(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid, int callid_created);
+
+static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid);
static struct ast_channel *my_new_analog_ast_channel(void *pvt, int state, int startpbx, enum analog_sub sub, const struct ast_channel *requestor)
{
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
struct dahdi_pvt *p = pvt;
int dsub = analogsub_to_dahdisub(sub);
@@ -2265,7 +2265,7 @@
struct dahdi_pvt *p = pvt;
int audio;
int newlaw = -1;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
switch (p->sig) {
@@ -3193,7 +3193,7 @@
struct dahdi_pvt *p = pvt;
int audio;
int newlaw;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
/* Set to audio mode at this point */
@@ -3677,7 +3677,7 @@
{
struct dahdi_pvt *p;
struct ast_channel *c;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
ast_verbose("MFC/R2 call offered on chan %d. ANI = %s, DNIS = %s, Category = %s\n",
openr2_chan_get_number(r2chan), ani ? ani : "(restricted)", dnis,
@@ -3746,7 +3746,7 @@
{
struct dahdi_pvt *p = NULL;
struct ast_channel *c = NULL;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
p = openr2_chan_get_client_data(r2chan);
dahdi_ec_enable(p);
@@ -7901,7 +7901,7 @@
p->subs[SUB_REAL].needflash = 1;
goto winkflashdone;
} else if (!check_for_conference(p)) {
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created;
char cid_num[256];
char cid_name[256];
@@ -9013,7 +9013,7 @@
return chan_name;
}
-static struct ast_channel *dahdi_new_callid_clean(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, struct ast_callid *callid, int callid_created)
+static struct ast_channel *dahdi_new_callid_clean(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid, int callid_created)
{
struct ast_channel *new_channel = dahdi_new(i, state, startpbx, idx, law, assignedids, requestor, callid);
@@ -9022,7 +9022,7 @@
return new_channel;
}
-static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, struct ast_callid *callid)
+static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpbx, int idx, int law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid)
{
struct ast_channel *tmp;
struct ast_format_cap *caps;
@@ -10620,7 +10620,7 @@
if (i & DAHDI_IOMUX_SIGEVENT) {
struct ast_channel *chan;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created;
/* If we get an event, screen out events that we do not act on.
@@ -11054,7 +11054,7 @@
int res;
pthread_t threadid;
struct ast_channel *chan;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created;
/* Handle an event on a given channel for the monitor thread. */
@@ -11540,7 +11540,7 @@
doomed = analog_handle_init_event(i->sig_pvt, ANALOG_EVENT_DTMFCID);
i->dtmfcid_holdoff_state = 1;
} else {
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
chan = dahdi_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, NULL, NULL, callid);
if (!chan) {
@@ -13342,7 +13342,7 @@
int transcapdigital = 0;
#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
struct dahdi_starting_point start;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
ast_mutex_lock(&iflock);
@@ -13664,12 +13664,12 @@
if (ss7) {
for (i = 0; i < NUM_SPANS; i++) {
if (linksets[i].ss7.ss7 == ss7) {
- ast_verbose_callid(NULL, "[%d] %s", i + 1, s);
+ ast_verbose_callid(0, "[%d] %s", i + 1, s);
return;
}
}
}
- ast_verbose_callid(NULL, "%s", s);
+ ast_verbose_callid(0, "%s", s);
}
#endif /* defined(HAVE_SS7) */
@@ -13681,12 +13681,12 @@
if (ss7) {
for (i = 0; i < NUM_SPANS; i++) {
if (linksets[i].ss7.ss7 == ss7) {
- ast_log_callid(LOG_ERROR, NULL, "[%d] %s", i + 1, s);
+ ast_log_callid(LOG_ERROR, 0, "[%d] %s", i + 1, s);
return;
}
}
}
- ast_log_callid(LOG_ERROR, NULL, "%s", s);
+ ast_log_callid(LOG_ERROR, 0, "%s", s);
}
#endif /* defined(HAVE_SS7) */
@@ -13796,22 +13796,22 @@
}
if (-1 < span) {
if (1 < dchancount) {
- ast_verbose_callid(NULL, "[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
+ ast_verbose_callid(0, "[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
} else {
- ast_verbose_callid(NULL, "PRI Span: %d %s", span + 1, s);
+ ast_verbose_callid(0, "PRI Span: %d %s", span + 1, s);
}
} else {
- ast_verbose_callid(NULL, "PRI Span: ? %s", s);
+ ast_verbose_callid(0, "PRI Span: ? %s", s);
}
} else {
- ast_verbose_callid(NULL, "PRI Span: ? %s", s);
+ ast_verbose_callid(0, "PRI Span: ? %s", s);
}
ast_mutex_lock(&pridebugfdlock);
if (pridebugfd >= 0) {
if (write(pridebugfd, s, strlen(s)) < 0) {
- ast_log_callid(LOG_WARNING, NULL, "write() failed: %s\n", strerror(errno));
+ ast_log_callid(LOG_WARNING, 0, "write() failed: %s\n", strerror(errno));
}
}
@@ -13847,22 +13847,22 @@
}
if (-1 < span) {
if (1 < dchancount) {
- ast_log_callid(LOG_ERROR, NULL, "[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
+ ast_log_callid(LOG_ERROR, 0, "[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
} else {
- ast_log_callid(LOG_ERROR, NULL, "PRI Span: %d %s", span + 1, s);
+ ast_log_callid(LOG_ERROR, 0, "PRI Span: %d %s", span + 1, s);
}
} else {
- ast_log_callid(LOG_ERROR, NULL, "PRI Span: ? %s", s);
+ ast_log_callid(LOG_ERROR, 0, "PRI Span: ? %s", s);
}
} else {
- ast_log_callid(LOG_ERROR, NULL, "PRI Span: ? %s", s);
+ ast_log_callid(LOG_ERROR, 0, "PRI Span: ? %s", s);
}
ast_mutex_lock(&pridebugfdlock);
if (pridebugfd >= 0) {
if (write(pridebugfd, s, strlen(s)) < 0) {
- ast_log_callid(LOG_WARNING, NULL, "write() failed: %s\n", strerror(errno));
+ ast_log_callid(LOG_WARNING, 0, "write() failed: %s\n", strerror(errno));
}
}
Modified: trunk/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Mar 12 20:12:35 2015
@@ -683,7 +683,7 @@
/*! Socket to send/receive on for this call */
int sockfd;
/*! ast_callid bound to dialog */
- struct ast_callid *callid;
+ ast_callid callid;
/*! Last received voice format */
iax2_format voiceformat;
/*! Last received video format */
@@ -1107,30 +1107,22 @@
*/
static struct chan_iax2_pvt *iaxs[IAX_MAX_CALLS];
-static struct ast_callid *iax_pvt_callid_get(int callno)
-{
- if (iaxs[callno]->callid) {
- return ast_callid_ref(iaxs[callno]->callid);
- }
- return NULL;
-}
-
-static void iax_pvt_callid_set(int callno, struct ast_callid *callid)
-{
- if (iaxs[callno]->callid) {
- ast_callid_unref(iaxs[callno]->callid);
- }
- ast_callid_ref(callid);
+static ast_callid iax_pvt_callid_get(int callno)
+{
+ return iaxs[callno]->callid;
+}
+
+static void iax_pvt_callid_set(int callno, ast_callid callid)
+{
iaxs[callno]->callid = callid;
}
static void iax_pvt_callid_new(int callno)
{
- struct ast_callid *callid = ast_create_callid();
+ ast_callid callid = ast_create_callid();
char buffer[AST_CALLID_BUFFER_LENGTH];
ast_callid_strnprint(buffer, sizeof(buffer), callid);
iax_pvt_callid_set(callno, callid);
- ast_callid_unref(callid);
}
/*!
@@ -2204,11 +2196,6 @@
jb_destroy(pvt->jb);
ast_string_field_free_memory(pvt);
}
-
- if (pvt->callid) {
- ast_callid_unref(pvt->callid);
- }
-
}
static struct chan_iax2_pvt *new_iax(struct ast_sockaddr *addr, const char *host)
@@ -5797,7 +5784,7 @@
struct ast_variable *v = NULL;
struct ast_format_cap *native;
struct ast_format *tmpfmt;
- struct ast_callid *callid;
+ ast_callid callid;
char *peer_name = NULL;
if (!(i = iaxs[callno])) {
@@ -10218,12 +10205,11 @@
}
if (fr->callno > 0) {
- struct ast_callid *mount_callid;
+ ast_callid mount_callid;
ast_mutex_lock(&iaxsl[fr->callno]);
if (iaxs[fr->callno] && ((mount_callid = iax_pvt_callid_get(fr->callno)))) {
/* Bind to thread */
ast_callid_threadassoc_add(mount_callid);
- ast_callid_unref(mount_callid);
}
}
@@ -11920,11 +11906,9 @@
static int socket_process(struct iax2_thread *thread)
{
- struct ast_callid *callid;
int res = socket_process_helper(thread);
- if ((callid = ast_read_threadstorage_callid())) {
+ if (ast_read_threadstorage_callid()) {
ast_callid_threadassoc_remove();
- callid = ast_callid_unref(callid);
}
return res;
}
@@ -12405,7 +12389,7 @@
struct parsed_dial_string pds;
struct create_addr_info cai;
char *tmpstr;
- struct ast_callid *callid;
+ ast_callid callid;
memset(&pds, 0, sizeof(pds));
tmpstr = ast_strdupa(data);
@@ -12508,9 +12492,6 @@
ao2_ref(format, -1);
}
- if (callid) {
- ast_callid_unref(callid);
- }
return c;
}
Modified: trunk/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_motif.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/chan_motif.c (original)
+++ trunk/channels/chan_motif.c Thu Mar 12 20:12:35 2015
@@ -317,7 +317,7 @@
struct ast_format_cap *peercap; /*!< Peer codec capabilities */
unsigned int outgoing:1; /*!< Whether this is an outgoing leg or not */
unsigned int gone:1; /*!< In the eyes of Jingle this session is already gone */
- struct ast_callid *callid; /*!< Bound session call-id */
+ ast_callid callid; /*!< Bound session call-id */
};
static const char desc[] = "Motif Jingle Channel";
@@ -585,10 +585,6 @@
ao2_cleanup(session->jointcap);
ao2_cleanup(session->peercap);
- if (session->callid) {
- ast_callid_unref(session->callid);
- }
-
ast_string_field_free_memory(session);
}
@@ -704,7 +700,7 @@
static struct jingle_session *jingle_alloc(struct jingle_endpoint *endpoint, const char *from, const char *sid)
{
struct jingle_session *session;
- struct ast_callid *callid;
+ ast_callid callid;
struct ast_sockaddr tmp;
if (!(session = ao2_alloc(sizeof(*session), jingle_session_destructor))) {
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Mar 12 20:12:35 2015
@@ -2039,7 +2039,7 @@
return -1;
}
- if (!(monitor_instance->subscription_pvt = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL, NULL))) {
+ if (!(monitor_instance->subscription_pvt = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL, 0))) {
return -1;
}
@@ -6574,11 +6574,6 @@
if (p->last_device_state_info) {
ao2_ref(p->last_device_state_info, -1);
p->last_device_state_info = NULL;
- }
-
- /* Lastly, kill the callid associated with the pvt */
- if (p->logger_callid) {
- ast_callid_unref(p->logger_callid);
}
}
@@ -7886,7 +7881,7 @@
*
* \return New ast_channel locked.
*/
-static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *title, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, struct ast_callid *callid)
+static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *title, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, ast_callid callid)
{
struct ast_format_cap *caps;
struct ast_channel *tmp;
@@ -8640,12 +8635,8 @@
return p->stimer;
}
-static void sip_pvt_callid_set(struct sip_pvt *pvt, struct ast_callid *callid)
-{
- if (pvt->logger_callid) {
- ast_callid_unref(pvt->logger_callid);
- }
- ast_callid_ref(callid);
+static void sip_pvt_callid_set(struct sip_pvt *pvt, ast_callid callid)
+{
pvt->logger_callid = callid;
}
@@ -8654,7 +8645,7 @@
* remember to release the reference.
*/
struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *addr,
- int useglobal_nat, const int intended_method, struct sip_request *req, struct ast_callid *logger_callid)
+ int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid)
{
struct sip_pvt *p;
@@ -9043,20 +9034,14 @@
{
struct sip_pvt *p;
const char *callid;
- struct ast_callid *logger_callid;
+ ast_callid logger_callid;
sip_pvt_lock(original);
callid = ast_strdupa(original->callid);
logger_callid = original->logger_callid;
- if (logger_callid) {
- ast_callid_ref(logger_callid);
- }
sip_pvt_unlock(original);
p = sip_alloc(callid, addr, 1, SIP_INVITE, req, logger_callid);
- if (logger_callid) {
- ast_callid_unref(logger_callid);
- }
if (!p) {
return; /* alloc error */
}
@@ -9339,7 +9324,7 @@
/* See if the method is capable of creating a dialog */
if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) {
struct sip_pvt *p = NULL;
- struct ast_callid *logger_callid = NULL;
+ ast_callid logger_callid = 0;
if (intended_method == SIP_INVITE) {
logger_callid = ast_create_callid();
@@ -9357,10 +9342,6 @@
*/
transmit_response_using_temp(callid, addr, 1, intended_method, req, "500 Server internal error");
ast_debug(4, "Failed allocating SIP dialog, sending 500 Server internal error and giving up\n");
- }
- /* If we created an ast_callid for an invite, we need to free it now. */
- if (logger_callid) {
- ast_callid_unref(logger_callid);
}
return p; /* can be NULL */
} else if( sip_methods[intended_method].can_create == CAN_CREATE_DIALOG_UNSUPPORTED_METHOD) {
@@ -14229,7 +14210,7 @@
epa_entry->publish_type = publish_type;
- if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_PUBLISH, NULL, NULL))) {
+ if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_PUBLISH, NULL, 0))) {
return -1;
}
@@ -14532,7 +14513,7 @@
}
/* Create a dialog that we will use for the subscription */
- if (!(mwi->call = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL, NULL))) {
+ if (!(mwi->call = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL, 0))) {
return -1;
}
@@ -15111,7 +15092,7 @@
channame += 4;
}
- if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, NULL))) {
+ if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, 0))) {
astman_send_error(s, m, "Unable to build sip pvt data for notify (memory/socket error)");
return 0;
}
@@ -15436,7 +15417,7 @@
r->callid_valid = TRUE;
}
/* Allocate SIP dialog for registration */
- if (!(p = sip_alloc( r->callid, NULL, 0, SIP_REGISTER, NULL, NULL))) {
+ if (!(p = sip_alloc( r->callid, NULL, 0, SIP_REGISTER, NULL, 0))) {
ast_log(LOG_WARNING, "Unable to allocate registration transaction (memory or socket error)\n");
return 0;
}
@@ -22018,7 +21999,7 @@
char buf[512];
struct ast_variable *header, *var;
- if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, NULL))) {
+ if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, 0))) {
ast_log(LOG_WARNING, "Unable to build sip pvt data for notify (memory/socket error)\n");
return CLI_FAILURE;
}
@@ -26757,7 +26738,7 @@
struct ast_msg_var_iterator *iter;
struct sip_peer *peer_ptr;
- if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_MESSAGE, NULL, NULL))) {
+ if (!(pvt = sip_alloc(NULL, NULL, 0, SIP_MESSAGE, NULL, 0))) {
return -1;
}
@@ -28658,7 +28639,7 @@
} else {
ao2_unlock(peer);
/* Build temporary dialog for this message */
- if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, NULL))) {
+ if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, 0))) {
update_peer_lastmsgssent(peer, -1, 0);
return -1;
}
@@ -29431,7 +29412,7 @@
peer->call = dialog_unref(peer->call, "unref dialog peer->call");
/* peer->call = sip_destroy(peer->call); */
}
- if (!(p = sip_alloc(NULL, NULL, 0, SIP_OPTIONS, NULL, NULL))) {
+ if (!(p = sip_alloc(NULL, NULL, 0, SIP_OPTIONS, NULL, 0))) {
return -1;
}
peer->call = dialog_ref(p, "copy sip alloc from p to peer->call");
@@ -29631,7 +29612,7 @@
char dialstring[256];
char *remote_address;
enum ast_transport transport = 0;
- struct ast_callid *callid;
+ ast_callid callid;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(peerorhost);
AST_APP_ARG(exten);
@@ -29664,9 +29645,6 @@
if (!(p = sip_alloc(NULL, NULL, 0, SIP_INVITE, NULL, callid))) {
ast_log(LOG_ERROR, "Unable to build sip pvt data for '%s' (Out of memory or socket error)\n", dest);
*cause = AST_CAUSE_SWITCH_CONGESTION;
- if (callid) {
- ast_callid_unref(callid);
- }
return NULL;
}
@@ -29681,9 +29659,6 @@
/* sip_destroy(p); */
ast_log(LOG_ERROR, "Unable to build option SIP data structure - Out of memory\n");
*cause = AST_CAUSE_SWITCH_CONGESTION;
- if (callid) {
- ast_callid_unref(callid);
- }
return NULL;
}
@@ -29765,9 +29740,6 @@
dialog_unlink_all(p);
dialog_unref(p, "unref dialog p UNREGISTERED");
/* sip_destroy(p); */
- if (callid) {
- ast_callid_unref(callid);
- }
return NULL;
}
if (ast_strlen_zero(p->peername) && ext)
@@ -29828,9 +29800,6 @@
sip_pvt_lock(p);
tmpc = sip_new(p, AST_STATE_DOWN, host, assignedids, requestor, callid); /* Place the call */
- if (callid) {
- callid = ast_callid_unref(callid);
- }
sip_pvt_unlock(p);
if (!tmpc) {
Modified: trunk/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_analog.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Thu Mar 12 20:12:35 2015
@@ -1715,7 +1715,7 @@
int len = 0;
int res;
int idx;
- struct ast_callid *callid;
+ ast_callid callid;
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
const char *pickupexten;
@@ -1730,7 +1730,6 @@
if ((callid = ast_channel_callid(chan))) {
ast_callid_threadassoc_add(callid);
- ast_callid_unref(callid);
}
/* in the bizarre case where the channel has become a zombie before we
@@ -3194,7 +3193,7 @@
ast_queue_control(p->subs[ANALOG_SUB_REAL].owner, AST_CONTROL_FLASH);
goto winkflashdone;
} else if (!analog_check_for_conference(p)) {
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created;
char cid_num[256];
char cid_name[256];
@@ -3657,7 +3656,7 @@
int res;
pthread_t threadid;
struct ast_channel *chan;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created;
ast_debug(1, "channel (%d) - signaling (%d) - event (%s)\n",
Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Thu Mar 12 20:12:35 2015
@@ -2030,11 +2030,10 @@
int timeout_ms = 30000;
int ms;
struct timeval start;
- struct ast_callid *callid;
+ ast_callid callid;
if ((callid = ast_channel_callid(chan))) {
ast_callid_threadassoc_add(callid);
- callid = ast_callid_unref(callid);
}
ast_verb(3, "Initiating idle call on channel %s\n", ast_channel_name(chan));
@@ -2089,7 +2088,7 @@
int res;
int len;
int timeout;
- struct ast_callid *callid;
+ ast_callid callid;
if (!chan) {
/* We lost the owner before we could get started. */
@@ -2098,7 +2097,6 @@
if ((callid = ast_channel_callid(chan))) {
ast_callid_threadassoc_add(callid);
- ast_callid_unref(callid);
}
/*
@@ -5369,13 +5367,12 @@
* \internal
* \brief Set callid threadstorage for the pri_dchannel thread when a new call is created
*
- * \return A new callid which has been bound to threadstorage. The return must be
- * unreffed and the threadstorage should be unbound when the pri_dchannel
- * primary loop wraps.
- */
-static struct ast_callid *func_pri_dchannel_new_callid(void)
-{
- struct ast_callid *callid = ast_create_callid();
+ * \return A new callid which has been bound to threadstorage. The threadstorage
+ * should be unbound when the pri_dchannel primary loop wraps.
+ */
+static ast_callid func_pri_dchannel_new_callid(void)
+{
+ ast_callid callid = ast_create_callid();
if (callid) {
ast_callid_threadassoc_add(callid);
@@ -5394,20 +5391,18 @@
* \note Assumes the pri->lock is already obtained.
* \note Assumes the sig_pri_lock_private(pri->pvts[chanpos]) is already obtained.
*
- * \return a reference to the callid bound to the channel which has also
- * been bound to threadstorage if it exists. If this returns non-NULL,
- * the callid must be unreffed and the threadstorage should be unbound
- * when the pri_dchannel primary loop wraps.
- */
-static struct ast_callid *func_pri_dchannel_chanpos_callid(struct sig_pri_span *pri, int chanpos)
+ * \return The callid which has also been bound to threadstorage if it exists.
+ * The threadstorage should be unbound when the pri_dchannel primary loop wraps.
+ */
+static ast_callid func_pri_dchannel_chanpos_callid(struct sig_pri_span *pri, int chanpos)
{
if (chanpos < 0) {
- return NULL;
+ return 0;
}
sig_pri_lock_owner(pri, chanpos);
if (pri->pvts[chanpos]->owner) {
- struct ast_callid *callid;
+ ast_callid callid;
callid = ast_channel_callid(pri->pvts[chanpos]->owner);
ast_channel_unlock(pri->pvts[chanpos]->owner);
if (callid) {
@@ -5416,7 +5411,7 @@
}
}
- return NULL;
+ return 0;
}
#if defined(HAVE_PRI_CALL_HOLD)
@@ -5439,7 +5434,7 @@
int chanpos_old;
int chanpos_new;
struct ast_channel *owner;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
chanpos_old = pri_find_principle_by_call(pri, ev->hold.call);
if (chanpos_old < 0) {
@@ -5499,7 +5494,6 @@
}
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
@@ -5523,7 +5517,7 @@
static void sig_pri_handle_hold_ack(struct sig_pri_span *pri, pri_event *ev)
{
int chanpos;
- struct ast_callid *callid;
+ ast_callid callid;
/*
* We were successfully put on hold by the remote party
@@ -5555,7 +5549,6 @@
sig_pri_span_devstate_changed(pri);
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
@@ -5577,7 +5570,7 @@
static void sig_pri_handle_hold_rej(struct sig_pri_span *pri, pri_event *ev)
{
int chanpos;
- struct ast_callid *callid;
+ ast_callid callid;
chanpos = pri_find_principle(pri, ev->hold_rej.channel, ev->hold_rej.call);
if (chanpos < 0) {
@@ -5605,7 +5598,6 @@
sig_pri_unlock_private(pri->pvts[chanpos]);
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
@@ -5627,7 +5619,7 @@
static void sig_pri_handle_retrieve(struct sig_pri_span *pri, pri_event *ev)
{
int chanpos;
- struct ast_callid *callid;
+ ast_callid callid;
if (!(ev->retrieve.channel & PRI_HELD_CALL)) {
/* The call is not currently held. */
@@ -5680,7 +5672,6 @@
sig_pri_span_devstate_changed(pri);
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
@@ -5702,7 +5693,7 @@
static void sig_pri_handle_retrieve_ack(struct sig_pri_span *pri, pri_event *ev)
{
int chanpos;
- struct ast_callid *callid;
+ ast_callid callid;
chanpos = pri_find_fixup_principle(pri, ev->retrieve_ack.channel,
ev->retrieve_ack.call);
@@ -5721,7 +5712,6 @@
sig_pri_span_devstate_changed(pri);
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
@@ -5743,7 +5733,7 @@
static void sig_pri_handle_retrieve_rej(struct sig_pri_span *pri, pri_event *ev)
{
int chanpos;
- struct ast_callid *callid;
+ ast_callid callid;
chanpos = pri_find_principle(pri, ev->retrieve_rej.channel, ev->retrieve_rej.call);
if (chanpos < 0) {
@@ -5772,7 +5762,6 @@
sig_pri_unlock_private(pri->pvts[chanpos]);
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
@@ -5892,7 +5881,7 @@
int need_dialtone;
enum sig_pri_law law;
int chanpos = -1;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
struct ast_channel *c;
char plancallingnum[AST_MAX_EXTENSION];
char plancallingani[AST_MAX_EXTENSION];
@@ -6246,7 +6235,6 @@
setup_exit:;
if (callid) {
- ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
@@ -6294,7 +6282,7 @@
ast_log(LOG_WARNING, "Idle dial string '%s' lacks '@context'\n", pri->idleext);
}
for (;;) {
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
if (!pri->dchans[i])
@@ -7651,9 +7639,8 @@
break;
}
- /* If a callid was set, we need to deref it and remove it from thread storage. */
+ /* If a callid was set, we need to remove it from thread storage. */
if (callid) {
- callid = ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
Modified: trunk/channels/sig_ss7.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_ss7.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/sig_ss7.c (original)
+++ trunk/channels/sig_ss7.c Thu Mar 12 20:12:35 2015
@@ -976,7 +976,7 @@
struct ast_channel *c;
char tmp[256];
char *strp;
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int callid_created = ast_callid_threadstorage_auto(&callid);
if (!(linkset->flags & LINKSET_FLAG_EXPLICITACM)) {
@@ -1315,14 +1315,13 @@
* \note Assumes the ss7->lock is already obtained.
* \note Assumes the sig_ss7_lock_private(ss7->pvts[chanpos]) is already obtained.
*
- * \return a reference to the callid bound to the channel which has also
- * been bound to threadstorage if it exists. If this returns non-NULL,
- * the callid must be unreffed and the threadstorage should be unbound
+ * \return The callid bound to the channel which has also been bound to threadstorage
+ * if it exists. If this returns non-zero, the threadstorage should be unbound
* before the while loop wraps in ss7_linkset.
*/
-static struct ast_callid *func_ss7_linkset_callid(struct sig_ss7_linkset *linkset, int chanpos)
-{
- struct ast_callid *callid = NULL;
+static ast_callid func_ss7_linkset_callid(struct sig_ss7_linkset *linkset, int chanpos)
+{
+ ast_callid callid = 0;
sig_ss7_lock_owner(linkset, chanpos);
if (linkset->pvts[chanpos]->owner) {
callid = ast_channel_callid(linkset->pvts[chanpos]->owner);
@@ -1460,7 +1459,7 @@
}
while ((e = ss7_check_event(ss7))) {
- struct ast_callid *callid = NULL;
+ ast_callid callid = 0;
int chanpos = -1;
char cause_str[30];
@@ -2342,7 +2341,6 @@
/* Call ID stuff needs to be cleaned up here */
if (callid) {
- callid = ast_callid_unref(callid);
ast_callid_threadassoc_remove();
}
}
Modified: trunk/channels/sip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/dialplan_functions.c?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/sip/dialplan_functions.c (original)
+++ trunk/channels/sip/dialplan_functions.c Thu Mar 12 20:12:35 2015
@@ -340,7 +340,7 @@
ast_rtp_engine_register2(&test_engine, NULL);
/* Have to associate this with a SIP pvt and an ast_channel */
- if (!(p = sip_alloc(NULL, NULL, 0, SIP_NOTIFY, NULL, NULL))) {
+ if (!(p = sip_alloc(0, NULL, 0, SIP_NOTIFY, NULL, 0))) {
res = AST_TEST_NOT_RUN;
goto done;
}
Modified: trunk/channels/sip/include/dialog.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/include/dialog.h?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/sip/include/dialog.h (original)
+++ trunk/channels/sip/include/dialog.h Thu Mar 12 20:12:35 2015
@@ -35,7 +35,7 @@
struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func);
struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *sin,
- int useglobal_nat, const int intended_method, struct sip_request *req, struct ast_callid *logger_callid);
+ int useglobal_nat, const int intended_method, struct sip_request *req, ast_callid logger_callid);
void sip_scheddestroy_final(struct sip_pvt *p, int ms);
void sip_scheddestroy(struct sip_pvt *p, int ms);
int sip_cancel_destroy(struct sip_pvt *p);
Modified: trunk/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/include/sip.h?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/channels/sip/include/sip.h (original)
+++ trunk/channels/sip/include/sip.h Thu Mar 12 20:12:35 2015
@@ -991,7 +991,7 @@
struct sip_pvt {
struct sip_pvt *next; /*!< Next dialog in chain */
enum invitestates invitestate; /*!< Track state of SIP_INVITEs */
- struct ast_callid *logger_callid; /*!< Identifier for call used in log messages */
+ ast_callid logger_callid; /*!< Identifier for call used in log messages */
int method; /*!< SIP method that opened this dialog */
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(callid); /*!< Global CallID */
Modified: trunk/include/asterisk/bridge.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridge.h?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/include/asterisk/bridge.h (original)
+++ trunk/include/asterisk/bridge.h Thu Mar 12 20:12:35 2015
@@ -280,7 +280,7 @@
/*! Per-bridge topics */
struct stasis_cp_single *topics;
/*! Call ID associated with the bridge */
- struct ast_callid *callid;
+ ast_callid callid;
/*! Linked list of channels participating in the bridge */
AST_LIST_HEAD_NOLOCK(, ast_bridge_channel) channels;
/*! Queue of actions to perform on the bridge. */
Modified: trunk/include/asterisk/bridge_channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridge_channel.h?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/include/asterisk/bridge_channel.h (original)
+++ trunk/include/asterisk/bridge_channel.h Thu Mar 12 20:12:35 2015
@@ -138,7 +138,7 @@
/*! Copy of write format used by chan before join */
struct ast_format *write_format;
/*! Call ID associated with bridge channel */
- struct ast_callid *callid;
+ ast_callid callid;
/*! A clone of the roles living on chan when the bridge channel joins the bridge. This may require some opacification */
struct bridge_roles_datastore *bridge_roles;
/*! Linked list information */
Modified: trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Thu Mar 12 20:12:35 2015
@@ -4046,12 +4046,12 @@
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan);
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value);
enum ast_channel_state ast_channel_state(const struct ast_channel *chan);
-struct ast_callid *ast_channel_callid(const struct ast_channel *chan);
+ast_callid ast_channel_callid(const struct ast_channel *chan);
/*!
* \pre chan is locked
*/
-void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *value);
+void ast_channel_callid_set(struct ast_channel *chan, ast_callid value);
/* XXX Internal use only, make sure to move later */
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state);
Modified: trunk/include/asterisk/core_unreal.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/core_unreal.h?view=diff&rev=432834&r1=432833&r2=432834
==============================================================================
--- trunk/include/asterisk/core_unreal.h (original)
+++ trunk/include/asterisk/core_unreal.h Thu Mar 12 20:12:35 2015
@@ -40,7 +40,6 @@
/* Forward declare some struct names */
struct ast_format_cap;
-struct ast_callid;
/* ------------------------------------------------------------------- */
@@ -207,7 +206,7 @@
struct ast_channel *ast_unreal_new_channels(struct ast_unreal_pvt *p,
const struct ast_channel_tech *tech, int semi1_state, int semi2_state,
const char *exten, const char *context, const struct ast_assigned_ids *assignedids,
- const struct ast_channel *requestor, struct ast_callid *callid);
+ const struct ast_channel *requestor, ast_callid callid);
/*!
* \brief Setup unreal owner and chan channels before initiating call.
Modified: trunk/include/asterisk/logger.h
[... 898 lines stripped ...]
More information about the asterisk-commits
mailing list