[asterisk-commits] res/res pjsip t38: Add debug statements (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Nov 21 11:14:04 CST 2015


Joshua Colp has submitted this change and it was merged.

Change subject: res/res_pjsip_t38: Add debug statements
......................................................................


res/res_pjsip_t38: Add debug statements

This patch adds some debug statements to res_pjsip_t38. These statements help
to determine which SDP negotiation callbacks are being executed, and, when
a particular callback exits, why a callback may not have applied its logic
to the local or remote SDP.

Change-Id: I61b3fb9183b7ebbb5da8e9f48b59a5d9d7042d77
---
M res/res_pjsip_t38.c
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 40899bf..dde6878 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -264,6 +264,7 @@
 	ast_udptl_set_error_correction_scheme(session_media->udptl, session->endpoint->media.t38.error_correction);
 	ast_udptl_setnat(session_media->udptl, session->endpoint->media.t38.nat);
 	ast_udptl_set_far_max_datagram(session_media->udptl, session->endpoint->media.t38.maxdatagram);
+	ast_debug(3, "UDPTL initialized on session for %s\n", ast_channel_name(session->channel));
 
 	return 0;
 }
@@ -630,10 +631,12 @@
 	struct t38_state *state;
 
 	if (!session->endpoint->media.t38.enabled) {
+		ast_debug(3, "Not deferring incoming SDP stream: T.38 not enabled on %s\n", ast_channel_name(session->channel));
 		return AST_SIP_SESSION_SDP_DEFER_NOT_HANDLED;
 	}
 
 	if (t38_initialize_session(session, session_media)) {
+		ast_debug(3, "Not deferring incoming SDP stream: Failed to initialize UDPTL on %s\n", ast_channel_name(session->channel));
 		return AST_SIP_SESSION_SDP_DEFER_ERROR;
 	}
 
@@ -646,6 +649,7 @@
 	/* If they are initiating the re-invite we need to defer responding until later */
 	if (session->t38state == T38_DISABLED) {
 		t38_change_state(session, session_media, state, T38_PEER_REINVITE);
+		ast_debug(3, "Deferring incoming SDP stream on %s for peer re-invite\n", ast_channel_name(session->channel));
 		return AST_SIP_SESSION_SDP_DEFER_NEEDED;
 	}
 
@@ -661,6 +665,7 @@
 	RAII_VAR(struct ast_sockaddr *, addrs, NULL, ast_free);
 
 	if (!session->endpoint->media.t38.enabled) {
+		ast_debug(3, "Declining; T.38 not enabled on session\n");
 		return -1;
 	}
 
@@ -669,6 +674,7 @@
 	}
 
 	if ((session->t38state == T38_REJECTED) || (session->t38state == T38_DISABLED)) {
+		ast_debug(3, "Declining; T.38 state is rejected or declined\n");
 		t38_change_state(session, session_media, state, T38_DISABLED);
 		return -1;
 	}
@@ -678,6 +684,7 @@
 	/* Ensure that the address provided is valid */
 	if (ast_sockaddr_resolve(&addrs, host, PARSE_PORT_FORBID, AST_AF_INET) <= 0) {
 		/* The provided host was actually invalid so we error out this negotiation */
+		ast_debug(3, "Declining; provided host is invalid\n");
 		return -1;
 	}
 
@@ -685,6 +692,7 @@
 	if ((ast_sockaddr_is_ipv6(addrs) && !session->endpoint->media.t38.ipv6) ||
 		(ast_sockaddr_is_ipv4(addrs) && session->endpoint->media.t38.ipv6)) {
 		/* The address does not match configured */
+		ast_debug(3, "Declining, provided host does not match configured address family\n");
 		return -1;
 	}
 
@@ -713,13 +721,16 @@
 	pj_str_t stmp;
 
 	if (!session->endpoint->media.t38.enabled) {
+		ast_debug(3, "Not creating outgoing SDP stream: T.38 not enabled\n");
 		return 1;
 	} else if ((session->t38state != T38_LOCAL_REINVITE) && (session->t38state != T38_PEER_REINVITE) &&
 		(session->t38state != T38_ENABLED)) {
+		ast_debug(3, "Not creating outgoing SDP stream: T.38 not enabled\n");
 		return 1;
 	} else if (!(state = t38_state_get_or_alloc(session))) {
 		return -1;
 	} else if (t38_initialize_session(session, session_media)) {
+		ast_debug(3, "Not creating outgoing SDP stream: Failed to initialize T.38 session\n");
 		return -1;
 	}
 
@@ -738,6 +749,7 @@
 	}
 
 	if (ast_strlen_zero(hostip)) {
+		ast_debug(3, "Not creating outgoing SDP stream: no known host IP\n");
 		return -1;
 	}
 
@@ -805,6 +817,7 @@
 	struct t38_state *state;
 
 	if (!session_media->udptl) {
+		ast_debug(3, "Not applying negotiated SDP stream: no UDTPL session\n");
 		return 0;
 	}
 
@@ -817,6 +830,7 @@
 	/* Ensure that the address provided is valid */
 	if (ast_sockaddr_resolve(&addrs, host, PARSE_PORT_FORBID, AST_AF_UNSPEC) <= 0) {
 		/* The provided host was actually invalid so we error out this negotiation */
+		ast_debug(3, "Not applying negotiated SDP stream: failed to resolve remote stream host\n");
 		return -1;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/1670
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I61b3fb9183b7ebbb5da8e9f48b59a5d9d7042d77
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list