Skip to content

Commit 0ed9477

Browse files
author
Mark Spencer
committed
Version 0.1.1 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@139 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1 parent d73d60a commit 0ed9477

File tree

13 files changed

+1750
-68
lines changed

13 files changed

+1750
-68
lines changed

BUGS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
these bugs are in asterisk, and sometimes they relate to the products
33
that asterisk uses.
44

5-
* The MP3 decoder is completely broken
6-
75
* The translator API may introduce warble in the case of going in both
86
directions, but I haven't verified that. The trouble should only enter
97
in the case of mismatched frame lengths.
8+
9+
* In general Asterisk is a very new program, and there are liable to be
10+
many bugs yet to be discovered, so if you think you've found one, please
11+
be sure to report it.

channels/chan_ixj.c

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* QuickNet Internet Phone Jack Channel
55
*
6-
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
6+
* Copyright (C) 1999, Mark Spencer
77
*
88
* Mark Spencer <markster@linux-support.net>
99
*
@@ -60,7 +60,7 @@ static pthread_mutex_t monlock = PTHREAD_MUTEX_INITIALIZER;
6060
which are not currently in use. */
6161
static pthread_t monitor_thread = -1;
6262

63-
static int restart_monitor();
63+
static int restart_monitor(void);
6464

6565
/* The private structures of the Phone Jack channels are linked for
6666
selecting outgoing channels */
@@ -129,7 +129,8 @@ static int ixj_call(struct ast_channel *ast, char *dest, int timeout)
129129
}
130130
/* When we call, it just works, really, there's no destination... Just
131131
ring the phone and wait for someone to answer */
132-
ast_log(LOG_DEBUG, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fd);
132+
if (option_debug)
133+
ast_log(LOG_DEBUG, "Ringing %s on %s (%d)\n", dest, ast->name, ast->fd);
133134
ioctl(p->fd, IXJCTL_RING_START);
134135
ast->state = AST_STATE_RINGING;
135136
return 0;
@@ -139,7 +140,8 @@ static int ixj_hangup(struct ast_channel *ast)
139140
{
140141
struct ixj_pvt *p;
141142
p = ast->pvt->pvt;
142-
ast_log(LOG_DEBUG, "ixj_hangup(%s)\n", ast->name);
143+
if (option_debug)
144+
ast_log(LOG_DEBUG, "ixj_hangup(%s)\n", ast->name);
143145
if (!ast->pvt->pvt) {
144146
ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
145147
return 0;
@@ -217,7 +219,8 @@ static int ixj_setup(struct ast_channel *ast)
217219
static int ixj_answer(struct ast_channel *ast)
218220
{
219221
ixj_setup(ast);
220-
ast_log(LOG_DEBUG, "ixj_answer(%s)\n", ast->name);
222+
if (option_debug)
223+
ast_log(LOG_DEBUG, "ixj_answer(%s)\n", ast->name);
221224
ast->rings = 0;
222225
ast->state = AST_STATE_UP;
223226
return 0;
@@ -287,6 +290,14 @@ static struct ast_frame *ixj_read(struct ast_channel *ast)
287290
res = read(p->fd, p->buf, IXJ_MAX_BUF);
288291
ast->blocking = 0;
289292
if (res < 0) {
293+
#if 0
294+
if (errno == EAGAIN) {
295+
ast_log(LOG_WARNING, "Null frame received\n");
296+
p->fr.frametype = AST_FRAME_NULL;
297+
p->fr.subclass = 0;
298+
return &p->fr;
299+
}
300+
#endif
290301
ast_log(LOG_WARNING, "Error reading: %s\n", strerror(errno));
291302
return NULL;
292303
}
@@ -486,6 +497,10 @@ static void ixj_check_exception(struct ixj_pvt *i)
486497
ixj_new(i, AST_STATE_UP);
487498
/* No need to restart monitor, we are the monitor */
488499
if (i->owner) {
500+
pthread_mutex_lock(&usecnt_lock);
501+
usecnt--;
502+
pthread_mutex_unlock(&usecnt_lock);
503+
ast_update_use_count();
489504
ixj_setup(i->owner);
490505
}
491506
} else if (ast_exists_extension(NULL, "default", i->ext, 1)) {
@@ -494,10 +509,16 @@ static void ixj_check_exception(struct ixj_pvt *i)
494509
strncpy(i->context, "default", sizeof(i->context));
495510
ixj_new(i, AST_STATE_UP);
496511
if (i->owner) {
512+
pthread_mutex_lock(&usecnt_lock);
513+
usecnt--;
514+
pthread_mutex_unlock(&usecnt_lock);
515+
ast_update_use_count();
497516
ixj_setup(i->owner);
498517
}
499518
} else if ((strlen(i->ext) >= ast_pbx_longest_extension(i->context)) &&
500519
(strlen(i->ext) >= ast_pbx_longest_extension("default"))) {
520+
if (option_debug)
521+
ast_log(LOG_DEBUG, "%s is too long\n", i->ext);
501522
/* It's not a valid extension, give a busy signal */
502523
ioctl(i->fd, IXJCTL_BUSY);
503524
}
@@ -512,18 +533,23 @@ static void ixj_check_exception(struct ixj_pvt *i)
512533
if (i->mode == MODE_IMMEDIATE) {
513534
ixj_new(i, AST_STATE_RING);
514535
} else if (i->mode == MODE_DIALTONE) {
515-
#if 0
516-
/* XXX Bug in the Phone jack, you can't detect DTMF when playing a tone XXX */
517-
ioctl(i->fd, IXJCTL_DIALTONE);
518-
#else
536+
pthread_mutex_lock(&usecnt_lock);
537+
usecnt++;
538+
pthread_mutex_unlock(&usecnt_lock);
539+
ast_update_use_count();
519540
/* Play the dialtone */
520541
i->dialtone++;
521542
ioctl(i->fd, IXJCTL_PLAY_STOP);
522543
ioctl(i->fd, IXJCTL_PLAY_CODEC, ULAW);
523544
ioctl(i->fd, IXJCTL_PLAY_START);
524-
#endif
525545
}
526546
} else {
547+
if (i->dialtone) {
548+
pthread_mutex_lock(&usecnt_lock);
549+
usecnt--;
550+
pthread_mutex_unlock(&usecnt_lock);
551+
ast_update_use_count();
552+
}
527553
memset(i->ext, 0, sizeof(i->ext));
528554
ioctl(i->fd, IXJCTL_CPT_STOP);
529555
ioctl(i->fd, IXJCTL_PLAY_STOP);
@@ -690,11 +716,13 @@ static int restart_monitor()
690716
return 0;
691717
}
692718

693-
struct ixj_pvt *mkif(char *iface, int mode)
719+
static struct ixj_pvt *mkif(char *iface, int mode)
694720
{
695721
/* Make a ixj_pvt structure for this interface */
696722
struct ixj_pvt *tmp;
723+
#if 0
697724
int flags;
725+
#endif
698726

699727
tmp = malloc(sizeof(struct ixj_pvt));
700728
if (tmp) {
@@ -709,8 +737,10 @@ struct ixj_pvt *mkif(char *iface, int mode)
709737
ioctl(tmp->fd, IXJCTL_RING_STOP);
710738
ioctl(tmp->fd, IXJCTL_CPT_STOP);
711739
tmp->mode = mode;
740+
#if 0
712741
flags = fcntl(tmp->fd, F_GETFL);
713742
fcntl(tmp->fd, F_SETFL, flags | O_NONBLOCK);
743+
#endif
714744
tmp->owner = NULL;
715745
tmp->lastformat = -1;
716746
tmp->lastinput = -1;

channels/chan_vofr.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Implementation of Voice over Frame Relay, Adtran Style
55
*
6-
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
6+
* Copyright (C) 1999, Mark Spencer
77
*
88
* Mark Spencer <markster@linux-support.net>
99
*
@@ -55,7 +55,7 @@ static pthread_mutex_t monlock = PTHREAD_MUTEX_INITIALIZER;
5555
which are not currently in use. */
5656
static pthread_t monitor_thread = -1;
5757

58-
static int restart_monitor();
58+
static int restart_monitor(void);
5959

6060
/* The private structures of the Adtran VoFR channels are linked for
6161
selecting outgoing channels */
@@ -558,6 +558,9 @@ static struct ast_frame *vofr_read(struct ast_channel *ast)
558558
fr->subclass = 0;
559559
break;
560560
}
561+
case VOFR_SIGNAL_RING:
562+
ast->rings++;
563+
break;
561564
case VOFR_SIGNAL_UNKNOWN:
562565
switch(vh->data[1]) {
563566
case 0x1:
@@ -783,7 +786,21 @@ static int vofr_mini_packet(struct vofr_pvt *i, struct vofr_hdr *pkt, int len)
783786
switch(pkt->data[0]) {
784787
case VOFR_SIGNAL_RING:
785788
/* If we get a RING, we definitely want to start a new thread */
786-
vofr_new(i, AST_STATE_RING);
789+
if (!i->owner)
790+
vofr_new(i, AST_STATE_RING);
791+
else
792+
ast_log(LOG_WARNING, "Got a ring, but there's an owner?\n");
793+
break;
794+
case VOFR_SIGNAL_OFF_HOOK:
795+
/* Network termination, go off hook */
796+
#if 0
797+
ast_log(LOG_DEBUG, "Off hook\n");
798+
#endif
799+
vofr_xmit_signal(i, 0x10, 2);
800+
if (!i->owner)
801+
vofr_new(i, AST_STATE_UP);
802+
else
803+
ast_log(LOG_WARNING, "Got an offhook, but there's an owner?\n");
787804
break;
788805
case VOFR_SIGNAL_ON_HOOK:
789806
break;
@@ -896,7 +913,7 @@ static void *do_monitor(void *data)
896913

897914
}
898915

899-
static int restart_monitor()
916+
static int restart_monitor(void)
900917
{
901918
/* If we're supposed to be stopped -- stay stopped */
902919
if (monitor_thread == -2)
@@ -926,7 +943,7 @@ static int restart_monitor()
926943
return 0;
927944
}
928945

929-
struct vofr_pvt *mkif(char *type, char *iface)
946+
static struct vofr_pvt *mkif(char *type, char *iface)
930947
{
931948
/* Make a vofr_pvt structure for this interface */
932949
struct vofr_pvt *tmp;

codecs/mp3/Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#
2+
# LMC section
3+
4+
CFLAGS+= -I../include -Iinclude -O6 -funroll-loops -finline-functions -Wall -Wno-missing-prototypes -Wno-missing-declarations -g
5+
RANLIB=ranlib
6+
7+
# the XING decoder objs and dependencies:
8+
# This is kinda nasty, since there's C, C++, and asm, oh my!
9+
# of course, each needs different compilation methods. grr.
10+
XINGOBJX86 = src/x86gas.o
11+
12+
XINGOBJS = src/cdct.o src/cupl3.o \
13+
src/hwin.o src/iup.o src/l3init.o \
14+
src/msis.o src/wavep.o src/csbt.o \
15+
src/cwinm.o src/icdct.o src/mdct.o \
16+
src/uph.o src/cup.o src/dec8.o \
17+
src/isbt.o src/l3dq.o src/mhead.o \
18+
src/upsf.o src/iwinm.o
19+
20+
LIBMP3=libmp3.a
21+
ARFLAGS=cr
22+
23+
XINGLMCOBJC += $(shell if uname -m | grep -q i.86; then echo src/x86gas.o; fi)
24+
25+
#assembly lang code, if we need it
26+
27+
XINGLMCOBJ = $(XINGOBJS)
28+
29+
all: $(LIBMP3)
30+
31+
$(LIBMP3): $(XINGOBJS)
32+
$(AR) $(ARFLAGS) $(LIBMP3) $(XINGLMCOBJ)
33+
$(RANLIB) $(LIBMP3)
34+
35+
clean:
36+
rm -f $(XINGOBJS)
37+
rm -f $(LIBMP3)

formats/format_g723.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Old-style G.723 frame/timestamp format.
55
*
6-
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
6+
* Copyright (C) 1999, Mark Spencer
77
*
88
* Mark Spencer <markster@linux-support.net>
99
*
@@ -285,7 +285,7 @@ static int g723_write(struct ast_filestream *fs, struct ast_frame *f)
285285
return 0;
286286
}
287287

288-
char *g723_getcomment(struct ast_filestream *s)
288+
static char *g723_getcomment(struct ast_filestream *s)
289289
{
290290
return NULL;
291291
}

0 commit comments

Comments
 (0)