[asterisk-dev] [Code Review] 2578: Refactor features configuration
Mark Michelson
reviewboard at asterisk.org
Mon Jun 3 12:17:43 CDT 2013
> On June 1, 2013, 12:10 a.m., rmudgett wrote:
> > /trunk/main/features_config.c, lines 341-349
> > <https://reviewboard.asterisk.org/r/2578/diff/2/?file=38835#file38835line341>
> >
> > Aren't you supposed to also parse the features.conf [parkinglot_*] sections?
>
> Mark Michelson wrote:
> That wasn't part of my task. Parking lot configuration currently lives in res_parking.conf. Parking lot configuration could be migrated back over to features.conf and mixed in with the rest of the features.conf configuration with some effort though.
>
> rmudgett wrote:
> Parking lot configuration was previously in features.conf. For features.conf to remain backwards compatible, you should at least parse those options and not give errors about "unknown" options.
Okay, I see what you're saying now. If someone has a [parkinglot_foo] context, we'll try to parse it as a featuregroup right now. We should instead print an error and abort loading since the configuration will not work as expected.
> On June 1, 2013, 12:10 a.m., rmudgett wrote:
> > /trunk/bridges/bridge_builtin_features.c, line 64
> > <https://reviewboard.asterisk.org/r/2578/diff/2/?file=38821#file38821line64>
> >
> > RAII_VAR is overkill here since all you want to get is digit_timeout. Also you can defer getting the digit_timeout until you need it in the one location.
>
> Mark Michelson wrote:
> As the API is written, you don't have a choice other than to grab the xfer_config. There are not accessor functions for each individual option.
>
> I felt that grabbing the xfer_config locally in this function was better than passing just the digit timeout into the function as a parameter because this would scale better if other transfer options became relevant in this function.
>
> rmudgett wrote:
> The reason RAII_VAR is overkill here is because you are only getting an integer out of the xfer_cfg. You don't need to keep a reference to xfer_cfg after that is done.
I'm going to respectfully disagree with this line of reasoning.
I tend to use RAII_VAR whenever it may be applicable, even if the reference continues to exist after my last access to it. The two main reasons are that it makes reference counting easier to get correct, and it makes it easier for refcounting to stay correct when code changes. To me, the automatic destruction behavior of RAII_VAR is something that makes it preferable to use in any situation over manual destruction. Changing away from using RAII_VAR seems like a big step backwards.
- Mark
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2578/#review8743
-----------------------------------------------------------
On May 30, 2013, 6:46 p.m., Mark Michelson wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2578/
> -----------------------------------------------------------
>
> (Updated May 30, 2013, 6:46 p.m.)
>
>
> Review request for Asterisk Developers, jrose and rmudgett.
>
>
> Bugs: ASTERISK-21542
> https://issues.asterisk.org/jira/browse/ASTERISK-21542
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> This change separates features configuration out of features.c into a separate features_config.c file. In addition, a features_config.h file has been added as a means of getting configured values. The configuration changes are as follows:
>
> * Configuration for features uses the config framework now.
> * The FEATURE and FEATUREMAP functions use the same handlers as the configuration. Therefore, any configuration item available in the config file is also available for the FEATURE and FEATUREMAP functions
> * Because the FEATURE and FEATUREMAP functions are more complete, feature configuration retrieval is done per channel rather than globally. Global configuration can be retrieved, but this is a rare occurrence.
> * The CLI command to show feature configuration has been moved into the features_config.c file as well
> * Three new options for attended transfers were added: atxfercomplete, atxferabort, and atxferthreeway. Now the key combinations for completing, aborting, and conferencing an attended transfer are no longer hard coded.
>
> Since feature configuration is handled differently than it used to be, it meant that several items from features.h and features.c could be removed altogether:
>
> * All functions having to do with configuration parsing have been removed from features.c. This includes functions that were used to modify the dialplan due to parking options being parsed.
> * Functions that retrieved call features have been removed. This includes the removal of ast_call_feature, its associated locks, the builtin_features array, and functions used to find dynamic features.
>
> The result of removing some of the above meant that there was quite a bit of dead code in features.c. However, I did not remove this code and instead opted to comment it out for several reasons. The following bits have been commented out rather than being removed.
>
> * All builtin feature operations in features.c have been commented out. These items had already been "dead" for a while, but now that nothing references them, they had to be commented out in order to compile with devmode enabled. I left these commented out since there are currently tasks to make the builtin features feature-complete. Leaving the old code around as an example is not a bad thing.
> * The unit tests in features.c have been commented out. The new parking code currently does not have unit tests, so keeping the old unit tests around but commented out allows for them to be used as a guide when writing new tests.
>
> There was a tangential change as well: an AST_FEATURES_DTMF_MASK constant was added that can be used to tell if a builtin feature requires DTMF. This was necessary for setting up bridge features since the ast_call_feature structure was removed.
>
> Things I'm looking for in this review:
>
> * Are there items in features.c that I have commented out that should just plain be removed instead?
> * Are there any items in features.c that I removed that should not have been?
>
>
> Diffs
> -----
>
> /trunk/apps/app_dial.c 390144
> /trunk/bridges/bridge_builtin_features.c 390144
> /trunk/channels/chan_dahdi.c 390144
> /trunk/channels/chan_mgcp.c 390144
> /trunk/channels/chan_misdn.c 390144
> /trunk/channels/chan_sip.c 390144
> /trunk/channels/chan_unistim.c 390144
> /trunk/channels/sig_analog.c 390144
> /trunk/channels/sip/include/sip.h 390144
> /trunk/include/asterisk/bridging_features.h 390144
> /trunk/include/asterisk/channel.h 390144
> /trunk/include/asterisk/features.h 390144
> /trunk/include/asterisk/features_config.h PRE-CREATION
> /trunk/main/bridging.c 390144
> /trunk/main/features.c 390144
> /trunk/main/features_config.c PRE-CREATION
> /trunk/main/manager.c 390144
>
> Diff: https://reviewboard.asterisk.org/r/2578/diff/
>
>
> Testing
> -------
>
> Tested configuration parsing. Ensured that general features, featuremap items, applicationmap items, and featuregroups were set and retrievable properly.
>
> Tested that the FEATURE and FEATUREMAP dialplan functions overrode the global configuration in features.conf
>
> Tested that items in the featuremap and applicationmap could be triggered mid-call. This includes the new attended transfer options.
>
>
> Thanks,
>
> Mark Michelson
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130603/dd33a522/attachment-0001.htm>
More information about the asterisk-dev
mailing list