diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-02-04 15:48:42 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-02-04 15:48:42 +0000 |
commit | bfeaccab3dc438565ef03fa961fee49805fd6eb8 (patch) | |
tree | 517ee94a20886f04c78a05a553831f5b081fed76 /res/res_adsi.c | |
parent | 151774c059eebca84557de8bed5495b523bdd8b2 (diff) |
Version 0.3.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@600 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_adsi.c')
-rwxr-xr-x | res/res_adsi.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/res/res_adsi.c b/res/res_adsi.c index 11a23c987..3d2333dca 100755 --- a/res/res_adsi.c +++ b/res/res_adsi.c @@ -20,7 +20,9 @@ #include <stdlib.h> #include <unistd.h> #include <math.h> +#include <errno.h> #include <asterisk/ulaw.h> +#include <asterisk/alaw.h> #include <asterisk/callerid.h> #include <asterisk/logger.h> #include <asterisk/fskmodem.h> @@ -49,7 +51,7 @@ static char speeddial[ADSI_MAX_SPEED_DIAL][3][20]; static int alignment = 0; -static int adsi_generate(unsigned char *buf, int msgtype, char *msg, int msglen, int msgnum, int last) +static int adsi_generate(unsigned char *buf, int msgtype, char *msg, int msglen, int msgnum, int last, int codec) { int sum; int x; @@ -121,7 +123,7 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l outf.subclass = AST_FORMAT_ULAW; outf.data = buf; outf.datalen = amt; - outf.timelen = amt * 8; + outf.samples = amt; if (ast_write(chan, &outf)) { ast_log(LOG_WARNING, "Failed to carefully write frame\n"); return -1; @@ -156,7 +158,7 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l outf.subclass = AST_FORMAT_ULAW; outf.data = buf; outf.datalen = amt; - outf.timelen = amt * 8; + outf.samples = amt; if (ast_write(chan, &outf)) { ast_log(LOG_WARNING, "Failed to carefully write frame\n"); return -1; @@ -196,7 +198,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms while(retries < maxretries) { if (!(chan->adsicpe & ADSI_FLAG_DATAMODE)) { /* Generate CAS (no SAS) */ - ast_gen_cas(buf, 0, 680); + ast_gen_cas(buf, 0, 680, AST_FORMAT_ULAW); /* Send CAS */ if (adsi_careful_send(chan, buf, 680, NULL)) { @@ -249,7 +251,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms def= ast_channel_defer_dtmf(chan); #endif while((x < 6) && msg[x]) { - res = adsi_generate(buf + pos, msgtype[x], msg[x], msglen[x], x+1 - start, (x == 5) || !msg[x+1]); + res = adsi_generate(buf + pos, msgtype[x], msg[x], msglen[x], x+1 - start, (x == 5) || !msg[x+1], AST_FORMAT_ULAW); if (res < 0) { ast_log(LOG_WARNING, "Failed to generate ADSI message %d on channel %s\n", x + 1, chan->name); return -1; @@ -1046,8 +1048,10 @@ static void adsi_load(void) total = x; x = 0; while(v) { - name = strtok(v->value, ","); - sname = strtok(NULL, ","); + char *stringp=NULL; + stringp=v->value; + name = strsep(&stringp, ","); + sname = strsep(&stringp, ","); if (!sname) sname = name; if (x < ADSI_MAX_SPEED_DIAL) { |