mirror of
https://github.com/asterisk/asterisk.git
synced 2026-03-19 03:54:04 +00:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
836e861dde | ||
|
|
04ec7f1429 | ||
|
|
35e505b579 | ||
|
|
e69da9d0ab | ||
|
|
426381275d | ||
|
|
5e0525cc65 | ||
|
|
c44f9f168a | ||
|
|
ec6fdc8c2b | ||
|
|
101435bd3d | ||
|
|
255ccb33d5 | ||
|
|
6ada28a442 | ||
|
|
0c3b134da5 | ||
|
|
aa6a80f31d | ||
|
|
5800db6556 | ||
|
|
9440db13f4 | ||
|
|
c8640d5486 | ||
|
|
22e0c573b6 | ||
|
|
9fafdf3ccc | ||
|
|
cec9e6563d | ||
|
|
cb625a6d3c | ||
|
|
2ebdf66e5f | ||
|
|
c340c2093c | ||
|
|
7b826e7687 | ||
|
|
1cc89abf56 | ||
|
|
f629f87836 | ||
|
|
e001c19bec | ||
|
|
f60ff8db65 | ||
|
|
33dbe25ff9 | ||
|
|
e077f63d6a | ||
|
|
b0d73ea947 | ||
|
|
7a355cb6e5 | ||
|
|
7e68a64751 | ||
|
|
0482ce4dcb | ||
|
|
1b0c5f3ac4 | ||
|
|
3b82506dd3 | ||
|
|
98511b9093 | ||
|
|
3fe1fe6462 | ||
|
|
17337b33ba | ||
|
|
ab7d243daf | ||
|
|
e58a5412db | ||
|
|
2693f2539a | ||
|
|
0ac7cc0094 |
9
CHANGES
9
CHANGES
@@ -1,3 +1,12 @@
|
||||
* 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.
|
||||
|
||||
4
Makefile
4
Makefile
@@ -25,6 +25,7 @@ DEBUG=-g #-pg
|
||||
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)
|
||||
CFLAGS+=$(shell [ ! -f /usr/include/linux/if_wanpipe.h ] && echo " -DOLD_SANGOMA_API")
|
||||
SUBDIRS=channels pbx apps codecs formats
|
||||
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
|
||||
@@ -70,6 +71,7 @@ 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. +"
|
||||
@@ -92,7 +94,7 @@ samples: all datafiles
|
||||
for x in sounds/demo-*; do \
|
||||
install $$x /var/lib/asterisk/sounds; \
|
||||
done
|
||||
mkdir -p /var/lib/asterisk/sounds/vm/1234
|
||||
mkdir -p /var/spool/asterisk/vm/1234/INBOX
|
||||
:> /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,6 +18,7 @@
|
||||
#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>
|
||||
@@ -25,14 +26,31 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
static char *tdesc = "Trivial Dialing Application";
|
||||
static char *tdesc = "Dialing/Parking 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. */
|
||||
@@ -44,8 +62,164 @@ 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 */
|
||||
@@ -222,15 +396,19 @@ 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)) {
|
||||
if ((f->frametype == AST_FRAME_DTMF) && (who == peer) && allowredirect) {
|
||||
(f->frametype == AST_FRAME_DTMF) ||
|
||||
(f->frametype == AST_FRAME_TEXT)) {
|
||||
if ((f->frametype == AST_FRAME_DTMF) && (who == peer) && allowredirect &&
|
||||
(f->subclass == '#')) {
|
||||
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")))
|
||||
if ((res=ast_streamfile(peer, "pbx-transfer", chan->language)))
|
||||
break;
|
||||
if ((res=ast_waitstream(peer, AST_DIGIT_ANY)) < 0)
|
||||
break;
|
||||
@@ -244,15 +422,35 @@ 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 (ast_exists_extension(chan, chan->context, newext, 1)) {
|
||||
/* Set the channel's new extension, since it exists */
|
||||
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 */
|
||||
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");
|
||||
res = ast_streamfile(peer, "pbx-invalid", chan->language);
|
||||
if (res)
|
||||
break;
|
||||
res = ast_waitstream(peer, AST_DIGIT_ANY);
|
||||
@@ -280,6 +478,63 @@ 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;
|
||||
@@ -414,7 +669,24 @@ int unload_module(void)
|
||||
|
||||
int load_module(void)
|
||||
{
|
||||
return ast_register_application(app, dial_exec);
|
||||
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;
|
||||
}
|
||||
|
||||
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)) {
|
||||
res = ast_streamfile(chan, fn);
|
||||
if (ast_fileexists(fn, NULL, chan->language)) {
|
||||
res = ast_streamfile(chan, fn, chan->language);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
} else {
|
||||
res = ast_say_digit_str(chan, v->name);
|
||||
res = ast_say_digit_str(chan, v->name, chan->language);
|
||||
}
|
||||
ahem:
|
||||
if (!res)
|
||||
res = ast_streamfile(chan, "dir-instr");
|
||||
res = ast_streamfile(chan, "dir-instr", chan->language);
|
||||
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");
|
||||
res = ast_streamfile(chan, "dir-nomore", chan->language);
|
||||
else
|
||||
res = ast_streamfile(chan, "dir-nomatch");
|
||||
res = ast_streamfile(chan, "dir-nomatch", chan->language);
|
||||
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");
|
||||
res = ast_streamfile(chan, "dir-intro", chan->language);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
|
||||
@@ -31,18 +31,22 @@ LOCAL_USER_DECL;
|
||||
|
||||
static int playback_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res;
|
||||
int res = 0;
|
||||
struct localuser *u;
|
||||
if (!data) {
|
||||
ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
|
||||
return -1;
|
||||
}
|
||||
LOCAL_USER_ADD(u);
|
||||
ast_stopstream(chan);
|
||||
res = ast_streamfile(chan, (char *)data);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, "");
|
||||
ast_stopstream(chan);
|
||||
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, "");
|
||||
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");
|
||||
res = ast_streamfile(chan, "vm-message", chan->language);
|
||||
if (!res) {
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
if (!res) {
|
||||
res = ast_say_number(chan, msgcnt+1);
|
||||
res = ast_say_number(chan, msgcnt+1, chan->language);
|
||||
if (!res) {
|
||||
fn = get_fn(dir, msgcnt);
|
||||
if (fn) {
|
||||
res = ast_streamfile(chan, fn);
|
||||
res = ast_streamfile(chan, fn, chan->language);
|
||||
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)) {
|
||||
if (silent || !ast_streamfile(chan, INTRO, chan->language)) {
|
||||
/* 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) > 0) {
|
||||
if (ast_fileexists(fn, NULL, chan->language) > 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");
|
||||
ast_streamfile(chan, "vm-msgsaved", chan->language);
|
||||
ast_waitstream(chan, "");
|
||||
}
|
||||
/* Send e-mail if applicable */
|
||||
@@ -323,7 +323,7 @@ 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")) {
|
||||
if (ast_streamfile(chan, "vm-login", chan->language)) {
|
||||
ast_log(LOG_WARNING, "Couldn't stream login file\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
res = 0;
|
||||
goto out;
|
||||
}
|
||||
if (ast_streamfile(chan, "vm-password")) {
|
||||
if (ast_streamfile(chan, "vm-password", chan->language)) {
|
||||
ast_log(LOG_WARNING, "Unable to stream password file\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"))
|
||||
if (ast_streamfile(chan, "vm-incorrect", chan->language))
|
||||
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))>0) {
|
||||
if ((res = ast_fileexists(fn, NULL, chan->language))>0) {
|
||||
maxmsg++;
|
||||
deleted[maxmsg] = 0;
|
||||
}
|
||||
free(fn);
|
||||
} while(res > 0);
|
||||
if (ast_streamfile(chan, "vm-youhave"))
|
||||
if (ast_streamfile(chan, "vm-youhave", chan->language))
|
||||
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)) < 0)
|
||||
if ((d = ast_say_number(chan, maxmsg, chan->language)) < 0)
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-no"))
|
||||
if (ast_streamfile(chan, "vm-no", chan->language))
|
||||
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")))
|
||||
if (ast_streamfile(chan, ((maxmsg == 1) ? "vm-message" : "vm-messages"), chan->language))
|
||||
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")) {
|
||||
if (!ast_streamfile(chan, "vm-instructions", chan->language)) {
|
||||
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")))
|
||||
if (!(d = ast_streamfile(chan, "vm-msginstruct", chan->language)))
|
||||
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"))
|
||||
if (ast_streamfile(chan, "vm-instructions", chan->language))
|
||||
goto out;
|
||||
break;
|
||||
case STATE_MESSAGE:
|
||||
case STATE_MESSAGE_PLAYING:
|
||||
if (ast_streamfile(chan, "vm-msginstruct"))
|
||||
if (ast_streamfile(chan, "vm-msginstruct", chan->language))
|
||||
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"))
|
||||
if (ast_streamfile(chan, "vm-deleted", chan->language))
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-undeleted"))
|
||||
if (ast_streamfile(chan, "vm-undeleted", chan->language))
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-nomore"))
|
||||
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
@@ -480,7 +480,7 @@ restart:
|
||||
else if (d < 0)
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-nomore"))
|
||||
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||
goto out;
|
||||
}
|
||||
state = STATE_MESSAGE_PLAYING;
|
||||
@@ -510,7 +510,7 @@ restart:
|
||||
else if (d < 0)
|
||||
goto out;
|
||||
} else {
|
||||
if (ast_streamfile(chan, "vm-nomore"))
|
||||
if (ast_streamfile(chan, "vm-nomore", chan->language))
|
||||
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"))
|
||||
if (ast_streamfile(chan, "vm-goodbye", chan->language))
|
||||
goto out;
|
||||
if (ast_waitstream(chan, ""))
|
||||
goto out;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#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>
|
||||
@@ -32,6 +33,8 @@ 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
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#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,6 +126,7 @@ 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;
|
||||
@@ -387,6 +388,16 @@ 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,6 +16,8 @@ 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+=#-DVOFRDUMPER
|
||||
|
||||
all: $(CHANNEL_LIBS)
|
||||
|
||||
@@ -125,6 +125,7 @@ struct iax_peer {
|
||||
char username[80];
|
||||
char secret[80];
|
||||
struct sockaddr_in addr;
|
||||
int formats;
|
||||
struct in_addr mask;
|
||||
struct iax_peer *next;
|
||||
};
|
||||
@@ -668,8 +669,8 @@ static int attempt_transmit(void *data)
|
||||
/* Attempt transmission */
|
||||
send_packet(f);
|
||||
f->retries++;
|
||||
/* Try again later after 2 times as long */
|
||||
f->retrytime *= 2;
|
||||
/* Try again later after 10 times as long */
|
||||
f->retrytime *= 10;
|
||||
if (f->retrytime > MAX_RETRY_TIME)
|
||||
f->retrytime = MAX_RETRY_TIME;
|
||||
ast_sched_add(sched, f->retrytime, attempt_transmit, f);
|
||||
@@ -854,6 +855,13 @@ 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;
|
||||
@@ -1023,6 +1031,7 @@ 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;
|
||||
|
||||
@@ -49,6 +49,9 @@ 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";
|
||||
|
||||
@@ -271,8 +274,13 @@ 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;
|
||||
@@ -433,6 +441,8 @@ 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++;
|
||||
@@ -596,6 +606,7 @@ 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);
|
||||
@@ -732,6 +743,8 @@ 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,6 +57,7 @@ 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;
|
||||
|
||||
@@ -66,6 +67,7 @@ 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 */
|
||||
@@ -341,6 +343,12 @@ 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);
|
||||
@@ -477,6 +485,14 @@ 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];
|
||||
@@ -535,14 +551,18 @@ 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);
|
||||
@@ -563,6 +583,7 @@ 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);
|
||||
@@ -572,7 +593,11 @@ 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;
|
||||
}
|
||||
return oss_new(&oss, AST_STATE_DOWN);
|
||||
tmp= oss_new(&oss, AST_STATE_DOWN);
|
||||
if (!tmp) {
|
||||
ast_log(LOG_WARNING, "Unable to create new OSS channel\n");
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static int console_autoanswer(int fd, int argc, char *argv[])
|
||||
@@ -629,6 +654,30 @@ 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";
|
||||
@@ -694,6 +743,7 @@ 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 }
|
||||
};
|
||||
|
||||
@@ -744,6 +794,8 @@ 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;
|
||||
|
||||
@@ -44,6 +44,8 @@ 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;
|
||||
@@ -91,6 +93,7 @@ static struct phone_pvt {
|
||||
char context[AST_MAX_EXTENSION];
|
||||
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)
|
||||
@@ -428,6 +431,8 @@ 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;
|
||||
@@ -494,6 +499,8 @@ 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++;
|
||||
@@ -790,12 +797,13 @@ static struct phone_pvt *mkif(char *iface, int mode)
|
||||
ioctl(tmp->fd, PHONE_REC_STOP);
|
||||
ioctl(tmp->fd, PHONE_RING_STOP);
|
||||
ioctl(tmp->fd, PHONE_CPT_STOP);
|
||||
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);
|
||||
@@ -806,6 +814,7 @@ 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;
|
||||
@@ -884,6 +893,8 @@ 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;
|
||||
|
||||
@@ -28,9 +28,15 @@
|
||||
#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
|
||||
@@ -42,6 +48,8 @@ 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;
|
||||
|
||||
@@ -63,7 +71,11 @@ 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 */
|
||||
@@ -75,6 +87,8 @@ 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
|
||||
@@ -241,7 +255,11 @@ 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);
|
||||
}
|
||||
@@ -434,6 +452,7 @@ 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)
|
||||
@@ -465,6 +484,9 @@ 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);
|
||||
@@ -531,6 +553,9 @@ static struct ast_frame *vofr_read(struct ast_channel *ast)
|
||||
CHECK_BLOCKING(ast);
|
||||
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);
|
||||
#ifdef VOFRDUMPER
|
||||
vofr_dump_packet((void *)(vh), res);
|
||||
#endif
|
||||
ast->blocking = 0;
|
||||
res -= FR_API_MESS;
|
||||
if (res < sizeof(struct vofr_hdr *)) {
|
||||
@@ -552,15 +577,17 @@ static struct ast_frame *vofr_read(struct ast_channel *ast)
|
||||
switch(vh->data[0]) {
|
||||
case VOFR_SIGNAL_ON_HOOK:
|
||||
/* Hang up this line */
|
||||
if (ast->state == AST_STATE_UP)
|
||||
if ((ast->state == AST_STATE_UP) || (p->ringgothangup)) {
|
||||
return NULL;
|
||||
else {
|
||||
} else {
|
||||
fr->frametype = AST_FRAME_NULL;
|
||||
fr->subclass = 0;
|
||||
break;
|
||||
p->ringgothangup=1;
|
||||
}
|
||||
break;
|
||||
case VOFR_SIGNAL_RING:
|
||||
ast->rings++;
|
||||
p->ringgothangup = 0;
|
||||
break;
|
||||
case VOFR_SIGNAL_UNKNOWN:
|
||||
switch(vh->data[1]) {
|
||||
@@ -745,7 +772,11 @@ 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 */
|
||||
@@ -760,6 +791,8 @@ 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++;
|
||||
@@ -788,9 +821,10 @@ 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)
|
||||
if (!i->owner) {
|
||||
i->ringgothangup = 0;
|
||||
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:
|
||||
@@ -867,7 +901,11 @@ 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);
|
||||
@@ -901,7 +939,11 @@ 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));
|
||||
@@ -964,22 +1006,44 @@ static struct vofr_pvt *mkif(char *type, char *iface)
|
||||
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;
|
||||
|
||||
/* Bind socket to specific interface */
|
||||
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
|
||||
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;
|
||||
@@ -997,6 +1061,8 @@ 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"))
|
||||
@@ -1078,6 +1144,8 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/******************************************************************************
|
||||
$Id$
|
||||
$Log$
|
||||
Revision 1.3 1999/12/01 05:25:58 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.4 1999/12/01 05:25:58 markster
|
||||
Version 0.1.3 from FTP
|
||||
|
||||
Revision 1.1 1999/12/01 05:25:58 markster
|
||||
Start on the Internet Phone Jack channel
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
$Log$
|
||||
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
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 00:20:06 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 00:20:06 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:39 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:39 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:40 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:40 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
Version 0.1.2 from FTP
|
||||
Revision 1.2 2000/01/05 08:20:40 markster
|
||||
Version 0.1.3 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.1 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.2 from FTP
|
||||
* Revision 1.2 2000/01/05 08:20:40 markster
|
||||
* Version 0.1.3 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,9 +2,13 @@
|
||||
; 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,6 +44,9 @@ 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.
|
||||
@@ -53,7 +56,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/4200/busy ; (2 + 101) "I'm on the phone"
|
||||
exten=1234,103,Playback,vm/1234/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,6 +13,10 @@ 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,6 +16,10 @@ 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.
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
; immediately provides the PBX without reading any digits or providing
|
||||
; any dialtone (this is the immediate mode, the default)
|
||||
;
|
||||
;mode=immediate
|
||||
mode=dialtone
|
||||
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.
|
||||
@@ -32,4 +32,4 @@ echocancel=medium
|
||||
; List all devices we can use. Contexts may also be specified
|
||||
;
|
||||
;context=local
|
||||
;device=/dev/ixj0
|
||||
;device=/dev/phone0
|
||||
|
||||
49
file.c
49
file.c
@@ -324,9 +324,27 @@ static int ast_filehelper(char *filename, char *filename2, char *fmt, int action
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_fileexists(char *filename, char *fmt)
|
||||
int ast_fileexists(char *filename, char *fmt, char *preflang)
|
||||
{
|
||||
return ast_filehelper(filename, NULL, fmt, ACTION_EXISTS);
|
||||
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;
|
||||
}
|
||||
|
||||
int ast_filedelete(char *filename, char *fmt)
|
||||
@@ -339,7 +357,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)
|
||||
int ast_streamfile(struct ast_channel *chan, char *filename, char *preflang)
|
||||
{
|
||||
/* This is a fairly complex routine. Essentially we should do
|
||||
the following:
|
||||
@@ -355,9 +373,23 @@ int ast_streamfile(struct ast_channel *chan, char *filename)
|
||||
*/
|
||||
int fd = -1;
|
||||
struct ast_channel *trans;
|
||||
int fmts;
|
||||
int fmts = -1;
|
||||
char filename2[256];
|
||||
char lang2[MAX_LANGUAGE];
|
||||
ast_stopstream(chan);
|
||||
fmts = ast_fileexists(filename, NULL);
|
||||
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);
|
||||
}
|
||||
if (fmts < 1) {
|
||||
ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
|
||||
return -1;
|
||||
@@ -379,10 +411,11 @@ int ast_streamfile(struct ast_channel *chan, char *filename)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fd = ast_filehelper(filename, (char *)trans, NULL, ACTION_OPEN);
|
||||
fd = ast_filehelper(filename2, (char *)trans, NULL, ACTION_OPEN);
|
||||
if (fd >= 0) {
|
||||
#if 0
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Playing '%s'\n", filename);
|
||||
#if 1
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Playing '%s'\n", filename2);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ 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();
|
||||
@@ -189,8 +191,8 @@ static int ast_read_callback(void *data)
|
||||
delay = ntohl(delay);
|
||||
else
|
||||
delay = -1;
|
||||
/* Average out frames <= 40 ms */
|
||||
if (delay < 41)
|
||||
/* Average out frames <= 50 ms */
|
||||
if (delay < 50)
|
||||
s->fr->timelen = 30;
|
||||
else
|
||||
s->fr->timelen = delay;
|
||||
@@ -227,8 +229,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) {
|
||||
ast_log(LOG_WARNING, "Bad stream?\n");
|
||||
return -1;
|
||||
/* Empty file */
|
||||
return 0;
|
||||
}
|
||||
ast_read_callback(s);
|
||||
return 0;
|
||||
|
||||
@@ -28,11 +28,14 @@ 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 */
|
||||
@@ -132,6 +135,9 @@ 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,6 +37,8 @@ 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 */
|
||||
int ast_streamfile(struct ast_channel *c, char *filename);
|
||||
/* Start streaming a file, in the preferred language if possible */
|
||||
int ast_streamfile(struct ast_channel *c, char *filename, char *preflang);
|
||||
|
||||
/* 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);
|
||||
int ast_fileexists(char *filename, char *fmt, char *preflang);
|
||||
|
||||
/* 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);
|
||||
|
||||
@@ -55,6 +55,7 @@ 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 */
|
||||
|
||||
/* Data formats for capabilities and frames alike */
|
||||
#define AST_FORMAT_G723_1 (1 << 0) /* G.723.1 compression */
|
||||
|
||||
@@ -24,6 +24,7 @@ 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,6 +26,9 @@ 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);
|
||||
int ast_say_digits(struct ast_channel *chan, int num);
|
||||
int ast_say_digit_str(struct ast_channel *chan, char *num);
|
||||
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);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ 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 */
|
||||
|
||||
64
pbx.c
64
pbx.c
@@ -91,6 +91,7 @@ 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];
|
||||
@@ -108,6 +109,7 @@ 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 */
|
||||
@@ -225,7 +227,8 @@ static int extension_close(char *pattern, char *data)
|
||||
if (strlen(pattern) < strlen(data))
|
||||
return 0;
|
||||
|
||||
if (!strncasecmp(pattern, data, strlen(data))) {
|
||||
|
||||
if (!strlen((char *)data) || !strncasecmp(pattern, data, strlen(data))) {
|
||||
return 1;
|
||||
}
|
||||
/* All patterns begin with _ */
|
||||
@@ -254,10 +257,24 @@ 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;
|
||||
struct ast_exten *e, *reale;
|
||||
struct ast_app *app;
|
||||
int newstack = 0;
|
||||
int res;
|
||||
@@ -280,6 +297,7 @@ 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
|
||||
@@ -328,10 +346,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 {
|
||||
} else if (action != HELPER_CANMATCH) {
|
||||
pthread_mutex_unlock(&conlock);
|
||||
return 0;
|
||||
}
|
||||
} else e = reale; /* Keep going */
|
||||
}
|
||||
e = e->next;
|
||||
}
|
||||
@@ -413,6 +431,7 @@ 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)
|
||||
@@ -426,16 +445,25 @@ 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)) {
|
||||
if (ast_spawn_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))) {
|
||||
/* Something bad happened, or a hangup has been requested. */
|
||||
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);
|
||||
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);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
/* If we're playing something in the background, wait for it to finish or for a digit */
|
||||
@@ -508,7 +536,8 @@ static void *pbx_thread(void *data)
|
||||
out:
|
||||
pbx_destroy(c->pbx);
|
||||
c->pbx = NULL;
|
||||
ast_hangup(c);
|
||||
if (res != AST_PBX_KEEPALIVE)
|
||||
ast_hangup(c);
|
||||
pthread_exit(NULL);
|
||||
|
||||
}
|
||||
@@ -820,6 +849,13 @@ 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 */
|
||||
@@ -863,10 +899,14 @@ 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);
|
||||
res = ast_streamfile(chan, (char *)data, chan->language);
|
||||
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)
|
||||
int ast_say_digit_str(struct ast_channel *chan, char *fn2, char *lang)
|
||||
{
|
||||
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);
|
||||
res = ast_streamfile(chan, fn, lang);
|
||||
if (!res)
|
||||
res = ast_waitstream(chan, AST_DIGIT_ANY);
|
||||
ast_stopstream(chan);
|
||||
@@ -33,45 +33,51 @@ int ast_say_digit_str(struct ast_channel *chan, char *fn2)
|
||||
return res;
|
||||
}
|
||||
|
||||
int ast_say_digits(struct ast_channel *chan, int num)
|
||||
int ast_say_digits(struct ast_channel *chan, int num, char *lang)
|
||||
{
|
||||
char fn2[256];
|
||||
snprintf(fn2, sizeof(fn2), "%d", num);
|
||||
return ast_say_digit_str(chan, fn2);
|
||||
return ast_say_digit_str(chan, fn2, lang);
|
||||
}
|
||||
int ast_say_number(struct ast_channel *chan, int num)
|
||||
int ast_say_number(struct ast_channel *chan, int num, char *language)
|
||||
{
|
||||
int res = 0;
|
||||
int playh = 0;
|
||||
char fn[256] = "";
|
||||
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++;
|
||||
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);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Number '%d' is too big for me\n", num);
|
||||
res = -1;
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user