[asterisk-commits] rizzo: branch rizzo/astobj2 r47948 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 22 15:31:39 MST 2006


Author: rizzo
Date: Wed Nov 22 16:31:39 2006
New Revision: 47948

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47948
Log:
introduce a function record_history(p) to wrap testing
the SIP_NO_HISTORY flag.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47948&r1=47947&r2=47948
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Nov 22 16:31:39 2006
@@ -1009,6 +1009,11 @@
 							you know more) */
 };
 
+static inline int record_history(const struct sip_pvt *p)
+{
+	return !ast_test_flag(&p->flags[0], SIP_NO_HISTORY);
+}
+
 #ifdef	USE_AO2	/* astobj2 implementation */
 #include "asterisk/astobj2.h"
 ao2_container *dialogs;
@@ -2240,7 +2245,7 @@
 	}
 	if (sip_debug_test_pvt(p))
 		ast_verbose("Scheduling destruction of SIP dialog '%s' in %d ms (Method: %s)\n", p->callid, ms, sip_methods[p->method].text);
-	if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+	if (record_history(p))
 		append_history(p, "SchedDestroy", "%d ms", ms);
 
 	if (p->autokillid > -1)	/* cancel previous schedule, but keep the reference */
@@ -2377,7 +2382,7 @@
 			ast_inet_ntoa(dst->sin_addr),
 			ntohs(dst->sin_port), req->data);
 	}
-	if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY)) {
+	if (record_history(p)) {
 		struct sip_request tmp;
 		parse_copy(&tmp, req);
 		append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s - %s", tmp.data, get_header(&tmp, "CSeq"), 
@@ -2408,7 +2413,7 @@
 			ast_inet_ntoa(dst->sin_addr),
 			ntohs(dst->sin_port), req->data);
 	}
-	if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY)) {
+	if (record_history(p)) {
 		struct sip_request tmp;
 		parse_copy(&tmp, req);
 		append_history(p, reliable ? "TxReqRel" : "TxReq", "%s / %s - %s", tmp.data, get_header(&tmp, "CSeq"), sip_methods[tmp.method].text);
@@ -3690,7 +3695,7 @@
 				transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
 
 				/* Get RTCP quality before end of call */
-				if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY)) {
+				if (record_history(p)) {
 					if (p->rtp)
 						append_history(p, "RTCPaudio", "Quality:%s", audioqos);
 					if (p->vrtp)
@@ -4182,7 +4187,7 @@
 	for (v = i->chanvars ; v ; v = v->next)
 		pbx_builtin_setvar_helper(tmp,v->name,v->value);
 
-	if (!ast_test_flag(&i->flags[0], SIP_NO_HISTORY))
+	if (record_history(i))
 		append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
 
 	return tmp;
@@ -6786,7 +6791,7 @@
 	add_header(&req, "Supported", SUPPORTED_EXTENSIONS);
 	if (sipdebug)
 		add_header(&req, "X-asterisk-Info", "SIP re-invite (External RTP bridge)");
-	if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+	if (record_history(p))
 		append_history(p, "ReInv", "Re-invite sent");
 	if (t38version)
 		add_t38_sdp(&req, p);
@@ -7517,7 +7522,7 @@
 			r->timeout = ast_sched_add(sched, global_reg_timeout*1000, sip_reg_timeout, r);
 			return 0;	/* non fatal error */
 		}
-		if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+		if (record_history(p))
 			append_history(p, "RegistryInit", "Account: %s@%s", r->username, r->hostname);
 		/* Copy back Call-ID in case create_addr changed it */
 		ast_string_field_set(r, callid, p->callid);
@@ -12407,7 +12412,7 @@
 					ast_verbose("No authentication challenge, giving up for %s\n", r->hostname);
 			} else {
 				/* ok, log events, send the packet and be done */
-				if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+				if (record_history(p))
 					append_history(p, "RegistryAuth", "Try: %d", p->authtries);
 				if (sip_debug_test_pvt(p))
 					ast_verbose("Responding to challenge, registration to domain/host name %s\n", r->hostname);
@@ -13766,7 +13771,7 @@
 				if (option_debug)
 					ast_log(LOG_DEBUG, "Hm....  No sdp for the moment\n");
 			}
-			if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY)) /* This is a response, note what it was for */
+			if (record_history(p)) /* This is a response, note what it was for */
 				append_history(p, "ReInv", "Re-invite received");
 		}
 	}
@@ -14571,18 +14576,18 @@
 	ast_set_flag(&p->flags[0], SIP_ALREADYGONE);	
 
 	/* Get RTCP quality before end of call */
-	if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY) || p->owner) {
+	if (record_history(p) || p->owner) {
 		char *audioqos, *videoqos;
 		if (p->rtp) {
 			audioqos = ast_rtp_get_quality(p->rtp);
-			if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+			if (record_history(p))
 				append_history(p, "RTCPaudio", "Quality:%s", audioqos);
 			if (p->owner)
 				pbx_builtin_setvar_helper(p->owner, "RTPAUDIOQOS", audioqos);
 		}
 		if (p->vrtp) {
 			videoqos = ast_rtp_get_quality(p->vrtp);
-			if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+			if (record_history(p))
 				append_history(p, "RTCPvideo", "Quality:%s", videoqos);
 			if (p->owner)
 				pbx_builtin_setvar_helper(p->owner, "RTPVIDEOQOS", videoqos);
@@ -15268,7 +15273,7 @@
 	}
 	p->recv = sin;
 
-	if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY)) /* This is a request or response, note what it was for */
+	if (record_history(p)) /* This is a request or response, note what it was for */
 		append_history(p, "Rx", "%s / %s / %s", req.data, get_header(&req, "CSeq"), req.rlPart2);
 
 	nounlock = 0;
@@ -17227,7 +17232,7 @@
 	}
 	if (changed && !ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 		if (chan->_state != AST_STATE_UP) {	/* We are in early state */
-			if (!ast_test_flag(&p->flags[0], SIP_NO_HISTORY))
+			if (record_history(p))
 				append_history(p, "ExtInv", "Initial invite sent with remote bridge proposal.");
 			if (option_debug)
 				ast_log(LOG_DEBUG, "Early remote bridge setting SIP '%s' - Sending media to %s\n", p->callid, ast_inet_ntoa(rtp ? p->redirip.sin_addr : p->ourip));



More information about the asterisk-commits mailing list