2 * Asterisk -- An open source telephony toolkit.
4 * See http://www.asterisk.org for more information about
5 * the Asterisk project. Please do not directly contact
6 * any of the maintainers of this project for assistance;
7 * the project provides a web site, mailing lists and IRC
8 * channels for your use.
12 * \brief BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 * Primary Author: Pauline Middelink <middelink@polyware.nl>
32 #ifndef _ASTERISK_INDICATIONS_H
33 #define _ASTERISK_INDICATIONS_H
35 #include "asterisk/lock.h"
37 struct ind_tone_zone_sound
{
38 struct ind_tone_zone_sound
*next
; /* next element */
39 const char *name
; /* Identifing name */
40 const char *data
; /* Actual zone description */
41 /* Description is a series of tones of the format:
42 [!]freq1[+freq2][/duration] separated by commas. There
43 are no spaces. The sequence is repeated back to the
44 first tone description not preceeded by !. Duration is
45 specified in milliseconds */
48 struct ind_tone_zone
{
49 struct ind_tone_zone
* next
; /* next in list */
50 char country
[5]; /* Country code */
51 char alias
[5]; /* is this an alias? */
52 char description
[40]; /* Description */
53 int nrringcadence
; /* # registered ringcadence elements */
54 int *ringcadence
; /* Ring cadence */
55 struct ind_tone_zone_sound
*tones
; /* The known tones for this zone */
58 /* set the default tone country */
59 int ast_set_indication_country(const char *country
);
61 /* locate ind_tone_zone, given the country. if country == NULL, use the default country */
62 struct ind_tone_zone
*ast_get_indication_zone(const char *country
);
63 /* locate a ind_tone_zone_sound, given the ind_tone_zone. if ind_tone_zone == NULL, use the default ind_tone_zone */
64 struct ind_tone_zone_sound
*ast_get_indication_tone(const struct ind_tone_zone
*zone
, const char *indication
);
66 /* add a new country, if country exists, it will be replaced. */
67 int ast_register_indication_country(struct ind_tone_zone
*country
);
68 /* remove an existing country and all its indications, country must exist */
69 int ast_unregister_indication_country(const char *country
);
70 /* add a new indication to a ind_tone_zone. ind_tone_zone must exist. if the indication already
71 * exists, it will be replaced. */
72 int ast_register_indication(struct ind_tone_zone
*zone
, const char *indication
, const char *tonelist
);
73 /* remove an existing ind_tone_zone's indication. ind_tone_zone must exist */
74 int ast_unregister_indication(struct ind_tone_zone
*zone
, const char *indication
);
76 /* Start a tone-list going */
77 int ast_playtones_start(struct ast_channel
*chan
, int vol
, const char* tonelist
, int interruptible
);
78 /*! Stop the tones from playing */
79 void ast_playtones_stop(struct ast_channel
*chan
);
81 /* support for walking through a list of indications */
82 struct ind_tone_zone
*ast_walk_indications(const struct ind_tone_zone
*cur
);
85 extern struct ind_tone_zone
*ind_tone_zones
;
86 extern ast_mutex_t tzlock
;
89 #endif /* _ASTERISK_INDICATIONS_H */