mirror of
https://github.com/asterisk/asterisk.git
synced 2026-03-19 03:54:04 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbe290b904 | ||
|
|
d6a447055d | ||
|
|
39e1748aea |
13
CHANGES
13
CHANGES
@@ -1,16 +1,3 @@
|
||||
* Asterisk 0.1.4
|
||||
-- Update VoFR some more
|
||||
-- Fix the QuickNet driver to work with LineJack
|
||||
-- Add ability to pass images for IAX.
|
||||
* Asterisk 0.1.3
|
||||
-- Update VoFR for latest sangoma code
|
||||
-- Update QuickNet Driver
|
||||
-- Add text message handling
|
||||
-- Fix transfers to use "default" if not in current context
|
||||
-- Add call parking
|
||||
-- Improve format/content negotiation
|
||||
-- Added support for multiple languages
|
||||
-- Bug fixes, as always...
|
||||
* Asterisk 0.1.2
|
||||
-- Updated README file with a "Getting Started" section
|
||||
-- Added sample sounds and configuration files.
|
||||
|
||||
5
Makefile
5
Makefile
@@ -26,7 +26,7 @@ INCLUDE=-Iinclude -I../include
|
||||
CFLAGS=-pipe -Wall -Werror -Wmissing-prototypes -Wmissing-declarations -O6 $(DEBUG) $(INCLUDE) -D_REENTRANT
|
||||
CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
|
||||
SUBDIRS=channels pbx apps codecs formats
|
||||
LIBS=-ldl -lpthread -lreadline # -lefence
|
||||
LIBS=-ldl -lpthread -lreadline #-lefence
|
||||
OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o translate.o file.o say.o pbx.o cli.o md5.o asterisk.o
|
||||
CC=gcc
|
||||
INSTALL=install
|
||||
@@ -70,7 +70,6 @@ install: all
|
||||
rm -f /var/lib/asterisk/sounds/vm
|
||||
mkdir -p /var/spool/asterisk/vm
|
||||
rm -f /usr/lib/asterisk/modules/chan_ixj.so
|
||||
mkdir -p /var/lib/asterisk/sounds
|
||||
( cd /var/lib/asterisk/sounds ; ln -s ../../../spool/asterisk/vm . )
|
||||
@echo " +---- Asterisk Installation Complete -------+"
|
||||
@echo " + Asterisk has successfully been installed. +"
|
||||
@@ -93,7 +92,7 @@ samples: all datafiles
|
||||
for x in sounds/demo-*; do \
|
||||
install $$x /var/lib/asterisk/sounds; \
|
||||
done
|
||||
mkdir -p /var/spool/asterisk/vm/1234/INBOX
|
||||
mkdir -p /var/lib/asterisk/sounds/vm/1234
|
||||
:> /var/lib/asterisk/sounds/vm/1234/unavail.gsm
|
||||
for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
|
||||
cat /var/lib/asterisk/sounds/$$x.gsm >> /var/lib/asterisk/sounds/vm/1234/unavail.gsm ; \
|
||||
|
||||
290
apps/app_dial.c
290
apps/app_dial.c
@@ -18,7 +18,6 @@
|
||||
#include <asterisk/options.h>
|
||||
#include <asterisk/module.h>
|
||||
#include <asterisk/translate.h>
|
||||
#include <asterisk/say.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
@@ -26,31 +25,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
static char *tdesc = "Dialing/Parking Application";
|
||||
|
||||
static char *tdesc = "Trivial Dialing Application";
|
||||
|
||||
static char *app = "Dial";
|
||||
|
||||
static char *parkedcall = "ParkedCall";
|
||||
|
||||
/* No more than 90 seconds parked before you do something with them */
|
||||
static int parkingtime = 90000;
|
||||
|
||||
/* Context for which parking is made accessible */
|
||||
static char parking_con[AST_MAX_EXTENSION] = "default";
|
||||
|
||||
/* Extension you type to park the call */
|
||||
static char parking_ext[AST_MAX_EXTENSION] = "700";
|
||||
|
||||
/* First available extension for parking */
|
||||
static int parking_start = 701;
|
||||
|
||||
/* Last available extension for parking */
|
||||
static int parking_stop = 750;
|
||||
|
||||
/* We define a customer "local user" structure because we
|
||||
use it not only for keeping track of what is in use but
|
||||
also for keeping track of who we're dialing. */
|
||||
@@ -62,164 +44,8 @@ struct localuser {
|
||||
struct localuser *next;
|
||||
};
|
||||
|
||||
struct parkeduser {
|
||||
struct ast_channel *chan;
|
||||
struct timeval start;
|
||||
int parkingnum;
|
||||
/* Where to go if our parking time expires */
|
||||
char context[AST_MAX_EXTENSION];
|
||||
char exten[AST_MAX_EXTENSION];
|
||||
int priority;
|
||||
struct parkeduser *next;
|
||||
};
|
||||
|
||||
static struct parkeduser *parkinglot;
|
||||
|
||||
static pthread_mutex_t parking_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static pthread_t parking_thread;
|
||||
|
||||
LOCAL_USER_DECL;
|
||||
|
||||
static int bridge_call(struct ast_channel *chan, struct ast_channel *peer, int allowredirect);
|
||||
|
||||
|
||||
static int park_call(struct ast_channel *chan, struct ast_channel *peer)
|
||||
{
|
||||
/* We put the user in the parking list, then wake up the parking thread to be sure it looks
|
||||
after these channels too */
|
||||
struct parkeduser *pu, *cur;
|
||||
int x;
|
||||
pu = malloc(sizeof(struct parkeduser));
|
||||
if (pu) {
|
||||
pthread_mutex_lock(&parking_lock);
|
||||
for (x=parking_start;x<=parking_stop;x++) {
|
||||
cur = parkinglot;
|
||||
while(cur) {
|
||||
if (cur->parkingnum == x)
|
||||
break;
|
||||
cur = cur->next;
|
||||
}
|
||||
if (!cur)
|
||||
break;
|
||||
}
|
||||
if (x <= parking_stop) {
|
||||
pu->chan = chan;
|
||||
gettimeofday(&pu->start, NULL);
|
||||
pu->parkingnum = x;
|
||||
/* Remember what had been dialed, so that if the parking
|
||||
expires, we try to come back to the same place */
|
||||
strncpy(pu->context, chan->context, sizeof(pu->context));
|
||||
strncpy(pu->exten, chan->exten, sizeof(pu->exten));
|
||||
pu->priority = chan->priority;
|
||||
pu->next = parkinglot;
|
||||
parkinglot = pu;
|
||||
pthread_mutex_unlock(&parking_lock);
|
||||
/* Wake up the (presumably select()ing) thread */
|
||||
pthread_kill(parking_thread, SIGURG);
|
||||
if (option_verbose > 1)
|
||||
ast_verbose(VERBOSE_PREFIX_2 "Parked %s on %d\n", pu->chan->name, pu->parkingnum);
|
||||
ast_say_digits(peer, pu->parkingnum, peer->language);
|
||||
return 0;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "No more parking spaces\n");
|
||||
free(pu);
|
||||
pthread_mutex_unlock(&parking_lock);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *do_parking_thread(void *ignore)
|
||||
{
|
||||
int ms, tms, max;
|
||||
struct parkeduser *pu, *pl, *pt = NULL;
|
||||
struct timeval tv;
|
||||
struct ast_frame *f;
|
||||
fd_set rfds, efds;
|
||||
fd_set nrfds, nefds;
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&efds);
|
||||
for (;;) {
|
||||
ms = -1;
|
||||
max = -1;
|
||||
pthread_mutex_lock(&parking_lock);
|
||||
pl = NULL;
|
||||
pu = parkinglot;
|
||||
gettimeofday(&tv, NULL);
|
||||
FD_ZERO(&nrfds);
|
||||
FD_ZERO(&nefds);
|
||||
while(pu) {
|
||||
tms = (tv.tv_sec - pu->start.tv_sec) * 1000 + (tv.tv_usec - pu->start.tv_usec) / 1000;
|
||||
if (tms > parkingtime) {
|
||||
/* They've been waiting too long, send them back to where they came. Theoretically they
|
||||
should have their original extensions and such, but we copy to be on the safe side */
|
||||
strncpy(pu->chan->exten, pu->exten, sizeof(pu->chan->exten));
|
||||
strncpy(pu->chan->context, pu->context, sizeof(pu->chan->context));
|
||||
pu->chan->priority = pu->priority;
|
||||
/* Start up the PBX, or hang them up */
|
||||
if (ast_pbx_start(pu->chan)) {
|
||||
ast_log(LOG_WARNING, "Unable to restart the PBX for user on '%s', hanging them up...\n", pu->chan->name);
|
||||
ast_hangup(pu->chan);
|
||||
}
|
||||
/* And take them out of the parking lot */
|
||||
if (pl)
|
||||
pl->next = pu->next;
|
||||
else
|
||||
parkinglot = pu->next;
|
||||
pt = pu;
|
||||
pu = pu->next;
|
||||
free(pt);
|
||||
} else if (FD_ISSET(pu->chan->fd, &rfds) || FD_ISSET(pu->chan->fd, &efds)) {
|
||||
/* See if they need servicing */
|
||||
f = ast_read(pu->chan);
|
||||
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
|
||||
/* There's a problem, hang them up*/
|
||||
if (option_verbose > 1)
|
||||
ast_verbose(VERBOSE_PREFIX_2 "%s got tired of being parked\n", pu->chan->name);
|
||||
ast_hangup(pu->chan);
|
||||
/* And take them out of the parking lot */
|
||||
if (pl)
|
||||
pl->next = pu->next;
|
||||
else
|
||||
parkinglot = pu->next;
|
||||
pt = pu;
|
||||
pu = pu->next;
|
||||
free(pt);
|
||||
} else {
|
||||
/* XXX Maybe we could do something with packets, like dial "0" for operator or something XXX */
|
||||
ast_frfree(f);
|
||||
goto std; /* XXX Ick: jumping into an else statement??? XXX */
|
||||
}
|
||||
} else {
|
||||
/* Keep this one for next one */
|
||||
std: FD_SET(pu->chan->fd, &nrfds);
|
||||
FD_SET(pu->chan->fd, &nefds);
|
||||
/* Keep track of our longest wait */
|
||||
if ((tms < ms) || (ms < 0))
|
||||
ms = tms;
|
||||
if (pu->chan->fd > max)
|
||||
max = pu->chan->fd;
|
||||
pl = pu;
|
||||
pu = pu->next;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&parking_lock);
|
||||
rfds = nrfds;
|
||||
efds = nefds;
|
||||
tv.tv_sec = ms / 1000;
|
||||
tv.tv_usec = (ms % 1000) * 1000;
|
||||
/* Wait for something to happen */
|
||||
select(max + 1, &rfds, NULL, &efds, (ms > -1) ? &tv : NULL);
|
||||
pthread_testcancel();
|
||||
}
|
||||
return NULL; /* Never reached */
|
||||
}
|
||||
|
||||
static void hanguptree(struct localuser *outgoing, struct ast_channel *exception)
|
||||
{
|
||||
/* Hang up a tree of stuff */
|
||||
@@ -396,19 +222,15 @@ static int bridge_call(struct ast_channel *chan, struct ast_channel *peer, int a
|
||||
(f->subclass == AST_CONTROL_BUSY))))
|
||||
return -1;
|
||||
if ((f->frametype == AST_FRAME_VOICE) ||
|
||||
(f->frametype == AST_FRAME_DTMF) ||
|
||||
(f->frametype == AST_FRAME_TEXT)) {
|
||||
if ((f->frametype == AST_FRAME_DTMF) && (who == peer) && allowredirect &&
|
||||
(f->subclass == '#')) {
|
||||
(f->frametype == AST_FRAME_DTMF)) {
|
||||
if ((f->frametype == AST_FRAME_DTMF) && (who == peer) && allowredirect) {
|
||||
if (f->subclass == '#') {
|
||||
memset(newext, 0, sizeof(newext));
|
||||
ptr = newext;
|
||||
len = ast_pbx_longest_extension(chan->context) + 1;
|
||||
if (len < ast_pbx_longest_extension("default") + 1)
|
||||
len = ast_pbx_longest_extension("default") + 1;
|
||||
|
||||
/* Transfer */
|
||||
if ((res=ast_streamfile(peer, "pbx-transfer", chan->language)))
|
||||
if ((res=ast_streamfile(peer, "pbx-transfer")))
|
||||
break;
|
||||
if ((res=ast_waitstream(peer, AST_DIGIT_ANY)) < 0)
|
||||
break;
|
||||
@@ -422,35 +244,15 @@ static int bridge_call(struct ast_channel *chan, struct ast_channel *peer, int a
|
||||
res = ast_readstring(peer, ptr, len, 3000, 2000, "#");
|
||||
if (res)
|
||||
break;
|
||||
if (!strcmp(newext, parking_ext)) {
|
||||
if (!park_call(chan, peer)) {
|
||||
/* We return non-zero, but tell the PBX not to hang the channel when
|
||||
the thread dies -- We have to be careful now though. We are responsible for
|
||||
hanging up the channel, else it will never be hung up! */
|
||||
res=AST_PBX_KEEPALIVE;
|
||||
break;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Unable to park call %s\n", chan->name);
|
||||
}
|
||||
/* XXX Maybe we should have another message here instead of invalid extension XXX */
|
||||
} else if (ast_exists_extension(chan, peer->context, newext, 1)) {
|
||||
/* Set the channel's new extension, since it exists, using peer context */
|
||||
if (ast_exists_extension(chan, chan->context, newext, 1)) {
|
||||
/* Set the channel's new extension, since it exists */
|
||||
strncpy(chan->exten, newext, sizeof(chan->exten));
|
||||
strncpy(chan->context, peer->context, sizeof(chan->context));
|
||||
chan->priority = 0;
|
||||
ast_frfree(f);
|
||||
res=0;
|
||||
break;
|
||||
} else if (ast_exists_extension(chan, "default", newext, 1)) {
|
||||
/* Set the channel's new extension, since it exists, using peer context */
|
||||
strncpy(chan->exten, newext, sizeof(chan->exten));
|
||||
strncpy(chan->context, "default", sizeof(chan->context));
|
||||
chan->priority = 0;
|
||||
ast_frfree(f);
|
||||
res=0;
|
||||
break;
|
||||
}
|
||||
res = ast_streamfile(peer, "pbx-invalid", chan->language);
|
||||
res = ast_streamfile(peer, "pbx-invalid");
|
||||
if (res)
|
||||
break;
|
||||
res = ast_waitstream(peer, AST_DIGIT_ANY);
|
||||
@@ -478,63 +280,6 @@ static int bridge_call(struct ast_channel *chan, struct ast_channel *peer, int a
|
||||
return res;
|
||||
}
|
||||
|
||||
static int park_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res=0;
|
||||
struct localuser *u;
|
||||
struct ast_channel *peer=NULL, *nchan;
|
||||
struct parkeduser *pu, *pl=NULL;
|
||||
int park;
|
||||
if (!data) {
|
||||
ast_log(LOG_WARNING, "Park requires an argument (extension number)\n");
|
||||
return -1;
|
||||
}
|
||||
LOCAL_USER_ADD(u);
|
||||
park = atoi((char *)data);
|
||||
pthread_mutex_lock(&parking_lock);
|
||||
pu = parkinglot;
|
||||
while(pu) {
|
||||
if (pu->parkingnum == park) {
|
||||
if (pl)
|
||||
pl->next = pu->next;
|
||||
else
|
||||
parkinglot = pu->next;
|
||||
break;
|
||||
}
|
||||
pu = pu->next;
|
||||
}
|
||||
pthread_mutex_unlock(&parking_lock);
|
||||
if (pu) {
|
||||
peer = pu->chan;
|
||||
free(pu);
|
||||
}
|
||||
if (peer) {
|
||||
/* Build a translator if necessary */
|
||||
if (peer->format & chan->format)
|
||||
nchan = chan;
|
||||
else
|
||||
nchan = ast_translator_create(chan, peer->format, AST_DIRECTION_BOTH);
|
||||
/* This runs sorta backwards, since we give the incoming channel control, as if it
|
||||
were the person called. */
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Channel %s connected to parked call %d\n", chan->name, park);
|
||||
res = bridge_call(peer, nchan, 1);
|
||||
if (nchan != chan)
|
||||
ast_translator_destroy(nchan);
|
||||
/* Simulate the PBX hanging up */
|
||||
if (res != AST_PBX_KEEPALIVE)
|
||||
ast_hangup(peer);
|
||||
return -1;
|
||||
} else {
|
||||
/* XXX Play a message XXX */
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Channel %s tried to talk to non-existant parked call %d\n", chan->name, park);
|
||||
res = -1;
|
||||
}
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return res;
|
||||
}
|
||||
|
||||
static int dial_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res=-1;
|
||||
@@ -669,24 +414,7 @@ int unload_module(void)
|
||||
|
||||
int load_module(void)
|
||||
{
|
||||
int res;
|
||||
int x;
|
||||
struct ast_context *con;
|
||||
char exten[AST_MAX_EXTENSION];
|
||||
con = ast_context_find(parking_con);
|
||||
if (!con) {
|
||||
ast_log(LOG_ERROR, "Parking context '%s' does not exist\n", parking_con);
|
||||
return -1;
|
||||
}
|
||||
for(x=parking_start; x<=parking_stop;x++) {
|
||||
snprintf(exten, sizeof(exten), "%d", x);
|
||||
ast_add_extension2(con, 1, exten, 1, parkedcall, strdup(exten), free);
|
||||
}
|
||||
pthread_create(&parking_thread, NULL, do_parking_thread, NULL);
|
||||
res = ast_register_application(parkedcall, park_exec);
|
||||
if (!res)
|
||||
res = ast_register_application(app, dial_exec);
|
||||
return res;
|
||||
return ast_register_application(app, dial_exec);
|
||||
}
|
||||
|
||||
char *description(void)
|
||||
|
||||
@@ -156,17 +156,17 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char *
|
||||
if (v) {
|
||||
/* We have a match -- play a greeting if they have it */
|
||||
snprintf(fn, sizeof(fn), "%s/vm/%s/greet", AST_SPOOL_DIR, v->name);
|
||||
if (ast_fileexists(fn, NULL, chan->language)) {
|
||||
res = ast_streamfile(chan, fn, chan->language);
|
||||
if (ast_fileexists(fn, NULL)) {
|
||||
res = ast_streamfile(chan, fn);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
} else {
|
||||
res = ast_say_digit_str(chan, v->name, chan->language);
|
||||
res = ast_say_digit_str(chan, v->name);
|
||||
}
|
||||
ahem:
|
||||
if (!res)
|
||||
res = ast_streamfile(chan, "dir-instr", chan->language);
|
||||
res = ast_streamfile(chan, "dir-instr");
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
if (!res)
|
||||
@@ -189,9 +189,9 @@ ahem:
|
||||
}
|
||||
} else {
|
||||
if (found)
|
||||
res = ast_streamfile(chan, "dir-nomore", chan->language);
|
||||
res = ast_streamfile(chan, "dir-nomore");
|
||||
else
|
||||
res = ast_streamfile(chan, "dir-nomatch", chan->language);
|
||||
res = ast_streamfile(chan, "dir-nomatch");
|
||||
if (!res)
|
||||
res = 1;
|
||||
return res;
|
||||
@@ -219,7 +219,7 @@ static int directory_exec(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_ADD(u);
|
||||
top:
|
||||
if (!res)
|
||||
res = ast_streamfile(chan, "dir-intro", chan->language);
|
||||
res = ast_streamfile(chan, "dir-intro");
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
|
||||
@@ -31,24 +31,18 @@ LOCAL_USER_DECL;
|
||||
|
||||
static int playback_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res = 0;
|
||||
int res;
|
||||
struct localuser *u;
|
||||
if (!data) {
|
||||
ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
|
||||
return -1;
|
||||
}
|
||||
LOCAL_USER_ADD(u);
|
||||
if (chan->state != AST_STATE_UP)
|
||||
res = ast_answer(chan);
|
||||
if (!res) {
|
||||
ast_stopstream(chan);
|
||||
res = ast_streamfile(chan, (char *)data, chan->language);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, "");
|
||||
else
|
||||
ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
ast_stopstream(chan);
|
||||
res = ast_streamfile(chan, (char *)data);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, "");
|
||||
ast_stopstream(chan);
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -81,15 +81,15 @@ static int announce_message(struct ast_channel *chan, char *dir, int msgcnt)
|
||||
{
|
||||
char *fn;
|
||||
int res;
|
||||
res = ast_streamfile(chan, "vm-message", chan->language);
|
||||
res = ast_streamfile(chan, "vm-message");
|
||||
if (!res) {
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
if (!res) {
|
||||
res = ast_say_number(chan, msgcnt+1, chan->language);
|
||||
res = ast_say_number(chan, msgcnt+1);
|
||||
if (!res) {
|
||||
fn = get_fn(dir, msgcnt);
|
||||
if (fn) {
|
||||
res = ast_streamfile(chan, fn, chan->language);
|
||||
res = ast_streamfile(chan, fn);
|
||||
free(fn);
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent)
|
||||
if (mkdir(dir, 0700) && (errno != EEXIST))
|
||||
ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dir, strerror(errno));
|
||||
/* Stream an info message */
|
||||
if (silent || !ast_streamfile(chan, INTRO, chan->language)) {
|
||||
if (silent || !ast_streamfile(chan, INTRO)) {
|
||||
/* Wait for the message to finish */
|
||||
if (silent || !ast_waitstream(chan, "")) {
|
||||
fmt = ast_variable_retrieve(cfg, "general", "format");
|
||||
@@ -182,7 +182,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent)
|
||||
snprintf(comment, sizeof(comment), "Voicemail from %s to %s (%s) on %s\n",
|
||||
(chan->callerid ? chan->callerid : "Unknown"),
|
||||
name, ext, chan->name);
|
||||
if (ast_fileexists(fn, NULL, chan->language) > 0) {
|
||||
if (ast_fileexists(fn, NULL) > 0) {
|
||||
msgnum++;
|
||||
continue;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent)
|
||||
if (outmsg) {
|
||||
if (outmsg > 1) {
|
||||
/* Let them know it worked */
|
||||
ast_streamfile(chan, "vm-msgsaved", chan->language);
|
||||
ast_streamfile(chan, "vm-msgsaved");
|
||||
ast_waitstream(chan, "");
|
||||
}
|
||||
/* Send e-mail if applicable */
|
||||
@@ -323,13 +323,13 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
ast_log(LOG_WARNING, "No voicemail configuration\n");
|
||||
goto out;
|
||||
}
|
||||
if (ast_streamfile(chan, "vm-login", chan->language)) {
|
||||
if (ast_streamfile(chan, "vm-login")) {
|
||||
ast_log(LOG_WARNING, "Couldn't stream login file\n");
|
||||
goto out;
|
||||
}
|
||||
do {
|
||||
/* Prompt for, and read in the username */
|
||||
if (ast_readstring(chan, username, sizeof(username), 2000, 10000, "#")) {
|
||||
if (ast_readstring(chan, username, sizeof(username), 2000, 5000, "#")) {
|
||||
ast_log(LOG_WARNING, "Couldn't read username\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -339,11 +339,11 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
res = 0;
|
||||
goto out;
|
||||
}
|
||||
if (ast_streamfile(chan, "vm-password", chan->language)) {
|
||||
if (ast_streamfile(chan, "vm-password")) {
|
||||
ast_log(LOG_WARNING, "Unable to stream password file\n");
|
||||
goto out;
|
||||
}
|
||||
if (ast_readstring(chan, password, sizeof(password), 2000, 10000, "#")) {
|
||||
if (ast_readstring(chan, password, sizeof(password), 2000, 5000, "#")) {
|
||||
ast_log(LOG_WARNING, "Unable to read password\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
} else if (option_verbose > 2)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "No such user '%s' in config file\n", username);
|
||||
if (!valid) {
|
||||
if (ast_streamfile(chan, "vm-incorrect", chan->language))
|
||||
if (ast_streamfile(chan, "vm-incorrect"))
|
||||
break;
|
||||
if (ast_waitstream(chan, ""))
|
||||
break;
|
||||
@@ -375,13 +375,13 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
not deleted. */
|
||||
do {
|
||||
fn = get_fn(dir, maxmsg);
|
||||
if ((res = ast_fileexists(fn, NULL, chan->language))>0) {
|
||||
if ((res = ast_fileexists(fn, NULL))>0) {
|
||||
maxmsg++;
|
||||
deleted[maxmsg] = 0;
|
||||
}
|
||||
free(fn);
|
||||
} while(res > 0);
|
||||
if (ast_streamfile(chan, "vm-youhave", chan->language))
|
||||
if (ast_streamfile(chan, "vm-youhave"))
|
||||
goto out;
|
||||
if ((d=ast_waitstream(chan, AST_DIGIT_ANY)) < 0)
|
||||
goto out;
|
||||
@@ -389,10 +389,10 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
if (!d) {
|
||||
/* If they haven't interrupted us, play the message count */
|
||||
if (maxmsg > 0) {
|
||||
if ((d = ast_say_number(chan, maxmsg, chan->language)) < 0)
|
||||
if ((d = ast_say_number(chan, maxmsg)) < 0)
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-no", chan->language))
|
||||
if (ast_streamfile(chan, "vm-no"))
|
||||
goto out;
|
||||
if ((d=ast_waitstream(chan, AST_DIGIT_ANY)) < 0)
|
||||
goto out;
|
||||
@@ -400,7 +400,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
}
|
||||
if (!d) {
|
||||
/* And if they still haven't, give them the last word */
|
||||
if (ast_streamfile(chan, ((maxmsg == 1) ? "vm-message" : "vm-messages"), chan->language))
|
||||
if (ast_streamfile(chan, ((maxmsg == 1) ? "vm-message" : "vm-messages")))
|
||||
goto out;
|
||||
if (ast_waitstream(chan, AST_DIGIT_ANY) < 0)
|
||||
goto out;
|
||||
@@ -416,7 +416,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
ast_log(LOG_EVENT, "User '%s' logged in on channel '%s' with %d message(s).\n", username, chan->name, maxmsg);
|
||||
if (option_verbose > 2)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "User '%s' logged in on channel %s with %d messages\n", username, chan->name, maxmsg);
|
||||
if (!ast_streamfile(chan, "vm-instructions", chan->language)) {
|
||||
if (!ast_streamfile(chan, "vm-instructions")) {
|
||||
for(;;) {
|
||||
if (chan->stream || (chan->trans && chan->trans->stream)) {
|
||||
d = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
@@ -424,7 +424,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
if (!d && (state == STATE_MESSAGE_PLAYING)) {
|
||||
state = STATE_MESSAGE;
|
||||
/* If it runs out playing a message, then give directions */
|
||||
if (!(d = ast_streamfile(chan, "vm-msginstruct", chan->language)))
|
||||
if (!(d = ast_streamfile(chan, "vm-msginstruct")))
|
||||
d = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
@@ -440,12 +440,12 @@ restart:
|
||||
best based up on where they are. Ditto if they press the '*' key. */
|
||||
switch(state) {
|
||||
case STATE_STARTING:
|
||||
if (ast_streamfile(chan, "vm-instructions", chan->language))
|
||||
if (ast_streamfile(chan, "vm-instructions"))
|
||||
goto out;
|
||||
break;
|
||||
case STATE_MESSAGE:
|
||||
case STATE_MESSAGE_PLAYING:
|
||||
if (ast_streamfile(chan, "vm-msginstruct", chan->language))
|
||||
if (ast_streamfile(chan, "vm-msginstruct"))
|
||||
goto out;
|
||||
break;
|
||||
default:
|
||||
@@ -460,14 +460,14 @@ restart:
|
||||
if (curmsg < maxmsg) {
|
||||
deleted[curmsg] = !deleted[curmsg];
|
||||
if (deleted[curmsg]) {
|
||||
if (ast_streamfile(chan, "vm-deleted", chan->language))
|
||||
if (ast_streamfile(chan, "vm-deleted"))
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-undeleted", chan->language))
|
||||
if (ast_streamfile(chan, "vm-undeleted"))
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||
if (ast_streamfile(chan, "vm-nomore"))
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
@@ -480,7 +480,7 @@ restart:
|
||||
else if (d < 0)
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||
if (ast_streamfile(chan, "vm-nomore"))
|
||||
goto out;
|
||||
}
|
||||
state = STATE_MESSAGE_PLAYING;
|
||||
@@ -510,7 +510,7 @@ restart:
|
||||
else if (d < 0)
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||
if (ast_streamfile(chan, "vm-nomore"))
|
||||
goto out;
|
||||
}
|
||||
state = STATE_MESSAGE_PLAYING;
|
||||
@@ -518,7 +518,7 @@ restart:
|
||||
/* XXX Message compose? It's easy! Just read their # and, assuming it's in the config,
|
||||
call the routine as if it were called from the PBX proper XXX */
|
||||
case '#':
|
||||
if (ast_streamfile(chan, "vm-goodbye", chan->language))
|
||||
if (ast_streamfile(chan, "vm-goodbye"))
|
||||
goto out;
|
||||
if (ast_waitstream(chan, ""))
|
||||
goto out;
|
||||
|
||||
20
asterisk.c
20
asterisk.c
@@ -16,7 +16,6 @@
|
||||
#include <asterisk/logger.h>
|
||||
#include <asterisk/options.h>
|
||||
#include <asterisk/cli.h>
|
||||
#include <asterisk/channel.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <sched.h>
|
||||
@@ -33,8 +32,6 @@ int option_console=0;
|
||||
int option_highpriority=0;
|
||||
int fully_booted = 0;
|
||||
|
||||
char defaultlanguage[MAX_LANGUAGE] = DEFAULT_LANGUAGE;
|
||||
|
||||
#define HIGH_PRIORITY 1
|
||||
#define HIGH_PRIORITY_SCHED SCHED_RR
|
||||
|
||||
@@ -48,19 +45,6 @@ static void urg_handler(int num)
|
||||
return;
|
||||
}
|
||||
|
||||
static void set_title(char *text)
|
||||
{
|
||||
/* Set an X-term or screen title */
|
||||
if (getenv("TERM") && strstr(getenv("TERM"), "xterm"))
|
||||
fprintf(stdout, "\033]2;%s\007", text);
|
||||
}
|
||||
|
||||
static void set_icon(char *text)
|
||||
{
|
||||
if (getenv("TERM") && strstr(getenv("TERM"), "xterm"))
|
||||
fprintf(stdout, "\033]1;%s\007", text);
|
||||
}
|
||||
|
||||
static int set_priority(int pri)
|
||||
{
|
||||
struct sched_param sched;
|
||||
@@ -223,10 +207,6 @@ int main(int argc, char *argv[])
|
||||
if (option_console) {
|
||||
/* Console stuff now... */
|
||||
/* Register our quit function */
|
||||
char title[256];
|
||||
set_icon("Asterisk");
|
||||
snprintf(title, sizeof(title), "Asterisk Console (pid %d)", getpid());
|
||||
set_title(title);
|
||||
ast_cli_register(&quit);
|
||||
consolethread = pthread_self();
|
||||
if (strlen(filename))
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#ifndef _ASTERISK_H
|
||||
#define _ASTERISK_H
|
||||
|
||||
#define DEFAULT_LANGUAGE "en"
|
||||
|
||||
#define AST_CONFIG_DIR "/etc/asterisk"
|
||||
#define AST_MODULE_DIR "/usr/lib/asterisk/modules"
|
||||
#define AST_SPOOL_DIR "/var/spool/asterisk"
|
||||
|
||||
11
channel.c
11
channel.c
@@ -126,7 +126,6 @@ struct ast_channel *ast_channel_alloc(void)
|
||||
tmp->data = NULL;
|
||||
pthread_mutex_init(&tmp->lock, NULL);
|
||||
strncpy(tmp->context, "default", sizeof(tmp->context));
|
||||
strncpy(tmp->language, defaultlanguage, sizeof(tmp->language));
|
||||
strncpy(tmp->exten, "s", sizeof(tmp->exten));
|
||||
tmp->priority=1;
|
||||
tmp->next = channels;
|
||||
@@ -388,16 +387,6 @@ struct ast_frame *ast_read(struct ast_channel *chan)
|
||||
return f;
|
||||
}
|
||||
|
||||
int ast_sendtext(struct ast_channel *chan, char *text)
|
||||
{
|
||||
int res = 0;
|
||||
CHECK_BLOCKING(chan);
|
||||
if (chan->pvt->send_text)
|
||||
res = chan->pvt->send_text(chan, text);
|
||||
chan->blocking = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_write(struct ast_channel *chan, struct ast_frame *fr)
|
||||
{
|
||||
int res = -1;
|
||||
|
||||
@@ -16,9 +16,6 @@ CHANNEL_LIBS=chan_vofr.so chan_modem.so \
|
||||
|
||||
CHANNEL_LIBS+=$(shell [ -f /usr/include/linux/ixjuser.h ] && echo chan_phone.so)
|
||||
|
||||
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
|
||||
CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
|
||||
|
||||
CFLAGS+=#-DVOFRDUMPER
|
||||
|
||||
all: $(CHANNEL_LIBS)
|
||||
@@ -29,13 +26,6 @@ clean:
|
||||
%.so : %.o
|
||||
$(CC) -shared -Xlinker -x -o $@ $<
|
||||
|
||||
#libiax.a: libiax.o
|
||||
# rm -f libiax.a
|
||||
# $(AR) cr libiax.a libiax.o
|
||||
|
||||
#chan_iax.so: chan_iax.o libiax.a
|
||||
# $(CC) -shared -Xlinker -x -o $@ $< -L. -liax
|
||||
|
||||
#chan_modem.so : chan_modem.o
|
||||
# $(CC) -rdynamic -shared -Xlinker -x -o $@ $<
|
||||
|
||||
|
||||
@@ -125,7 +125,6 @@ struct iax_peer {
|
||||
char username[80];
|
||||
char secret[80];
|
||||
struct sockaddr_in addr;
|
||||
int formats;
|
||||
struct in_addr mask;
|
||||
struct iax_peer *next;
|
||||
};
|
||||
@@ -452,9 +451,8 @@ static int do_deliver(void *data)
|
||||
ts = calc_timestamp(iaxs[fr->callno], 0);
|
||||
iaxs[fr->callno]->lag = ts - fr->ts;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
ast_fr_fdwrite(iaxs[fr->callno]->pipe[1], fr->f);
|
||||
}
|
||||
}
|
||||
/* Free the packet */
|
||||
ast_frfree(fr->f);
|
||||
@@ -670,8 +668,8 @@ static int attempt_transmit(void *data)
|
||||
/* Attempt transmission */
|
||||
send_packet(f);
|
||||
f->retries++;
|
||||
/* Try again later after 10 times as long */
|
||||
f->retrytime *= 10;
|
||||
/* Try again later after 2 times as long */
|
||||
f->retrytime *= 2;
|
||||
if (f->retrytime > MAX_RETRY_TIME)
|
||||
f->retrytime = MAX_RETRY_TIME;
|
||||
ast_sched_add(sched, f->retrytime, attempt_transmit, f);
|
||||
@@ -856,13 +854,6 @@ static int iax_digit(struct ast_channel *c, char digit)
|
||||
return send_command(c->pvt->pvt, AST_FRAME_DTMF, digit, 0, NULL, 0, -1);
|
||||
}
|
||||
|
||||
static int iax_sendtext(struct ast_channel *c, char *text)
|
||||
{
|
||||
|
||||
return send_command(c->pvt->pvt, AST_FRAME_TEXT,
|
||||
0, 0, text, strlen(text) + 1, -1);
|
||||
}
|
||||
|
||||
static int create_addr(struct sockaddr_in *sin, char *peer)
|
||||
{
|
||||
struct hostent *hp;
|
||||
@@ -900,15 +891,14 @@ static int iax_call(struct ast_channel *c, char *dest, int timeout)
|
||||
char *hname;
|
||||
char requeststr[256] = "";
|
||||
char myrdest [5] = "s";
|
||||
char *portno = NULL;
|
||||
if ((c->state != AST_STATE_DOWN) && (c->state != AST_STATE_RESERVED)) {
|
||||
ast_log(LOG_WARNING, "Line is already in use (%s)?\n", c->name);
|
||||
return -1;
|
||||
}
|
||||
strncpy(host, dest, sizeof(host));
|
||||
strtok(host, "/");
|
||||
strtok(host, ":");
|
||||
/* If no destination extension specified, use 's' */
|
||||
rdest = strtok(NULL, "/");
|
||||
rdest = strtok(NULL, ":");
|
||||
if (!rdest)
|
||||
rdest = myrdest;
|
||||
strtok(rdest, "@");
|
||||
@@ -922,17 +912,10 @@ static int iax_call(struct ast_channel *c, char *dest, int timeout)
|
||||
} else {
|
||||
hname = host;
|
||||
}
|
||||
if (strtok(hname, ":")) {
|
||||
strtok(hname, ":");
|
||||
portno = strtok(hname, ":");
|
||||
}
|
||||
if (create_addr(&sin, hname)) {
|
||||
ast_log(LOG_WARNING, "No address associated with '%s'\n", hname);
|
||||
return -1;
|
||||
}
|
||||
if (portno) {
|
||||
sin.sin_port = htons(atoi(portno));
|
||||
}
|
||||
/* Now we build our request string */
|
||||
#define MYSNPRINTF snprintf(requeststr + strlen(requeststr), sizeof(requeststr) - strlen(requeststr),
|
||||
MYSNPRINTF "exten=%s;", rdest);
|
||||
@@ -951,7 +934,7 @@ static int iax_call(struct ast_channel *c, char *dest, int timeout)
|
||||
requeststr[strlen(requeststr) - 1] = '\0';
|
||||
/* Transmit the string in a "NEW" request */
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Calling using options '%s'\n", requeststr);
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Calling using options '%s'\n", requeststr);
|
||||
send_command((struct chan_iax_pvt *)c->pvt->pvt, AST_FRAME_IAX,
|
||||
AST_IAX_COMMAND_NEW, 0, requeststr, strlen(requeststr) + 1, -1);
|
||||
c->state = AST_STATE_RINGING;
|
||||
@@ -1040,7 +1023,6 @@ static struct ast_channel *ast_iax_new(struct chan_iax_pvt *i, int state)
|
||||
tmp->format = iax_capability;
|
||||
tmp->pvt->pvt = i;
|
||||
tmp->pvt->send_digit = iax_digit;
|
||||
tmp->pvt->send_text = iax_sendtext;
|
||||
tmp->pvt->call = iax_call;
|
||||
tmp->pvt->hangup = iax_hangup;
|
||||
tmp->pvt->answer = iax_answer;
|
||||
@@ -1330,27 +1312,6 @@ static int apply_ha(struct iax_ha *ha, struct sockaddr_in *sin)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int iax_getformats(int callno, char *orequest)
|
||||
{
|
||||
char *var, *value;
|
||||
char request[256];
|
||||
strncpy(request, orequest, sizeof(request));
|
||||
var = strtok(request, ";");
|
||||
while(var) {
|
||||
value = strchr(var, '=');
|
||||
if (value) {
|
||||
*value='\0';
|
||||
value++;
|
||||
if (!strcmp(var, "formats")) {
|
||||
iaxs[callno]->peerformats = atoi(value);
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Unknown variable '%s' with value '%s'\n", var, value);
|
||||
}
|
||||
var = strtok(NULL, ";");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_access(int callno, struct sockaddr_in *sin, char *orequest, int requestl)
|
||||
{
|
||||
/* Start pessimistic */
|
||||
@@ -1718,38 +1679,15 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
|
||||
iax_destroy(fr.callno);
|
||||
break;
|
||||
case AST_IAX_COMMAND_REJECT:
|
||||
if (f.data)
|
||||
((char *)f.data)[f.datalen] = '\0';
|
||||
((char *)f.data)[f.datalen] = '\0';
|
||||
ast_log(LOG_WARNING, "Call rejected by %s: %s\n", inet_ntoa(iaxs[fr.callno]->addr.sin_addr), f.data);
|
||||
iaxs[fr.callno]->error = EPERM;
|
||||
iax_destroy(fr.callno);
|
||||
break;
|
||||
case AST_IAX_COMMAND_ACCEPT:
|
||||
if (f.data) {
|
||||
((char *)f.data)[f.datalen]='\0';
|
||||
iax_getformats(fr.callno, (char *)f.data);
|
||||
} else {
|
||||
iaxs[fr.callno]->peerformats = iax_capability;
|
||||
}
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Call accepted by %s\n", inet_ntoa(iaxs[fr.callno]->addr.sin_addr));
|
||||
iaxs[fr.callno]->state |= IAX_STATE_STARTED;
|
||||
if (iaxs[fr.callno]->owner) {
|
||||
/* Switch us to use a compatible format */
|
||||
iaxs[fr.callno]->owner->format &= iaxs[fr.callno]->peerformats;
|
||||
|
||||
if (!iaxs[fr.callno]->owner->format)
|
||||
iaxs[fr.callno]->owner->format = iaxs[fr.callno]->peerformats & iax_capability;
|
||||
if (!iaxs[fr.callno]->owner->format) {
|
||||
ast_log(LOG_WARNING, "Unable to negotiate a common format with the peer.");
|
||||
iaxs[fr.callno]->error = EBADE;
|
||||
iax_destroy(fr.callno);
|
||||
} else {
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Format for call is %d\n", iaxs[fr.callno]->owner->format);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case AST_IAX_COMMAND_PING:
|
||||
/* Send back a pong packet with the original timestamp */
|
||||
|
||||
@@ -49,9 +49,6 @@ static char mtype[80] = "autodetect";
|
||||
/* Default context for incoming calls */
|
||||
static char context[AST_MAX_EXTENSION]= "default";
|
||||
|
||||
/* Default language */
|
||||
static char language[MAX_LANGUAGE] = "";
|
||||
|
||||
/* Initialization String */
|
||||
static char initstr[AST_MAX_INIT_STR] = "ATE1Q0";
|
||||
|
||||
@@ -274,13 +271,8 @@ static int modem_setup(struct ast_modem_pvt *p, int baudrate)
|
||||
mode. Set the baud rate, etc. */
|
||||
char identity[256];
|
||||
char *ident = NULL;
|
||||
char etx[2] = { 0x10, 0x03 };
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Setting up modem %s\n", p->dev);
|
||||
if (ast_modem_send(p, etx, 2)) {
|
||||
ast_log(LOG_WARNING, "Failed to send ETX?\n");
|
||||
return -1;
|
||||
}
|
||||
if (ast_modem_send(p, "\r\n", 2)) {
|
||||
ast_log(LOG_WARNING, "Failed to send enter?\n");
|
||||
return -1;
|
||||
@@ -441,8 +433,6 @@ struct ast_channel *ast_modem_new(struct ast_modem_pvt *i, int state)
|
||||
strncpy(tmp->context, i->context, sizeof(tmp->context));
|
||||
if (strlen(i->cid))
|
||||
tmp->callerid = strdup(i->cid);
|
||||
if (strlen(i->language))
|
||||
strncpy(tmp->language,i->language, sizeof(tmp->language));
|
||||
i->owner = tmp;
|
||||
pthread_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
@@ -606,7 +596,6 @@ static struct ast_modem_pvt *mkif(char *iface)
|
||||
free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
strncpy(tmp->language, language, sizeof(tmp->language));
|
||||
tmp->f = fdopen(tmp->fd, "w+");
|
||||
/* Disable buffering */
|
||||
setvbuf(tmp->f, NULL, _IONBF,0);
|
||||
@@ -743,8 +732,6 @@ int load_module()
|
||||
dialtype = toupper(v->value[0]);
|
||||
} else if (!strcasecmp(v->name, "context")) {
|
||||
strncpy(context, v->value, sizeof(context));
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(language, v->value, sizeof(language));
|
||||
}
|
||||
v = v->next;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ static int silencesuppression = 0;
|
||||
static int silencethreshold = 1000;
|
||||
|
||||
static char digits[80] = "";
|
||||
static char text2send[80] = "";
|
||||
|
||||
static pthread_mutex_t usecnt_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -67,7 +66,6 @@ static char *tdesc = "OSS Console Channel Driver";
|
||||
static char *config = "oss.conf";
|
||||
|
||||
static char context[AST_MAX_EXTENSION] = "default";
|
||||
static char language[MAX_LANGUAGE] = "";
|
||||
static char exten[AST_MAX_EXTENSION] = "s";
|
||||
|
||||
/* Some pipes to prevent overflow */
|
||||
@@ -343,12 +341,6 @@ static int oss_digit(struct ast_channel *c, char digit)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int oss_text(struct ast_channel *c, char *text)
|
||||
{
|
||||
ast_verbose( " << Console Received text %s >> \n", text);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int oss_call(struct ast_channel *c, char *dest, int timeout)
|
||||
{
|
||||
ast_verbose( " << Call placed to '%s' on console >> \n", dest);
|
||||
@@ -485,14 +477,6 @@ static struct ast_frame *oss_read(struct ast_channel *chan)
|
||||
if (needhangup) {
|
||||
return NULL;
|
||||
}
|
||||
if (strlen(text2send)) {
|
||||
f.frametype = AST_FRAME_TEXT;
|
||||
f.subclass = 0;
|
||||
f.data = text2send;
|
||||
f.datalen = strlen(text2send);
|
||||
strcpy(text2send,"");
|
||||
return &f;
|
||||
}
|
||||
if (strlen(digits)) {
|
||||
f.frametype = AST_FRAME_DTMF;
|
||||
f.subclass = digits[0];
|
||||
@@ -551,18 +535,14 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *p, int state)
|
||||
tmp->format = AST_FORMAT_SLINEAR;
|
||||
tmp->pvt->pvt = p;
|
||||
tmp->pvt->send_digit = oss_digit;
|
||||
tmp->pvt->send_text = oss_text;
|
||||
tmp->pvt->hangup = oss_hangup;
|
||||
tmp->pvt->answer = oss_answer;
|
||||
tmp->pvt->read = oss_read;
|
||||
tmp->pvt->call = oss_call;
|
||||
tmp->pvt->write = oss_write;
|
||||
if (strlen(p->context))
|
||||
strncpy(tmp->context, p->context, sizeof(tmp->context));
|
||||
if (strlen(p->exten))
|
||||
strncpy(tmp->exten, p->exten, sizeof(tmp->exten));
|
||||
if (strlen(language))
|
||||
strncpy(tmp->language, language, sizeof(tmp->language));
|
||||
p->owner = tmp;
|
||||
tmp->state = state;
|
||||
pthread_mutex_lock(&usecnt_lock);
|
||||
@@ -583,7 +563,6 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *p, int state)
|
||||
static struct ast_channel *oss_request(char *type, int format, void *data)
|
||||
{
|
||||
int oldformat = format;
|
||||
struct ast_channel *tmp;
|
||||
format &= AST_FORMAT_SLINEAR;
|
||||
if (!format) {
|
||||
ast_log(LOG_NOTICE, "Asked to get a channel of format '%d'\n", oldformat);
|
||||
@@ -593,11 +572,7 @@ static struct ast_channel *oss_request(char *type, int format, void *data)
|
||||
ast_log(LOG_NOTICE, "Already have a call on the OSS channel\n");
|
||||
return NULL;
|
||||
}
|
||||
tmp= oss_new(&oss, AST_STATE_DOWN);
|
||||
if (!tmp) {
|
||||
ast_log(LOG_WARNING, "Unable to create new OSS channel\n");
|
||||
}
|
||||
return tmp;
|
||||
return oss_new(&oss, AST_STATE_DOWN);
|
||||
}
|
||||
|
||||
static int console_autoanswer(int fd, int argc, char *argv[])
|
||||
@@ -654,30 +629,6 @@ static int console_answer(int fd, int argc, char *argv[])
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char sendtext_usage[] =
|
||||
"Usage: send text <message>\n"
|
||||
" Sends a text message for display on the remote terminal.\n";
|
||||
|
||||
static int console_sendtext(int fd, int argc, char *argv[])
|
||||
{
|
||||
int tmparg = 1;
|
||||
if (argc < 1)
|
||||
return RESULT_SHOWUSAGE;
|
||||
if (!oss.owner) {
|
||||
ast_cli(fd, "No one is calling us\n");
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
if (strlen(text2send))
|
||||
ast_cli(fd, "Warning: message already waiting to be sent, overwriting\n");
|
||||
strcpy(text2send, "");
|
||||
while(tmparg <= argc) {
|
||||
strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send));
|
||||
strncat(text2send, " ", sizeof(text2send) - strlen(text2send));
|
||||
}
|
||||
needanswer++;
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static char answer_usage[] =
|
||||
"Usage: answer\n"
|
||||
" Answers an incoming call on the console (OSS) channel.\n";
|
||||
@@ -743,7 +694,6 @@ static struct ast_cli_entry myclis[] = {
|
||||
{ { "answer", NULL }, console_answer, "Answer an incoming console call", answer_usage },
|
||||
{ { "hangup", NULL }, console_hangup, "Hangup a call on the console", hangup_usage },
|
||||
{ { "dial", NULL }, console_dial, "Dial an extension on the console", dial_usage },
|
||||
{ { "send text", NULL }, console_sendtext, "Send text to the remote device", sendtext_usage },
|
||||
{ { "autoanswer", NULL }, console_autoanswer, "Sets/displays autoanswer", autoanswer_usage, autoanswer_complete }
|
||||
};
|
||||
|
||||
@@ -794,8 +744,6 @@ int load_module()
|
||||
silencethreshold = atoi(v->value);
|
||||
else if (!strcasecmp(v->name, "context"))
|
||||
strncpy(context, v->value, sizeof(context));
|
||||
else if (!strcasecmp(v->name, "language"))
|
||||
strncpy(language, v->value, sizeof(language));
|
||||
else if (!strcasecmp(v->name, "extension"))
|
||||
strncpy(exten, v->value, sizeof(exten));
|
||||
v=v->next;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <linux/ixjuser.h>
|
||||
#include "DialTone.h"
|
||||
|
||||
#define PHONE_MAX_BUF 480
|
||||
#define phone_MAX_BUF 480
|
||||
|
||||
static char *desc = "Linux Telephony API Support";
|
||||
static char *type = "Phone";
|
||||
@@ -44,8 +44,6 @@ static char *config = "phone.conf";
|
||||
/* Default context for dialtone mode */
|
||||
static char context[AST_MAX_EXTENSION] = "default";
|
||||
|
||||
/* Default language */
|
||||
static char language[MAX_LANGUAGE] = "";
|
||||
static int usecnt =0;
|
||||
|
||||
static int echocancel = AEC_OFF;
|
||||
@@ -74,7 +72,6 @@ static int restart_monitor(void);
|
||||
|
||||
#define MODE_DIALTONE 1
|
||||
#define MODE_IMMEDIATE 2
|
||||
#define MODE_FXO 3
|
||||
|
||||
static struct phone_pvt {
|
||||
int fd; /* Raw file descriptor for this device */
|
||||
@@ -87,14 +84,13 @@ static struct phone_pvt {
|
||||
struct phone_pvt *next; /* Next channel in list */
|
||||
struct ast_frame fr; /* Frame */
|
||||
char offset[AST_FRIENDLY_OFFSET];
|
||||
char buf[PHONE_MAX_BUF]; /* Static buffer for reading frames */
|
||||
char buf[phone_MAX_BUF]; /* Static buffer for reading frames */
|
||||
int obuflen;
|
||||
int dialtone;
|
||||
int silencesupression;
|
||||
char context[AST_MAX_EXTENSION];
|
||||
char obuf[PHONE_MAX_BUF * 2];
|
||||
char obuf[phone_MAX_BUF * 2];
|
||||
char ext[AST_MAX_EXTENSION];
|
||||
char language[MAX_LANGUAGE];
|
||||
} *iflist = NULL;
|
||||
|
||||
static int phone_digit(struct ast_channel *ast, char digit)
|
||||
@@ -166,13 +162,6 @@ static int phone_hangup(struct ast_channel *ast)
|
||||
ast_log(LOG_WARNING, "Failed to stop ringing\n");
|
||||
if (ioctl(p->fd, PHONE_CPT_STOP))
|
||||
ast_log(LOG_WARNING, "Failed to stop sounds\n");
|
||||
|
||||
/* If it's an FXO, hang them up */
|
||||
if (p->mode == MODE_FXO) {
|
||||
if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK))
|
||||
ast_log(LOG_DEBUG, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",ast->name, strerror(errno));
|
||||
}
|
||||
|
||||
/* If they're off hook, give a busy signal */
|
||||
if (ioctl(p->fd, PHONE_HOOKSTATE)) {
|
||||
if (option_debug)
|
||||
@@ -238,15 +227,6 @@ static int phone_setup(struct ast_channel *ast)
|
||||
|
||||
static int phone_answer(struct ast_channel *ast)
|
||||
{
|
||||
struct phone_pvt *p;
|
||||
p = ast->pvt->pvt;
|
||||
/* In case it's a LineJack, take it off hook */
|
||||
if (p->mode == MODE_FXO) {
|
||||
if (ioctl(p->fd, PHONE_PSTN_SET_STATE, PSTN_OFF_HOOK))
|
||||
ast_log(LOG_DEBUG, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n", ast->name, strerror(errno));
|
||||
else
|
||||
ast_log(LOG_DEBUG, "Took linejack off hook\n");
|
||||
}
|
||||
phone_setup(ast);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "phone_answer(%s)\n", ast->name);
|
||||
@@ -284,8 +264,6 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
|
||||
|
||||
phonee.bytes = ioctl(p->fd, PHONE_EXCEPTION);
|
||||
if (phonee.bits.dtmf_ready) {
|
||||
ast_log(LOG_DEBUG, "phone_read(): DTMF\n");
|
||||
|
||||
/* We've got a digit -- Just handle this nicely and easily */
|
||||
digit = ioctl(p->fd, PHONE_GET_DTMF_ASCII);
|
||||
p->fr.subclass = digit;
|
||||
@@ -293,11 +271,9 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
|
||||
return &p->fr;
|
||||
}
|
||||
if (phonee.bits.hookstate) {
|
||||
ast_log(LOG_DEBUG, "Hookstate changed\n");
|
||||
res = ioctl(p->fd, PHONE_HOOKSTATE);
|
||||
/* See if we've gone on hook, if so, notify by returning NULL */
|
||||
ast_log(LOG_DEBUG, "New hookstate: %d\n", res);
|
||||
if (!res && (p->mode != MODE_FXO))
|
||||
if (!res)
|
||||
return NULL;
|
||||
else {
|
||||
if (ast->state == AST_STATE_RINGING) {
|
||||
@@ -311,18 +287,16 @@ static struct ast_frame *phone_read(struct ast_channel *ast)
|
||||
ast_log(LOG_WARNING, "Got off hook in weird state %d\n", ast->state);
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
#if 0
|
||||
if (phonee.bits.pstn_ring)
|
||||
ast_verbose("Unit is ringing\n");
|
||||
if (phonee.bits.caller_id) {
|
||||
ast_verbose("We have caller ID: %s\n");
|
||||
}
|
||||
if (phonee.bits.pstn_wink)
|
||||
ast_verbose("Detected Wink\n");
|
||||
#endif
|
||||
/* Try to read some data... */
|
||||
CHECK_BLOCKING(ast);
|
||||
res = read(p->fd, p->buf, PHONE_MAX_BUF);
|
||||
res = read(p->fd, p->buf, phone_MAX_BUF);
|
||||
ast->blocking = 0;
|
||||
if (res < 0) {
|
||||
#if 0
|
||||
@@ -454,8 +428,6 @@ static int phone_write(struct ast_channel *ast, struct ast_frame *frame)
|
||||
}
|
||||
maxfr = 480;
|
||||
}
|
||||
ioctl(p->fd, PHONE_REC_DEPTH, 3);
|
||||
ioctl(p->fd, PHONE_PLAY_DEPTH, 3);
|
||||
if (ioctl(p->fd, PHONE_PLAY_START)) {
|
||||
ast_log(LOG_WARNING, "Failed to start playback\n");
|
||||
return -1;
|
||||
@@ -522,8 +494,6 @@ static struct ast_channel *phone_new(struct phone_pvt *i, int state, char *conte
|
||||
strncpy(tmp->context, context, sizeof(tmp->context));
|
||||
if (strlen(i->ext))
|
||||
strncpy(tmp->exten, i->ext, sizeof(tmp->exten));
|
||||
if (strlen(i->language))
|
||||
strncpy(tmp->language, i->language, sizeof(tmp->language));
|
||||
i->owner = tmp;
|
||||
pthread_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
@@ -641,10 +611,8 @@ static void phone_check_exception(struct phone_pvt *i)
|
||||
i->dialtone = 0;
|
||||
}
|
||||
}
|
||||
if (phonee.bits.pstn_ring) {
|
||||
if (phonee.bits.pstn_ring)
|
||||
ast_verbose("Unit is ringing\n");
|
||||
phone_new(i, AST_STATE_RING, i->context);
|
||||
}
|
||||
if (phonee.bits.caller_id)
|
||||
ast_verbose("We have caller ID\n");
|
||||
|
||||
@@ -818,23 +786,16 @@ static struct phone_pvt *mkif(char *iface, int mode)
|
||||
free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
if (mode == MODE_FXO) {
|
||||
if (ioctl(tmp->fd, IXJCTL_PORT, PORT_PSTN))
|
||||
ast_log(LOG_DEBUG, "Unable to set port to PSTN\n");
|
||||
}
|
||||
ioctl(tmp->fd, PHONE_PLAY_STOP);
|
||||
ioctl(tmp->fd, PHONE_REC_STOP);
|
||||
ioctl(tmp->fd, PHONE_RING_STOP);
|
||||
ioctl(tmp->fd, PHONE_CPT_STOP);
|
||||
if (ioctl(tmp->fd, PHONE_PSTN_SET_STATE, PSTN_ON_HOOK))
|
||||
ast_log(LOG_DEBUG, "ioctl(PHONE_PSTN_SET_STATE) failed on %s (%s)\n",iface, strerror(errno));
|
||||
ioctl(tmp->fd, PHONE_REC_DEPTH, 4);
|
||||
if (echocancel != AEC_OFF)
|
||||
ioctl(tmp->fd, IXJCTL_AEC_START, echocancel);
|
||||
if (silencesupression)
|
||||
tmp->silencesupression = 1;
|
||||
#ifdef PHONE_VAD
|
||||
ioctl(tmp->fd, PHONE_VAD, tmp->silencesupression);
|
||||
#endif
|
||||
tmp->mode = mode;
|
||||
#if 0
|
||||
flags = fcntl(tmp->fd, F_GETFL);
|
||||
@@ -845,7 +806,6 @@ static struct phone_pvt *mkif(char *iface, int mode)
|
||||
tmp->lastinput = -1;
|
||||
tmp->ministate = 0;
|
||||
memset(tmp->ext, 0, sizeof(tmp->ext));
|
||||
strncpy(tmp->language, language, sizeof(tmp->language));
|
||||
strncpy(tmp->dev, iface, sizeof(tmp->dev));
|
||||
strncpy(tmp->context, context, sizeof(tmp->context));
|
||||
tmp->next = NULL;
|
||||
@@ -924,15 +884,11 @@ int load_module()
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "silencesupression")) {
|
||||
silencesupression = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(language, v->value, sizeof(language));
|
||||
} else if (!strcasecmp(v->name, "mode")) {
|
||||
if (!strncasecmp(v->value, "di", 2))
|
||||
mode = MODE_DIALTONE;
|
||||
else if (!strncasecmp(v->value, "im", 2))
|
||||
mode = MODE_IMMEDIATE;
|
||||
else if (!strncasecmp(v->value, "fx", 2))
|
||||
mode = MODE_FXO;
|
||||
else
|
||||
ast_log(LOG_WARNING, "Unknown mode: %s\n", v->value);
|
||||
} else if (!strcasecmp(v->name, "context")) {
|
||||
|
||||
@@ -25,19 +25,12 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <linux/if_ether.h>
|
||||
#ifndef OLD_SANGOMA_API
|
||||
#include <linux/if_wanpipe.h>
|
||||
#include <linux/wanpipe.h>
|
||||
#endif
|
||||
#include <sys/signal.h>
|
||||
#include "adtranvofr.h"
|
||||
|
||||
/* #define VOFRDUMPER */
|
||||
|
||||
#define G723_MAX_BUF 2048
|
||||
|
||||
#define FR_API_MESS 16
|
||||
@@ -49,8 +42,6 @@ static char *config = "adtranvofr.conf";
|
||||
|
||||
static char context[AST_MAX_EXTENSION] = "default";
|
||||
|
||||
static char language[MAX_LANGUAGE] = "";
|
||||
|
||||
static int usecnt =0;
|
||||
static pthread_mutex_t usecnt_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
@@ -72,11 +63,7 @@ static int restart_monitor(void);
|
||||
|
||||
static struct vofr_pvt {
|
||||
int s; /* Raw socket for this DLCI */
|
||||
#ifdef OLD_SANGOMA_API
|
||||
struct sockaddr_pkt sa; /* Sockaddr needed for sending, also has iface name */
|
||||
#else
|
||||
struct wan_sockaddr_ll sa; /* Wanpipe sockaddr */
|
||||
#endif
|
||||
struct ast_channel *owner; /* Channel we belong to, possibly NULL */
|
||||
int outgoing; /* Does this channel support outgoing calls? */
|
||||
struct vofr_pvt *next; /* Next channel in list */
|
||||
@@ -88,8 +75,6 @@ static struct vofr_pvt {
|
||||
char buf[G723_MAX_BUF]; /* Static buffer for reading frames */
|
||||
char obuf[G723_MAX_BUF]; /* Output buffer */
|
||||
char context[AST_MAX_EXTENSION];
|
||||
char language[MAX_LANGUAGE];
|
||||
int ringgothangup; /* Have we received exactly one hangup after a ring */
|
||||
} *iflist = NULL;
|
||||
|
||||
#ifdef VOFRDUMPER
|
||||
@@ -256,11 +241,7 @@ static void vofr_dump_packet(struct vofr_hdr *vh, int len)
|
||||
static int vofr_xmit(struct vofr_pvt *p, char *data, int len)
|
||||
{
|
||||
int res;
|
||||
#ifdef OLD_SANGOMA_API
|
||||
res=sendto(p->s, data, len, 0, (struct sockaddr *)&p->sa, sizeof(struct sockaddr_pkt));
|
||||
#else
|
||||
res=sendto(p->s, data, len, 0, (struct sockaddr *)&p->sa, sizeof(struct wan_sockaddr_ll));
|
||||
#endif
|
||||
if (res != len) {
|
||||
ast_log(LOG_WARNING, "vofr_xmit returned %d\n", res);
|
||||
}
|
||||
@@ -356,7 +337,7 @@ static int vofr_call(struct ast_channel *ast, char *dest, int timeout)
|
||||
while(otimeout) {
|
||||
otimeout = ast_waitfor(ast, 1000);
|
||||
if (otimeout < 1) {
|
||||
ast_log(LOG_WARNING, "Unable to take line '%s' off hook\n", ast->name);
|
||||
ast_log(LOG_WARNING, "Unable to take line off hook\n");
|
||||
/* Musta gotten hung up, or no ack on off hook */
|
||||
return -1;
|
||||
}
|
||||
@@ -453,7 +434,6 @@ static int vofr_hangup(struct ast_channel *ast)
|
||||
}
|
||||
ast->state = AST_STATE_DOWN;
|
||||
((struct vofr_pvt *)(ast->pvt->pvt))->owner = NULL;
|
||||
((struct vofr_pvt *)(ast->pvt->pvt))->ringgothangup = 0;
|
||||
pthread_mutex_lock(&usecnt_lock);
|
||||
usecnt--;
|
||||
if (usecnt < 0)
|
||||
@@ -485,9 +465,6 @@ static int vofr_answer(struct ast_channel *ast)
|
||||
cnt = ast_waitfor(ast, cnt);
|
||||
if (cnt > 0) {
|
||||
res = read(ast->fd, buf, sizeof(buf));
|
||||
#ifdef VOFRDUMPER
|
||||
vofr_dump_packet((void *)(buf +FR_API_MESS), res - FR_API_MESS);
|
||||
#endif
|
||||
res -= FR_API_MESS;
|
||||
if (res < 0)
|
||||
ast_log(LOG_WARNING, "Warning: read failed (%s) on %s\n", strerror(errno), ast->name);
|
||||
@@ -552,32 +529,15 @@ static struct ast_frame *vofr_read(struct ast_channel *ast)
|
||||
/* Read into the right place in the buffer, in case we send this
|
||||
as a voice frame. */
|
||||
CHECK_BLOCKING(ast);
|
||||
retry:
|
||||
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);
|
||||
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
|
||||
vofr_dump_packet((void *)(vh), res);
|
||||
#endif
|
||||
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);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Some nice norms */
|
||||
fr->datalen = 0;
|
||||
fr->timelen = 0;
|
||||
@@ -592,17 +552,15 @@ retry:
|
||||
switch(vh->data[0]) {
|
||||
case VOFR_SIGNAL_ON_HOOK:
|
||||
/* Hang up this line */
|
||||
if ((ast->state == AST_STATE_UP) || (p->ringgothangup)) {
|
||||
if (ast->state == AST_STATE_UP)
|
||||
return NULL;
|
||||
} else {
|
||||
else {
|
||||
fr->frametype = AST_FRAME_NULL;
|
||||
fr->subclass = 0;
|
||||
p->ringgothangup=1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case VOFR_SIGNAL_RING:
|
||||
ast->rings++;
|
||||
p->ringgothangup = 0;
|
||||
break;
|
||||
case VOFR_SIGNAL_UNKNOWN:
|
||||
switch(vh->data[1]) {
|
||||
@@ -699,7 +657,7 @@ retry:
|
||||
ast->state = AST_STATE_UP;
|
||||
return fr;
|
||||
} else if (ast->state != AST_STATE_UP) {
|
||||
ast_log(LOG_WARNING, "%s: Voice in weird state %d\n", ast->name, ast->state);
|
||||
ast_log(LOG_WARNING, "Voice in weird state %d\n", ast->state);
|
||||
}
|
||||
fr->frametype = AST_FRAME_VOICE;
|
||||
fr->subclass = AST_FORMAT_G723_1;
|
||||
@@ -787,11 +745,7 @@ static struct ast_channel *vofr_new(struct vofr_pvt *i, int state)
|
||||
struct ast_channel *tmp;
|
||||
tmp = ast_channel_alloc();
|
||||
if (tmp) {
|
||||
#ifdef OLD_SANGOMA_API
|
||||
snprintf(tmp->name, sizeof(tmp->name), "AdtranVoFR/%s", i->sa.spkt_device);
|
||||
#else
|
||||
snprintf(tmp->name, sizeof(tmp->name), "AdtranVoFR/%s", i->sa.sll_device);
|
||||
#endif
|
||||
tmp->type = type;
|
||||
tmp->fd = i->s;
|
||||
/* Adtran VoFR supports only G723.1 format data. G711 (ulaw) would be nice too */
|
||||
@@ -806,8 +760,6 @@ static struct ast_channel *vofr_new(struct vofr_pvt *i, int state)
|
||||
tmp->pvt->answer = vofr_answer;
|
||||
tmp->pvt->read = vofr_read;
|
||||
tmp->pvt->write = vofr_write;
|
||||
if (strlen(i->language))
|
||||
strncpy(tmp->language, i->language, sizeof(tmp->language));
|
||||
i->owner = tmp;
|
||||
pthread_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
@@ -836,10 +788,9 @@ 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 */
|
||||
if (!i->owner) {
|
||||
i->ringgothangup = 0;
|
||||
if (!i->owner)
|
||||
vofr_new(i, AST_STATE_RING);
|
||||
} else
|
||||
else
|
||||
ast_log(LOG_WARNING, "Got a ring, but there's an owner?\n");
|
||||
break;
|
||||
case VOFR_SIGNAL_OFF_HOOK:
|
||||
@@ -916,11 +867,7 @@ static void *do_monitor(void *data)
|
||||
i = iflist;
|
||||
while(i) {
|
||||
if (FD_ISSET(i->s, &rfds))
|
||||
#ifdef OLD_SANGOMA_API
|
||||
ast_log(LOG_WARNING, "Descriptor %d appears twice (%s)?\n", i->s, i->sa.spkt_device);
|
||||
#else
|
||||
ast_log(LOG_WARNING, "Descriptor %d appears twice (%s)?\n", i->s, i->sa.sll_device);
|
||||
#endif
|
||||
if (!i->owner) {
|
||||
/* This needs to be watched, as it lacks an owner */
|
||||
FD_SET(i->s, &rfds);
|
||||
@@ -954,11 +901,7 @@ static void *do_monitor(void *data)
|
||||
while(i) {
|
||||
if (FD_ISSET(i->s, &rfds)) {
|
||||
if (i->owner) {
|
||||
#ifdef OLD_SANGOMA_API
|
||||
ast_log(LOG_WARNING, "Whoa.... I'm owned but found (%d, %s)...\n", i->s, i->sa.spkt_device);
|
||||
#else
|
||||
ast_log(LOG_WARNING, "Whoa.... I'm owned but found (%d, %s)...\n", i->s, i->sa.sll_device);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
res = read(i->s, i->buf, sizeof(i->buf));
|
||||
@@ -1016,49 +959,27 @@ static struct vofr_pvt *mkif(char *type, char *iface)
|
||||
/* Make a vofr_pvt structure for this interface */
|
||||
struct vofr_pvt *tmp;
|
||||
int sndbuf = 4096;
|
||||
|
||||
|
||||
tmp = malloc(sizeof(struct vofr_pvt));
|
||||
if (tmp) {
|
||||
|
||||
/* Allocate a packet socket */
|
||||
#ifdef OLD_SANGOMA_API
|
||||
tmp->s = socket(AF_INET, SOCK_PACKET, htons(ETH_P_ALL));
|
||||
#else
|
||||
/* Why the HELL does Sangoma change their API every damn time
|
||||
they make a new driver release?!?!?! Leave it the hell
|
||||
alone this time. */
|
||||
tmp->s = socket(AF_WANPIPE, SOCK_RAW, 0);
|
||||
#endif
|
||||
|
||||
if (tmp->s < 0) {
|
||||
ast_log(LOG_ERROR, "Unable to create socket: %s\n", strerror(errno));
|
||||
free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef OLD_SANGOMA_API
|
||||
/* Prepare sockaddr for binding */
|
||||
memset(&tmp->sa, 0, sizeof(tmp->sa));
|
||||
strncpy(tmp->sa.spkt_device, iface, sizeof(tmp->sa.spkt_device));
|
||||
tmp->sa.spkt_protocol = htons(0x16);
|
||||
tmp->sa.spkt_family = AF_PACKET;
|
||||
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct sockaddr))) {
|
||||
#else
|
||||
/* Prepare sockaddr for binding */
|
||||
memset(&tmp->sa, 0, sizeof(tmp->sa));
|
||||
tmp->sa.sll_family = AF_WANPIPE;
|
||||
tmp->sa.sll_protocol = htons(ETH_P_IP);
|
||||
strncpy(tmp->sa.sll_device, iface, sizeof(tmp->sa.sll_device));
|
||||
strncpy(tmp->sa.sll_card, "wanpipe1", sizeof(tmp->sa.sll_card));
|
||||
tmp->sa.sll_ifindex = 0;
|
||||
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct wan_sockaddr_ll))) {
|
||||
#endif
|
||||
|
||||
/* Bind socket to specific interface */
|
||||
#ifdef OLD_SANGOMA_API
|
||||
if (bind(tmp->s, (struct sockaddr *)&tmp->sa, sizeof(struct sockaddr))) {
|
||||
ast_log(LOG_ERROR, "Unable to bind to '%s': %s\n", tmp->sa.spkt_device,
|
||||
#else
|
||||
ast_log(LOG_ERROR, "Unable to bind to '%s': %s\n", tmp->sa.sll_device,
|
||||
#endif
|
||||
strerror(errno));
|
||||
free(tmp);
|
||||
return NULL;
|
||||
@@ -1076,8 +997,6 @@ static struct vofr_pvt *mkif(char *type, char *iface)
|
||||
tmp->dlcil = 0;
|
||||
tmp->dlcih = 0;
|
||||
tmp->cid = 1;
|
||||
tmp->ringgothangup = 0;
|
||||
strncpy(tmp->language, language, sizeof(tmp->language));
|
||||
strncpy(tmp->context, context, sizeof(tmp->context));
|
||||
/* User terminations are game for outgoing connections */
|
||||
if (!strcasecmp(type, "user"))
|
||||
@@ -1113,7 +1032,7 @@ static struct ast_channel *vofr_request(char *type, int format, void *data)
|
||||
}
|
||||
p = iflist;
|
||||
while(p) {
|
||||
if (!p->owner && p->outgoing) {
|
||||
if (!p->owner) {
|
||||
tmp = vofr_new(p, AST_STATE_DOWN);
|
||||
break;
|
||||
}
|
||||
@@ -1159,8 +1078,6 @@ int load_module()
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "context")) {
|
||||
strncpy(context, v->value, sizeof(context));
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(language, v->value, sizeof(language));
|
||||
}
|
||||
v = v->next;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ struct ast_iax_full_hdr {
|
||||
/* Mini header is used only for voice frames -- delivered unreliably */
|
||||
struct ast_iax_mini_hdr {
|
||||
short callno; /* Source call number -- high bit must be 0 */
|
||||
unsigned short ts; /* 16-bit Timestamp (high 16 bits from last ast_iax_full_hdr) */
|
||||
unsigned short ts; /* 16-bit Timestamp (high 32 bits from last ast_iax_full_hdr) */
|
||||
/* Frametype implicitly VOICE_FRAME */
|
||||
/* subclass implicit from last ast_iax_full_hdr */
|
||||
char data[0];
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/******************************************************************************
|
||||
$Id$
|
||||
$Log$
|
||||
Revision 1.5 1999/12/01 05:25:58 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.3 1999/12/01 05:25:58 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.1 1999/12/01 05:25:58 markster
|
||||
Start on the Internet Phone Jack channel
|
||||
|
||||
@@ -173,14 +173,16 @@ static struct ast_frame *g723tolin_frameout(struct ast_translator_pvt *pvt)
|
||||
tmp->tail = 0;
|
||||
|
||||
#if 0
|
||||
/* Save the frames */
|
||||
{
|
||||
static int fd2 = -1;
|
||||
if (fd2 == -1) {
|
||||
fd2 = open("g723.example", O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
}
|
||||
write(fd2, tmp->f.data, tmp->f.datalen);
|
||||
/* Save a sample frame */
|
||||
{ static int samplefr = 0;
|
||||
if (samplefr == 80) {
|
||||
int fd;
|
||||
fd = open("g723.example", O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
write(fd, tmp->f.data, tmp->f.datalen);
|
||||
close(fd);
|
||||
}
|
||||
samplefr++;
|
||||
}
|
||||
#endif
|
||||
return &tmp->f;
|
||||
}
|
||||
@@ -198,7 +200,7 @@ static int g723tolin_framein(struct ast_translator_pvt *pvt, struct ast_frame *f
|
||||
#ifdef ANNEX_B
|
||||
Decod(&tmp->dec, tmpdata, f->data, 0);
|
||||
for (x=0;x<Frame;x++)
|
||||
(tmp->buf + tmp->tail)[x] = (short)(tmpdata[x]);
|
||||
(tmp->buf + tmp->tail)[x] = (short)tmpdata[x];
|
||||
#else
|
||||
Decod(&tmp->dec, tmp->buf + tmp->tail, f->data, 0);
|
||||
#endif
|
||||
|
||||
@@ -156,7 +156,7 @@ static int lintogsm_framein(struct ast_translator_pvt *tmp, struct ast_frame *f)
|
||||
/* XXX We should look at how old the rest of our stream is, and if it
|
||||
is too old, then we should overwrite it entirely, otherwise we can
|
||||
get artifacts of earlier talk that do not belong */
|
||||
if (tmp->tail + f->datalen/2 < sizeof(tmp->buf) / 2) {
|
||||
if (tmp->tail + f->datalen < sizeof(tmp->buf) / 2) {
|
||||
memcpy((tmp->buf + tmp->tail), f->data, f->datalen);
|
||||
tmp->tail += f->datalen/2;
|
||||
} else {
|
||||
@@ -187,14 +187,16 @@ static struct ast_frame *lintogsm_frameout(struct ast_translator_pvt *tmp)
|
||||
if (tmp->tail)
|
||||
memmove(tmp->buf, tmp->buf + 160, tmp->tail * 2);
|
||||
#if 0
|
||||
/* Save the frames */
|
||||
{
|
||||
static int fd2 = -1;
|
||||
if (fd2 == -1) {
|
||||
fd2 = open("gsm.example", O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
}
|
||||
write(fd2, tmp->f.data, tmp->f.datalen);
|
||||
/* Save a sample frame */
|
||||
{ static int samplefr = 0;
|
||||
if (samplefr == 0) {
|
||||
int fd;
|
||||
fd = open("gsm.example", O_WRONLY | O_CREAT, 0644);
|
||||
write(fd, tmp->f.data, tmp->f.datalen);
|
||||
close(fd);
|
||||
}
|
||||
samplefr++;
|
||||
}
|
||||
#endif
|
||||
return &tmp->f;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -79,8 +79,8 @@ static integer c__1 = 1;
|
||||
/* ANALYS Version 55 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -246,8 +246,8 @@ static integer c__1 = 1;
|
||||
real phi[100] /* was [10][10] */, psi[10];
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -277,8 +277,8 @@ static integer c__1 = 1;
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* Arguments to ANALYS */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -48,8 +48,8 @@ extern struct {
|
||||
/* BSYNZ Version 54 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -144,8 +144,8 @@ extern struct {
|
||||
real lpi0, hpi0;
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -175,8 +175,8 @@ extern struct {
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -35,8 +35,8 @@ extern int chanrd_(integer *order, integer *ipitv, integer *irms, integer *irc,
|
||||
/* CHANL Version 49 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int dcbias_(integer *len, real *speech, real *sigout);
|
||||
/* DCBIAS Version 50 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -53,8 +53,8 @@ static integer c__2 = 2;
|
||||
/* DECODE Version 54 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -188,8 +188,8 @@ static integer c__2 = 2;
|
||||
integer ishift, errcnt, lsb;
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -219,8 +219,8 @@ static integer c__2 = 2;
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -37,8 +37,8 @@ extern int deemp_(real *x, integer *n, struct lpc10_decoder_state *st);
|
||||
/* DEEMP Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int difmag_(real *speech, integer *lpita, integer *tau, integer *ltau, in
|
||||
/* DIFMAG Version 49 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -47,8 +47,8 @@ extern struct {
|
||||
/* DYPTRK Version 52 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -136,8 +136,8 @@ extern struct {
|
||||
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -43,8 +43,8 @@ static integer c__2 = 2;
|
||||
/* ENCODE Version 54 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -128,8 +128,8 @@ static integer c__2 = 2;
|
||||
integer idel, nbit, i__, j, i2, i3, mrk;
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -151,8 +151,8 @@ static integer c__2 = 2;
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int energy_(integer *len, real *speech, real *rms);
|
||||
/* ENERGY Version 50 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int ham84_(integer *input, integer *output, integer *errcnt);
|
||||
/* HAM84 Version 45G */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -39,8 +39,8 @@ extern int inithp100_(void);
|
||||
/* HP100 Version 55 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int invert_(integer *order, real *phi, real *psi, real *rc);
|
||||
/* INVERT Version 45G */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -91,8 +91,8 @@ extern int invert_(integer *order, real *phi, real *psi, real *rc);
|
||||
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int irc2pc_(real *rc, real *pc, integer *order, real *gprime, real *g2pas
|
||||
/* IRC2PC Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -82,8 +82,8 @@ extern int irc2pc_(real *rc, real *pc, integer *order, real *gprime, real *g2pas
|
||||
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int ivfilt_(real *lpbuf, real *ivbuf, integer *len, integer *nsamp, real
|
||||
/* IVFILT Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 00:20:06 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 00:20:06 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.1 2000/01/05 00:20:06 markster
|
||||
Add broken lpc10 code... It's not too far from working I don't think...
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -58,8 +58,8 @@ static integer c__10 = 10;
|
||||
/* ***************************************************************** */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -113,8 +113,8 @@ static integer c__10 = 10;
|
||||
real rms;
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -147,8 +147,8 @@ static integer c__10 = 10;
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -50,8 +50,8 @@ static integer c__10 = 10;
|
||||
/* ***************************************************************** */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -109,8 +109,8 @@ static integer c__10 = 10;
|
||||
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -45,8 +45,8 @@ struct {
|
||||
/* ***************************************************************** */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -71,8 +71,8 @@ struct {
|
||||
{
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -97,8 +97,8 @@ struct {
|
||||
/* LPC Configuration parameters: */
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int lpfilt_(real *inbuf, real *lpbuf, integer *len, integer *nsamp);
|
||||
/* LPFILT Version 55 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern integer median_(integer *d1, integer *d2, integer *d3);
|
||||
/* MEDIAN Version 45G */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int mload_(integer *order, integer *awins, integer *awinf, real *speech,
|
||||
/* MLOAD Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -41,8 +41,8 @@ static real c_b2 = 1.f;
|
||||
/* ONSET Version 49 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -143,8 +143,8 @@ static real c_b2 = 1.f;
|
||||
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -37,8 +37,8 @@ extern int pitsyn_(integer *order, integer *voice, integer *pitch, real *rms, re
|
||||
/* PITSYN Version 53 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -143,8 +143,8 @@ extern int pitsyn_(integer *order, integer *voice, integer *pitch, real *rms, re
|
||||
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int placea_(integer *ipitch, integer *voibuf, integer *obound, integer *a
|
||||
/* PLACEA Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int placev_(integer *osbuf, integer *osptr, integer *oslen, integer *obou
|
||||
/* PLACEV Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int preemp_(real *inbuf, real *pebuf, integer *nsamp, real *coef, real *z
|
||||
/* PREEMP Version 55 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -44,8 +44,8 @@ static integer c__1 = 1;
|
||||
/* PREPRO Version 48 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -37,8 +37,8 @@ extern integer random_(struct lpc10_decoder_state *st);
|
||||
/* RANDOM Version 49 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -29,8 +29,8 @@ extern int rcchk_(integer *order, real *rc1f, real *rc2f);
|
||||
/* RCCHK Version 45G */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:39 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -58,8 +58,8 @@ static real c_b2 = .7f;
|
||||
/* SYNTHS Version 54 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -178,8 +178,8 @@ static real c_b2 = .7f;
|
||||
real rci[160] /* was [10][16] */;
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -209,8 +209,8 @@ static real c_b2 = .7f;
|
||||
/* Frame size, Prediction order, Pitch period */
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:40 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:40 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:40 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -30,8 +30,8 @@ extern int tbdm_(real *speech, integer *lpita, integer *tau, integer *ltau, real
|
||||
/* TBDM Version 49 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:40 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:40 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:40 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -48,8 +48,8 @@ extern struct {
|
||||
/* VOICIN Version 52 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -290,8 +290,8 @@ s*/
|
||||
/* Global Variables: */
|
||||
/* Arguments */
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
Revision 1.3 2000/01/05 08:20:40 markster
|
||||
Version 0.1.4 from FTP
|
||||
Revision 1.1 2000/01/05 08:20:40 markster
|
||||
Version 0.1.2 from FTP
|
||||
|
||||
Revision 1.2 2000/01/05 08:20:40 markster
|
||||
Some OSS fixes and a few lpc changes to make it actually work
|
||||
@@ -33,8 +33,8 @@ static real c_b2 = 1.f;
|
||||
/* VPARMS Version 50 */
|
||||
|
||||
/* $Log$
|
||||
* Revision 1.3 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.4 from FTP
|
||||
* Revision 1.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
*
|
||||
/* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
/* Some OSS fixes and a few lpc changes to make it actually work
|
||||
|
||||
@@ -2,13 +2,9 @@
|
||||
; Voice over Frame Relay (Adtran style)
|
||||
;
|
||||
; Configuration file
|
||||
|
||||
;
|
||||
[interfaces]
|
||||
;
|
||||
; Default language
|
||||
;
|
||||
;language=en
|
||||
;
|
||||
; Lines for which we are the user termination. They accept incoming
|
||||
; and outgoing calls. We use the default context on the first 8 lines
|
||||
; used by internal phones.
|
||||
|
||||
@@ -44,9 +44,6 @@ exten=s,6,BackGround,demo-instruct ; Play some instructions
|
||||
exten=2,1,BackGround,demo-moreinfo ; Give some more information.
|
||||
exten=2,2,Goto,s|6
|
||||
|
||||
exten=3,1,SetLanguage,fr ; Set language to french
|
||||
exten=3,2,Goto,s|5 ; Start with the congratulations
|
||||
|
||||
;
|
||||
; We also create an example user, 1234, who is on the console and has
|
||||
; voicemail, etc.
|
||||
@@ -56,7 +53,7 @@ exten=1234,2,Dial,Console/dsp|10 ; Ring the console, 10 secs max
|
||||
exten=1234,3,Playback,vm/1234/unavail ; "I'm not here right now"
|
||||
exten=1234,4,Voicemail,1234 ; Send to voicemail...
|
||||
exten=1234,5,Goto,s|6 ; Start over
|
||||
exten=1234,103,Playback,vm/1234/busy ; (2 + 101) "I'm on the phone"
|
||||
exten=1234,103,Playback,vm/4200/busy ; (2 + 101) "I'm on the phone"
|
||||
exten=1234,104,Goto,4 ; Go to voicemail, etc.
|
||||
|
||||
exten=1235,1,Goto,1234|3 ; Right to voicemail
|
||||
|
||||
@@ -13,10 +13,6 @@ context=remote
|
||||
;
|
||||
driver=aopen
|
||||
;
|
||||
; Default language
|
||||
;
|
||||
;language=en
|
||||
;
|
||||
; We can optionally override the auto detection. This is necessary
|
||||
; particularly if asterisk does not know about our kind of modem.
|
||||
;
|
||||
|
||||
@@ -16,10 +16,6 @@ autoanswer=yes
|
||||
;
|
||||
extension=s
|
||||
;
|
||||
; Default language
|
||||
;
|
||||
;language=en
|
||||
;
|
||||
; Silence supression can be enabled when sound is over a certain threshold.
|
||||
; The value for the threshold should probably be between 500 and 2000 or so,
|
||||
; but your mileage may vary. Use the echo test to evaluate the best setting.
|
||||
|
||||
@@ -5,23 +5,20 @@
|
||||
;
|
||||
[interfaces]
|
||||
;
|
||||
; Select a mode, either the phone jack provides dialtone, reads digits,
|
||||
; Select a mode, either the line jack provides dialtone, reads digits,
|
||||
; then starts PBX with the given extension (dialtone mode), or
|
||||
; immediately provides the PBX without reading any digits or providing
|
||||
; any dialtone (this is the immediate mode, the default). Also, you
|
||||
; can set the mode to "fxo" if you have a linejack to make it operate
|
||||
; properly.
|
||||
; any dialtone (this is the immediate mode, the default)
|
||||
;
|
||||
mode=immediate
|
||||
;mode=dialtone
|
||||
;mode=fxo
|
||||
;mode=immediate
|
||||
mode=dialtone
|
||||
;
|
||||
; You can decide which format to use by default, "g723.1" or "slinear".
|
||||
; XXX Be careful, sometimes the card causes kernel panics when running
|
||||
; in signed linear mode for some reason... XXX
|
||||
;
|
||||
format=slinear
|
||||
;format=g723.1
|
||||
;format=slinear
|
||||
format=g723.1
|
||||
;
|
||||
; And set the echo cancellation to "off", "low", "medium", and "high".
|
||||
; This is not supported on all phones.
|
||||
@@ -35,4 +32,4 @@ echocancel=medium
|
||||
; List all devices we can use. Contexts may also be specified
|
||||
;
|
||||
;context=local
|
||||
;device=/dev/phone0
|
||||
;device=/dev/ixj0
|
||||
|
||||
49
file.c
49
file.c
@@ -324,27 +324,9 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_fileexists(char *filename, char *fmt, char *preflang)
|
||||
int ast_fileexists(char *filename, char *fmt)
|
||||
{
|
||||
char filename2[256];
|
||||
char lang2[MAX_LANGUAGE];
|
||||
int res = -1;
|
||||
if (preflang && strlen(preflang)) {
|
||||
snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang);
|
||||
res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS);
|
||||
if (res < 1) {
|
||||
strncpy(lang2, preflang, sizeof(lang2));
|
||||
strtok(lang2, "_");
|
||||
if (strcmp(lang2, preflang)) {
|
||||
snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2);
|
||||
res = ast_filehelper(filename2, NULL, fmt, ACTION_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (res < 1) {
|
||||
res = ast_filehelper(filename, NULL, fmt, ACTION_EXISTS);
|
||||
}
|
||||
return res;
|
||||
return ast_filehelper(filename, NULL, fmt, ACTION_EXISTS);
|
||||
}
|
||||
|
||||
int ast_filedelete(char *filename, char *fmt)
|
||||
@@ -357,7 +339,7 @@ int ast_filerename(char *filename, char *filename2, char *fmt)
|
||||
return ast_filehelper(filename, filename2, fmt, ACTION_RENAME);
|
||||
}
|
||||
|
||||
int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
|
||||
int ast_streamfile(struct ast_channel *chan, char *filename)
|
||||
{
|
||||
/* This is a fairly complex routine. Essentially we should do
|
||||
the following:
|
||||
@@ -373,23 +355,9 @@ int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
|
||||
*/
|
||||
int fd = -1;
|
||||
struct ast_channel *trans;
|
||||
int fmts = -1;
|
||||
char filename2[256];
|
||||
char lang2[MAX_LANGUAGE];
|
||||
int fmts;
|
||||
ast_stopstream(chan);
|
||||
if (preflang && strlen(preflang)) {
|
||||
snprintf(filename2, sizeof(filename2), "%s-%s", filename, preflang);
|
||||
fmts = ast_fileexists(filename2, NULL, NULL);
|
||||
if (fmts < 1) {
|
||||
strncpy(lang2, preflang, sizeof(lang2));
|
||||
snprintf(filename2, sizeof(filename2), "%s-%s", filename, lang2);
|
||||
fmts = ast_fileexists(filename2, NULL, NULL);
|
||||
}
|
||||
}
|
||||
if (fmts < 1) {
|
||||
strncpy(filename2, filename, sizeof(filename2));
|
||||
fmts = ast_fileexists(filename2, NULL, NULL);
|
||||
}
|
||||
fmts = ast_fileexists(filename, NULL);
|
||||
if (fmts < 1) {
|
||||
ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
|
||||
return -1;
|
||||
@@ -411,11 +379,10 @@ int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fd = ast_filehelper(filename2, (char *)trans, NULL, ACTION_OPEN);
|
||||
fd = ast_filehelper(filename, (char *)trans, NULL, ACTION_OPEN);
|
||||
if (fd >= 0) {
|
||||
#if 1
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Playing '%s'\n", filename2);
|
||||
#if 0
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Playing '%s'\n", filename);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -102,8 +102,6 @@ static struct ast_filestream *g723_rewrite(int fd, char *comment)
|
||||
tmp->owner = NULL;
|
||||
tmp->fr = NULL;
|
||||
tmp->lasttimeout = -1;
|
||||
tmp->orig.tv_usec = 0;
|
||||
tmp->orig.tv_sec = 0;
|
||||
glistcnt++;
|
||||
pthread_mutex_unlock(&g723_lock);
|
||||
ast_update_use_count();
|
||||
@@ -191,15 +189,11 @@ static int ast_read_callback(void *data)
|
||||
delay = ntohl(delay);
|
||||
else
|
||||
delay = -1;
|
||||
#if 0
|
||||
/* Average out frames <= 50 ms */
|
||||
if (delay < 50)
|
||||
/* Average out frames <= 40 ms */
|
||||
if (delay < 41)
|
||||
s->fr->timelen = 30;
|
||||
else
|
||||
s->fr->timelen = delay;
|
||||
#else
|
||||
s->fr->timelen = 30;
|
||||
#endif
|
||||
/* Unless there is no delay, we're going to exit out as soon as we
|
||||
have processed the current frame. */
|
||||
if (delay > VOFR_FUDGE) {
|
||||
@@ -233,8 +227,8 @@ static int g723_apply(struct ast_channel *c, struct ast_filestream *s)
|
||||
s->owner = c;
|
||||
/* Read and ignore the first delay */
|
||||
if (read(s->fd, &delay, 4) != 4) {
|
||||
/* Empty file */
|
||||
return 0;
|
||||
ast_log(LOG_WARNING, "Bad stream?\n");
|
||||
return -1;
|
||||
}
|
||||
ast_read_callback(s);
|
||||
return 0;
|
||||
@@ -275,10 +269,6 @@ static int g723_write(struct ast_filestream *fs, struct ast_frame *f)
|
||||
fs->orig.tv_sec = now.tv_sec;
|
||||
fs->orig.tv_usec = now.tv_usec;
|
||||
}
|
||||
if (f->datalen <= 0) {
|
||||
ast_log(LOG_WARNING, "Short frame ignored (%d bytes long?)\n", f->datalen);
|
||||
return 0;
|
||||
}
|
||||
if ((res = write(fs->fd, &delay, 4)) != 4) {
|
||||
ast_log(LOG_WARNING, "Unable to write delay: res=%d (%s)\n", res, strerror(errno));
|
||||
return -1;
|
||||
|
||||
@@ -28,14 +28,11 @@ extern "C" {
|
||||
#define AST_CHANNEL_NAME 80
|
||||
#define AST_CHANNEL_MAX_STACK 32
|
||||
|
||||
#define MAX_LANGUAGE 20
|
||||
|
||||
/* Max length an extension can be (unique) is this number */
|
||||
#define AST_MAX_EXTENSION 80
|
||||
|
||||
struct ast_channel {
|
||||
char name[AST_CHANNEL_NAME]; /* ASCII Description of channel name */
|
||||
char language[MAX_LANGUAGE]; /* Language requested */
|
||||
pthread_t blocker; /* If anyone is blocking, this is them */
|
||||
pthread_mutex_t lock; /* Lock, can be used to lock a channel for some operations */
|
||||
char *blockproc; /* Procedure causing blocking */
|
||||
@@ -135,9 +132,6 @@ struct ast_frame *ast_read(struct ast_channel *chan);
|
||||
/* Write a frame to a channel */
|
||||
int ast_write(struct ast_channel *chan, struct ast_frame *frame);
|
||||
|
||||
/* Write text to a display on a channel */
|
||||
int ast_sendtext(struct ast_channel *chan, char *text);
|
||||
|
||||
/* Browse the channels currently in use */
|
||||
struct ast_channel *ast_channel_walk(struct ast_channel *prev);
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ struct ast_channel_pvt {
|
||||
struct ast_frame * (*read)(struct ast_channel *chan);
|
||||
/* Write a frame, in standard format */
|
||||
int (*write)(struct ast_channel *chan, struct ast_frame *frame);
|
||||
/* Display or transmit text */
|
||||
int (*send_text)(struct ast_channel *chan, char *text);
|
||||
};
|
||||
|
||||
/* Create a channel structure */
|
||||
|
||||
@@ -43,14 +43,14 @@ int ast_format_register(char *name, char *exts, int format,
|
||||
|
||||
int ast_format_unregister(char *name);
|
||||
|
||||
/* Start streaming a file, in the preferred language if possible */
|
||||
int ast_streamfile(struct ast_channel *c, char *filename, char *preflang);
|
||||
/* Start streaming a file */
|
||||
int ast_streamfile(struct ast_channel *c, char *filename);
|
||||
|
||||
/* Stop playback of a stream */
|
||||
int ast_stopstream(struct ast_channel *c);
|
||||
|
||||
/* See if a given file exists in a given format. If fmt is NULL, any format is accepted.*/
|
||||
int ast_fileexists(char *filename, char *fmt, char *preflang);
|
||||
int ast_fileexists(char *filename, char *fmt);
|
||||
|
||||
/* Rename a given file in a given format, or if fmt is NULL, then do so for all */
|
||||
int ast_filerename(char *oldname, char *newname, char *fmt);
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU Lesser General Public License. Other components of
|
||||
* Asterisk are distributed under The GNU General Public License
|
||||
* only.
|
||||
* the GNU General Public License
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_FRAME_H
|
||||
@@ -57,8 +55,6 @@ struct ast_frame_chain {
|
||||
#define AST_FRAME_CONTROL 4 /* A control frame, subclass is AST_CONTROL_* */
|
||||
#define AST_FRAME_NULL 5 /* An empty, useless frame */
|
||||
#define AST_FRAME_IAX 6 /* Inter Aterisk Exchange private frame type */
|
||||
#define AST_FRAME_TEXT 7 /* Text messages */
|
||||
#define AST_FRAME_IMAGE 8 /* Image Frames */
|
||||
|
||||
/* Data formats for capabilities and frames alike */
|
||||
#define AST_FORMAT_G723_1 (1 << 0) /* G.723.1 compression */
|
||||
|
||||
@@ -24,7 +24,6 @@ extern int option_nofork;
|
||||
extern int option_quiet;
|
||||
extern int option_console;
|
||||
extern int fully_booted;
|
||||
extern char defaultlanguage[];
|
||||
|
||||
#define VERBOSE_PREFIX_1 " "
|
||||
#define VERBOSE_PREFIX_2 " == "
|
||||
|
||||
@@ -26,9 +26,6 @@ extern "C" {
|
||||
/* Max length of an application */
|
||||
#define AST_MAX_APP 32
|
||||
|
||||
/* Special return values from applications to the PBX */
|
||||
#define AST_PBX_KEEPALIVE 10 /* Destroy the thread, but don't hang up the channel */
|
||||
|
||||
struct ast_context;
|
||||
|
||||
/* Register a new context */
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ast_say_number(struct ast_channel *chan, int num, char *lang);
|
||||
int ast_say_digits(struct ast_channel *chan, int num, char *lang);
|
||||
int ast_say_digit_str(struct ast_channel *chan, char *num, char *lang);
|
||||
int ast_say_number(struct ast_channel *chan, int num);
|
||||
int ast_say_digits(struct ast_channel *chan, int num);
|
||||
int ast_say_digit_str(struct ast_channel *chan, char *num);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ struct ast_modem_pvt {
|
||||
char context[AST_MAX_EXTENSION];
|
||||
char cid[AST_MAX_EXTENSION]; /* Caller ID if available */
|
||||
char initstr[AST_MAX_INIT_STR]; /* Modem initialization String */
|
||||
char language[MAX_LANGUAGE]; /* default language */
|
||||
char response[256]; /* Static response buffer */
|
||||
struct ast_modem_driver *mc; /* Modem Capability */
|
||||
struct ast_modem_pvt *next; /* Next channel in list */
|
||||
|
||||
2
logger.c
2
logger.c
@@ -89,7 +89,7 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Unable to retrieve local time?\n");
|
||||
} else {
|
||||
fprintf(stdout, "%s[%ld]: File %s, Line %d (%s): ", levels[level], pthread_self(), file, line, function);
|
||||
fprintf(stdout, "%s: File %s, Line %d (%s): ", levels[level], file, line, function);
|
||||
vfprintf(stdout, fmt, ap);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
71
pbx.c
71
pbx.c
@@ -91,7 +91,6 @@ static int pbx_builtin_background(struct ast_channel *, void *);
|
||||
static int pbx_builtin_dtimeout(struct ast_channel *, void *);
|
||||
static int pbx_builtin_rtimeout(struct ast_channel *, void *);
|
||||
static int pbx_builtin_wait(struct ast_channel *, void *);
|
||||
static int pbx_builtin_setlanguage(struct ast_channel *, void *);
|
||||
|
||||
static struct pbx_builtin {
|
||||
char name[AST_MAX_APP];
|
||||
@@ -109,7 +108,6 @@ static struct pbx_builtin {
|
||||
{ "Wait", pbx_builtin_wait },
|
||||
{ "StripMSD", pbx_builtin_stripmsd },
|
||||
{ "Prefix", pbx_builtin_prefix },
|
||||
{ "SetLanguage", pbx_builtin_setlanguage },
|
||||
};
|
||||
|
||||
/* Lock for the application list */
|
||||
@@ -227,8 +225,7 @@ static int extension_close(char *pattern, char *data)
|
||||
if (strlen(pattern) < strlen(data))
|
||||
return 0;
|
||||
|
||||
|
||||
if (!strlen((char *)data) || !strncasecmp(pattern, data, strlen(data))) {
|
||||
if (!strncasecmp(pattern, data, strlen(data))) {
|
||||
return 1;
|
||||
}
|
||||
/* All patterns begin with _ */
|
||||
@@ -257,24 +254,10 @@ static int extension_close(char *pattern, char *data)
|
||||
return match;
|
||||
}
|
||||
|
||||
struct ast_context *ast_context_find(char *name)
|
||||
{
|
||||
struct ast_context *tmp;
|
||||
pthread_mutex_lock(&conlock);
|
||||
tmp = contexts;
|
||||
while(tmp) {
|
||||
if (!strcasecmp(name, tmp->name))
|
||||
break;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
pthread_mutex_unlock(&conlock);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static int pbx_extension_helper(struct ast_channel *c, char *context, char *exten, int priority, int action)
|
||||
{
|
||||
struct ast_context *tmp;
|
||||
struct ast_exten *e, *reale;
|
||||
struct ast_exten *e;
|
||||
struct ast_app *app;
|
||||
int newstack = 0;
|
||||
int res;
|
||||
@@ -297,7 +280,6 @@ static int pbx_extension_helper(struct ast_channel *c, char *context, char *exte
|
||||
while(e) {
|
||||
if (extension_match(e->exten, exten) ||
|
||||
((action == HELPER_CANMATCH) && extension_close(e->exten, exten))) {
|
||||
reale = e;
|
||||
while(e) {
|
||||
if (e->priority == priority) {
|
||||
/* We have a winner! Maybe there are some races
|
||||
@@ -346,10 +328,10 @@ static int pbx_extension_helper(struct ast_channel *c, char *context, char *exte
|
||||
ast_log(LOG_WARNING, "No such priority '%d' in '%s' in '%s'\n", priority, exten, context);
|
||||
pthread_mutex_unlock(&conlock);
|
||||
return -1;
|
||||
} else if (action != HELPER_CANMATCH) {
|
||||
} else {
|
||||
pthread_mutex_unlock(&conlock);
|
||||
return 0;
|
||||
} else e = reale; /* Keep going */
|
||||
}
|
||||
}
|
||||
e = e->next;
|
||||
}
|
||||
@@ -431,7 +413,6 @@ static void *pbx_thread(void *data)
|
||||
char exten[256];
|
||||
int pos;
|
||||
int waittime;
|
||||
int res=0;
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "PBX_THREAD(%s)\n", c->name);
|
||||
else if (option_verbose > 1)
|
||||
@@ -445,25 +426,16 @@ static void *pbx_thread(void *data)
|
||||
c->priority = 1;
|
||||
}
|
||||
for(;;) {
|
||||
memset(exten, 0, sizeof(exten));
|
||||
pos = 0;
|
||||
digit = 0;
|
||||
while(ast_exists_extension(c, c->context, c->exten, c->priority)) {
|
||||
memset(exten, 0, sizeof(exten));
|
||||
if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority))) {
|
||||
if (ast_spawn_extension(c, c->context, c->exten, c->priority)) {
|
||||
/* Something bad happened, or a hangup has been requested. */
|
||||
switch(res) {
|
||||
case AST_PBX_KEEPALIVE:
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited KEEPALIVE on '%s'\n", c->context, c->exten, c->priority, c->name);
|
||||
else if (option_verbose > 1)
|
||||
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited KEEPALIVE on '%s'\n", c->context, c->exten, c->priority, c->name);
|
||||
break;
|
||||
default:
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name);
|
||||
else if (option_verbose > 1)
|
||||
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name);
|
||||
}
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name);
|
||||
else if (option_verbose > 1)
|
||||
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", c->context, c->exten, c->priority, c->name);
|
||||
goto out;
|
||||
}
|
||||
/* If we're playing something in the background, wait for it to finish or for a digit */
|
||||
@@ -471,11 +443,8 @@ static void *pbx_thread(void *data)
|
||||
digit = ast_waitstream(c, AST_DIGIT_ANY);
|
||||
ast_stopstream(c);
|
||||
/* Hang up if something goes wrong */
|
||||
if (digit < 0) {
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Lost connection on %s\n", c->name);
|
||||
if (digit < 0)
|
||||
goto out;
|
||||
}
|
||||
else if (digit) {
|
||||
exten[pos++] = digit;
|
||||
break;
|
||||
@@ -490,7 +459,7 @@ static void *pbx_thread(void *data)
|
||||
else
|
||||
waittime = c->pbx->rtimeout;
|
||||
while(!ast_exists_extension(c, c->context, exten, 1) &&
|
||||
ast_canmatch_extension(c, c->context, exten, 1)) {
|
||||
ast_canmatch_extension(c, c->context, exten, 1)) {
|
||||
/* As long as we're willing to wait, and as long as it's not defined,
|
||||
keep reading digits until we can't possibly get a right answer anymore. */
|
||||
digit = ast_waitfordigit(c, waittime * 1000);
|
||||
@@ -539,8 +508,7 @@ static void *pbx_thread(void *data)
|
||||
out:
|
||||
pbx_destroy(c->pbx);
|
||||
c->pbx = NULL;
|
||||
if (res != AST_PBX_KEEPALIVE)
|
||||
ast_hangup(c);
|
||||
ast_hangup(c);
|
||||
pthread_exit(NULL);
|
||||
|
||||
}
|
||||
@@ -852,13 +820,6 @@ int pbx_builtin_answer(struct ast_channel *chan, void *data)
|
||||
return ast_answer(chan);
|
||||
}
|
||||
|
||||
int pbx_builtin_setlanguage(struct ast_channel *chan, void *data)
|
||||
{
|
||||
/* Copy the language as specified */
|
||||
strncpy(chan->language, (char *)data, sizeof(chan->language));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pbx_builtin_hangup(struct ast_channel *chan, void *data)
|
||||
{
|
||||
/* Just return non-zero and it will hang up */
|
||||
@@ -902,14 +863,10 @@ int pbx_builtin_wait(struct ast_channel *chan, void *data)
|
||||
int pbx_builtin_background(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res;
|
||||
/* Answer if need be */
|
||||
if (chan->state != AST_STATE_UP)
|
||||
if (ast_answer(chan))
|
||||
return -1;
|
||||
/* Stop anything playing */
|
||||
ast_stopstream(chan);
|
||||
/* Stream a file */
|
||||
res = ast_streamfile(chan, (char *)data, chan->language);
|
||||
res = ast_streamfile(chan, (char *)data);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ PBX_LIBS=pbx_config.so # pbx_gtkconsole.so pbx_kdeconsole.so
|
||||
# Add GTK console if appropriate
|
||||
PBX_LIBS+=$(shell gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
|
||||
# Add KDE Console if appropriate
|
||||
#PBX_LIBS+=$(shell [ "$$QTDIR" != "" ] && echo "pbx_kdeconsole.so")
|
||||
PBX_LIBS+=$(shell [ "$$QTDIR" != "" ] && echo "pbx_kdeconsole.so")
|
||||
|
||||
|
||||
GTK_FLAGS=`gtk-config --cflags gthread`
|
||||
|
||||
66
say.c
66
say.c
@@ -17,14 +17,14 @@
|
||||
#include <asterisk/say.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int ast_say_digit_str(struct ast_channel *chan, char *fn2, char *lang)
|
||||
int ast_say_digit_str(struct ast_channel *chan, char *fn2)
|
||||
{
|
||||
char fn[256] = "";
|
||||
int num = 0;
|
||||
int res = 0;
|
||||
while(fn2[num] && !res) {
|
||||
snprintf(fn, sizeof(fn), "digits/%c", fn2[num]);
|
||||
res = ast_streamfile(chan, fn, lang);
|
||||
res = ast_streamfile(chan, fn);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
@@ -33,51 +33,45 @@ int ast_say_digit_str(struct ast_channel *chan, char *fn2, char *lang)
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_say_digits(struct ast_channel *chan, int num, char *lang)
|
||||
int ast_say_digits(struct ast_channel *chan, int num)
|
||||
{
|
||||
char fn2[256];
|
||||
snprintf(fn2, sizeof(fn2), "%d", num);
|
||||
return ast_say_digit_str(chan, fn2, lang);
|
||||
return ast_say_digit_str(chan, fn2);
|
||||
}
|
||||
int ast_say_number(struct ast_channel *chan, int num, char *language)
|
||||
int ast_say_number(struct ast_channel *chan, int num)
|
||||
{
|
||||
int res = 0;
|
||||
int playh = 0;
|
||||
char fn[256] = "";
|
||||
if (0) {
|
||||
/* XXX Only works for english XXX */
|
||||
} else {
|
||||
/* Use english numbers */
|
||||
language = "en";
|
||||
while(num && !res) {
|
||||
if (playh) {
|
||||
snprintf(fn, sizeof(fn), "digits/hundred");
|
||||
playh = 0;
|
||||
} else
|
||||
if (num < 20) {
|
||||
snprintf(fn, sizeof(fn), "digits/%d", num);
|
||||
num = 0;
|
||||
} else
|
||||
if (num < 100) {
|
||||
snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
|
||||
num -= ((num / 10) * 10);
|
||||
while(num && !res) {
|
||||
if (playh) {
|
||||
snprintf(fn, sizeof(fn), "digits/hundred");
|
||||
playh = 0;
|
||||
} else
|
||||
if (num < 20) {
|
||||
snprintf(fn, sizeof(fn), "digits/%d", num);
|
||||
num = 0;
|
||||
} else
|
||||
if (num < 100) {
|
||||
snprintf(fn, sizeof(fn), "digits/%d", (num /10) * 10);
|
||||
num -= ((num / 10) * 10);
|
||||
} else {
|
||||
if (num < 1000){
|
||||
snprintf(fn, sizeof(fn), "digits/%d", (num/100));
|
||||
playh++;
|
||||
} else {
|
||||
if (num < 1000){
|
||||
snprintf(fn, sizeof(fn), "digits/%d", (num/100));
|
||||
playh++;
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
|
||||
res = -1;
|
||||
}
|
||||
ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
|
||||
res = -1;
|
||||
}
|
||||
if (!res) {
|
||||
res = ast_streamfile(chan, fn, language);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
|
||||
}
|
||||
if (!res) {
|
||||
res = ast_streamfile(chan, fn);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
}
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
11
translate.c
11
translate.c
@@ -304,8 +304,7 @@ struct ast_frame_chain *ast_translate(struct ast_trans_pvt *path, struct ast_fra
|
||||
|
||||
#define FUDGE 0
|
||||
|
||||
static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *path, struct ast_frame *f, int fd, struct ast_channel *c,
|
||||
struct timeval *last)
|
||||
static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *path, struct ast_frame *f, int fd, struct ast_channel *c, struct timeval *last)
|
||||
{
|
||||
struct ast_trans_pvt *p;
|
||||
struct ast_frame *out;
|
||||
@@ -329,7 +328,7 @@ static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *p
|
||||
#ifdef EXPERIMENTAL_TRANSLATION
|
||||
if (ms + FUDGE < out->timelen)
|
||||
schedule_delivery(pvt->sched, pvt,
|
||||
c, fd, out, out->timelen - ms);
|
||||
c, fd, out, ms);
|
||||
else {
|
||||
if (c)
|
||||
ast_write(c, out);
|
||||
@@ -341,17 +340,13 @@ static void translator_apply(struct translator_pvt *pvt, struct ast_trans_pvt *p
|
||||
/* Schedule this packet to be delivered at the
|
||||
right time */
|
||||
} else
|
||||
gettimeofday(last, NULL);
|
||||
#else
|
||||
#if 0
|
||||
/* XXX Not correct in the full duplex case XXX */
|
||||
if (ms + FUDGE < out->timelen)
|
||||
usleep((out->timelen - ms - FUDGE) * 1000);
|
||||
#endif
|
||||
last->tv_sec = tv.tv_sec;
|
||||
last->tv_usec = tv.tv_usec;
|
||||
} else
|
||||
gettimeofday(last, NULL);
|
||||
}
|
||||
#endif
|
||||
if (c)
|
||||
ast_write(c, out);
|
||||
|
||||
Reference in New Issue
Block a user