[asterisk-commits] murf: branch murf/bug11210 r101370 - in /team/murf/bug11210: channels/ includ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 30 21:06:43 CST 2008


Author: murf
Date: Wed Jan 30 21:06:42 2008
New Revision: 101370

URL: http://svn.digium.com/view/asterisk?view=rev&rev=101370
Log:
Updates to resolve ReviewBoard issues.

Added:
    team/murf/bug11210/tests/test_dlinklists.c   (with props)
Modified:
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/include/asterisk.h
    team/murf/bug11210/include/asterisk/astobj2.h
    team/murf/bug11210/include/asterisk/sched.h
    team/murf/bug11210/main/sched.c

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=101370&r1=101369&r2=101370
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Wed Jan 30 21:06:42 2008
@@ -179,9 +179,6 @@
 #include "asterisk/version.h"
 #include "asterisk/event.h"
 #include "asterisk/tcptls.h"
-
-/* remove when someone fixes this */
-const char *ast_get_version(void);
 
 #ifndef FALSE
 #define FALSE    0
@@ -1329,32 +1326,32 @@
 static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
 {
 	if (p)
-		ao2_ref_debug(p,1,tag,file,line,func);
+		ao2_ref_debug(p, 1, tag, file, line, func);
 	else
-		ast_log(LOG_ERROR,"Attempt to Ref a null pointer\n");
+		ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
 	return p;
 }
 
 static struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
 {
 	if (p)
-		ao2_ref_debug(p,-1, tag, file, line, func);
+		ao2_ref_debug(p, -1, tag, file, line, func);
 	return NULL;
 }
 #else
 static struct sip_pvt *dialog_ref(struct sip_pvt *p, char *tag)
 {
 	if (p)
-		ao2_ref(p,1);
+		ao2_ref(p, 1);
 	else
-		ast_log(LOG_ERROR,"Attempt to Ref a null pointer\n");
+		ast_log(LOG_ERROR, "Attempt to Ref a null pointer\n");
 	return p;
 }
 
 static struct sip_pvt *dialog_unref(struct sip_pvt *p, char *tag)
 {
 	if (p)
-		ao2_ref(p,-1);
+		ao2_ref(p, -1);
 	return NULL;
 }
 #endif
@@ -1403,7 +1400,7 @@
 
 	/* things that don't belong in flags */
 	char is_realtime;		/*!< this is a 'realtime' user */
-	char theMark;          /*!< moved out of the ASTOBJ fields; that which bears theMark should be deleted! */
+	char the_mark;          /*!< moved out of the ASTOBJ fields; that which bears the_mark should be deleted! */
 
 	int amaflags;			/*!< AMA flags for billing */
 	int callingpres;		/*!< Calling id presentation */
@@ -1477,7 +1474,7 @@
 	char rt_fromcontact;		/*!< P: copy fromcontact from realtime */
 	char host_dynamic;		/*!< P: Dynamic Peers register with Asterisk */
 	char selfdestruct;		/*!< P: Automatic peers need to destruct themselves */
-	char theMark;           /*!< moved out of ASTOBJ into struct proper; That which bears theMark should be deleted! */
+	char the_mark;           /*!< moved out of ASTOBJ into struct proper; That which bears the_mark should be deleted! */
 
 	int expire;			/*!<  When to expire this peer registration */
 	int capability;			/*!<  Codec capability */
@@ -1594,10 +1591,8 @@
 	int recheck;
 } regl;
 
-static void addr2str(struct sockaddr_in *sin, char *buf);
-
 /*!
- * \note The only member of the peer passed here guaranteed to be set is the name field
+ * \note The only member of the peer used here is the name field
  */
 static int peer_hash_cb(const void *obj, const int flags)
 {
@@ -1607,7 +1602,7 @@
 }
 
 /*!
- * \note The only member of the peer passed here guaranteed to be set is the name field
+ * \note The only member of the peer used here is the name field
  */
 static int peer_cmp_cb(void *obj, void *arg, int flags)
 {
@@ -1617,7 +1612,7 @@
 }
 
 /*!
- * \note The only member of the peer passed here guaranteed to be set is the name field
+ * \note the peer's addr struct provides to fields combined to make a key: the sin_addr.s_addr and sin_port fields.
  */
 static int peer_iphash_cb(const void *obj, const int flags)
 {
@@ -1634,7 +1629,7 @@
 }
 
 /*!
- * \note The only member of the peer passed here guaranteed to be set is the name field
+ * \note the peer's addr struct provides to fields combined to make a key: the sin_addr.s_addr and sin_port fields.
  */
 static int peer_ipcmp_cb(void *obj, void *arg, int flags)
 {
@@ -1653,7 +1648,7 @@
 }
 
 /*!
- * \note The only member of the user passed here guaranteed to be set is the name field
+ * \note The only member of the user used here is the name field
  */
 static int user_hash_cb(const void *obj, const int flags)
 {
@@ -1663,7 +1658,7 @@
 }
 
 /*!
- * \note The only member of the user passed here guaranteed to be set is the name field
+ * \note The only member of the user used here is the name field
  */
 static int user_cmp_cb(void *obj, void *arg, int flags)
 {
@@ -1673,7 +1668,7 @@
 }
 
 /*!
- * \note The only member of the user passed here guaranteed to be set is the name field
+ * \note The only member of the dialog used here callid string
  */
 static int dialog_hash_cb(const void *obj, const int flags)
 {
@@ -1683,7 +1678,7 @@
 }
 
 /*!
- * \note The only member of the user passed here guaranteed to be set is the name field
+ * \note The only member of the dialog used here callid string
  */
 static int dialog_cmp_cb(void *obj, void *arg, int flags)
 {
@@ -1790,7 +1785,6 @@
 	in coming releases */
 
 /*--- PBX interface functions */
-static void check_rtp_timeout(struct sip_pvt *dialog, time_t t);
 static struct ast_channel *sip_request_call(const char *type, int format, void *data, int *cause);
 static int sip_devicestate(void *data);
 static int sip_sendtext(struct ast_channel *ast, const char *text);
@@ -1912,6 +1906,7 @@
 static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, const char *realm);
 
 /*--- Misc functions */
+static void check_rtp_timeout(struct sip_pvt *dialog, time_t t);
 static int sip_do_reload(enum channelreloadreason reason);
 static int reload_config(enum channelreloadreason reason);
 static int expire_register(const void *data);
@@ -2371,19 +2366,19 @@
  */
 static void *unref_peer(struct sip_peer *peer, char *tag)
 {
-	ao2_t_ref(peer,-1,tag);
+	ao2_t_ref(peer, -1, tag);
 	return NULL;
 }
 
 static void *unref_user(struct sip_user *user, char *tag)
 {
-	ao2_t_ref(user,-1, tag);
+	ao2_t_ref(user, -1, tag);
 	return NULL;
 }
 
 static struct sip_peer *ref_peer(struct sip_peer *peer, char *tag)
 {
-	ao2_t_ref(peer,1,tag);
+	ao2_t_ref(peer, 1,tag);
 	return peer;
 }
 
@@ -2403,25 +2398,25 @@
 		if (lockowner)
 			ast_channel_lock(dialog->owner);
 		ast_debug(1, "Detaching from channel %s\n", dialog->owner->name);
-		dialog->owner->tech_pvt = dialog_unref(dialog->owner->tech_pvt,"resetting channel dialog ptr in unlink_all");
+		dialog->owner->tech_pvt = dialog_unref(dialog->owner->tech_pvt, "resetting channel dialog ptr in unlink_all");
 		if (lockowner)
 			ast_channel_unlock(dialog->owner);
 	}
 	if (dialog->registry) {
 		if (dialog->registry->call == dialog)
-			dialog->registry->call = dialog_unref(dialog->registry->call,"nulling out the registry's call dialog field in unlink_all");
+			dialog->registry->call = dialog_unref(dialog->registry->call, "nulling out the registry's call dialog field in unlink_all");
 		dialog->registry = registry_unref(dialog->registry, "delete dialog->registry");
 	}
 	if (dialog->initid > -1) {
 		if (ast_sched_del(sched, dialog->initid)==0)
-			dialog_unref(dialog,"when you delete the initid sched, you should dec the refcount for the stored dialog ptr");
+			dialog_unref(dialog, "when you delete the initid sched, you should dec the refcount for the stored dialog ptr");
 		dialog->initid = -1;
 	}
 	
 	if (dialog->autokillid > -1) {
 		dialog->autokillid = -1;
 		if (ast_sched_del(sched, dialog->autokillid)==0)
-			dialog_unref(dialog,"when you delete the autokillid sched, you should dec the refcount for the stored dialog ptr");
+			dialog_unref(dialog, "when you delete the autokillid sched, you should dec the refcount for the stored dialog ptr");
 	}
 	return NULL;
 }
@@ -2960,7 +2955,7 @@
 	/* I removed the code from retrans_pkt that does the same thing so it doesn't get loaded into the scheduler */
 	/* According to the RFC some packets need to be retransmitted even if its TCP, so this needs to get revisited */
 	if (!(p->socket.type & SIP_TRANSPORT_UDP)) {
-		xmitres = __sip_xmit(dialog_ref(p,"pasing dialog ptr into callback..."), data, len);	/* Send packet */
+		xmitres = __sip_xmit(dialog_ref(p, "pasing dialog ptr into callback..."), data, len);	/* Send packet */
 		if (xmitres == XMIT_ERROR) {	/* Serious network trouble, no need to try again */
 			append_history(p, "XmitErr", "%s", fatal ? "(Critical)" : "(Non-critical)");
 			return AST_FAILURE;
@@ -2979,7 +2974,7 @@
 	pkt->seqno = seqno;
 	pkt->is_resp = resp;
 	pkt->is_fatal = fatal;
-	pkt->owner = dialog_ref(p,"__sip_reliable_xmit: setting pkt->owner");
+	pkt->owner = dialog_ref(p, "__sip_reliable_xmit: setting pkt->owner");
 	pkt->next = p->packets;
 	p->packets = pkt;	/* Add it to the queue */
 	pkt->timer_t1 = p->timer_t1;	/* Set SIP timer T1 */
@@ -3028,7 +3023,7 @@
 
 	if (p->subscribed == MWI_NOTIFICATION)
 		if (p->relatedpeer)
-			p->relatedpeer = unref_peer(p->relatedpeer,"__sip_autodestruct: unref peer p->relatedpeer");	/* Remove link to peer. If it's realtime, make sure it's gone from memory) */
+			p->relatedpeer = unref_peer(p->relatedpeer, "__sip_autodestruct: unref peer p->relatedpeer");	/* Remove link to peer. If it's realtime, make sure it's gone from memory) */
 
 	/* Reset schedule ID */
 	if (p->autokillid != -1) {
@@ -3036,26 +3031,26 @@
 		res3 = ast_sched_del(sched, p->autokillid);
 		append_history(p, "CancelDestroy", "");
 		p->autokillid = -1;
-		if (res3 == 0)
-			dialog_unref(p,"dialog unrefd because autokillid sched is being deleted");
+		if (!res3)
+			dialog_unref(p, "dialog unrefd because autokillid sched is being deleted");
 	}
 	
 
 	if (p->owner) {
 		ast_log(LOG_WARNING, "Autodestruct on dialog '%s' with owner in place (Method: %s)\n", p->callid, sip_methods[p->method].text);
 		ast_queue_hangup(p->owner);
-		dialog_unref(p,"unref dialog when owner is set");
+		dialog_unref(p, "unref dialog when owner is set");
 	} else if (p->refer) {
 		ast_debug(3, "Finally hanging up channel after transfer: %s\n", p->callid);
 		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
 		append_history(p, "ReferBYE", "Sending BYE on transferer call leg %s", p->callid);
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
-		dialog_unref(p,"unref dialog when refer is set");
+		dialog_unref(p, "unref dialog when refer is set");
 	} else {
 		append_history(p, "AutoDestroy", "%s", p->callid);
 		ast_debug(3, "Auto destroying SIP dialog '%s'\n", p->callid);
 		dialog_unlink_all(p, TRUE, TRUE); /* once it's unlinked and unrefd everywhere, it'll be freed automagically */
-		dialog_unref(p,"unref dialog-- no other matching conditions"); /* theoretically, this should be the last ref to this dialog */
+		dialog_unref(p, "unref dialog-- no other matching conditions"); /* theoretically, this should be the last ref to this dialog */
 		/* sip_destroy(p); */		/* Go ahead and destroy dialog. All attempts to recover is done */
 		/* sip_destroy also absorbs the reference */
 	}
@@ -3079,7 +3074,7 @@
 
 	if (p->do_history)
 		append_history(p, "SchedDestroy", "%d ms", ms);
-	p->autokillid = ast_sched_add(sched, ms, __sip_autodestruct, dialog_ref(p,"setting ref as passing into ast_sched_add for __sip_autodestruct"));
+	p->autokillid = ast_sched_add(sched, ms, __sip_autodestruct, dialog_ref(p, "setting ref as passing into ast_sched_add for __sip_autodestruct"));
 
 	if (p->stimer && p->stimer->st_active == TRUE && p->stimer->st_schedid > 0)
 		stop_session_timer(p);
@@ -3098,8 +3093,8 @@
 			append_history(p, "CancelDestroy", "");
 			p->autokillid = -1;
 		}
-		if (res3 == 0)
-			dialog_unref(p,"dialog unrefd because autokillid is de-sched'd");
+		if (!res3)
+			dialog_unref(p, "dialog unrefd because autokillid is de-sched'd");
 	}
 	return res;
 }
@@ -3576,15 +3571,13 @@
 	/* Delete it, it needs to disappear */
 	if (peer->call) {
 		dialog_unlink_all(peer->call, TRUE, TRUE);
-		peer->call = dialog_unref(peer->call,"peer->call is being unset");
-		/* peer->call = sip_destroy(peer->call); */
+		peer->call = dialog_unref(peer->call, "peer->call is being unset");
 	}
 	
 
 	if (peer->mwipvt) {	/* We have an active subscription, delete it */
 		dialog_unlink_all(peer->mwipvt, TRUE, TRUE);
 		peer->mwipvt = dialog_unref(peer->mwipvt, "unreffing peer->mwipvt");
-		/* peer->mwipvt = sip_destroy(peer->mwipvt); */
 	}
 	
 	if (peer->chanvars) {
@@ -3617,12 +3610,12 @@
 	register_peer_exten(peer, FALSE);
 	ast_free_ha(peer->ha);
 	if (peer->selfdestruct)
-		apeerobjs--;
+		ast_atomic_fetchadd_int(&apeerobjs, -1);
 	else if (peer->is_realtime) {
-		rpeerobjs--;
-		ast_debug(3,"-REALTIME- peer Destroyed. Name: %s. Realtime Peer objects: %d\n", peer->name, rpeerobjs);
+		ast_atomic_fetchadd_int(&rpeerobjs, -1);
+		ast_debug(3, "-REALTIME- peer Destroyed. Name: %s. Realtime Peer objects: %d\n", peer->name, rpeerobjs);
 	} else
-		speerobjs--;
+		ast_atomic_fetchadd_int(&speerobjs, -1);
 	clear_realm_authentication(peer->auth);
 	peer->auth = NULL;
 	if (peer->dnsmgr)
@@ -3670,6 +3663,8 @@
 /*! \brief  realtime_peer: Get peer from realtime storage
  * Checks the "sippeers" realtime family from extconfig.conf 
  * Checks the "sipregs" realtime family from extconfig.conf if it's configured.
+ * This returns a pointer to a peer and because we use build_peer, we can rest
+ * assured that the refcount is bumped.
 */
 static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_in *sin)
 {
@@ -3828,11 +3823,11 @@
 		return NULL;
 	}
 
-	ast_debug(3,"-REALTIME- loading peer from database to memory. Name: %s. Peer objects: %d\n", peer->name, rpeerobjs);
+	ast_debug(3, "-REALTIME- loading peer from database to memory. Name: %s. Peer objects: %d\n", peer->name, rpeerobjs);
 
 	if (ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
 		/* Cache peer */
-		ast_copy_flags(&peer->flags[1],&global_flags[1], SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
+		ast_copy_flags(&peer->flags[1], &global_flags[1], SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
 		if (ast_test_flag(&global_flags[1], SIP_PAGE2_RTAUTOCLEAR)) {
 			AST_SCHED_REPLACE(peer->expire, sched, global_rtautoclear * 1000, expire_register, (void *) peer); /* HUH? peer is a refcounted object, and we are storing it in the sched struct, so 
 																   really, really, we should be incr. its refcount right here, but I guess, since
@@ -3840,9 +3835,6 @@
 		}
 		ao2_t_link(peers, peer, "link peer into peers table");
 		if (peer->addr.sin_addr.s_addr) {
-			char buf8[20];
-			addr2str(&peer->addr,buf8);
-			ast_log(LOG_NOTICE,"Inserted %s into peers_by_ip\n", buf8);
 			ao2_t_link(peers_by_ip, peer, "link peer into peers_by_ip table");
 		}
 		
@@ -3859,87 +3851,31 @@
 	return peer;
 }
 
-
-
-#ifdef NO_MORE
-/*! \brief Support routine for find_peer */
-static int sip_addrcmp(char *name, struct sockaddr_in *sin)
-{
-	/* We know name is the first field, so we can cast */
-	struct sip_peer *p = (struct sip_peer *) name;
-	return 	!(!inaddrcmp(&p->addr, sin) || 
-					(ast_test_flag(&p->flags[0], SIP_INSECURE_PORT) &&
-					(p->addr.sin_addr.s_addr == sin->sin_addr.s_addr)));
-}
-#endif
-
-/*! \brief Locate peer by name or ip address 
- *	This is used on incoming SIP message to find matching peer on ip
-	or outgoing message to find matching peer on name 
-	\note Avoid using this function in new functions if there's a way to avoid it, i
-	since it causes a database lookup or a traversal of the in-memory peer list.
-*/
-static void addr2str(struct sockaddr_in *sin, char *buf)
-{
-	int a,b,c,d;
-	a = (sin->sin_addr.s_addr >> 24);
-	b = (sin->sin_addr.s_addr & 0x00ff0000) >> 16;
-	c = (sin->sin_addr.s_addr & 0x0000ff00) >> 8;
-	d = (sin->sin_addr.s_addr & 0xff);
-	sprintf(buf,"%d.%d.%d.%d (%x)", d,c,b,a, sin->sin_addr.s_addr);
-}
-
 static struct sip_peer *find_peer(const char *peer, struct sockaddr_in *sin, int realtime)
 {
 	struct sip_peer *p = NULL;
 	struct sip_peer tmp_peer;
 	
-	if (peer)
-	{
+	if (peer) {
 		ast_copy_string(tmp_peer.name, peer, sizeof(tmp_peer.name));
-		p = ao2_t_find(peers, &tmp_peer, OBJ_POINTER,"ao2_find in peers table");
+		p = ao2_t_find(peers, &tmp_peer, OBJ_POINTER, "ao2_find in peers table");
 	} else if (sin) { /* search by addr? */
 		tmp_peer.addr.sin_addr.s_addr = sin->sin_addr.s_addr;
 		tmp_peer.addr.sin_port = sin->sin_port;
 		tmp_peer.flags[0].flags = 0;
-		p = ao2_t_find(peers_by_ip, &tmp_peer, OBJ_POINTER,"ao2_find in peers_by_ip table"); /* WAS:  p = ASTOBJ_CONTAINER_FIND_FULL(&peerl, sin, name, sip_addr_hashfunc, 1, sip_addrcmp); */
+		p = ao2_t_find(peers_by_ip, &tmp_peer, OBJ_POINTER, "ao2_find in peers_by_ip table"); /* WAS:  p = ASTOBJ_CONTAINER_FIND_FULL(&peerl, sin, name, sip_addr_hashfunc, 1, sip_addrcmp); */
 		if (!p) {
-			struct ao2_iterator i;
-			char ad[40];
-			struct sip_peer *d2;
 			ast_set_flag(&tmp_peer.flags[0], SIP_INSECURE_PORT);
-			p = ao2_t_find(peers_by_ip, &tmp_peer, OBJ_POINTER,"ao2_find in peers_by_ip table 2"); /* WAS:  p = ASTOBJ_CONTAINER_FIND_FULL(&peerl, sin, name, sip_addr_hashfunc, 1, sip_addrcmp); */
+			p = ao2_t_find(peers_by_ip, &tmp_peer, OBJ_POINTER, "ao2_find in peers_by_ip table 2"); /* WAS:  p = ASTOBJ_CONTAINER_FIND_FULL(&peerl, sin, name, sip_addr_hashfunc, 1, sip_addrcmp); */
 			if (p) {
 				return p;
 			}
-			
-			addr2str(sin, ad);
-			ast_log(LOG_NOTICE,"Couldn't find sin=> %s...\n", ad);
-			i = ao2_iterator_init(peers_by_ip, 0);
-				
-			while ((d2 = ao2_t_iterator_next(&i,"iterate thru peers_by_ip "))) {
-				addr2str(&d2->addr, ad);
-				ast_log(LOG_NOTICE, "Peers_by_ip:  %s\n", ad);
-				ao2_t_ref(d2,-1,"done with d2 pointer");
-			}
 		}
 	}
 
 	if (!p && realtime)
 		p = realtime_peer(peer, sin);
 
-#ifdef FIND_PEER_DEBUG
-	int rc;
-	if (!p && !sin)
-		ast_log(LOG_NOTICE,"Did not find peer %s\n", peer);
-	else if (!p)
-		ast_log(LOG_NOTICE,"Did not find peer %s / addr=%d port=%d\n", peer, sin->sin_addr.s_addr, sin->sin_port);
-
-	if (p) {
-		rc = ao2_t_ref(p,0,"");
-		ast_log(LOG_NOTICE,"FOUND peer %s refcount = %d\n", peer, rc);
-	}
-#endif
 	return p;
 }
 
@@ -3960,13 +3896,14 @@
 		user->chanvars = NULL;
 	}
 	if (user->is_realtime)
-		ruserobjs--;
+		ast_atomic_fetchadd_int(&ruserobjs, -1);
 	else
-		suserobjs--;
+		ast_atomic_fetchadd_int(&suserobjs, -1);
 }
 
 /*! \brief Load user from realtime storage
  * Loads user from "sipusers" category in realtime (extconfig.conf)
+ * returns a refcounted pointer to a sip_user structure.
  * Users are matched on From: user name (the domain in skipped) */
 static struct sip_user *realtime_user(const char *username)
 {
@@ -3996,12 +3933,12 @@
 
 	if (ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
 		ast_set_flag(&user->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
-		suserobjs++;
+		ast_atomic_fetchadd_int(&suserobjs, 1);
 		ao2_t_link(users, user, "link user into users table");
 	} else {
 		/* Move counter from s to r... */
-		suserobjs--;
-		ruserobjs++;
+		ast_atomic_fetchadd_int(&suserobjs, -1);
+		ast_atomic_fetchadd_int(&ruserobjs, 1);
 		user->is_realtime = 1;
 	}
 	ast_variables_destroy(var);
@@ -4069,8 +4006,6 @@
  *
  * \return -1 on error, 0 on success.
  *
- * \todo XXX This function is written in such a way that it expects the dialog to be locked.
- * Is this actually true?
  */
 static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer)
 {
@@ -4158,9 +4093,9 @@
 			c = strchr(tmpcall, '@');
 			if (c) {
 				*c = '\0';
-				ao2_t_unlink(dialogs,dialog,"About to change the callid -- remove the old name");
+				ao2_t_unlink(dialogs, dialog, "About to change the callid -- remove the old name");
 				ast_string_field_build(dialog, callid, "%s@%s", tmpcall, peer->fromdomain);
-				ao2_t_link(dialogs,dialog,"New dialog callid -- inserted back into table");
+				ao2_t_link(dialogs, dialog, "New dialog callid -- inserted back into table");
 			}
 		}
 	}
@@ -4220,7 +4155,7 @@
 
 	if (peer) {
 		int res = create_addr_from_peer(dialog, peer);
-		unref_peer(peer,"create_addr: unref peer from find_peer hashtab lookup");
+		unref_peer(peer, "create_addr: unref peer from find_peer hashtab lookup");
 		return res;
 	}
 
@@ -4279,7 +4214,7 @@
 		}
 	}
 	sip_pvt_unlock(p);
-	dialog_unref(p,"unreffing arg passed into auto_congest callback (p->initid)");
+	dialog_unref(p, "unreffing arg passed into auto_congest callback (p->initid)");
 	return 0;
 }
 
@@ -4321,7 +4256,7 @@
 			p->options->replaces = ast_var_value(current);
 		} else if (!strcasecmp(ast_var_name(current), "T38CALL")) {
 			p->t38.state = T38_LOCAL_DIRECT;
-			ast_debug(1,"T38State change to %d on channel %s\n", p->t38.state, ast->name);
+			ast_debug(1, "T38State change to %d on channel %s\n", p->t38.state, ast->name);
 		}
 
 	}
@@ -4359,7 +4294,7 @@
 		int xmitres;
 
 		p->t38.jointcapability = p->t38.capability;
-		ast_debug(2,"Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
+		ast_debug(2, "Our T38 capability (%d), joint T38 capability (%d)\n", p->t38.capability, p->t38.jointcapability);
 
 		xmitres = transmit_invite(p, SIP_INVITE, 1, 2);
 		if (xmitres == XMIT_ERROR)
@@ -4367,7 +4302,7 @@
 		p->invitestate = INV_CALLING;
 	
 		/* Initialize auto-congest time */
-		AST_SCHED_REPLACE(p->initid, sched, p->timer_b, auto_congest, dialog_ref(p,"sched:replace:this is a pointer for the autocongest callback to use (p->initid)"));
+		AST_SCHED_REPLACE(p->initid, sched, p->timer_b, auto_congest, p /* replace should not affect the refcount */);
 	}
 	return res;
 }
@@ -4385,17 +4320,17 @@
 		reg->call->registry = registry_unref(reg->call->registry, "destroy reg->call->registry");
 		ast_debug(3, "Destroying active SIP dialog for registry %s@%s\n", reg->username, reg->hostname);
 		dialog_unlink_all(reg->call, TRUE, TRUE);
-		reg->call = dialog_unref(reg->call,"unref reg->call");
+		reg->call = dialog_unref(reg->call, "unref reg->call");
 		/* reg->call = sip_destroy(reg->call); */
 	}
 	AST_SCHED_DEL(sched, reg->expire);  /* HUH?  normally, if reg were being refcounted thru sched calls, we'd
 											   add code after this to unref the reg */
 	
-	AST_SCHED_DEL(sched, reg->timeout);   /* HUH?  normally, if peer were being refcounted thru sched calls, we'd
-											   add code after this to unref the peer */
+	AST_SCHED_DEL(sched, reg->timeout);   /* HUH?  normally, if reg were being refcounted thru sched calls, we'd
+											   add code after this to unref the reg */
 	
 	ast_string_field_free_memory(reg);
-	regobjs--;
+	ast_atomic_fetchadd_int(&regobjs, -1);
 	ast_free(reg);
 	
 }
@@ -4419,7 +4354,7 @@
 	
 	if (p->registry) {
 		if (p->registry->call == p)
-			p->registry->call = dialog_unref(p->registry->call,"nulling out the registry's call dialog field in unlink_all");
+			p->registry->call = dialog_unref(p->registry->call, "nulling out the registry's call dialog field in unlink_all");
 		p->registry = registry_unref(p->registry, "delete p->registry");
 	}
 	
@@ -4431,9 +4366,9 @@
 
 	if (p->stateid > -1)
 		ast_extension_state_del(p->stateid, NULL);
-	AST_SCHED_DEL_UNREF(sched, p->initid,dialog_unref(p,"when you delete the initid sched, you should dec the refcount for the stored dialog ptr"));
-	AST_SCHED_DEL_UNREF(sched, p->waitid, dialog_unref(p,"when you delete the waitid sched, you should dec the refcount for the stored dialog ptr"));
-	AST_SCHED_DEL_UNREF(sched, p->autokillid,dialog_unref(p,"when you delete the autokillid sched, you should dec the refcount for the stored dialog ptr"));
+	AST_SCHED_DEL_UNREF(sched, p->initid, dialog_unref(p, "when you delete the initid sched, you should dec the refcount for the stored dialog ptr"));
+	AST_SCHED_DEL_UNREF(sched, p->waitid, dialog_unref(p, "when you delete the waitid sched, you should dec the refcount for the stored dialog ptr"));
+	AST_SCHED_DEL_UNREF(sched, p->autokillid, dialog_unref(p, "when you delete the autokillid sched, you should dec the refcount for the stored dialog ptr"));
 
 	if (p->rtp)
 		ast_rtp_destroy(p->rtp);
@@ -4481,7 +4416,7 @@
 	while((cp = p->packets)) {
 		p->packets = p->packets->next;
 		AST_SCHED_DEL(sched, cp->retransid);
-		dialog_unref(cp->owner,"remove all current packets in this dialog, and the pointer to the dialog too");
+		dialog_unref(cp->owner, "remove all current packets in this dialog, and the pointer to the dialog too");
 		ast_free(cp);
 	}
 	if (p->chanvars) {
@@ -4570,7 +4505,7 @@
 			if (*inuse >= *call_limit) {
 				ast_log(LOG_ERROR, "Call %s %s '%s' rejected due to usage limit of %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *call_limit);
 				if (u)
-					unref_user(u,"update_call_counter: unref user u call limit exceeded");
+					unref_user(u, "update_call_counter: unref user u call limit exceeded");
 				else
 					unref_peer(p, "update_call_counter: unref peer p, call limit exceeded");
 				return -1; 
@@ -4602,9 +4537,9 @@
 	}
 	if (p) {
 		ast_device_state_changed("SIP/%s", p->name);
-		unref_peer(p,"update_call_counter: unref_peer from call counter");
+		unref_peer(p, "update_call_counter: unref_peer from call counter");
 	} else /* u must be set */
-		unref_user(u,"update_call_counter: unref_user from call counter");
+		unref_user(u, "update_call_counter: unref_user from call counter");
 	return 0;
 }
 
@@ -4945,7 +4880,7 @@
 				   but we can't send one while we have "INVITE" outstanding. */
 				ast_set_flag(&p->flags[0], SIP_PENDINGBYE);	
 				ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);	
-				AST_SCHED_DEL_UNREF(sched, p->waitid, dialog_unref(p,"when you delete the waitid sched, you should dec the refcount for the stored dialog ptr"));
+				AST_SCHED_DEL_UNREF(sched, p->waitid, dialog_unref(p, "when you delete the waitid sched, you should dec the refcount for the stored dialog ptr"));
 				if (sip_cancel_destroy(p))
 					ast_log(LOG_WARNING, "Unable to cancel SIP destruction.  Expect bad things.\n");
 			}
@@ -4995,7 +4930,7 @@
 		ast_debug(1, "SIP answering channel: %s\n", ast->name);
 		if (p->t38.state == T38_PEER_DIRECT) {
 			p->t38.state = T38_ENABLED;
-			ast_debug(2,"T38State change to %d on channel %s\n", p->t38.state, ast->name);
+			ast_debug(2, "T38State change to %d on channel %s\n", p->t38.state, ast->name);
 			res = transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
 		} else 
 			res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE);
@@ -5316,7 +5251,7 @@
 	
 		if (title)
 			my_name = title;
-		else if ( (my_name = strchr(i->fromdomain,':')) )
+		else if ( (my_name = strchr(i->fromdomain, ':')) )
 			my_name++;	/* skip ':' */
 		else
 			my_name = i->fromdomain;
@@ -5711,7 +5646,7 @@
 	if (faxdetected && ast_test_flag(&p->t38.t38support, SIP_PAGE2_T38SUPPORT_UDPTL) && (p->t38.state == T38_DISABLED) && !(ast_bridged_channel(ast))) {
 		if (!ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 			if (!p->pendinginvite) {
-				ast_debug(3, "Sending reinvite on SIP (%s) for T.38 negotiation.\n",ast->name);
+				ast_debug(3, "Sending reinvite on SIP (%s) for T.38 negotiation.\n", ast->name);
 				p->t38.state = T38_LOCAL_REINVITE;
 				transmit_reinvite_with_sdp(p, TRUE, FALSE);
 				ast_debug(2, "T38 state changed to %d on channel %s\n", p->t38.state, ast->name);
@@ -5800,7 +5735,7 @@
 		return NULL;
 
 	if (ast_string_field_init(p, 512)) {
-		ao2_t_ref(p,-1,"failed to string_field_init, drop p");
+		ao2_t_ref(p, -1, "failed to string_field_init, drop p");
 		ast_free(p);
 		return NULL;
 	}
@@ -5858,7 +5793,7 @@
 				ast_variables_destroy(p->chanvars);
 				p->chanvars = NULL;
 			}
-			ao2_t_ref(p,-1,"failed to create RTP audio session, drop p");
+			ao2_t_ref(p, -1, "failed to create RTP audio session, drop p");
 			return NULL;
 		}
 		ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio, "SIP RTP");
@@ -5942,11 +5877,7 @@
 	struct find_call_cb_arg *arg = __arg;
 	/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
 	int found = FALSE;
-	static int prof_id = -1;
-	if (prof_id == -1)
-		prof_id = ast_add_profile("find_call_cb", 0);
 	
-	ast_mark(prof_id, 1);
 	if (!ast_strlen_zero(p->callid)) { /* XXX double check, do we allow match on empty p->callid ? */
 		if (arg->method == SIP_REGISTER)
  	  	  	found = (!strcmp(p->callid, arg->callid));
@@ -5970,7 +5901,6 @@
 				ast_debug(5, "= Being pedantic: This is not our match on request: Call ID: %s Ourtag <null> Totag %s Method %s\n", p->callid, arg->totag, sip_methods[arg->method].text);
 		}
 	}
-	ast_mark(prof_id, 0);
  	return found;
 }
 
@@ -5990,21 +5920,12 @@
 	const char *from = get_header(req, "From");
 	const char *to = get_header(req, "To");
 	const char *cseq = get_header(req, "Cseq");
-	struct sip_pvt tmp_dialog, *sip_pvt_ptr;
-
-	static int prof_head = -1, prof_find = -1, prof_tail = -1;
-	if (prof_head == -1) {
-		prof_head = ast_add_profile("find_call-headers", 0);
-		prof_find = ast_add_profile("find_call-find", 0);
-		prof_tail = ast_add_profile("find_call-tail", 0);
-	}
-	ast_mark(prof_head, 1);
+	struct sip_pvt *sip_pvt_ptr;
 
 	callid = get_header(req, "Call-ID");
 	from = get_header(req, "From");
 	to = get_header(req, "To");
 	cseq = get_header(req, "Cseq");
-	ast_mark(prof_head, 0);
 
 	/* Call-ID, to, from and Cseq are required by RFC 3261. (Max-forwards and via too - ignored now) */
 	/* get_header always returns non-NULL so we must use ast_strlen_zero() */
@@ -6045,49 +5966,40 @@
 		}
 	}
 
-	ast_mark(prof_find, 1);
-
 	if (!pedanticsipchecking) {
-		if (!ast_string_field_init(&tmp_dialog, 100)) {
-			ast_string_field_set(&tmp_dialog, callid, callid);
+		struct sip_pvt tmp_dialog = {
+			.callid = callid,
+		};			
+		sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find in dialogs");
+#ifdef DIALOG_DEBUG
+		if (sip_pvt_ptr) {
+			int rc;
+			rc = ao2_t_ref(sip_pvt_ptr, 0, "");
+		}
+		if (!sip_pvt_ptr) {
+			struct ao2_iterator i;
+			struct sip_pvt *d2;
 			
-			sip_pvt_ptr = ao2_t_find(dialogs, &tmp_dialog, OBJ_POINTER, "ao2_find in dialogs");
-#ifdef DIALOG_DEBUG
-			if (sip_pvt_ptr) {
-				int rc;
-				rc = ao2_t_ref(sip_pvt_ptr,0,"");
+			i = ao2_iterator_init(dialogs, 0);
+			
+			while ((d2 = ao2_t_iterator_next(&i, "iterate thru dialogs "))) {
+				ast_log(LOG_NOTICE, "Dialogs:  %s\n", d2->callid);
+				ao2_t_ref(d2, -1, "done with d2 pointer");
 			}
-			if (!sip_pvt_ptr) {
-				struct ao2_iterator i;
-				struct sip_pvt *d2;
-				
-				i = ao2_iterator_init(dialogs, 0);
-				
-				while ((d2 = ao2_t_iterator_next(&i,"iterate thru dialogs "))) {
-					ast_log(LOG_NOTICE, "Dialogs:  %s\n", d2->callid);
-					ao2_t_ref(d2,-1,"done with d2 pointer");
-				}
-			}
+		}
 #endif
-			ast_string_field_free_memory(&tmp_dialog);
-			if (sip_pvt_ptr) {  /* well, if we don't find it-- what IS in there? */
-				/* Found the call */
-				sip_pvt_lock(sip_pvt_ptr);
-				return sip_pvt_ptr;
-			}
-		} else { /* in pedantic mode! -- do the fancy linear search */
-			p = ao2_t_callback(dialogs, 0 /* single, data */, find_call_cb, &arg, "pedantic linear search for dialog");
-			if (p) {
-                sip_pvt_lock(p);
-                ast_mark(prof_find, 0);
-                return p;
-			}
-		}
-		
-	}
-	ast_mark(prof_find, 0);
-	
-	ast_mark(prof_tail, 1);
+		if (sip_pvt_ptr) {  /* well, if we don't find it-- what IS in there? */
+			/* Found the call */
+			sip_pvt_lock(sip_pvt_ptr);
+			return sip_pvt_ptr;
+		}
+	} else { /* in pedantic mode! -- do the fancy linear search */
+		p = ao2_t_callback(dialogs, 0 /* single, data */, find_call_cb, &arg, "pedantic linear search for dialog");
+		if (p) {
+			sip_pvt_lock(p);
+			return p;
+		}
+	}
  
 	/* See if the method is capable of creating a dialog */
 	if (sip_methods[intended_method].can_create == CAN_CREATE_DIALOG) {
@@ -6116,7 +6028,6 @@
 				ast_debug(4, "Failed allocating SIP dialog, sending 500 Server internal error and giving up\n");
 			}
 		}
-		ast_mark(prof_tail, 0);
 		return p; /* can be NULL */
 	} else if( sip_methods[intended_method].can_create == CAN_CREATE_DIALOG_UNSUPPORTED_METHOD) {
 		/* A method we do not support, let's take it on the volley */
@@ -6132,7 +6043,6 @@
 	if (intended_method == SIP_RESPONSE)
 		ast_debug(2, "That's odd...  Got a response on a call we dont know about. Callid %s\n", callid ? callid : "<unknown>");
 
-	ast_mark(prof_tail, 0);
 	return NULL;
 }
 
@@ -6217,7 +6127,7 @@
 		return -1;
 	}
 
-	regobjs++;
+	ast_atomic_fetchadd_int(&regobjs, 1);
 	ASTOBJ_INIT(reg);
 	ast_string_field_set(reg, callback, callback);
 	if (!ast_strlen_zero(username))
@@ -6237,7 +6147,7 @@
 	reg->callid_valid = FALSE;
 	reg->ocseq = INITIAL_CSEQ;
 	ASTOBJ_CONTAINER_LINK(&regl, reg); /* Add the new registry entry to the list */
-	registry_unref(reg,"unref the reg pointer");	/* release the reference given by ASTOBJ_INIT. The container has another reference */
+	registry_unref(reg, "unref the reg pointer");	/* release the reference given by ASTOBJ_INIT. The container has another reference */
 	return 0;
 }
 
@@ -6707,7 +6617,7 @@
 			sin.sin_port = htons(udptlportno);
 			ast_udptl_set_peer(p->udptl, &sin);
 			if (debug)
-				ast_debug(1,"Peer T.38 UDPTL is at port %s:%d\n",ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
+				ast_debug(1, "Peer T.38 UDPTL is at port %s:%d\n", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
 		} else {
 			ast_udptl_stop(p->udptl);
 			if (debug)
@@ -6840,7 +6750,7 @@
 					if (debug) 
 						ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec);
 				}
-			} else if (!strncasecmp(mimeSubtype, "T140",4)) { /* Text */
+			} else if (!strncasecmp(mimeSubtype, "T140", 4)) { /* Text */
 				if (p->trtp) {
 					/* ast_verbose("Adding t140 mimeSubtype to textrtp struct\n"); */
 					ast_rtp_set_rtpmap_type(newtextrtp, codec, "text", mimeSubtype, 0);
@@ -6872,10 +6782,10 @@
 		while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
 			if ((sscanf(a, "T38FaxMaxBuffer:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3, "MaxBufferSize:%d\n",x);
+				ast_debug(3, "MaxBufferSize:%d\n", x);
 			} else if ((sscanf(a, "T38MaxBitRate:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3,"T38MaxBitRate: %d\n",x);
+				ast_debug(3, "T38MaxBitRate: %d\n", x);
 				switch (x) {
 				case 14400:
 					peert38capability |= T38FAX_RATE_14400 | T38FAX_RATE_12000 | T38FAX_RATE_9600 | T38FAX_RATE_7200 | T38FAX_RATE_4800 | T38FAX_RATE_2400;
@@ -6898,30 +6808,30 @@
 				}
 			} else if ((sscanf(a, "T38FaxVersion:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3, "FaxVersion: %d\n",x);
+				ast_debug(3, "FaxVersion: %d\n", x);
 				if (x == 0)
 					peert38capability |= T38FAX_VERSION_0;
 				else if (x == 1)
 					peert38capability |= T38FAX_VERSION_1;
 			} else if ((sscanf(a, "T38FaxMaxDatagram:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3, "FaxMaxDatagram: %d\n",x);
+				ast_debug(3, "FaxMaxDatagram: %d\n", x);
 				ast_udptl_set_far_max_datagram(p->udptl, x);
 				ast_udptl_set_local_max_datagram(p->udptl, x);
 			} else if ((sscanf(a, "T38FaxFillBitRemoval:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3, "FillBitRemoval: %d\n",x);
+				ast_debug(3, "FillBitRemoval: %d\n", x);
 				if (x == 1)
 					peert38capability |= T38FAX_FILL_BIT_REMOVAL;
 			} else if ((sscanf(a, "T38FaxTranscodingMMR:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3, "Transcoding MMR: %d\n",x);
+				ast_debug(3, "Transcoding MMR: %d\n", x);
 				if (x == 1)
 					peert38capability |= T38FAX_TRANSCODING_MMR;
 			}
 			if ((sscanf(a, "T38FaxTranscodingJBIG:%d", &x) == 1)) {
 				found = 1;
-				ast_debug(3, "Transcoding JBIG: %d\n",x);
+				ast_debug(3, "Transcoding JBIG: %d\n", x);
 				if (x == 1)
 					peert38capability |= T38FAX_TRANSCODING_JBIG;
 			} else if ((sscanf(a, "T38FaxRateManagement:%255s", s) == 1)) {
@@ -7504,7 +7414,7 @@
 	}
 
 	/* Check for strict or loose router */
-	if (p->route && !ast_strlen_zero(p->route->hop) && strstr(p->route->hop,";lr") == NULL) {
+	if (p->route && !ast_strlen_zero(p->route->hop) && strstr(p->route->hop, ";lr") == NULL) {
 		is_strict = TRUE;
 		if (sipdebug)
 			ast_debug(1, "Strict routing enforced for session %s\n", p->callid);
@@ -8030,14 +7940,14 @@
 	if ((p->t38.jointcapability & T38FAX_VERSION) == T38FAX_VERSION_1)
 		ast_str_append(&a_modem, 0, "a=T38FaxVersion:1\r\n");
 	if ((x = t38_get_rate(p->t38.jointcapability)))
-		ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%d\r\n",x);
+		ast_str_append(&a_modem, 0, "a=T38MaxBitRate:%d\r\n", x);
 	ast_str_append(&a_modem, 0, "a=T38FaxFillBitRemoval:%d\r\n", (p->t38.jointcapability & T38FAX_FILL_BIT_REMOVAL) ? 1 : 0);
 	ast_str_append(&a_modem, 0, "a=T38FaxTranscodingMMR:%d\r\n", (p->t38.jointcapability & T38FAX_TRANSCODING_MMR) ? 1 : 0);
 	ast_str_append(&a_modem, 0, "a=T38FaxTranscodingJBIG:%d\r\n", (p->t38.jointcapability & T38FAX_TRANSCODING_JBIG) ? 1 : 0);
 	ast_str_append(&a_modem, 0, "a=T38FaxRateManagement:%s\r\n", (p->t38.jointcapability & T38FAX_RATE_MANAGEMENT_LOCAL_TCF) ? "localTCF" : "transferredTCF");
 	x = ast_udptl_get_local_max_datagram(p->udptl);
-	ast_str_append(&a_modem, 0, "a=T38FaxMaxBuffer:%d\r\n",x);
-	ast_str_append(&a_modem, 0, "a=T38FaxMaxDatagram:%d\r\n",x);
+	ast_str_append(&a_modem, 0, "a=T38FaxMaxBuffer:%d\r\n", x);
+	ast_str_append(&a_modem, 0, "a=T38FaxMaxDatagram:%d\r\n", x);
 	if (p->t38.jointcapability != T38FAX_UDP_EC_NONE)
 		ast_str_append(&a_modem, 0, "a=T38FaxUdpEC:%s\r\n", (p->t38.jointcapability & T38FAX_UDP_EC_REDUNDANCY) ? "t38UDPRedundancy" : "t38UDPFEC");
 	len = m_modem->used + a_modem->used;
@@ -8515,7 +8425,6 @@
 static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int oldsdp)
 {
 	struct sip_request req;
-	int res;
 	
 	reqprep(&req, p, ast_test_flag(&p->flags[0], SIP_REINVITE_UPDATE) ?  SIP_UPDATE : SIP_INVITE, 0, 1);
 
@@ -8540,8 +8449,7 @@
 	p->lastinvite = p->ocseq;
 	ast_set_flag(&p->flags[0], SIP_OUTGOING);       /* Change direction of this dialog */
 
-	res = send_request(p, &req, XMIT_CRITICAL, p->ocseq);
-	return res;
+	return send_request(p, &req, XMIT_CRITICAL, p->ocseq);
 }
 
 /* \brief Remove URI parameters at end of URI, not in username part though */
@@ -8822,7 +8730,6 @@
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init)
 {
 	struct sip_request req;
-	int res;
 	
 	req.method = sipmethod;
 	if (init) {/* Bump branch even on initial requests */
@@ -8880,7 +8787,7 @@
 		headp = &chan->varshead;
 
 		if (!headp)
-			ast_log(LOG_WARNING,"No Headp for the channel...ooops!\n");
+			ast_log(LOG_WARNING, "No Headp for the channel...ooops!\n");
 		else {
 			const struct ast_var_t *current;
 			AST_LIST_TRAVERSE(headp, current, entries) {  
@@ -8925,8 +8832,7 @@
 	if (!p->initreq.headers)
 		initialize_initreq(p, &req);
 	p->lastinvite = p->ocseq;
-	res = send_request(p, &req, init ? XMIT_CRITICAL : XMIT_RELIABLE, p->ocseq);
-	return res;
+	return send_request(p, &req, init ? XMIT_CRITICAL : XMIT_RELIABLE, p->ocseq);
 }
 
 /*! \brief Used in the SUBSCRIBE notification subsystem */
@@ -9122,7 +9028,6 @@
 {
 	struct sip_request req;
 	struct ast_str *out = ast_str_alloca(500);
-	int res;
 	
 	initreqprep(&req, p, SIP_NOTIFY);
 	add_header(&req, "Event", "message-summary");
@@ -9149,18 +9054,15 @@
 
 	if (!p->initreq.headers) 
 		initialize_initreq(p, &req);
-	res = send_request(p, &req, XMIT_RELIABLE, p->ocseq);
-	return res;
+	return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
 }
 
 /*! \brief Transmit SIP request unreliably (only used in sip_notify subsystem) */
 static int transmit_sip_request(struct sip_pvt *p, struct sip_request *req)
 {
-	int res;
 	if (!p->initreq.headers) 	/* Initialize first request before sending */

[... 3438 lines stripped ...]



More information about the asterisk-commits mailing list