00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * See http://www.asterisk.org for more information about 00005 * the Asterisk project. Please do not directly contact 00006 * any of the maintainers of this project for assistance; 00007 * the project provides a web site, mailing lists and IRC 00008 * channels for your use. 00009 */ 00010 00011 /*! \file 00012 * \brief BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 00013 * 00014 * This program is free software; you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as published by 00016 * the Free Software Foundation; either version 2 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU General Public License 00025 * along with this program; if not, write to the Free Software 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00027 * 00028 * Primary Author: Pauline Middelink <middelink@polyware.nl> 00029 * 00030 */ 00031 00032 #ifndef _ASTERISK_INDICATIONS_H 00033 #define _ASTERISK_INDICATIONS_H 00034 00035 #include "asterisk/lock.h" 00036 00037 struct tone_zone_sound { 00038 struct tone_zone_sound *next; /* next element */ 00039 const char *name; /* Identifing name */ 00040 const char *data; /* Actual zone description */ 00041 /* Description is a series of tones of the format: 00042 [!]freq1[+freq2][/duration] separated by commas. There 00043 are no spaces. The sequence is repeated back to the 00044 first tone description not preceeded by !. Duration is 00045 specified in milliseconds */ 00046 }; 00047 00048 struct tone_zone { 00049 struct tone_zone* next; /* next in list */ 00050 char country[5]; /* Country code */ 00051 char alias[5]; /* is this an alias? */ 00052 char description[40]; /* Description */ 00053 int nrringcadence; /* # registered ringcadence elements */ 00054 int *ringcadence; /* Ring cadence */ 00055 struct tone_zone_sound *tones; /* The known tones for this zone */ 00056 }; 00057 00058 /* set the default tone country */ 00059 int ast_set_indication_country(const char *country); 00060 00061 /* locate ind_tone_zone, given the country. if country == NULL, use the default country */ 00062 struct tone_zone *ast_get_indication_zone(const char *country); 00063 /* locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */ 00064 struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication); 00065 00066 /* add a new country, if country exists, it will be replaced. */ 00067 int ast_register_indication_country(struct tone_zone *country); 00068 /* remove an existing country and all its indications, country must exist */ 00069 int ast_unregister_indication_country(const char *country); 00070 /* add a new indication to a tone_zone. tone_zone must exist. if the indication already 00071 * exists, it will be replaced. */ 00072 int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist); 00073 /* remove an existing tone_zone's indication. tone_zone must exist */ 00074 int ast_unregister_indication(struct tone_zone *zone, const char *indication); 00075 00076 /* Start a tone-list going */ 00077 int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible); 00078 /*! Stop the tones from playing */ 00079 void ast_playtones_stop(struct ast_channel *chan); 00080 00081 /* support for walking through a list of indications */ 00082 struct tone_zone *ast_walk_indications(const struct tone_zone *cur); 00083 00084 #if 0 00085 extern struct tone_zone *tone_zones; 00086 extern ast_mutex_t tzlock; 00087 #endif 00088 00089 #endif /* _ASTERISK_INDICATIONS_H */