Sat Apr 26 20:55:02 2008

Asterisk developer's documentation


indications.h

Go to the documentation of this file.
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 /* forward reference */
00038 struct ast_channel;
00039 
00040 struct tone_zone_sound {
00041    struct tone_zone_sound *next;    /* next element */
00042    const char *name;       /* Identifing name */
00043    const char *data;       /* Actual zone description */
00044    /* Description is a series of tones of the format:
00045       [!]freq1[+freq2][/duration] separated by commas.  There
00046       are no spaces.  The sequence is repeated back to the 
00047       first tone description not preceeded by !. Duration is
00048       specified in milliseconds */
00049 };
00050 
00051 struct tone_zone {
00052    struct tone_zone* next;          /* next in list */
00053    char country[5];           /* Country code */
00054    char alias[5];             /* is this an alias? */
00055    char description[40];            /* Description */
00056    int  nrringcadence;           /* # registered ringcadence elements */
00057    int *ringcadence;          /* Ring cadence */
00058    struct tone_zone_sound *tones;         /* The known tones for this zone */
00059 };
00060 
00061 /* set the default tone country */
00062 extern int ast_set_indication_country(const char *country);
00063 
00064 /* locate tone_zone, given the country. if country == NULL, use the default country */
00065 extern struct tone_zone *ast_get_indication_zone(const char *country);
00066 /* locate a tone_zone_sound, given the tone_zone. if tone_zone == NULL, use the default tone_zone */
00067 extern struct tone_zone_sound *ast_get_indication_tone(const struct tone_zone *zone, const char *indication);
00068 
00069 /* add a new country, if country exists, it will be replaced. */
00070 extern int ast_register_indication_country(struct tone_zone *country);
00071 /* remove an existing country and all its indications, country must exist */
00072 extern int ast_unregister_indication_country(const char *country);
00073 /* add a new indication to a tone_zone. tone_zone must exist. if the indication already
00074  * exists, it will be replaced. */
00075 extern int ast_register_indication(struct tone_zone *zone, const char *indication, const char *tonelist);
00076 /* remove an existing tone_zone's indication. tone_zone must exist */
00077 extern int ast_unregister_indication(struct tone_zone *zone, const char *indication);
00078 
00079 /* Start a tone-list going */
00080 int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
00081 /*! Stop the tones from playing */
00082 void ast_playtones_stop(struct ast_channel *chan);
00083 
00084 extern struct tone_zone *tone_zones;
00085 extern ast_mutex_t tzlock;
00086 
00087 #endif /* _ASTERISK_INDICATIONS_H */

Generated on Sat Apr 26 20:55:02 2008 for Asterisk - the Open Source PBX by  doxygen 1.5.1