[asterisk-commits] mjordan: branch mjordan/trunk-astdb-cluster r432916 - in /team/mjordan/trunk-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 13 15:51:53 CDT 2015


Author: mjordan
Date: Fri Mar 13 15:51:49 2015
New Revision: 432916

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=432916
Log:
Update merge

Added:
    team/mjordan/trunk-astdb-cluster/contrib/ast-db-manage/config/versions/45e3f47c6c44_add_pjsip_endpoint_identifier_order.py
      - copied unchanged from r432895, trunk/contrib/ast-db-manage/config/versions/45e3f47c6c44_add_pjsip_endpoint_identifier_order.py
Modified:
    team/mjordan/trunk-astdb-cluster/   (props changed)
    team/mjordan/trunk-astdb-cluster/Makefile
    team/mjordan/trunk-astdb-cluster/UPGRADE.txt
    team/mjordan/trunk-astdb-cluster/apps/app_mixmonitor.c
    team/mjordan/trunk-astdb-cluster/apps/app_voicemail.c
    team/mjordan/trunk-astdb-cluster/apps/confbridge/conf_chan_announce.c
    team/mjordan/trunk-astdb-cluster/channels/chan_bridge_media.c
    team/mjordan/trunk-astdb-cluster/channels/chan_dahdi.c
    team/mjordan/trunk-astdb-cluster/channels/chan_iax2.c
    team/mjordan/trunk-astdb-cluster/channels/chan_motif.c
    team/mjordan/trunk-astdb-cluster/channels/chan_pjsip.c
    team/mjordan/trunk-astdb-cluster/channels/chan_sip.c
    team/mjordan/trunk-astdb-cluster/channels/sig_analog.c
    team/mjordan/trunk-astdb-cluster/channels/sig_pri.c
    team/mjordan/trunk-astdb-cluster/channels/sig_ss7.c
    team/mjordan/trunk-astdb-cluster/channels/sip/dialplan_functions.c
    team/mjordan/trunk-astdb-cluster/channels/sip/include/dialog.h
    team/mjordan/trunk-astdb-cluster/channels/sip/include/sip.h
    team/mjordan/trunk-astdb-cluster/configure
    team/mjordan/trunk-astdb-cluster/configure.ac
    team/mjordan/trunk-astdb-cluster/include/asterisk/bridge.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/bridge_channel.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/channel.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/core_unreal.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/inline_api.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/logger.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/res_pjsip.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/res_pjsip_session.h
    team/mjordan/trunk-astdb-cluster/include/asterisk/utils.h
    team/mjordan/trunk-astdb-cluster/main/Makefile
    team/mjordan/trunk-astdb-cluster/main/audiohook.c
    team/mjordan/trunk-astdb-cluster/main/autoservice.c
    team/mjordan/trunk-astdb-cluster/main/bridge.c
    team/mjordan/trunk-astdb-cluster/main/bridge_basic.c
    team/mjordan/trunk-astdb-cluster/main/bridge_channel.c
    team/mjordan/trunk-astdb-cluster/main/channel.c
    team/mjordan/trunk-astdb-cluster/main/channel_internal_api.c
    team/mjordan/trunk-astdb-cluster/main/cli.c
    team/mjordan/trunk-astdb-cluster/main/core_local.c
    team/mjordan/trunk-astdb-cluster/main/core_unreal.c
    team/mjordan/trunk-astdb-cluster/main/dial.c
    team/mjordan/trunk-astdb-cluster/main/endpoints.c
    team/mjordan/trunk-astdb-cluster/main/features.c
    team/mjordan/trunk-astdb-cluster/main/logger.c
    team/mjordan/trunk-astdb-cluster/main/pbx.c
    team/mjordan/trunk-astdb-cluster/main/stasis_bridges.c
    team/mjordan/trunk-astdb-cluster/main/stasis_channels.c
    team/mjordan/trunk-astdb-cluster/main/stdtime/localtime.c
    team/mjordan/trunk-astdb-cluster/makeopts.in
    team/mjordan/trunk-astdb-cluster/res/ari/resource_bridges.c
    team/mjordan/trunk-astdb-cluster/res/res_config_odbc.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip/config_domain_aliases.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip/config_global.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip/include/res_pjsip_private.h
    team/mjordan/trunk-astdb-cluster/res/res_pjsip/pjsip_configuration.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip/pjsip_global_headers.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip_caller_id.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip_refer.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip_session.c
    team/mjordan/trunk-astdb-cluster/res/res_pjsip_session.exports.in

Propchange: team/mjordan/trunk-astdb-cluster/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Propchange: team/mjordan/trunk-astdb-cluster/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar 13 15:51:49 2015
@@ -1,1 +1,1 @@
-/trunk:1-432633
+/trunk:1-432915

Modified: team/mjordan/trunk-astdb-cluster/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/Makefile?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/Makefile (original)
+++ team/mjordan/trunk-astdb-cluster/Makefile Fri Mar 13 15:51:49 2015
@@ -184,7 +184,7 @@
   _ASTCFLAGS+=-Wall
 endif
 
-_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(DEBUG)
+_ASTCFLAGS+=-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_NESTED_FUNCTIONS) $(AST_CLANG_BLOCKS) $(DEBUG)
 ADDL_TARGETS=
 
 ifeq ($(AST_DEVMODE),yes)
@@ -931,7 +931,7 @@
 	- at menuselect/nmenuselect menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
 
 # options for make in menuselect/
-MAKE_MENUSELECT=CC="$(BUILD_CC)" CXX="" LD="" AR="" RANLIB="" \
+MAKE_MENUSELECT=CC="$(CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" \
 		CFLAGS="$(BUILD_CFLAGS)" LDFLAGS="$(BUILD_LDFLAGS)" \
 		$(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
 

Modified: team/mjordan/trunk-astdb-cluster/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/UPGRADE.txt?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/UPGRADE.txt (original)
+++ team/mjordan/trunk-astdb-cluster/UPGRADE.txt Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/apps/app_mixmonitor.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/apps/app_mixmonitor.c (original)
+++ team/mjordan/trunk-astdb-cluster/apps/app_mixmonitor.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/apps/app_voicemail.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/apps/app_voicemail.c (original)
+++ team/mjordan/trunk-astdb-cluster/apps/app_voicemail.c Fri Mar 13 15:51:49 2015
@@ -2173,6 +2173,8 @@
 	char *attachment;
 	int i;
 	BODY *body;
+	int ret = 0;
+	int curr_mbox;
 
 	/* This function is only used for retrieval of IMAP greetings
 	 * regular messages are not retrieved this way, nor are greetings
@@ -2206,6 +2208,10 @@
 	*vms_p->introfn = '\0';
 
 	ast_mutex_lock(&vms_p->lock);
+
+	/* get the current mailbox so that we can point the mailstream back to it later */
+	curr_mbox = get_folder_by_name(vms_p->curbox);
+
 	if (init_mailstream(vms_p, GREETINGS_FOLDER) || !vms_p->mailstream) {
 		ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL or can't init_mailstream\n");
 		ast_mutex_unlock(&vms_p->lock);
@@ -2220,21 +2226,28 @@
 			attachment = ast_strdupa(body->nested.part->next->body.parameter->value);
 		} else {
 			ast_log(AST_LOG_ERROR, "There is no file attached to this IMAP message.\n");
-			ast_mutex_unlock(&vms_p->lock);
-			return -1;
+			ret = -1;
+			break;
 		}
 		filename = strsep(&attachment, ".");
 		if (!strcmp(filename, file)) {
 			ast_copy_string(vms_p->fn, dir, sizeof(vms_p->fn));
 			vms_p->msgArray[vms_p->curmsg] = i + 1;
 			save_body(body, vms_p, "2", attachment, 0);
-			ast_mutex_unlock(&vms_p->lock);
-			return 0;
+			ret = 0;
+			break;
+		}
+	}
+
+	if (curr_mbox != -1) {
+		/* restore previous mbox stream */
+		if (init_mailstream(vms_p, curr_mbox) || !vms_p->mailstream) {
+			ast_log(AST_LOG_ERROR, "IMAP mailstream is NULL or can't init_mailstream\n");
+			ret = -1;
 		}
 	}
 	ast_mutex_unlock(&vms_p->lock);
-
-	return -1;
+	return ret;
 }
 
 static int imap_retrieve_file(const char *dir, const int msgnum, const char *mailbox, const char *context)
@@ -2248,12 +2261,13 @@
 	FILE *text_file_ptr;
 	int res = 0;
 	struct ast_vm_user *vmu;
+	int curr_mbox;
 
 	if (!(vmu = find_user(NULL, context, mailbox))) {
 		ast_log(LOG_WARNING, "Couldn't find user with mailbox %s@%s\n", mailbox, context);
 		return -1;
 	}
-	
+
 	if (msgnum < 0) {
 		if (imapgreetings) {
 			res = imap_retrieve_greeting(dir, msgnum, vmu);
@@ -2276,6 +2290,19 @@
 		 * and should have its msgArray properly set up.
 		 */
 		ast_log(LOG_ERROR, "Couldn't find a vm_state for mailbox %s!!! Oh no!\n", vmu->mailbox);
+		res = -1;
+		goto exit;
+	}
+
+	/* Ensure we have the correct mailbox open and have a valid mailstream for it */
+	curr_mbox = get_folder_by_name(vms->curbox);
+	if (curr_mbox < 0) {
+		ast_debug(3, "Mailbox folder curbox not set, defaulting to Inbox\n");
+		curr_mbox = 0;
+	}
+	init_mailstream(vms, curr_mbox);
+	if (!vms->mailstream) {
+		ast_log(AST_LOG_ERROR, "IMAP mailstream for %s is NULL\n", vmu->mailbox);
 		res = -1;
 		goto exit;
 	}

Modified: team/mjordan/trunk-astdb-cluster/apps/confbridge/conf_chan_announce.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/apps/confbridge/conf_chan_announce.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/apps/confbridge/conf_chan_announce.c (original)
+++ team/mjordan/trunk-astdb-cluster/apps/confbridge/conf_chan_announce.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/chan_bridge_media.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/chan_bridge_media.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/chan_bridge_media.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/chan_bridge_media.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/chan_dahdi.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/chan_dahdi.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/chan_dahdi.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/chan_iax2.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/chan_iax2.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/chan_iax2.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/chan_motif.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/chan_motif.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/chan_motif.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/chan_motif.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/chan_pjsip.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/chan_pjsip.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/chan_pjsip.c Fri Mar 13 15:51:49 2015
@@ -219,10 +219,13 @@
 
 static int send_direct_media_request(void *data)
 {
-	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
-
-	return ast_sip_session_refresh(session, NULL, NULL, NULL,
-			session->endpoint->media.direct_media.method, 1);
+	struct ast_sip_session *session = data;
+	int res;
+
+	res = ast_sip_session_refresh(session, NULL, NULL, NULL,
+		session->endpoint->media.direct_media.method, 1);
+	ao2_ref(session, -1);
+	return res;
 }
 
 /*! \brief Destructor function for \ref transport_info_data */
@@ -1057,17 +1060,66 @@
 	return 0;
 }
 
+/*!
+ * \internal
+ * \brief TRUE if a COLP update can be sent to the peer.
+ * \since 13.3.0
+ *
+ * \param session The session to see if the COLP update is allowed.
+ *
+ * \retval 0 Update is not allowed.
+ * \retval 1 Update is allowed.
+ */
+static int is_colp_update_allowed(struct ast_sip_session *session)
+{
+	struct ast_party_id connected_id;
+	int update_allowed = 0;
+
+	if (!session->endpoint->id.send_pai && !session->endpoint->id.send_rpid) {
+		return 0;
+	}
+
+	/*
+	 * Check if privacy allows the update.  Check while the channel
+	 * is locked so we can work with the shallow connected_id copy.
+	 */
+	ast_channel_lock(session->channel);
+	connected_id = ast_channel_connected_effective_id(session->channel);
+	if (connected_id.number.valid
+		&& (session->endpoint->id.trust_outbound
+			|| (ast_party_id_presentation(&connected_id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED)) {
+		update_allowed = 1;
+	}
+	ast_channel_unlock(session->channel);
+
+	return update_allowed;
+}
+
 /*! \brief Update connected line information */
 static int update_connected_line_information(void *data)
 {
-	RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
-
-	if ((ast_channel_state(session->channel) != AST_STATE_UP) && (session->inv_session->role == PJSIP_UAS_ROLE)) {
+	struct ast_sip_session *session = data;
+
+	if (ast_channel_state(session->channel) == AST_STATE_UP
+		|| session->inv_session->role == PJSIP_ROLE_UAC) {
+		if (is_colp_update_allowed(session)) {
+			enum ast_sip_session_refresh_method method;
+			int generate_new_sdp;
+
+			method = session->endpoint->id.refresh_method;
+			if (session->inv_session->invite_tsx
+				&& (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
+				method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
+			}
+
+			/* Only the INVITE method actually needs SDP, UPDATE can do without */
+			generate_new_sdp = (method == AST_SIP_SESSION_REFRESH_METHOD_INVITE);
+
+			ast_sip_session_refresh(session, NULL, NULL, NULL, method, generate_new_sdp);
+		}
+	} else if (session->inv_session->state != PJSIP_INV_STATE_DISCONNECTED
+		&& is_colp_update_allowed(session)) {
 		int response_code = 0;
-
-		if (session->inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
-			return 0;
-		}
 
 		if (ast_channel_state(session->channel) == AST_STATE_RING) {
 			response_code = !session->endpoint->inband_progress ? 180 : 183;
@@ -1082,34 +1134,9 @@
 				ast_sip_session_send_response(session, packet);
 			}
 		}
-	} else {
-		enum ast_sip_session_refresh_method method = session->endpoint->id.refresh_method;
-		int generate_new_sdp;
-		struct ast_party_id connected_id;
-
-		if (session->inv_session->invite_tsx && (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
-			method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
-		}
-
-		/* Only the INVITE method actually needs SDP, UPDATE can do without */
-		generate_new_sdp = (method == AST_SIP_SESSION_REFRESH_METHOD_INVITE);
-
-		/*
-		 * We can get away with a shallow copy here because we are
-		 * not looking at strings.
-		 */
-		ast_channel_lock(session->channel);
-		connected_id = ast_channel_connected_effective_id(session->channel);
-		ast_channel_unlock(session->channel);
-
-		if ((session->endpoint->id.send_pai || session->endpoint->id.send_rpid) &&
-		    (session->endpoint->id.trust_outbound ||
-		     ((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
-		      (connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) {
-			ast_sip_session_refresh(session, NULL, NULL, NULL, method, generate_new_sdp);
-		}
-	}
-
+	}
+
+	ao2_ref(session, -1);
 	return 0;
 }
 

Modified: team/mjordan/trunk-astdb-cluster/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/chan_sip.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/chan_sip.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/chan_sip.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/sig_analog.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/sig_analog.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/sig_analog.c Fri Mar 13 15:51:49 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: team/mjordan/trunk-astdb-cluster/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-astdb-cluster/channels/sig_pri.c?view=diff&rev=432916&r1=432915&r2=432916
==============================================================================
--- team/mjordan/trunk-astdb-cluster/channels/sig_pri.c (original)
+++ team/mjordan/trunk-astdb-cluster/channels/sig_pri.c Fri Mar 13 15:51:49 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) {

[... 3216 lines stripped ...]



More information about the asterisk-commits mailing list