[svn-commits] mmichelson: branch group/issue8824 r183097 - in /team/group/issue8824: ./ app...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 18 18:56:58 CDT 2009


Author: mmichelson
Date: Wed Mar 18 18:56:54 2009
New Revision: 183097

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183097
Log:
Address some of Russell's notes in his review.


Modified:
    team/group/issue8824/CHANGES
    team/group/issue8824/apps/app_dial.c
    team/group/issue8824/channels/chan_iax2.c
    team/group/issue8824/channels/chan_sip.c
    team/group/issue8824/configs/sip.conf.sample
    team/group/issue8824/funcs/func_connectedline.c
    team/group/issue8824/funcs/func_redirecting.c
    team/group/issue8824/include/asterisk/callerid.h
    team/group/issue8824/main/dial.c
    team/group/issue8824/main/features.c

Modified: team/group/issue8824/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/CHANGES?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/CHANGES (original)
+++ team/group/issue8824/CHANGES Wed Mar 18 18:56:54 2009
@@ -17,18 +17,11 @@
    present, those values are sent immediatly upon receiving a PROGRESS message
    regardless if the call has been answered or not.
 
-Functions
----------
- * The CHANNEL() function now supports the "name" option.
-
-------------------------------------------------------------------------------
---- Functionality changes for COLP feature -----------------------------------
-------------------------------------------------------------------------------
-
 Dialplan Functions
 ------------------
  * Added new dialplan functions CONNECTEDLINE and REDIRECTING which permits
    setting various connected line and redirecting party information.
+ * The CHANNEL() function now supports the "name" option.
 
 Queue changes
 -------------

Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Wed Mar 18 18:56:54 2009
@@ -635,12 +635,11 @@
 	}
 }
 
-/*! \brief free the buffer if allocated, and set the pointer to the second arg */
+/*! free the buffer if allocated, and set the pointer to the second arg */
 #define S_REPLACE(s, new_val) \
 	do {                      \
-		if (s) {              \
+		if (s)                \
 			ast_free(s);      \
-		}                     \
 		s = (new_val);        \
 	} while (0)
 
@@ -757,7 +756,7 @@
 
 		ast_set_redirecting(c, apr);
 		S_REPLACE(c->cid.cid_rdnis, ast_strdup(S_OR(original->cid.cid_rdnis, S_OR(in->macroexten, in->exten))));
-		
+
 		c->cid.cid_tns = in->cid.cid_tns;
 
 		if (ast_test_flag64(o, OPT_FORCECLID)) {

Modified: team/group/issue8824/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_iax2.c?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/channels/chan_iax2.c (original)
+++ team/group/issue8824/channels/chan_iax2.c Wed Mar 18 18:56:54 2009
@@ -10972,8 +10972,7 @@
 				peer->adsi = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "connectedline")) {
 				if (ast_true(v->value)) {
-					ast_set_flag(peer, IAX_SENDCONNECTEDLINE);
-					ast_set_flag(peer, IAX_RECVCONNECTEDLINE);
+					ast_set_flag(peer, IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 				} else if (!strcasecmp(v->value, "send")) {
 					ast_clear_flag(peer, IAX_RECVCONNECTEDLINE);
 					ast_set_flag(peer, IAX_SENDCONNECTEDLINE);
@@ -10981,8 +10980,7 @@
 					ast_clear_flag(peer, IAX_SENDCONNECTEDLINE);
 					ast_set_flag(peer, IAX_RECVCONNECTEDLINE);
 				} else {
-					ast_clear_flag(peer, IAX_SENDCONNECTEDLINE);
-					ast_clear_flag(peer, IAX_RECVCONNECTEDLINE);
+					ast_clear_flag(peer, IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 				}
 			}/* else if (strcasecmp(v->name,"type")) */
 			/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
@@ -11229,8 +11227,7 @@
 				user->adsi = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "connectedline")) {
 				if (ast_true(v->value)) {
-					ast_set_flag(user, IAX_SENDCONNECTEDLINE);
-					ast_set_flag(user, IAX_RECVCONNECTEDLINE);
+					ast_set_flag(user, IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 				} else if (!strcasecmp(v->value, "send")) {
 					ast_clear_flag(user, IAX_RECVCONNECTEDLINE);
 					ast_set_flag(user, IAX_SENDCONNECTEDLINE);
@@ -11238,8 +11235,7 @@
 					ast_clear_flag(user, IAX_SENDCONNECTEDLINE);
 					ast_set_flag(user, IAX_RECVCONNECTEDLINE);
 				} else {
-					ast_clear_flag(user, IAX_SENDCONNECTEDLINE);
-					ast_clear_flag(user, IAX_RECVCONNECTEDLINE);
+					ast_clear_flag(user, IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 				}
 			}/* else if (strcasecmp(v->name,"type")) */
 			/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
@@ -11667,8 +11663,7 @@
 			srvlookup = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "connectedline")) {
 			if (ast_true(v->value)) {
-				ast_set_flag((&globalflags), IAX_SENDCONNECTEDLINE);
-				ast_set_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+				ast_set_flag((&globalflags), IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 			} else if (!strcasecmp(v->value, "send")) {
 				ast_clear_flag((&globalflags), IAX_RECVCONNECTEDLINE);
 				ast_set_flag((&globalflags), IAX_SENDCONNECTEDLINE);
@@ -11676,8 +11671,7 @@
 				ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE);
 				ast_set_flag((&globalflags), IAX_RECVCONNECTEDLINE);
 			} else {
-				ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE);
-				ast_clear_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+				ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
 			}
 		} /*else if (strcasecmp(v->name,"type")) */
 		/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */

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=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Wed Mar 18 18:56:54 2009
@@ -9017,7 +9017,8 @@
 }
 
 /*! \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;
 	char *lid_name = NULL;

Modified: team/group/issue8824/configs/sip.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/configs/sip.conf.sample?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/configs/sip.conf.sample (original)
+++ team/group/issue8824/configs/sip.conf.sample Wed Mar 18 18:56:54 2009
@@ -209,14 +209,14 @@
 ;relaxdtmf=yes                  ; Relax dtmf handling
 ;trustrpid = no                 ; If Remote-Party-ID should be trusted
 ;sendrpid = yes                 ; If Remote-Party-ID should be sent
-;sendrpid = rpid				; Use the "Remote-Party-ID" header
-								; to send the identity of the remote party
-								; This is identical to sendrpid=yes
-;sendrpid = pai					; Use the "P-Asserted-Identity" header
-								; to send the identity of the remote party
+;sendrpid = rpid                ; Use the "Remote-Party-ID" header
+                                ; to send the identity of the remote party
+                                ; This is identical to sendrpid=yes
+;sendrpid = pai                 ; Use the "P-Asserted-Identity" header
+                                ; to send the identity of the remote party
 ;rpid_header = rpid             ; Which header should be used when sending Remote Party ID
                                 ; 'rpid' means to send "Remote-Party-ID"
-								; 'pai' means to send "P-Asserted-Identity"
+                                ; 'pai' means to send "P-Asserted-Identity"
 ;progressinband=never           ; If we should generate in-band ringing always
                                 ; use 'never' to never use in-band signalling, even in cases
                                 ; where some buggy devices might not render it

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=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/funcs/func_connectedline.c (original)
+++ team/group/issue8824/funcs/func_connectedline.c Wed Mar 18 18:56:54 2009
@@ -40,6 +40,40 @@
 #include "asterisk/app.h"
 #include "asterisk/options.h"
 #include "asterisk/callerid.h"
+
+/*** DOCUMENTATION
+	<function name="CONNECTEDLINE" language="en_US">
+		<synopsis>
+			Gets or sets Connected Line data on the channel.
+		</synopsis>
+		<syntax>
+			<parameter name="datatype" required="true">
+				<para>The allowable datatypes are:</para>
+				<enumlist>
+					<enum name = "all" />
+					<enum name = "num" />
+					<enum name = "name" />
+					<enum name = "ton" />
+					<enum name = "pres" />
+					<enum name = "source" />
+				</enumlist>
+			</parameter>
+			<parameter name="i">
+				<para>If set, this will prevent the channel from sending out protocol
+				messages because of the value being set</para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Gets or sets Connected Line data on the channel. Possible values
+			for the <replaceable>source</replaceable> datatype are:</para>
+			<enumlist>
+				<enum name="answer">Normal Call Answering</enum>
+				<enum name="transfer_alerting">Call Transfer(Alerting)</enum>
+				<enum name="transfer_active">Call Transfer(Active)</enum>
+			</enumlist>
+		</description>
+	</function>
+ ***/
 
 static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data,
 			      char *buf, size_t len)
@@ -186,19 +220,6 @@
 
 static struct ast_custom_function connectedline_function = {
 	.name = "CONNECTEDLINE",
-	.synopsis = "Gets or sets Connected Line data on the channel.",
-	.syntax = "CONNECTEDLINE(datatype[,i])",
-	.desc =
-		"Gets or sets Connected Line data on the channel.\n"
-		"The optional update Inhibit option prevents the channel\n"
-		"from sending out protocol messages because of the value\n"
-		"being set.\n"
-		"The allowable datatypes are:\n"
-		"\"all\", \"name\", \"num\", \"ton\", \"pres\", and \"source\"\n"
-		"The source datatype can be set to the following:\n"
-		"answer            - Normal Call Answering\n"
-		"transfer_alerting - Call Transfer(Alerting)\n"
-		"transfer_active   - Call Transfer(Active)\n",
 	.read = connectedline_read,
 	.write = connectedline_write,
 };

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=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/funcs/func_redirecting.c (original)
+++ team/group/issue8824/funcs/func_redirecting.c Wed Mar 18 18:56:54 2009
@@ -48,6 +48,54 @@
 #include "asterisk/app.h"
 #include "asterisk/options.h"
 #include "asterisk/callerid.h"
+
+/*** DOCUMENTATION
+	<function name="REDIRECTING" language="en_US">
+		<synopsis>
+			Gets or sets Redirecting data on the channel.
+		</synopsis>
+		<syntax>
+			<parameter name="datatype" required="true">
+				<para>The allowable datatypes are:</para>
+				<enumlist>
+					<enum name = "from-all" />
+					<enum name = "from-num" />
+					<enum name = "from-name" />
+					<enum name = "from-ton" />
+					<enum name = "to-all" />
+					<enum name = "to-num" />
+					<enum name = "to-name" />
+					<enum name = "to-ton" />
+					<enum name = "pres" />
+					<enum name = "reason" />
+					<enum name = "count" />
+				</enumlis>
+			</parameter>
+			<parameter name="i">
+				<para>If set, this will prevent the channel from sending out protocol
+				messages because of the value being set</para>
+			</parameter>
+		</syntax>
+		<description>
+			<para>Gets or sets Redirecting data on the channel. The allowable values
+			for the <replaceable>reason</replaceable> field are the following:</para>
+			<enumlist>
+				<enum name = "unknown">Unknown</enum>
+				<enum name = "cfb">Call Forwarding Busy</enum>
+				<enum name = "cfnr">Call Forwarding No Reply</enum>
+				<enum name = "unavailable">Callee is Unavailable</enum>
+				<enum name = "time_of_day">Time of Day</enum>
+				<enum name = "dnd">Do Not Disturb</enum>
+				<enum name = "deflection">Call Deflection</enum>
+				<enum name = "follow_me">Follow Me</enum>
+				<enum name = "out_of_order">Called DTE Out-Of-Order</enum>
+				<enum name = "away">Callee is Away</enum>
+				<enum name = "cf_dte">Call Forwarding By The Called DTE</enum>
+				<enum name = "cfu">Call Forwarding Unconditional</enum>
+			</enumlist>
+		</description>
+	</function>
+ ***/
 
 enum ID_FIELD_STATUS {
 	ID_FIELD_VALID,
@@ -193,8 +241,12 @@
 		char num[256];
 
 		ast_callerid_split(value, name, sizeof(name), num, sizeof(num));
-		id->name = ast_strdup(name);
-		id->number = ast_strdup(num);
+		if (!(id->name = ast_strdup(name))) {
+			return ID_FIELD_INVALID;
+		}
+		if (!(id->number = ast_strdup(num))) {
+			return ID_FIELD_INVALID;
+		}
 	} else if (!strncasecmp("name", data, 4)) {
 		id->name = ast_strdup(value);
 		ast_trim_blanks(id->name);
@@ -374,30 +426,6 @@
 
 static struct ast_custom_function redirecting_function = {
 	.name = "REDIRECTING",
-	.synopsis = "Gets or sets Redirecting data on the channel.",
-	.syntax = "REDIRECTING(datatype[,i])",
-	.desc =
-		"Gets or sets Redirecting data on the channel.\n"
-		"The optional update Inhibit option prevents the channel\n"
-		"from sending out protocol messages because of the value\n"
-		"being set.\n"
-		"The allowable datatypes are:\n"
-		"\"from-all\", \"from-name\", \"from-num\", \"from-ton\",\n"
-		"\"to-all\", \"to-name\", \"to-num\", \"to-ton\",\n"
-		"\"pres\", \"reason\", and \"count\"\n"
-		"The reason datatype can be set to the following:\n"
-		"unknown      - Unknown\n"
-		"cfb          - Call Forwarding Busy\n"
-		"cfnr         - Call Forwarding No Reply\n"
-		"unavailable  - Callee is Unavailable\n"
-		"time_of_day  - Time of Day\n"
-		"dnd          - Do Not Disturb\n"
-		"deflection   - Call Deflection\n"
-		"follow_me    - Follow Me\n"
-		"out_of_order - Called DTE Out-Of-Order\n"
-		"away         - Callee is Away\n"
-		"cf_dte       - Call Forwarding By The Called DTE\n"
-		"cfu          - Call Forwarding Unconditional\n",
 	.read = redirecting_read,
 	.write = redirecting_write,
 };

Modified: team/group/issue8824/include/asterisk/callerid.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/include/asterisk/callerid.h?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/include/asterisk/callerid.h (original)
+++ team/group/issue8824/include/asterisk/callerid.h Wed Mar 18 18:56:54 2009
@@ -396,11 +396,16 @@
  * \brief Connected line update source code
  */
 enum AST_CONNECTED_LINE_UPDATE_SOURCE {
-	AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN,   /* Update for unknown reason (May be interpreted to mean from answer) */
-	AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER,    /* Update from normal call answering */
-	AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION, /* Update from call diversion (Deprecated, use REDIRECTING updates instead.) */
-	AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER,   /* Update from call transfer(active) (Party has already answered) */
-	AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING   /* Update from call transfer(alerting) (Party has not answered yet) */
+	/*! Update for unknown reason (May be interpreted to mean from answer) */
+	AST_CONNECTED_LINE_UPDATE_SOURCE_UNKNOWN,   
+	/*! Update from normal call answering */
+	AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER,    
+	/*! Update from call diversion (Deprecated, use REDIRECTING updates instead.) */
+	AST_CONNECTED_LINE_UPDATE_SOURCE_DIVERSION, 
+	/*! Update from call transfer(active) (Party has already answered) */
+	AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER,   
+	/*! Update from call transfer(alerting) (Party has not answered yet) */
+	AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER_ALERTING   
 };
 
 int ast_connected_line_source_parse(const char *data);

Modified: team/group/issue8824/main/dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/main/dial.c?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/main/dial.c (original)
+++ team/group/issue8824/main/dial.c Wed Mar 18 18:56:54 2009
@@ -177,7 +177,7 @@
 #define S_REPLACE(s, new_val) \
 	do {                      \
 		if (s) {              \
-			ast_free(s);      \
+			free(s);          \
 		}                     \
 		s = (new_val);        \
 	} while (0)

Modified: team/group/issue8824/main/features.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/main/features.c?view=diff&rev=183097&r1=183096&r2=183097
==============================================================================
--- team/group/issue8824/main/features.c (original)
+++ team/group/issue8824/main/features.c Wed Mar 18 18:56:54 2009
@@ -1490,7 +1490,9 @@
 		 * As a result, we need to be sure to free this data before returning
 		 * or overwriting it.
 		 */
+		ast_channel_lock(transferer);
 		ast_party_connected_line_copy(&connected_line, &transferer->connected);
+		ast_channel_unlock(transferer);
 		res = ast_bridge_call(transferer, newchan, &bconfig);
 		if (ast_check_hangup(newchan) || !ast_check_hangup(transferer)) {
 			ast_hangup(newchan);
@@ -1584,7 +1586,9 @@
 		 * the info with the callerid of xferchan. Otherwise, there would be a memory leak
 		 */
 		ast_party_connected_line_free(&connected_line);
+		ast_channel_lock(xferchan);
 		ast_party_connected_line_collect_caller(&connected_line, &xferchan->cid);
+		ast_channel_unlock(xferchan);
 		connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 		ast_connected_line_update(newchan, &connected_line);
 
@@ -1689,10 +1693,14 @@
 			tobj->bconfig.end_bridge_callback_data_fixup(&tobj->bconfig, tobj->peer, tobj->chan);
 		}
 
+		ast_channel_lock(newchan);
 		ast_party_connected_line_collect_caller(&connected_line, &newchan->cid);
+		ast_channel_unlock(newchan);
 		connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 		ast_connected_line_update(xferchan, &connected_line);
+		ast_channel_lock(xferchan);
 		ast_party_connected_line_collect_caller(&connected_line, &xferchan->cid);
+		ast_channel_unlock(xferchan);
 		connected_line.source = AST_CONNECTED_LINE_UPDATE_SOURCE_TRANSFER;
 		ast_connected_line_update(newchan, &connected_line);
 		
@@ -2198,7 +2206,9 @@
 	ast_channel_inherit_variables(caller, chan);	
 	pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller->name);
 		
+	ast_channel_lock(chan);
 	ast_copy_caller_to_connected(&chan->connected, &caller->cid);
+	ast_channel_unlock(chan);
 	
 	if (ast_call(chan, data, timeout)) {
 		ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, (char *)data);




More information about the svn-commits mailing list