[asterisk-commits] mmichelson: branch mmichelson/direct_media r382646 - /team/mmichelson/direct_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 7 15:39:58 CST 2013


Author: mmichelson
Date: Thu Mar  7 15:39:55 2013
New Revision: 382646

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382646
Log:
Clean up debug messages a bit.

If I don't do it now, then ... don't know when I will, really.


Modified:
    team/mmichelson/direct_media/res/res_sip_session.c

Modified: team/mmichelson/direct_media/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/direct_media/res/res_sip_session.c?view=diff&rev=382646&r1=382645&r2=382646
==============================================================================
--- team/mmichelson/direct_media/res/res_sip_session.c (original)
+++ team/mmichelson/direct_media/res/res_sip_session.c Thu Mar  7 15:39:55 2013
@@ -360,7 +360,7 @@
 		return 0;
 	}
 
-	ast_log(LOG_NOTICE, "Sending delayed %s message to %s\n", delay->method, ast_sorcery_object_get_id(session->endpoint));
+	ast_debug(3, "Sending delayed %s request to %s\n", delay->method, ast_sorcery_object_get_id(session->endpoint));
 
 	if (!strcmp(delay->method, "INVITE")) {
 		ast_sip_session_send_reinvite(session, NULL);
@@ -381,7 +381,7 @@
 		return;
 	}
 
-	ast_log(LOG_NOTICE, "Queuing delayed request to run for %s\n",
+	ast_debug(3, "Queuing delayed request to run for %s\n",
 			S_OR(ast_sorcery_object_get_id(session->endpoint), "outbound"));
 
 	ao2_ref(session, +1);
@@ -408,19 +408,17 @@
 
 	if (inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
 		/* Don't try to do anything with a hung-up call */
-		ast_log(LOG_NOTICE, "Not sending reinvite to %s because of disconnected state...\n",
+		ast_debug(3, "Not sending reinvite to %s because of disconnected state...\n",
 				S_OR(ast_sorcery_object_get_id(session->endpoint), "outbound"));
 		return 0;
 	}
 
 	if (inv_session->invite_tsx) {
 		/* We can't send a reinvite yet, so delay it */
-		ast_log(LOG_NOTICE, "Delaying sending reinvite to %s because of outstanding transaction...\n",
+		ast_debug(3, "Delaying sending reinvite to %s because of outstanding transaction...\n",
 				S_OR(ast_sorcery_object_get_id(session->endpoint), "outbound"));
 		return delay_request(session, "INVITE");
 	}
-
-	ast_log(LOG_NOTICE, "Out of curiosity, the inv state is %s\n", pjsip_inv_state_name(inv_session->state));
 
 	if (pjmedia_sdp_neg_was_answer_remote(inv_session->neg)) {
 		pjmedia_sdp_neg_get_active_remote(inv_session->neg, &last_sdp);
@@ -429,8 +427,8 @@
 	}
 	reinvite_sdp = create_local_sdp(inv_session, session, last_sdp);
 	if (pjsip_inv_reinvite(inv_session, NULL, reinvite_sdp, &tdata)) {
-		ast_log(LOG_NOTICE, "Failing to create reinvite properly?\n");
-		return 0;
+		ast_log(LOG_WARNING, "Failed to create reinvite properly.\n");
+		return -1;
 	}
 	ast_sip_session_send_request(session, tdata);
 	return 0;
@@ -449,7 +447,6 @@
 
 	if (inv_session->state == PJSIP_INV_STATE_DISCONNECTED) {
 		/* Don't try to do anything with a hung-up call */
-		ast_log(LOG_NOTICE, "Not sending because of disconnected state...\n");
 		return;
 	}
 
@@ -457,7 +454,7 @@
 		/* We can't send a request yet, so delay it */
 		char method[15];
 		ast_copy_pj_str(method, &tdata->msg->line.req.method.name, sizeof(method));
-		ast_log(LOG_NOTICE, "Delaying sending %s request to %s due to outstanding transaction\n",
+		ast_debug(3, "Delaying sending %s request to %s due to outstanding transaction\n",
 				method, S_OR(ast_sorcery_object_get_id(session->endpoint), "outbound"));
 		delay_request(session, method);
 		return;
@@ -1007,31 +1004,31 @@
 static void print_debug_details(const char *function, pjsip_inv_session *inv, pjsip_transaction *tsx)
 {
 	struct ast_sip_session *session;
-	ast_log(LOG_NOTICE, "Function %s called\n", function);
+	ast_debug(3, "Function %s called\n", function);
 	if (!inv) {
-		ast_log(LOG_NOTICE, "Transaction %p does not belong to an inv_session?\n", tsx);
-		ast_log(LOG_NOTICE, "The transaction state is %s\n", pjsip_tsx_state_str(tsx->state));
+		ast_debug(3, "Transaction %p does not belong to an inv_session?\n", tsx);
+		ast_debug(3, "The transaction state is %s\n", pjsip_tsx_state_str(tsx->state));
 		return;
 	}
 	session = inv->mod_data[session_module.id];
 	if (!session) {
-		ast_log(LOG_NOTICE, "inv_session %p has no ast session\n", inv);
+		ast_debug(3, "inv_session %p has no ast session\n", inv);
 	} else {
-		ast_log(LOG_NOTICE, "The state change pertains to the session with %s\n",
+		ast_debug(3, "The state change pertains to the session with %s\n",
 				S_OR(ast_sorcery_object_get_id(session->endpoint), "outbound"));
 	}
 	if (inv->invite_tsx) {
-		ast_log(LOG_NOTICE, "The inv session still has an invite_tsx (%p)\n", inv->invite_tsx);
+		ast_debug(3, "The inv session still has an invite_tsx (%p)\n", inv->invite_tsx);
 	} else {
-		ast_log(LOG_NOTICE, "The inv session does NOT have an invite_tsx\n");
+		ast_debug(3, "The inv session does NOT have an invite_tsx\n");
 	}
 	if (tsx) {
-		ast_log(LOG_NOTICE, "The transaction involved in this state change is %p\n", tsx);
-		ast_log(LOG_NOTICE, "The current transaction state is %s\n", pjsip_tsx_state_str(tsx->state));
+		ast_debug(3, "The transaction involved in this state change is %p\n", tsx);
+		ast_debug(3, "The current transaction state is %s\n", pjsip_tsx_state_str(tsx->state));
 	} else {
-		ast_log(LOG_NOTICE, "There is no transaction involved in this state change\n");
-	}
-	ast_log(LOG_NOTICE, "The current inv state is %s\n", pjsip_inv_state_name(inv->state));
+		ast_debug(3, "There is no transaction involved in this state change\n");
+	}
+	ast_debug(3, "The current inv state is %s\n", pjsip_inv_state_name(inv->state));
 }
 
 static void handle_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
@@ -1193,15 +1190,15 @@
 
 static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
 {
+	struct ast_sip_session *session = inv->mod_data[session_module.id];
 	print_debug_details(__PRETTY_FUNCTION__, inv, tsx);
+	if (!session) {
+		/* Transaction likely timed out after the call was hung up. Just
+		 * ignore such transaction changes
+		 */
+		return;
+	}
 	if (tsx->method.id == PJSIP_INVITE_METHOD) {
-		struct ast_sip_session *session = inv->mod_data[session_module.id];
-		if (!session) {
-			/* Transaction likely timed out after the call was hung up. Just
-			 * ignore such transaction changes
-			 */
-			return;
-		}
 		if (tsx->state == PJSIP_TSX_STATE_TERMINATED) {
 			queue_delayed_request(session);
 			if (session->endpoint->direct_media && session->channel) {




More information about the asterisk-commits mailing list