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(chan->zone, "dialrecall"); } else { ts = ast_get_indication_tone(chan->zone, "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); } }