[asterisk-commits] mmichelson: branch group/issue8824 r183826 - in /team/group/issue8824: channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 23 17:06:09 CDT 2009


Author: mmichelson
Date: Mon Mar 23 17:06:05 2009
New Revision: 183826

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183826
Log:
Address more of Russell's comments!!!!!!!!!1


Modified:
    team/group/issue8824/channels/chan_sip.c
    team/group/issue8824/funcs/func_connectedline.c
    team/group/issue8824/funcs/func_redirecting.c

Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=183826&r1=183825&r2=183826
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Mon Mar 23 17:06:05 2009
@@ -965,7 +965,7 @@
 	{ AST_REDIRECTING_REASON_CALL_FWD_DTE, "unknown"}
 };
 
-static enum AST_REDIRECTING_REASON sip_reason_str_to_code(const char *text) 
+static enum AST_REDIRECTING_REASON sip_reason_str_to_code(const char *text)
 {
 	enum AST_REDIRECTING_REASON ast = AST_REDIRECTING_REASON_UNKNOWN;
 	int i;
@@ -5102,7 +5102,7 @@
 		if (xmitres == XMIT_ERROR)
 			return -1;
 		p->invitestate = INV_CALLING;
-	
+
 		/* Initialize auto-congest time */
 		AST_SCHED_REPLACE_UNREF(p->initid, sched, p->timer_b, auto_congest, p, 
 								dialog_unref(_data, "dialog ptr dec when SCHED_REPLACE del op succeeded"), 
@@ -5870,7 +5870,7 @@
 					ast_rtp_new_source(p->rtp);
 					p->invitestate = INV_EARLY_MEDIA;
 					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE, FALSE);
-					ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
+					ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
 				}
 				p->lastrtptx = time(NULL);
 				res = ast_rtp_write(p->rtp, frame);
@@ -5888,7 +5888,7 @@
 				    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
 					p->invitestate = INV_EARLY_MEDIA;
 					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE, FALSE);
-					ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
+					ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
 				}
 				p->lastrtptx = time(NULL);
 				res = ast_rtp_write(p->vrtp, frame);
@@ -5909,7 +5909,7 @@
 					    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
 						p->invitestate = INV_EARLY_MEDIA;
 						transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE, FALSE);
-						ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
+						ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
 					}
 					p->lastrtptx = time(NULL);
 					res = ast_rtp_write(p->trtp, frame);
@@ -6113,7 +6113,7 @@
 		    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
 			p->invitestate = INV_EARLY_MEDIA;
 			transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE, FALSE);
-			ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
+			ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);
 			break;
 		}
 		res = -1;
@@ -8803,9 +8803,9 @@
 	}
 	respprep(&resp, p, msg, req);
 
-	if (ast_test_flag(&p->flags[0], SIP_SENDRPID) 
-			&& ast_test_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND) 
-			&& (!strcasecmp(msg, "180 Ringing") || !strcasecmp(msg, "183 Session Progress"))) {
+	if (ast_test_flag(&p->flags[0], SIP_SENDRPID)
+			&& ast_test_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND)
+			&& (!strncasecmp(msg, "180", 3) || !strncasecmp(msg, "183", 3))) {
 		ast_clear_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND);
 		add_rpid(&resp, p);
 	}
@@ -9033,7 +9033,7 @@
  * \pre if p->owner exists, it must be locked
  * \brief Add Remote-Party-ID header to SIP message 
  */
-static int add_rpid(struct sip_request *req, struct sip_pvt *p) 
+static int add_rpid(struct sip_request *req, struct sip_pvt *p)
 {
 	char tmp[256];
 	char *lid_num = NULL;
@@ -9042,7 +9042,7 @@
 	const char *fromdomain;
 	const char *privacy = NULL;
 	const char *screen = NULL;
-	const char *anonymous_string = "\"Anonymous\" <anonymous at anonymous.invalid>"; 
+	const char *anonymous_string = "\"Anonymous\" <anonymous at anonymous.invalid>";
 
 	if (!ast_test_flag(&p->flags[0], SIP_SENDRPID)) {
 		return 0;
@@ -9062,7 +9062,7 @@
 
 	if (ast_test_flag(&p->flags[0], SIP_SENDRPID_PAI)) {
 		if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
-			snprintf(tmp, sizeof(tmp), "%s", anonymous_string); 
+			snprintf(tmp, sizeof(tmp), "%s", anonymous_string);
 		} else {
 			snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
 		}
@@ -9942,7 +9942,7 @@
 
 	if (p->owner && (p->owner->connected.id.number_presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
 		l = p->owner->connected.id.number; 
-		n = p->owner->connected.id.name; 
+		n = p->owner->connected.id.name;
 	}
 	if (ast_strlen_zero(l))
 		l = default_callerid;
@@ -10707,7 +10707,7 @@
 /*! \brief Notify peer that the connected line has changed */
 static void update_connectedline(struct sip_pvt *p, const void *data, size_t datalen)
 {
-	
+
 	if (!ast_test_flag(&p->flags[0], SIP_SENDRPID))
 		return;
 	if (ast_strlen_zero(p->owner->connected.id.number))
@@ -10739,7 +10739,7 @@
 	} else {
 		if (ast_test_flag(&p->flags[1], SIP_PAGE2_RPID_IMMEDIATE)) {
 			struct sip_request resp;
-  
+ 
 			if ((p->owner->_state == AST_STATE_RING) && !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT)) {
 				respprep(&resp, p, "180 Ringing", &p->initreq);
 				add_rpid(&resp, p);
@@ -12387,7 +12387,7 @@
 		cid_name = start;
 		start = ast_skip_blanks(end);
 	}
-	
+
 	if (*start != '<')
 		return 0;
 	*start++ = '\0';
@@ -12541,7 +12541,7 @@
 	char tmp[256], *exten, *rexten, *rdomain, *rname = NULL;
 	char *params, *reason_param = NULL;
 	struct sip_request *req;
-	
+
 	req = oreq ? oreq : &p->initreq;
 
 	ast_copy_string(tmp, get_header(req, "Diversion"), sizeof(tmp));
@@ -12572,7 +12572,7 @@
 		if ((reason_param = strcasestr(params, "reason="))) {
 			reason_param+=7;
 			/* Remove enclosing double-quotes */
-			if (*reason_param == '"') 
+			if (*reason_param == '"')
 				ast_strip_quoted(reason_param, "\"", "\"");
 			if (!ast_strlen_zero(reason_param)) {
 				sip_set_redirstr(p, reason_param);
@@ -12586,7 +12586,7 @@
 
 	rdomain = exten;
 	rexten = strsep(&rdomain, "@");	/* trim anything after @ */
-	if (p->owner) 
+	if (p->owner)
 		pbx_builtin_setvar_helper(p->owner, "__SIPRDNISDOMAIN", rdomain);
 
 	if (sip_debug_test_pvt(p))
@@ -13335,7 +13335,7 @@
 					ast_shrink_phone_number(tmp);
 				ast_string_field_set(p, cid_num, tmp);
 			}
-			if (!ast_strlen_zero(peer->cid_name)) 
+			if (!ast_strlen_zero(peer->cid_name))
 				ast_string_field_set(p, cid_name, peer->cid_name);
 			if (peer->callingpres)
 				p->callingpres = peer->callingpres;
@@ -17072,7 +17072,7 @@
 		}
 		check_pendings(p);
 		break;
-	
+
 	case 181:	/* Call Is Being Forwarded */
 		if (!req->ignore && (p->invitestate != INV_CANCELLED) && sip_cancel_destroy(p))
 			ast_log(LOG_WARNING, "Unable to cancel SIP destruction.  Expect bad things.\n");
@@ -17120,9 +17120,9 @@
 				if (!reinvite)
 					/* This 200 OK's SDP is not acceptable, so we need to ack, then hangup */
 					/* For re-invites, we try to recover */
-					ast_set_flag(&p->flags[0], SIP_PENDINGBYE);	
-		}
-		
+					ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
+		}
+
 		if (!req->ignore && p->owner && get_rpid(p, req)) {
 			/* Queue a connected line update */
 			ast_party_connected_line_init(&connected);
@@ -19771,7 +19771,7 @@
 			} else if (p->t38.state == T38_DISABLED) {
 				/* If this is not a re-invite or something to ignore - it's critical */
 				ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
-				transmit_response_with_sdp(p, "200 OK", req, (reinvite ? XMIT_RELIABLE : (req->ignore ?  XMIT_UNRELIABLE : XMIT_CRITICAL)), p->session_modify == TRUE ? FALSE : TRUE, FALSE); 
+				transmit_response_with_sdp(p, "200 OK", req, (reinvite ? XMIT_RELIABLE : (req->ignore ?  XMIT_UNRELIABLE : XMIT_CRITICAL)), p->session_modify == TRUE ? FALSE : TRUE, FALSE);
 			}
 
 			p->invitestate = INV_TERMINATED;
@@ -19916,7 +19916,7 @@
 			ast_connected_line_update(current->chan2, &connected_caller);
 		} else {
 			/* Notify the first other party that they are connected to someone else assuming that target.chan1
-			   has progressed far enough through the dialplan to have it's called party information set. */ 
+			   has progressed far enough through the dialplan to have it's called party information set. */
 			if (current->chan2) {
 				connected_caller = target.chan1->connected;
 				connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;

Modified: team/group/issue8824/funcs/func_connectedline.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/funcs/func_connectedline.c?view=diff&rev=183826&r1=183825&r2=183826
==============================================================================
--- team/group/issue8824/funcs/func_connectedline.c (original)
+++ team/group/issue8824/funcs/func_connectedline.c Mon Mar 23 17:06:05 2009
@@ -137,7 +137,7 @@
 		default:
 			ast_log(LOG_ERROR, "Unknown connectedline option '%s'.\n", option);
 			return 0;
-		}	/* end switch */
+		}
 	}
 	else {
 		set_it = ast_connected_line_update;
@@ -231,7 +231,9 @@
 
 static int load_module(void)
 {
-	return ast_custom_function_register(&connectedline_function);
+	return ast_custom_function_register(&connectedline_function)
+		? AST_MODULE_LOAD_DECLINE
+		: AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Connected Line dialplan function");

Modified: team/group/issue8824/funcs/func_redirecting.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/funcs/func_redirecting.c?view=diff&rev=183826&r1=183825&r2=183826
==============================================================================
--- team/group/issue8824/funcs/func_redirecting.c (original)
+++ team/group/issue8824/funcs/func_redirecting.c Mon Mar 23 17:06:05 2009
@@ -145,7 +145,7 @@
 	}
 
 	return status;
-}	/* end redirecting_id_read() */
+}
 
 
 
@@ -187,7 +187,7 @@
 		default:
 			ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
 			break;
-		}	/* end switch */
+		}
 	} else if (!strncasecmp("to-", data, 3)) {
 		switch (redirecting_id_read(buf, len, data + 3, &chan->redirecting.to)) {
 		case ID_FIELD_VALID:
@@ -197,7 +197,7 @@
 		default:
 			ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
 			break;
-		}	/* end switch */
+		}
 	} else if (!strncasecmp("pres", data, 4)) {
 		ast_copy_string(buf, ast_named_caller_presentation(chan->redirecting.from.number_presentation), len);
 	} else if (!strncasecmp("reason", data, 6)) {
@@ -211,7 +211,7 @@
 	ast_channel_unlock(chan);
 
 	return 0;
-}	/* end redirecting_read() */
+}
 
 
 
@@ -286,7 +286,7 @@
 	}
 
 	return status;
-}	/* end redirecting_id_write() */
+}
 
 
 
@@ -327,7 +327,7 @@
 		default:
 			ast_log(LOG_ERROR, "Unknown redirecting option '%s'.\n", option);
 			return 0;
-		}	/* end switch */
+		}
 	}
 	else {
 		set_it = ast_redirecting_update;
@@ -352,7 +352,7 @@
 		default:
 			ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
 			break;
-		}	/* end switch */
+		}
 	} else if (!strncasecmp("to-", data, 3)) {
 		switch (redirecting_id_write(&redirecting.to, data + 3, value)) {
 		case ID_FIELD_VALID:
@@ -366,7 +366,7 @@
 		default:
 			ast_log(LOG_ERROR, "Unknown redirecting data type '%s'.\n", data);
 			break;
-		}	/* end switch */
+		}
 	} else if (!strncasecmp("pres", data, 4)) {
 		int pres;
 
@@ -419,7 +419,7 @@
 	}
 
 	return 0;
-}	/* end redirecting_write() */
+}
 
 
 
@@ -444,7 +444,7 @@
 static int unload_module(void)
 {
 	return ast_custom_function_unregister(&redirecting_function);
-}	/* end unload_module() */
+}
 
 
 
@@ -459,8 +459,10 @@
  */
 static int load_module(void)
 {
-	return ast_custom_function_register(&redirecting_function);
-}	/* end load_module() */
+	return ast_custom_function_register(&redirecting_function)
+		? AST_MODULE_LOAD_DECLINE
+		: AST_MODULE_LOAD_SUCCESS;
+}
 
 
 




More information about the asterisk-commits mailing list