static void play_dialtone(struct ast_channel *chan, char *mailbox) { const struct tone_zone_sound *ts = NULL; if(ast_app_has_voicemail(mailbox, NULL)) ts = ast_get_indication_tone(chan->zone, "dialrecall"); else ts = ast_get_indication_tone(chan->zone, "dial"); if (ts) ast_playtones_start(chan, 0, ts->data, 0); else ast_tonepair_start(chan, 350, 440, 0, 0); }
static int handle_playtones(struct ast_channel *chan, const char *data) { struct ast_tone_zone_sound *ts; int res; const char *str = data; if (ast_strlen_zero(str)) { ast_log(LOG_NOTICE,"Nothing to play\n"); return -1; } ts = ast_get_indication_tone(ast_channel_zone(chan), str); if (ts) { res = ast_playtones_start(chan, 0, ts->data, 0); ts = ast_tone_zone_sound_unref(ts); } else { res = ast_playtones_start(chan, 0, str, 0); } if (res) { ast_log(LOG_NOTICE, "Unable to start playtones\n"); } return res; }
static void play_dialtone(struct ast_channel *chan, char *mailbox) { struct ast_tone_zone_sound *ts = NULL; if (ast_app_has_voicemail(mailbox, NULL)) { ts = ast_get_indication_tone(ast_channel_zone(chan), "dialrecall"); } else { ts = ast_get_indication_tone(ast_channel_zone(chan), "dial"); } if (ts) { ast_playtones_start(chan, 0, ts->data, 0); ts = ast_tone_zone_sound_unref(ts); } else { ast_tonepair_start(chan, 350, 440, 0, 0); } }
/* * Playtones command stuff */ static int handle_playtones(struct ast_channel *chan, void *data) { struct ind_tone_zone_sound *ts; int res; if (!data || !((char*)data)[0]) { ast_log(LOG_NOTICE,"Nothing to play\n"); return -1; } ts = ast_get_indication_tone(chan->zone, (const char*)data); if (ts && ts->data[0]) res = ast_playtones_start(chan, 0, ts->data, 0); else res = ast_playtones_start(chan, 0, (const char*)data, 0); if (res) ast_log(LOG_NOTICE,"Unable to start playtones\n"); return res; }