aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-17 20:41:24 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-17 20:41:24 +0000
commit1f57cd4e5150eb916b30f5183deb3449a0d6795d (patch)
tree106de0147974e2e7f7c18dec2d603d9060afebc2 /funcs
parent2a22b3a479a4d109af680c80cbad31831fe28af5 (diff)
Merge a large set of updates to the Asterisk indications API.
This patch includes a number of changes to the indications API. The primary motivation for this work was to improve stability. The object management in this API was significantly flawed, and a number of trivial situations could cause crashes. The changes included are: 1) Remove the module res_indications. This included the critical functionality that actually loaded the indications configuration. I have seen many people have Asterisk problems because they accidentally did not have an indications.conf present and loaded. Now, this code is in the core, and Asterisk will fail to start without indications configuration. There was one part of res_indications, the dialplan applications, which did belong in a module, and have been moved to a new module, app_playtones. 2) Object management has been significantly changed. Tone zones are now managed using astobj2, and it is no longer possible to crash Asterisk by issuing a reload that destroys tone zones while they are in use. 3) The API documentation has been filled out. 4) The API has been updated to follow our naming conventions. 5) Various bits of code throughout the tree have been updated to account for the API update. 6) Configuration parsing has been mostly re-written. 7) "Code cleanup" The code is from svn/asterisk/team/russell/indications/. Review: http://reviewboard.digium.com/r/149/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176627 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_channel.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 959f332d2..ff8eeb2e5 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -296,12 +296,19 @@ static int func_channel_write(struct ast_channel *chan, const char *function,
}
#endif
else if (!strcasecmp(data, "tonezone")) {
- struct tone_zone *new_zone;
+ struct ast_tone_zone *new_zone;
if (!(new_zone = ast_get_indication_zone(value))) {
ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", value);
ret = -1;
- } else
- chan->zone = new_zone;
+ } else {
+ ast_channel_lock(chan);
+ if (chan->zone) {
+ chan->zone = ast_tone_zone_unref(chan->zone);
+ }
+ chan->zone = ast_tone_zone_ref(new_zone);
+ ast_channel_unlock(chan);
+ new_zone = ast_tone_zone_unref(new_zone);
+ }
} else if (!strcasecmp(data, "callgroup"))
chan->callgroup = ast_get_group(value);
else if (!strcasecmp(data, "txgain")) {