[svn-commits] mmichelson: branch group/CCSS r222312 - /team/group/CCSS/main/channel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 6 15:00:40 CDT 2009


Author: mmichelson
Date: Tue Oct  6 15:00:39 2009
New Revision: 222312

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=222312
Log:
This is pretty sweet.

Okay, so part of the CC work involved is the ability to configure CC
parameters in channel device configuration sections. Not all channel
drivers have had the necessary code updates to parse these config options.
This change will make it so that even if the channel driver has not been
updated to parse the necessary configuration options, the configuration
parameters can still be set on a channel using the CALLCOMPLETION
dialplan function.

The reason why is that the CALLCOMPLETION function searches for the
config parameters datastore on the channel. The only reason it would
not be present is if the channel's driver had not been updated to
parse the CC config settings. So what we do now is, if we don't find
the datastore, we just create it with the defaults. That way it can
be retrieved and the configuration items can be set properly on it.


Modified:
    team/group/CCSS/main/channel.c

Modified: team/group/CCSS/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=222312&r1=222311&r2=222312
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Tue Oct  6 15:00:39 2009
@@ -7145,7 +7145,17 @@
 	struct ast_datastore *cc_datastore;
 
 	if (!(cc_datastore = ast_channel_datastore_find(chan, &cc_channel_datastore_info, NULL))) {
-		return NULL;
+		/* If we can't find the datastore, it almost definitely means that the channel type being
+		 * used has not had its driver modified to parse CC config parameters. The best action
+		 * to take here is to create the parameters on the spot with the defaults set.
+		 */
+		if (ast_channel_cc_params_init(chan, NULL)) {
+			return NULL;
+		}
+		if (!(cc_datastore = ast_channel_datastore_find(chan, &cc_channel_datastore_info, NULL))) {
+			/* Should be impossible */
+			return NULL;
+		}
 	}
 
 	ast_assert(cc_datastore->data != NULL);




More information about the svn-commits mailing list