forked from asterisk/asterisk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@139 65c4cc65-6c06-0410-ace0-fbb531ad65f3
- Loading branch information
Mark Spencer
committed
Dec 16, 1999
1 parent
d73d60a
commit 0ed9477
Showing
13 changed files
with
1,750 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* QuickNet Internet Phone Jack Channel | ||
* | ||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC | ||
* Copyright (C) 1999, Mark Spencer | ||
* | ||
* Mark Spencer <[email protected]> | ||
* | ||
|
@@ -60,7 +60,7 @@ static pthread_mutex_t monlock = PTHREAD_MUTEX_INITIALIZER; | |
which are not currently in use. */ | ||
static pthread_t monitor_thread = -1; | ||
|
||
static int restart_monitor(); | ||
static int restart_monitor(void); | ||
|
||
/* The private structures of the Phone Jack channels are linked for | ||
selecting outgoing channels */ | ||
|
@@ -129,7 +129,8 @@ static int ixj_call(struct ast_channel *ast, char *dest, int timeout) | |
} | ||
/* When we call, it just works, really, there's no destination... Just | ||
ring the phone and wait for someone to answer */ | ||
ast_log(LOG_DEBUG, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fd); | ||
if (option_debug) | ||
ast_log(LOG_DEBUG, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fd); | ||
ioctl(p->fd, IXJCTL_RING_START); | ||
ast->state = AST_STATE_RINGING; | ||
return 0; | ||
|
@@ -139,7 +140,8 @@ static int ixj_hangup(struct ast_channel *ast) | |
{ | ||
struct ixj_pvt *p; | ||
p = ast->pvt->pvt; | ||
ast_log(LOG_DEBUG, "ixj_hangup(%s)\n", ast->name); | ||
if (option_debug) | ||
ast_log(LOG_DEBUG, "ixj_hangup(%s)\n", ast->name); | ||
if (!ast->pvt->pvt) { | ||
ast_log(LOG_WARNING, "Asked to hangup channel not connected\n"); | ||
return 0; | ||
|
@@ -217,7 +219,8 @@ static int ixj_setup(struct ast_channel *ast) | |
static int ixj_answer(struct ast_channel *ast) | ||
{ | ||
ixj_setup(ast); | ||
ast_log(LOG_DEBUG, "ixj_answer(%s)\n", ast->name); | ||
if (option_debug) | ||
ast_log(LOG_DEBUG, "ixj_answer(%s)\n", ast->name); | ||
ast->rings = 0; | ||
ast->state = AST_STATE_UP; | ||
return 0; | ||
|
@@ -287,6 +290,14 @@ static struct ast_frame *ixj_read(struct ast_channel *ast) | |
res = read(p->fd, p->buf, IXJ_MAX_BUF); | ||
ast->blocking = 0; | ||
if (res < 0) { | ||
#if 0 | ||
if (errno == EAGAIN) { | ||
ast_log(LOG_WARNING, "Null frame received\n"); | ||
p->fr.frametype = AST_FRAME_NULL; | ||
p->fr.subclass = 0; | ||
return &p->fr; | ||
} | ||
#endif | ||
ast_log(LOG_WARNING, "Error reading: %s\n", strerror(errno)); | ||
return NULL; | ||
} | ||
|
@@ -486,6 +497,10 @@ static void ixj_check_exception(struct ixj_pvt *i) | |
ixj_new(i, AST_STATE_UP); | ||
/* No need to restart monitor, we are the monitor */ | ||
if (i->owner) { | ||
pthread_mutex_lock(&usecnt_lock); | ||
usecnt--; | ||
pthread_mutex_unlock(&usecnt_lock); | ||
ast_update_use_count(); | ||
ixj_setup(i->owner); | ||
} | ||
} else if (ast_exists_extension(NULL, "default", i->ext, 1)) { | ||
|
@@ -494,10 +509,16 @@ static void ixj_check_exception(struct ixj_pvt *i) | |
strncpy(i->context, "default", sizeof(i->context)); | ||
ixj_new(i, AST_STATE_UP); | ||
if (i->owner) { | ||
pthread_mutex_lock(&usecnt_lock); | ||
usecnt--; | ||
pthread_mutex_unlock(&usecnt_lock); | ||
ast_update_use_count(); | ||
ixj_setup(i->owner); | ||
} | ||
} else if ((strlen(i->ext) >= ast_pbx_longest_extension(i->context)) && | ||
(strlen(i->ext) >= ast_pbx_longest_extension("default"))) { | ||
if (option_debug) | ||
ast_log(LOG_DEBUG, "%s is too long\n", i->ext); | ||
/* It's not a valid extension, give a busy signal */ | ||
ioctl(i->fd, IXJCTL_BUSY); | ||
} | ||
|
@@ -512,18 +533,23 @@ static void ixj_check_exception(struct ixj_pvt *i) | |
if (i->mode == MODE_IMMEDIATE) { | ||
ixj_new(i, AST_STATE_RING); | ||
} else if (i->mode == MODE_DIALTONE) { | ||
#if 0 | ||
/* XXX Bug in the Phone jack, you can't detect DTMF when playing a tone XXX */ | ||
ioctl(i->fd, IXJCTL_DIALTONE); | ||
#else | ||
pthread_mutex_lock(&usecnt_lock); | ||
usecnt++; | ||
pthread_mutex_unlock(&usecnt_lock); | ||
ast_update_use_count(); | ||
/* Play the dialtone */ | ||
i->dialtone++; | ||
ioctl(i->fd, IXJCTL_PLAY_STOP); | ||
ioctl(i->fd, IXJCTL_PLAY_CODEC, ULAW); | ||
ioctl(i->fd, IXJCTL_PLAY_START); | ||
#endif | ||
} | ||
} else { | ||
if (i->dialtone) { | ||
pthread_mutex_lock(&usecnt_lock); | ||
usecnt--; | ||
pthread_mutex_unlock(&usecnt_lock); | ||
ast_update_use_count(); | ||
} | ||
memset(i->ext, 0, sizeof(i->ext)); | ||
ioctl(i->fd, IXJCTL_CPT_STOP); | ||
ioctl(i->fd, IXJCTL_PLAY_STOP); | ||
|
@@ -690,11 +716,13 @@ static int restart_monitor() | |
return 0; | ||
} | ||
|
||
struct ixj_pvt *mkif(char *iface, int mode) | ||
static struct ixj_pvt *mkif(char *iface, int mode) | ||
{ | ||
/* Make a ixj_pvt structure for this interface */ | ||
struct ixj_pvt *tmp; | ||
#if 0 | ||
int flags; | ||
#endif | ||
|
||
tmp = malloc(sizeof(struct ixj_pvt)); | ||
if (tmp) { | ||
|
@@ -709,8 +737,10 @@ struct ixj_pvt *mkif(char *iface, int mode) | |
ioctl(tmp->fd, IXJCTL_RING_STOP); | ||
ioctl(tmp->fd, IXJCTL_CPT_STOP); | ||
tmp->mode = mode; | ||
#if 0 | ||
flags = fcntl(tmp->fd, F_GETFL); | ||
fcntl(tmp->fd, F_SETFL, flags | O_NONBLOCK); | ||
#endif | ||
tmp->owner = NULL; | ||
tmp->lastformat = -1; | ||
tmp->lastinput = -1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* Implementation of Voice over Frame Relay, Adtran Style | ||
* | ||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC | ||
* Copyright (C) 1999, Mark Spencer | ||
* | ||
* Mark Spencer <[email protected]> | ||
* | ||
|
@@ -55,7 +55,7 @@ static pthread_mutex_t monlock = PTHREAD_MUTEX_INITIALIZER; | |
which are not currently in use. */ | ||
static pthread_t monitor_thread = -1; | ||
|
||
static int restart_monitor(); | ||
static int restart_monitor(void); | ||
|
||
/* The private structures of the Adtran VoFR channels are linked for | ||
selecting outgoing channels */ | ||
|
@@ -558,6 +558,9 @@ static struct ast_frame *vofr_read(struct ast_channel *ast) | |
fr->subclass = 0; | ||
break; | ||
} | ||
case VOFR_SIGNAL_RING: | ||
ast->rings++; | ||
break; | ||
case VOFR_SIGNAL_UNKNOWN: | ||
switch(vh->data[1]) { | ||
case 0x1: | ||
|
@@ -783,7 +786,21 @@ static int vofr_mini_packet(struct vofr_pvt *i, struct vofr_hdr *pkt, int len) | |
switch(pkt->data[0]) { | ||
case VOFR_SIGNAL_RING: | ||
/* If we get a RING, we definitely want to start a new thread */ | ||
vofr_new(i, AST_STATE_RING); | ||
if (!i->owner) | ||
vofr_new(i, AST_STATE_RING); | ||
else | ||
ast_log(LOG_WARNING, "Got a ring, but there's an owner?\n"); | ||
break; | ||
case VOFR_SIGNAL_OFF_HOOK: | ||
/* Network termination, go off hook */ | ||
#if 0 | ||
ast_log(LOG_DEBUG, "Off hook\n"); | ||
#endif | ||
vofr_xmit_signal(i, 0x10, 2); | ||
if (!i->owner) | ||
vofr_new(i, AST_STATE_UP); | ||
else | ||
ast_log(LOG_WARNING, "Got an offhook, but there's an owner?\n"); | ||
break; | ||
case VOFR_SIGNAL_ON_HOOK: | ||
break; | ||
|
@@ -896,7 +913,7 @@ static void *do_monitor(void *data) | |
|
||
} | ||
|
||
static int restart_monitor() | ||
static int restart_monitor(void) | ||
{ | ||
/* If we're supposed to be stopped -- stay stopped */ | ||
if (monitor_thread == -2) | ||
|
@@ -926,7 +943,7 @@ static int restart_monitor() | |
return 0; | ||
} | ||
|
||
struct vofr_pvt *mkif(char *type, char *iface) | ||
static struct vofr_pvt *mkif(char *type, char *iface) | ||
{ | ||
/* Make a vofr_pvt structure for this interface */ | ||
struct vofr_pvt *tmp; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# LMC section | ||
|
||
CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g | ||
RANLIB=ranlib | ||
|
||
# the XING decoder objs and dependencies: | ||
# This is kinda nasty, since there's C, C++, and asm, oh my! | ||
# of course, each needs different compilation methods. grr. | ||
XINGOBJX86 = src/x86gas.o | ||
|
||
XINGOBJS = src/cdct.o src/cupl3.o \ | ||
src/hwin.o src/iup.o src/l3init.o \ | ||
src/msis.o src/wavep.o src/csbt.o \ | ||
src/cwinm.o src/icdct.o src/mdct.o \ | ||
src/uph.o src/cup.o src/dec8.o \ | ||
src/isbt.o src/l3dq.o src/mhead.o \ | ||
src/upsf.o src/iwinm.o | ||
|
||
LIBMP3=libmp3.a | ||
ARFLAGS=cr | ||
|
||
XINGLMCOBJC += $(shell if uname -m | grep -q i.86; then echo src/x86gas.o; fi) | ||
|
||
#assembly lang code, if we need it | ||
|
||
XINGLMCOBJ = $(XINGOBJS) | ||
|
||
all: $(LIBMP3) | ||
|
||
$(LIBMP3): $(XINGOBJS) | ||
$(AR) $(ARFLAGS) $(LIBMP3) $(XINGLMCOBJ) | ||
$(RANLIB) $(LIBMP3) | ||
|
||
clean: | ||
rm -f $(XINGOBJS) | ||
rm -f $(LIBMP3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* Old-style G.723 frame/timestamp format. | ||
* | ||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC | ||
* Copyright (C) 1999, Mark Spencer | ||
* | ||
* Mark Spencer <[email protected]> | ||
* | ||
|
@@ -285,7 +285,7 @@ static int g723_write(struct ast_filestream *fs, struct ast_frame *f) | |
return 0; | ||
} | ||
|
||
char *g723_getcomment(struct ast_filestream *s) | ||
static char *g723_getcomment(struct ast_filestream *s) | ||
{ | ||
return NULL; | ||
} | ||
|
Oops, something went wrong.