[svn-commits] jrose: branch jrose/call_identifiers r364279 - in /team/jrose/call_identifier...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Apr 27 14:27:18 CDT 2012


Author: jrose
Date: Fri Apr 27 14:27:12 2012
New Revision: 364279

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=364279
Log:
Update previous SIP changes based on some feedback by mmichelson in https://reviewboard.asterisk.org/r/1886/

Modified:
    team/jrose/call_identifiers/channels/chan_sip.c
    team/jrose/call_identifiers/main/cli.c

Modified: team/jrose/call_identifiers/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/channels/chan_sip.c?view=diff&rev=364279&r1=364278&r2=364279
==============================================================================
--- team/jrose/call_identifiers/channels/chan_sip.c (original)
+++ team/jrose/call_identifiers/channels/chan_sip.c Fri Apr 27 14:27:12 2012
@@ -8200,7 +8200,7 @@
 {
 	struct sip_pvt *p;
 
-	if (!(p = sip_alloc(original->callid, addr, 1, SIP_INVITE, req, NULL)))  {
+	if (!(p = sip_alloc(original->callid, addr, 1, SIP_INVITE, req, original->logger_callid)))  {
 		return; /* alloc error */
 	}
 	p->invitestate = INV_TERMINATED;
@@ -8449,13 +8449,18 @@
 	/* 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;
+
+		if (intended_method == SIP_INVITE) {
+			logger_callid = ast_create_callid();
+		}
 
 		if (intended_method == SIP_REFER) {
 			/* We do support REFER, but not outside of a dialog yet */
 			transmit_response_using_temp(callid, addr, 1, intended_method, req, "603 Declined (no dialog)");
-	
+
 		/* Ok, time to create a new SIP dialog object, a pvt */
-		} else if (!(p = sip_alloc(callid, addr, 1, intended_method, req, NULL)))  {
+		} else if (!(p = sip_alloc(callid, addr, 1, intended_method, req, logger_callid)))  {
 			/* We have a memory or file/socket error (can't allocate RTP sockets or something) so we're not
 				getting a dialog from sip_alloc.
 
@@ -8466,6 +8471,10 @@
 			*/
 			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) {
@@ -23613,8 +23622,6 @@
 			res = INV_REQ_FAILED;
 			goto request_invite_cleanup;
 		} else {
-			struct ast_callid *callid;
-
 			/* If no extension was specified, use the s one */
 			/* Basically for calling to IP/Host name only */
 			if (ast_strlen_zero(p->exten))
@@ -23625,15 +23632,7 @@
 			/* First invitation - create the channel.  Allocation
 			 * failures are handled below. */
 
-			callid = ast_create_callid();
-			sip_pvt_callid_set(p, callid);
-			if (callid) {
-				ast_callid_threadassoc_add(p->logger_callid);
-			}
-
-			c = sip_new(p, AST_STATE_DOWN, S_OR(p->peername, NULL), NULL, callid);
-
-			callid = ast_callid_unref(callid);
+			c = sip_new(p, AST_STATE_DOWN, S_OR(p->peername, NULL), NULL, p->logger_callid);
 
 			if (cc_recall_core_id != -1) {
 				ast_setup_cc_recall_datastore(c, cc_recall_core_id);

Modified: team/jrose/call_identifiers/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/main/cli.c?view=diff&rev=364279&r1=364278&r2=364279
==============================================================================
--- team/jrose/call_identifiers/main/cli.c (original)
+++ team/jrose/call_identifiers/main/cli.c Fri Apr 27 14:27:12 2012
@@ -1398,6 +1398,7 @@
 #ifdef CHANNEL_TRACE
 	int trace_enabled;
 #endif
+	call_identifier_str[0] = '\0';
 
 	switch (cmd) {
 	case CLI_INIT:




More information about the svn-commits mailing list