diff options
author | Anthony Minessale II <anthmct@yahoo.com> | 2004-05-07 20:39:14 +0000 |
---|---|---|
committer | Anthony Minessale II <anthmct@yahoo.com> | 2004-05-07 20:39:14 +0000 |
commit | 66b96f417c34f877ccba67e466cbb0fc7542c903 (patch) | |
tree | 033ebcd77785f0886ef673f19d830339fee527e1 /app.c | |
parent | b974395573947aad276c9541eea23e3475f25291 (diff) |
Created API call ast_dtmf_stream
int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between)
changed app_senddtmf.c to use this new call
added D() parameter to app_dial to allow post connect dtmf stream to be sent using above call
-Tony
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2918 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'app.c')
-rwxr-xr-x | app.c | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -259,3 +259,48 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs) } return 0; } + +int ast_dtmf_stream(struct ast_channel *chan,struct ast_channel *peer,char *digits,int between) { + char *ptr=NULL; + int res=0; + struct ast_frame f; + if(!between) + between = 100; + + if(peer) + res = ast_autoservice_start(peer); + + if (!res) { + res = ast_waitfor(chan,100); + if(res > -1) { + for(ptr=digits;*ptr;*ptr++) { + if(*ptr == 'w') { + res = ast_safe_sleep(chan, 500); + if(res) + break; + continue; + } + memset(&f, 0, sizeof(f)); + f.frametype = AST_FRAME_DTMF; + f.subclass = *ptr; + f.src = "ast_dtmf_stream"; + if (strchr("0123456789*#abcdABCD",*ptr)==NULL) { + ast_log(LOG_WARNING, "Illegal DTMF character '%c' in string. (0-9*#aAbBcCdD allowed)\n",*ptr); + } + else { + res = ast_write(chan, &f); + if (res) + break; + /* pause between digits */ + res = ast_safe_sleep(chan,between); + if (res) + break; + } + } + } + if(peer) + res = ast_autoservice_stop(peer); + } + + return res; +} |