diff options
Diffstat (limited to 'res')
-rwxr-xr-x | res/res_adsi.c | 18 | ||||
-rwxr-xr-x | res/res_crypto.c | 13 |
2 files changed, 19 insertions, 12 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) { diff --git a/res/res_crypto.c b/res/res_crypto.c index 5ac2e441b..61eb1328e 100755 --- a/res/res_crypto.c +++ b/res/res_crypto.c @@ -28,7 +28,10 @@ #include <dirent.h> #include <string.h> #include <errno.h> +#include <unistd.h> +#include <fcntl.h> #include "../asterisk.h" +#include "../astconf.h" /* * Asterisk uses RSA keys with SHA-1 message digests for its @@ -460,14 +463,14 @@ static void crypto_load(int ifd, int ofd) } ast_pthread_mutex_unlock(&keylock); /* Load new keys */ - dir = opendir(AST_KEY_DIR); + dir = opendir((char *)ast_config_AST_KEY_DIR); if (dir) { while((ent = readdir(dir))) { - try_load_key(AST_KEY_DIR, ent->d_name, ifd, ofd, ¬e); + try_load_key((char *)ast_config_AST_KEY_DIR, ent->d_name, ifd, ofd, ¬e); } closedir(dir); } else - ast_log(LOG_WARNING, "Unable to open key directory '%s'\n", AST_KEY_DIR); + ast_log(LOG_WARNING, "Unable to open key directory '%s'\n", (char *)ast_config_AST_KEY_DIR); if (note) { ast_log(LOG_NOTICE, "Please run the command 'init keys' to enter the passcodes for the keys\n"); } @@ -531,9 +534,9 @@ static int init_keys(int fd, int argc, char *argv[]) while(key) { /* Reload keys that need pass codes now */ if (key->ktype & KEY_NEEDS_PASSCODE) { - kn = key->fn + strlen(AST_KEY_DIR) + 1; + kn = key->fn + strlen(ast_config_AST_KEY_DIR) + 1; strncpy(tmp, kn, sizeof(tmp)); - try_load_key(AST_KEY_DIR, tmp, fd, fd, &ign); + try_load_key((char *)ast_config_AST_KEY_DIR, tmp, fd, fd, &ign); } key = key->next; } |