int npos;
int oldnpos;
int pos;
- int origwfmt;
+ struct ast_format origwfmt;
struct ast_frame f;
unsigned char offset[AST_FRIENDLY_OFFSET];
short data[4000];
struct playtones_state *ps = params;
if (chan) {
- ast_set_write_format(chan, ps->origwfmt);
+ ast_set_write_format(chan, &ps->origwfmt);
}
if (ps->items) {
return NULL;
}
- ps->origwfmt = chan->writeformat;
+ ast_format_copy(&ps->origwfmt, &chan->writeformat);
- if (ast_set_write_format(chan, AST_FORMAT_SLINEAR)) {
- ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", chan->name);
+ if (ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR)) {
+ ast_log(LOG_WARNING, "Unable to set '%s' to signed linear format (write)\n", ast_channel_name(chan));
playtones_release(NULL, ps);
ps = NULL;
} else {
}
ps->f.frametype = AST_FRAME_VOICE;
- ps->f.subclass.codec = AST_FORMAT_SLINEAR;
+ ast_format_set(&ps->f.subclass.format, AST_FORMAT_SLINEAR, 0);
ps->f.datalen = len;
ps->f.samples = samples;
ps->f.offset = AST_FRIENDLY_OFFSET;
return ao2_iterator_init(ast_tone_zones, 0);
}
-/* Set global indication country */
+/*! \brief Set global indication country
+ If no country is specified or we are unable to find the zone, then return not found */
static int ast_set_indication_country(const char *country)
{
struct ast_tone_zone *zone = NULL;
- /* If no country is specified or we are unable to find the zone, then return not found */
if (ast_strlen_zero(country) || !(zone = ast_get_indication_zone(country))) {
return -1;
}
return 0;
}
-/* locate ast_tone_zone, given the country. if country == NULL, use the default country */
+/*! \brief locate ast_tone_zone, given the country. if country == NULL, use the default country */
struct ast_tone_zone *ast_get_indication_zone(const char *country)
{
struct ast_tone_zone *tz = NULL;
}
}
-/* add a new country, if country exists, it will be replaced. */
+/*! \brief add a new country, if country exists, it will be replaced. */
static int ast_register_indication_country(struct ast_tone_zone *zone)
{
ao2_lock(ast_tone_zones);
return 0;
}
-/* remove an existing country and all its indications, country must exist. */
+/*! \brief remove an existing country and all its indications, country must exist. */
static int ast_unregister_indication_country(const char *country)
{
struct ast_tone_zone *tz = NULL;
return 0;
}
-/* remove an existing country's indication. Both country and indication must exist */
+/*! \brief remove an existing country's indication. Both country and indication must exist */
static int ast_unregister_indication(struct ast_tone_zone *zone, const char *indication)
{
struct ast_tone_zone_sound *ts;
break;
}
}
+ ao2_iterator_destroy(&i);
return res;
}
ast_tone_zone_unlock(tz);
tz = ast_tone_zone_unref(tz);
}
+ ao2_iterator_destroy(&iter);
return CLI_SUCCESS;
}
return res;
}
-/*!
+/*!\brief
+ *
* \note This is called with the tone zone locked.
*/
static void store_tone_zone_ring_cadence(struct ast_tone_zone *zone, const char *val)
return 0;
}
-/*!
+/*! \brief
* Mark the zone and its tones before parsing configuration. We will use this
* to know what to remove after configuration is parsed.
*/
return 0;
}
-/*!
+/*! \brief
* Prune tones no longer in the configuration, and have the tone zone unlinked
* if it is no longer in the configuration at all.
*/