Skip to content
Snippets Groups Projects
Commit d562c7c2 authored by Martin Pycko's avatar Martin Pycko
Browse files

Fix the playtones app so that we can pass the tones as an argument ( we don't...

Fix the playtones app so that we can pass the tones as an argument ( we don't need to refer to a defined tone in indications.conf )


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 26858191
No related branches found
No related tags found
No related merge requests found
...@@ -143,6 +143,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst, ...@@ -143,6 +143,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
char *s, *data = ast_strdupa(playlst); /* cute */ char *s, *data = ast_strdupa(playlst); /* cute */
struct playtones_def d = { vol, -1, 0, 1, NULL}; struct playtones_def d = { vol, -1, 0, 1, NULL};
char *stringp=NULL; char *stringp=NULL;
char *separator;
if (!data) if (!data)
return -1; return -1;
if (vol < 1) if (vol < 1)
...@@ -151,7 +152,13 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst, ...@@ -151,7 +152,13 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
d.interruptible = interruptible; d.interruptible = interruptible;
stringp=data; stringp=data;
s = strsep(&stringp,","); /* the stringp/data is not null here */
/* check if the data is separated with '|' or with ',' by default */
if (strchr(stringp,'|'))
separator = "|";
else
separator = ",";
s = strsep(&stringp,separator);
while(s && *s) { while(s && *s) {
int freq1, freq2, time; int freq1, freq2, time;
...@@ -184,7 +191,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst, ...@@ -184,7 +191,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
d.items[d.nitems].duration = time; d.items[d.nitems].duration = time;
d.nitems++; d.nitems++;
s = strsep(&stringp,","); s = strsep(&stringp,separator);
} }
if (ast_activate_generator(chan, &playtones, &d)) { if (ast_activate_generator(chan, &playtones, &d)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment