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