Version 0.1.4 from FTP

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2000-09-06 21:53:28 +00:00
parent 81b7115939
commit dc57c56065

View File

@@ -25,6 +25,7 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <linux/if_packet.h> #include <linux/if_packet.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
@@ -355,7 +356,7 @@ static int vofr_call(struct ast_channel *ast, char *dest, int timeout)
while(otimeout) { while(otimeout) {
otimeout = ast_waitfor(ast, 1000); otimeout = ast_waitfor(ast, 1000);
if (otimeout < 1) { if (otimeout < 1) {
ast_log(LOG_WARNING, "Unable to take line off hook\n"); ast_log(LOG_WARNING, "Unable to take line '%s' off hook\n", ast->name);
/* Musta gotten hung up, or no ack on off hook */ /* Musta gotten hung up, or no ack on off hook */
return -1; return -1;
} }
@@ -551,18 +552,32 @@ static struct ast_frame *vofr_read(struct ast_channel *ast)
/* Read into the right place in the buffer, in case we send this /* Read into the right place in the buffer, in case we send this
as a voice frame. */ as a voice frame. */
CHECK_BLOCKING(ast); CHECK_BLOCKING(ast);
retry:
res = read(p->s, ((char *)vh) - FR_API_MESS, res = read(p->s, ((char *)vh) - FR_API_MESS,
G723_MAX_BUF - AST_FRIENDLY_OFFSET - sizeof(struct ast_frame) + sizeof(struct vofr_hdr) + FR_API_MESS); G723_MAX_BUF - AST_FRIENDLY_OFFSET - sizeof(struct ast_frame) + sizeof(struct vofr_hdr) + FR_API_MESS);
if (res < 0) {
/* XXX HUGE BUG IN SANGOMA'S STACK: IT IGNORES O_NONBLOCK XXX */
if (errno == EAGAIN) {
fd_set fds;
FD_ZERO(&fds);
FD_SET(p->s, &fds);
select(p->s + 1, &fds, NULL, NULL, NULL);
goto retry;
}
ast->blocking = 0;
ast_log(LOG_WARNING, "Read error on %s: %s (%d)\n", ast->name, strerror(errno));
return NULL;
}
ast->blocking = 0;
#ifdef VOFRDUMPER #ifdef VOFRDUMPER
vofr_dump_packet((void *)(vh), res); vofr_dump_packet((void *)(vh), res);
#endif #endif
ast->blocking = 0;
res -= FR_API_MESS; res -= FR_API_MESS;
if (res < sizeof(struct vofr_hdr *)) { if (res < sizeof(struct vofr_hdr)) {
ast_log(LOG_WARNING, "Nonsense frame on %s\n", ast->name); ast_log(LOG_WARNING, "Nonsense frame on %s\n", ast->name);
return NULL; return NULL;
} }
/* Some nice norms */ /* Some nice norms */
fr->datalen = 0; fr->datalen = 0;
fr->timelen = 0; fr->timelen = 0;
@@ -684,7 +699,7 @@ static struct ast_frame *vofr_read(struct ast_channel *ast)
ast->state = AST_STATE_UP; ast->state = AST_STATE_UP;
return fr; return fr;
} else if (ast->state != AST_STATE_UP) { } else if (ast->state != AST_STATE_UP) {
ast_log(LOG_WARNING, "Voice in weird state %d\n", ast->state); ast_log(LOG_WARNING, "%s: Voice in weird state %d\n", ast->name, ast->state);
} }
fr->frametype = AST_FRAME_VOICE; fr->frametype = AST_FRAME_VOICE;
fr->subclass = AST_FORMAT_G723_1; fr->subclass = AST_FORMAT_G723_1;
@@ -1098,7 +1113,7 @@ static struct ast_channel *vofr_request(char *type, int format, void *data)
} }
p = iflist; p = iflist;
while(p) { while(p) {
if (!p->owner) { if (!p->owner && p->outgoing) {
tmp = vofr_new(p, AST_STATE_DOWN); tmp = vofr_new(p, AST_STATE_DOWN);
break; break;
} }