Fix law table (i4l) (bug #3412)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4887 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Mark Spencer 21 years ago
parent b5f5e0762e
commit 248c923284

@ -26,7 +26,7 @@
#include <asterisk/options.h> #include <asterisk/options.h>
#include <asterisk/dsp.h> #include <asterisk/dsp.h>
#include <asterisk/callerid.h> #include <asterisk/callerid.h>
#include <asterisk/alaw.h> #include <asterisk/ulaw.h>
#define STATE_COMMAND 0 #define STATE_COMMAND 0
#define STATE_VOICE 1 #define STATE_VOICE 1
@ -211,9 +211,9 @@ static int i4l_init(struct ast_modem_pvt *p)
return -1; return -1;
} }
if (ast_modem_send(p, "AT+VSM=5", 0) || if (ast_modem_send(p, "AT+VSM=6", 0) ||
ast_modem_expect(p, "OK", 5)) { ast_modem_expect(p, "OK", 5)) {
ast_log(LOG_WARNING, "Unable to set to aLAW mode\n"); ast_log(LOG_WARNING, "Unable to set to muLAW mode\n");
return -1; return -1;
} }
if (ast_modem_send(p, "AT+VLS=2", 0) || if (ast_modem_send(p, "AT+VLS=2", 0) ||
@ -420,7 +420,7 @@ static struct ast_frame *i4l_read(struct ast_modem_pvt *p)
if (!f) if (!f)
return NULL; return NULL;
} else { } else {
*(b++) = AST_ALAW(result[x]); *(b++) = AST_MULAW(result[x]);
p->obuflen += 2; p->obuflen += 2;
} }
} }
@ -480,7 +480,7 @@ static int i4l_write(struct ast_modem_pvt *p, struct ast_frame *f)
return -1; return -1;
} }
for (x=0;x<f->datalen/2;x++) { for (x=0;x<f->datalen/2;x++) {
b = AST_LIN2A(((short *)f->data)[x]); b = AST_LIN2MU(((short *)f->data)[x]);
result[bpos++] = b; result[bpos++] = b;
if (b == CHAR_DLE) if (b == CHAR_DLE)
result[bpos++]=b; result[bpos++]=b;

Loading…
Cancel
Save