aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_unistim.c
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 /channels/chan_unistim.c
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 'channels/chan_unistim.c')
-rw-r--r--channels/chan_unistim.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 48d11e481..8229c9a32 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -439,7 +439,7 @@ static struct unistim_device {
char datetimeformat; /*!< format used for displaying time/date */
char contrast; /*!< contrast */
char country[3]; /*!< country used for dial tone frequency */
- struct tone_zone *tz; /*!< Tone zone for res_indications (ring, busy, congestion) */
+ struct ast_tone_zone *tz; /*!< Tone zone for res_indications (ring, busy, congestion) */
char ringvolume; /*!< Ring volume */
char ringstyle; /*!< Ring melody */
int rtp_port; /*!< RTP port used by the phone */
@@ -4057,17 +4057,17 @@ static char *control2str(int ind)
return "UNKNOWN";
}
-static void in_band_indication(struct ast_channel *ast, const struct tone_zone *tz,
+static void in_band_indication(struct ast_channel *ast, const struct ast_tone_zone *tz,
const char *indication)
{
- const struct tone_zone_sound *ts = NULL;
+ struct ast_tone_zone_sound *ts = NULL;
- ts = ast_get_indication_tone(tz, indication);
-
- if (ts && ts->data[0])
+ if ((ts = ast_get_indication_tone(tz, indication))) {
ast_playtones_start(ast, 0, ts->data, 1);
- else
+ ts = ast_tone_zone_sound_unref(ts);
+ } else {
ast_log(LOG_WARNING, "Unable to get indication tone for %s\n", indication);
+ }
}
static int unistim_indicate(struct ast_channel *ast, int ind, const void *data,
@@ -5223,6 +5223,9 @@ static struct unistim_device *build_device(const char *cat, const struct ast_var
ast_log(LOG_ERROR, "An Unistim device must have at least one line!\n");
ast_mutex_destroy(&l->lock);
ast_free(l);
+ if (d->tz) {
+ d->tz = ast_tone_zone_unref(d->tz);
+ }
ast_free(d);
return NULL;
}
@@ -5240,6 +5243,9 @@ static struct unistim_device *build_device(const char *cat, const struct ast_var
ast_log(LOG_ERROR, "You must specify the mac address with device=\n");
ast_mutex_destroy(&l->lock);
ast_free(l);
+ if (d->tz) {
+ d->tz = ast_tone_zone_unref(d->tz);
+ }
ast_free(d);
return NULL;
} else
@@ -5461,6 +5467,9 @@ static int reload_config(void)
d2 = d2->next;
}
}
+ if (d->tz) {
+ d->tz = ast_tone_zone_unref(d->tz);
+ }
ast_free(d);
d = devices;
continue;