dom mar 16 23:37:23 CET 2003

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@647 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Matteo Brancaleoni 22 years ago
parent 7640e83360
commit 61e446f04b

@ -22,14 +22,14 @@ Wasim - Hangup detect
PhoneJack and Linejack card to the project. (http://www.quicknet.net)
=== MISCELLANEOUS PATCHES ===
James Golovch - Innumerable contributions
You can find him and asterisk-perl at http://asterisk.gnuinter.net
Oliver Daudey - ISDN4Linux fixes
Pauline Middelink - ISDN4Linux patches and some general patches.
She can be found at http://www.polyware.nl/~middelink/En/
Jean-Denis Girard - Various contributions from the South Pacific Islands
jd-girard@esoft.pf http://www.esoft.pf
Jac Kersing - Various fixes
James Golovch - Various contributions
You can find him and asterisk-perl at http://asterisk.gnuinter.net
Steven Critchfield - Seek and Trunc functions for playback and recording
critch@basesys.com
Jefferson Noxon - app_lookupcidname, app_db, and various other contributions

@ -96,11 +96,13 @@ deltree_exec (struct ast_channel *chan, void *data)
}
if (option_verbose > 2)
{
if (keytree)
ast_verbose (VERBOSE_PREFIX_3 "DBdeltree: family=%s, keytree=%s\n",
family, keytree);
else
ast_verbose (VERBOSE_PREFIX_3 "DBdeltree: family=%s\n", family);
}
if (ast_db_deltree (family, keytree))
{

@ -71,7 +71,7 @@ static int write_audio(short *data, int len)
return res;
}
static int create_audio()
static int create_audio(void)
{
int fmt, desired, res, fd;
fd = open(DEV_DSP, O_WRONLY);

@ -21,6 +21,7 @@
#include <asterisk/translate.h>
#include <asterisk/image.h>
#include <asterisk/callerid.h>
#include <asterisk/astdb.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>

@ -21,6 +21,7 @@
#include <asterisk/translate.h>
#include <asterisk/image.h>
#include <asterisk/callerid.h>
#include <asterisk/astdb.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>

@ -23,6 +23,7 @@
#include <asterisk/parking.h>
#include <asterisk/options.h>
#include <asterisk/logger.h>
#include <asterisk/say.h>
#include <stdlib.h>
#include <unistd.h>

@ -21,6 +21,7 @@
#include <asterisk/translate.h>
#include <asterisk/image.h>
#include <asterisk/callerid.h>
#include <asterisk/app.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>

@ -94,12 +94,12 @@ char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH];
static int fdprint(int fd, char *s)
static int fdprint(int fd, const char *s)
{
return write(fd, s, strlen(s) + 1);
}
static void network_verboser(char *s, int pos, int replace, int complete)
static void network_verboser(const char *s, int pos, int replace, int complete)
{
int x;
for (x=0;x<AST_MAX_CONNECTS; x++) {
@ -437,7 +437,7 @@ static int fix_header(char *outbuf, int maxout, char **s, char *cmp)
return 0;
}
static void console_verboser(char *s, int pos, int replace, int complete)
static void console_verboser(const char *s, int pos, int replace, int complete)
{
char tmp[80];
/* Return to the beginning of the line */
@ -544,6 +544,7 @@ static char restart_when_convenient_help[] =
"Usage: restart when convenient\n"
" Causes Asterisk to perform a cold restart when all active calls have ended.\n";
#if 0
static int handle_quit(int fd, int argc, char *argv[])
{
if (argc != 1)
@ -551,6 +552,7 @@ static int handle_quit(int fd, int argc, char *argv[])
quit_handler(0, 0, 1, 0);
return RESULT_SUCCESS;
}
#endif
static int no_more_quit(int fd, int argc, char *argv[])
{
@ -1028,7 +1030,7 @@ static int show_cli_help(void) {
return 0;
}
static void ast_readconfig() {
static void ast_readconfig(void) {
struct ast_config *cfg;
struct ast_variable *v;
char *config = ASTCONFPATH;

@ -1080,7 +1080,7 @@ int ast_indicate(struct ast_channel *chan, int condition)
}
if (ts && ts->data[0]) {
ast_log(LOG_DEBUG, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition);
ast_playtones_start(chan,0,ts->data);
ast_playtones_start(chan,0,ts->data, 1);
}
else {
/* not handled */
@ -1164,13 +1164,13 @@ static int do_senddigit(struct ast_channel *chan, char digit)
"!941+1209/50,!0/50", /* * */
"!941+1477/50,!0/50" }; /* # */
if (digit >= '0' && digit <='9')
ast_playtones_start(chan,0,dtmf_tones[digit-'0']);
ast_playtones_start(chan,0,dtmf_tones[digit-'0'], 0);
else if (digit >= 'A' && digit <= 'D')
ast_playtones_start(chan,0,dtmf_tones[digit-'A'+10]);
ast_playtones_start(chan,0,dtmf_tones[digit-'A'+10], 0);
else if (digit == '*')
ast_playtones_start(chan,0,dtmf_tones[14]);
ast_playtones_start(chan,0,dtmf_tones[14], 0);
else if (digit == '#')
ast_playtones_start(chan,0,dtmf_tones[15]);
ast_playtones_start(chan,0,dtmf_tones[15], 0);
else {
/* not handled */
ast_log(LOG_WARNING, "Unable to handle DTMF tone '%c' for '%s'\n", digit, chan->name);
@ -1942,12 +1942,10 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags
tackygoto:
/* Don't copy packets if there is a generator on either one, since they're
not supposed to be listening anyway */
if (!c0->generator && !c1->generator) {
if (who == c0)
ast_write(c1, f);
else
ast_write(c0, f);
}
if (who == c0)
ast_write(c1, f);
else
ast_write(c0, f);
}
ast_frfree(f);
} else

@ -73,6 +73,9 @@ ringtone.h: gentone
chan_oss.o: chan_oss.c busy.h ringtone.h
chan_iax2.so: chan_iax2.o iax2-parser.o
$(CC) -shared -Xlinker -x -o $@ chan_iax2.o iax2-parser.o
chan_zap.o: $(CHANZAP)
$(CC) -c $(CFLAGS) -o chan_zap.o $(CHANZAP)

@ -122,7 +122,7 @@ static struct chan_alsa_pvt {
} alsa;
static int time_has_passed()
static int time_has_passed(void)
{
struct timeval tv;
int ms;
@ -453,7 +453,7 @@ static snd_pcm_t *alsa_card_init(char *dev, snd_pcm_stream_t stream)
return handle;
}
static int soundcard_init()
static int soundcard_init(void)
{
alsa.icard = alsa_card_init(indevname, SND_PCM_STREAM_CAPTURE);
alsa.ocard = alsa_card_init(outdevname, SND_PCM_STREAM_PLAYBACK);

File diff suppressed because it is too large Load Diff

@ -1896,8 +1896,8 @@ int load_module()
int unload_module()
{
struct mgcp_endpoint *p, *pl;
#if 0
struct mgcp_endpoint *p, *pl;
/* First, take us out of the channel loop */
ast_channel_unregister(type);
if (!ast_pthread_mutex_lock(&gatelock)) {

@ -361,7 +361,7 @@ static char *aopen_identify(struct ast_modem_pvt *p)
return strdup(identity);
}
static void aopen_incusecnt()
static void aopen_incusecnt(void)
{
ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
@ -369,7 +369,7 @@ static void aopen_incusecnt()
ast_update_use_count();
}
static void aopen_decusecnt()
static void aopen_decusecnt(void)
{
ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;

@ -436,7 +436,7 @@ static char *bestdata_identify(struct ast_modem_pvt *p)
return strdup(identity);
}
static void bestdata_incusecnt()
static void bestdata_incusecnt(void)
{
ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;
@ -444,7 +444,7 @@ static void bestdata_incusecnt()
ast_update_use_count();
}
static void bestdata_decusecnt()
static void bestdata_decusecnt(void)
{
ast_pthread_mutex_lock(&usecnt_lock);
usecnt++;

@ -299,6 +299,7 @@ static int phone_answer(struct ast_channel *ast)
return 0;
}
#if 0
static char phone_2digit(char c)
{
if (c == 12)
@ -310,6 +311,7 @@ static char phone_2digit(char c)
else
return '?';
}
#endif
static struct ast_frame *phone_exception(struct ast_channel *ast)
{

@ -1654,7 +1654,8 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, char *msg, stru
copy_via_headers(p, resp, req, "Via");
copy_header(resp, req, "From");
ot = get_header(req, "To");
copy_header(resp, req, "Record-Route");
if (strlen(get_header(req, "Record-Route")))
copy_header(resp, req, "Record-Route");
if (!strstr(ot, "tag=")) {
/* Add the proper tag if we don't have it already. If they have specified
their tag, use it. Otherwise, use our own tag */

@ -0,0 +1,344 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Implementation of Inter-Asterisk eXchange
*
* Copyright (C) 2003, Digium
*
* Mark Spencer <markster@linux-support.net>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
*/
#include <sys/socket.h>
#include <string.h>
#include <netinet/in.h>
#include <asterisk/frame.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "iax2.h"
#include "iax2-parser.h"
static void internaloutput(const char *str)
{
printf(str);
}
static void internalerror(const char *str)
{
fprintf(stderr, "WARNING: %s", str);
}
static void (*outputf)(const char *str) = internaloutput;
static void (*errorf)(const char *str) = internalerror;
static void dump_addr(char *output, int maxlen, void *value, int len)
{
struct sockaddr_in sin;
if (len == sizeof(sin)) {
memcpy(&sin, value, len);
snprintf(output, maxlen, "IPV4 %s:%d", inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
} else {
snprintf(output, maxlen, "Invalid Address");
}
}
static void dump_string(char *output, int maxlen, void *value, int len)
{
maxlen--;
if (maxlen > len)
maxlen = len;
strncpy(output,value, maxlen);
output[maxlen] = '\0';
}
static void dump_int(char *output, int maxlen, void *value, int len)
{
if (len == sizeof(unsigned int))
snprintf(output, maxlen, "%d", ntohl(*((unsigned int *)value)));
else
snprintf(output, maxlen, "Invalid INT");
}
static void dump_short(char *output, int maxlen, void *value, int len)
{
if (len == sizeof(unsigned short))
snprintf(output, maxlen, "%d", ntohs(*((unsigned short *)value)));
else
snprintf(output, maxlen, "Invalid SHORT");
}
static void dump_byte(char *output, int maxlen, void *value, int len)
{
if (len == sizeof(unsigned char))
snprintf(output, maxlen, "%d", ntohs(*((unsigned char *)value)));
else
snprintf(output, maxlen, "Invalid BYTE");
}
static struct iax2_ie {
int ie;
char *name;
void (*dump)(char *output, int maxlen, void *value, int len);
} ies[] = {
{ IAX_IE_CALLED_NUMBER, "CALLED NUMBER", dump_string },
{ IAX_IE_CALLING_NUMBER, "CALLING NUMBER", dump_string },
{ IAX_IE_CALLING_NUMBER, "ANI", dump_string },
{ IAX_IE_CALLING_NAME, "CALLING NAME", dump_string },
{ IAX_IE_CALLED_CONTEXT, "CALLED CONTEXT", dump_string },
{ IAX_IE_USERNAME, "USERNAME", dump_string },
{ IAX_IE_PASSWORD, "PASSWORD", dump_string },
{ IAX_IE_CAPABILITY, "CAPABILITY", dump_int },
{ IAX_IE_FORMAT, "FORMAT", dump_int },
{ IAX_IE_LANGUAGE, "LANGUAGE", dump_string },
{ IAX_IE_VERSION, "VERSION", dump_short },
{ IAX_IE_ADSICPE, "ADSICPE", dump_short },
{ IAX_IE_DNID, "DNID", dump_string },
{ IAX_IE_AUTHMETHODS, "AUTHMETHODS", dump_short },
{ IAX_IE_CHALLENGE, "CHALLENGE", dump_string },
{ IAX_IE_MD5_RESULT, "MD5 RESULT", dump_string },
{ IAX_IE_RSA_RESULT, "RSA RESULT", dump_string },
{ IAX_IE_APPARENT_ADDR, "APPARENT ADDRESS", dump_addr },
{ IAX_IE_REFRESH, "REFRESH", dump_short },
{ IAX_IE_DPSTATUS, "DIALPLAN STATUS", dump_short },
{ IAX_IE_CALLNO, "CALL NUMBER", dump_short },
{ IAX_IE_CAUSE, "CAUSE", dump_string },
{ IAX_IE_IAX_UNKNOWN, "UNKNOWN IAX CMD", dump_byte },
{ IAX_IE_MSGCOUNT, "MESSAGE COUNT", dump_short },
{ IAX_IE_AUTOANSWER, "AUTO ANSWER REQ" },
};
const char *iax_ie2str(int ie)
{
int x;
for (x=0;x<sizeof(ies) / sizeof(ies[0]); x++) {
if (ies[x].ie == ie)
return ies[x].name;
}
return "Unknown IE";
}
static void dump_ies(unsigned char *iedata, int len)
{
int ielen;
int ie;
int x;
int found;
char interp[80];
char tmp[256];
if (len < 2)
return;
while(len > 2) {
ie = iedata[0];
ielen = iedata[1];
if (ielen + 2> len) {
snprintf(tmp, sizeof(tmp), "Total IE length of %d bytes exceeds remaining frame length of %d bytes\n", ielen + 2, len);
outputf(tmp);
return;
}
found = 0;
for (x=0;x<sizeof(ies) / sizeof(ies[0]); x++) {
if (ies[x].ie == ie) {
if (ies[x].dump) {
ies[x].dump(interp, sizeof(interp), iedata + 2, ielen);
snprintf(tmp, sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp);
outputf(tmp);
} else {
snprintf(tmp, sizeof(tmp), " %-15.15s : Present\n", ies[x].name);
outputf(tmp);
}
found++;
}
}
if (!found) {
snprintf(tmp, sizeof(tmp), " Unknown IE %03d : Present\n", ie);
outputf(tmp);
}
iedata += (2 + ielen);
len -= (2 + ielen);
}
outputf("\n");
}
void iax_showframe(struct ast_iax2_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen)
{
char *frames[] = {
"(0?)",
"DTMF ",
"VOICE ",
"VIDEO ",
"CONTROL",
"NULL ",
"IAX ",
"TEXT ",
"IMAGE " };
char *iaxs[] = {
"(0?)",
"NEW ",
"PING ",
"PONG ",
"ACK ",
"HANGUP ",
"REJECT ",
"ACCEPT ",
"AUTHREQ",
"AUTHREP",
"INVAL ",
"LAGRQ ",
"LAGRP ",
"REGREQ ",
"REGAUTH",
"REGACK ",
"REGREJ ",
"REGREL ",
"VNAK ",
"DPREQ ",
"DPREP ",
"DIAL ",
"TXREQ ",
"TXCNT ",
"TXACC ",
"TXREADY",
"TXREL ",
"TXREJ ",
"QUELCH ",
"UNQULCH",
"POKE",
"PAGE",
"MWI",
"UNSUPPORTED",
};
char *cmds[] = {
"(0?)",
"HANGUP ",
"RING ",
"RINGING",
"ANSWER ",
"BUSY ",
"TKOFFHK ",
"OFFHOOK" };
struct ast_iax2_full_hdr *fh;
char retries[20];
char class2[20];
char subclass2[20];
char *class;
char *subclass;
char tmp[256];
if (f) {
fh = f->data;
snprintf(retries, sizeof(retries), "%03d", f->retries);
} else {
fh = fhi;
if (ntohs(fh->dcallno) & IAX_FLAG_RETRANS)
strcpy(retries, "Yes");
else
strcpy(retries, "No");
}
if (!(ntohs(fh->scallno) & IAX_FLAG_FULL)) {
/* Don't mess with mini-frames */
return;
}
if (fh->type > sizeof(frames)/sizeof(char *)) {
snprintf(class2, sizeof(class2), "(%d?)", fh->type);
class = class2;
} else {
class = frames[(int)fh->type];
}
if (fh->type == AST_FRAME_DTMF) {
sprintf(subclass2, "%c", fh->csub);
subclass = subclass2;
} else if (fh->type == AST_FRAME_IAX) {
if (fh->csub >= sizeof(iaxs)/sizeof(iaxs[0])) {
snprintf(subclass2, sizeof(subclass2), "(%d?)", fh->csub);
subclass = subclass2;
} else {
subclass = iaxs[(int)fh->csub];
}
} else if (fh->type == AST_FRAME_CONTROL) {
if (fh->csub > sizeof(cmds)/sizeof(char *)) {
snprintf(subclass2, sizeof(subclass2), "(%d?)", fh->csub);
subclass = subclass2;
} else {
subclass = cmds[(int)fh->csub];
}
} else {
snprintf(subclass2, sizeof(subclass2), "%d", fh->csub);
subclass = subclass2;
}
snprintf(tmp, sizeof(tmp),
"%s-Frame Retry[%s] -- OSeqno: %3.3d ISeqno: %3.3d Type: %s Subclass: %s\n",
(rx ? "Rx" : "Tx"),
retries, fh->oseqno, fh->iseqno, class, subclass);
outputf(tmp);
snprintf(tmp, sizeof(tmp),
" Timestamp: %05dms SCall: %5.5d DCall: %5.5d [%s:%d]\n",
ntohl(fh->ts),
ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS,
inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
outputf(tmp);
if (fh->type == AST_FRAME_IAX)
dump_ies(fh->iedata, datalen);
}
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen)
{
char tmp[256];
if (datalen > (sizeof(ied->buf) - ied->pos)) {
snprintf(tmp, sizeof(tmp), "Out of space for ie '%s' (%d), need %d have %d\n", iax_ie2str(ie), ie, datalen, sizeof(ied->buf) - ied->pos);
errorf(tmp);
return -1;
}
ied->buf[ied->pos++] = ie;
ied->buf[ied->pos++] = datalen;
memcpy(ied->buf + ied->pos, data, datalen);
ied->pos += datalen;
return 0;
}
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin)
{
return iax_ie_append_raw(ied, ie, sin, sizeof(struct sockaddr_in));
}
int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
{
unsigned int newval;
newval = htonl(value);
return iax_ie_append_raw(ied, ie, &newval, sizeof(newval));
}
int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value)
{
unsigned short newval;
newval = htons(value);
return iax_ie_append_raw(ied, ie, &newval, sizeof(newval));
}
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, unsigned char *str)
{
return iax_ie_append_raw(ied, ie, str, strlen(str));
}
int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat)
{
return iax_ie_append_raw(ied, ie, &dat, 1);
}
int iax_ie_append(struct iax_ie_data *ied, unsigned char ie)
{
return iax_ie_append_raw(ied, ie, NULL, 0);
}
void iax_set_output(void (*func)(const char *))
{
outputf = func;
}
void iax_set_error(void (*func)(const char *))
{
errorf = func;
}

@ -0,0 +1,110 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Implementation of Inter-Asterisk eXchange
*
* Copyright (C) 2003, Digium
*
* Mark Spencer <markster@linux-support.net>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
*/
#ifndef _IAX2_PARSER_H
#define _IAX2_PARSER_H
struct iax_ies {
char *called_number;
char *calling_number;
char *calling_ani;
char *calling_name;
char *called_context;
char *username;
char *password;
unsigned int capability;
unsigned int format;
char *language;
int version;
unsigned short adsicpe;
char *dnid;
unsigned int authmethods;
char *challenge;
char *md5_result;
char *rsa_result;
struct sockaddr_in *apparent_addr;
unsigned short refresh;
unsigned short dpstatus;
unsigned short callno;
char *cause;
unsigned char iax_unknown;
int msgcount;
int autoanswer;
int musiconhold;
};
#define DIRECTION_INGRESS 1
#define DIRECTION_OUTGRESS 2
struct ast_iax2_frame {
/* /Our/ call number */
unsigned short callno;
/* /Their/ call number */
unsigned short dcallno;
/* Start of raw frame (outgoing only) */
void *data;
/* Length of frame (outgoing only) */
int datalen;
/* How many retries so far? */
int retries;
/* Outgoing relative timestamp (ms) */
unsigned int ts;
/* How long to wait before retrying */
int retrytime;
/* Are we received out of order? */
int outoforder;
/* Have we been sent at all yet? */
int sentyet;
/* Outgoing Packet sequence number */
int oseqno;
/* Next expected incoming packet sequence number */
int iseqno;
/* Non-zero if should be sent to transfer peer */
int transfer;
/* Non-zero if this is the final message */
int final;
/* Ingress or outgres */
int direction;
/* Retransmission ID */
int retrans;
/* Easy linking */
struct ast_iax2_frame *next;
struct ast_iax2_frame *prev;
/* Actual, isolated frame header */
struct ast_frame af;
unsigned char unused[AST_FRIENDLY_OFFSET];
unsigned char afdata[0]; /* Data for frame */
};
struct iax_ie_data {
unsigned char buf[1024];
int pos;
};
/* Choose a different function for output */
extern void iax_set_output(void (*output)(const char *data));
/* Choose a different function for errors */
extern void iax_set_error(void (*output)(const char *data));
extern void iax_showframe(struct ast_iax2_frame *f, struct ast_iax2_full_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen);
extern const char *iax_ie2str(int ie);
extern int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, void *data, int datalen);
extern int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin);
extern int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value);
extern int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value);
extern int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, unsigned char *str);
extern int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat);
extern int iax_ie_append(struct iax_ie_data *ied, unsigned char ie);
#endif

@ -11,62 +11,62 @@
* the GNU General Public License
*/
#ifndef _ASTERISK_IAX2_H
#define _ASTERISK_IAX2_H
#ifndef _IAX2_H
#define _IAX2_H
/* Max version of IAX protocol we support */
#define AST_IAX2_PROTO_VERSION 2
#define IAX_PROTO_VERSION 2
#define AST_IAX2_MAX_CALLS 32768
#define IAX_MAX_CALLS 32768
#define AST_FLAG_FULL 0x8000
#define IAX_FLAG_FULL 0x8000
#define AST_FLAG_RETRANS 0x8000
#define IAX_FLAG_RETRANS 0x8000
#define AST_FLAG_SC_LOG 0x80
#define IAX_FLAG_SC_LOG 0x80
#define AST_MAX_SHIFT 0x1F
#define IAX_MAX_SHIFT 0x1F
#define AST_IAX2_WINDOW 256
#define IAX_WINDOW 64
/* Subclass for AST_FRAME_IAX */
#define AST_IAX2_COMMAND_NEW 1
#define AST_IAX2_COMMAND_PING 2
#define AST_IAX2_COMMAND_PONG 3
#define AST_IAX2_COMMAND_ACK 4
#define AST_IAX2_COMMAND_HANGUP 5
#define AST_IAX2_COMMAND_REJECT 6
#define AST_IAX2_COMMAND_ACCEPT 7
#define AST_IAX2_COMMAND_AUTHREQ 8
#define AST_IAX2_COMMAND_AUTHREP 9
#define AST_IAX2_COMMAND_INVAL 10
#define AST_IAX2_COMMAND_LAGRQ 11
#define AST_IAX2_COMMAND_LAGRP 12
#define AST_IAX2_COMMAND_REGREQ 13 /* Registration request */
#define AST_IAX2_COMMAND_REGAUTH 14 /* Registration authentication required */
#define AST_IAX2_COMMAND_REGACK 15 /* Registration accepted */
#define AST_IAX2_COMMAND_REGREJ 16 /* Registration rejected */
#define AST_IAX2_COMMAND_REGREL 17 /* Force release of registration */
#define AST_IAX2_COMMAND_VNAK 18 /* If we receive voice before valid first voice frame, send this */
#define AST_IAX2_COMMAND_DPREQ 19 /* Request status of a dialplan entry */
#define AST_IAX2_COMMAND_DPREP 20 /* Request status of a dialplan entry */
#define AST_IAX2_COMMAND_DIAL 21 /* Request a dial on channel brought up TBD */
#define AST_IAX2_COMMAND_TXREQ 22 /* Transfer Request */
#define AST_IAX2_COMMAND_TXCNT 23 /* Transfer Connect */
#define AST_IAX2_COMMAND_TXACC 24 /* Transfer Accepted */
#define AST_IAX2_COMMAND_TXREADY 25 /* Transfer ready */
#define AST_IAX2_COMMAND_TXREL 26 /* Transfer release */
#define AST_IAX2_COMMAND_TXREJ 27 /* Transfer reject */
#define AST_IAX2_COMMAND_QUELCH 28 /* Stop audio/video transmission */
#define AST_IAX2_COMMAND_UNQUELCH 29 /* Resume audio/video transmission */
#define AST_IAX2_COMMAND_POKE 30 /* Like ping, but does not require an open connection */
#define AST_IAX2_COMMAND_PAGE 31 /* Paging description */
#define AST_IAX2_COMMAND_MWI 32 /* Stand-alone message waiting indicator */
#define AST_IAX2_COMMAND_UNSUPPORT 33 /* Unsupported message received */
#define AST_DEFAULT_REG_EXPIRE 60 /* By default require re-registration once per minute */
#define AST_DEFAULT_IAX_PORTNO 4569
#define IAX_COMMAND_NEW 1
#define IAX_COMMAND_PING 2
#define IAX_COMMAND_PONG 3
#define IAX_COMMAND_ACK 4
#define IAX_COMMAND_HANGUP 5
#define IAX_COMMAND_REJECT 6
#define IAX_COMMAND_ACCEPT 7
#define IAX_COMMAND_AUTHREQ 8
#define IAX_COMMAND_AUTHREP 9
#define IAX_COMMAND_INVAL 10
#define IAX_COMMAND_LAGRQ 11
#define IAX_COMMAND_LAGRP 12
#define IAX_COMMAND_REGREQ 13 /* Registration request */
#define IAX_COMMAND_REGAUTH 14 /* Registration authentication required */
#define IAX_COMMAND_REGACK 15 /* Registration accepted */
#define IAX_COMMAND_REGREJ 16 /* Registration rejected */
#define IAX_COMMAND_REGREL 17 /* Force release of registration */
#define IAX_COMMAND_VNAK 18 /* If we receive voice before valid first voice frame, send this */
#define IAX_COMMAND_DPREQ 19 /* Request status of a dialplan entry */
#define IAX_COMMAND_DPREP 20 /* Request status of a dialplan entry */
#define IAX_COMMAND_DIAL 21 /* Request a dial on channel brought up TBD */
#define IAX_COMMAND_TXREQ 22 /* Transfer Request */
#define IAX_COMMAND_TXCNT 23 /* Transfer Connect */
#define IAX_COMMAND_TXACC 24 /* Transfer Accepted */
#define IAX_COMMAND_TXREADY 25 /* Transfer ready */
#define IAX_COMMAND_TXREL 26 /* Transfer release */
#define IAX_COMMAND_TXREJ 27 /* Transfer reject */
#define IAX_COMMAND_QUELCH 28 /* Stop audio/video transmission */
#define IAX_COMMAND_UNQUELCH 29 /* Resume audio/video transmission */
#define IAX_COMMAND_POKE 30 /* Like ping, but does not require an open connection */
#define IAX_COMMAND_PAGE 31 /* Paging description */
#define IAX_COMMAND_MWI 32 /* Stand-alone message waiting indicator */
#define IAX_COMMAND_UNSUPPORT 33 /* Unsupported message received */
#define IAX_DEFAULT_REG_EXPIRE 60 /* By default require re-registration once per minute */
#define IAX_DEFAULT_PORTNO 4569
/* IAX Information elements */
#define IAX_IE_CALLED_NUMBER 1 /* Number/extension being called - string */
@ -93,6 +93,8 @@
#define IAX_IE_CAUSE 22 /* Cause - string */
#define IAX_IE_IAX_UNKNOWN 23 /* Unknown IAX command - byte */
#define IAX_IE_MSGCOUNT 24 /* How many messages waiting - short */
#define IAX_IE_AUTOANSWER 25 /* Request auto-answering -- none */
#define IAX_IE_MUSICONHOLD 26 /* Request musiconhold with QUELCH -- none or string */
#define IAX_AUTH_PLAINTEXT (1 << 0)
#define IAX_AUTH_MD5 (1 << 1)

@ -64,7 +64,7 @@ struct ulaw_encoder_pvt
};
static struct ast_translator_pvt *
alawtoulaw_new ()
alawtoulaw_new (void)
{
struct ulaw_encoder_pvt *tmp;
tmp = malloc (sizeof (struct ulaw_encoder_pvt));
@ -79,7 +79,7 @@ alawtoulaw_new ()
}
static struct ast_translator_pvt *
ulawtoalaw_new ()
ulawtoalaw_new (void)
{
struct alaw_encoder_pvt *tmp;
tmp = malloc (sizeof (struct alaw_encoder_pvt));
@ -189,7 +189,7 @@ ulawtoalaw_frameout (struct ast_translator_pvt *pvt)
*/
static struct ast_frame *
alawtoulaw_sample ()
alawtoulaw_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
@ -204,7 +204,7 @@ alawtoulaw_sample ()
}
static struct ast_frame *
ulawtoalaw_sample ()
ulawtoalaw_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;

@ -185,7 +185,7 @@ struct adpcm_decoder_pvt
*/
static struct ast_translator_pvt *
adpcmtolin_new ()
adpcmtolin_new (void)
{
struct adpcm_decoder_pvt *tmp;
tmp = malloc (sizeof (struct adpcm_decoder_pvt));
@ -211,7 +211,7 @@ adpcmtolin_new ()
*/
static struct ast_translator_pvt *
lintoadpcm_new ()
lintoadpcm_new (void)
{
struct adpcm_encoder_pvt *tmp;
tmp = malloc (sizeof (struct adpcm_encoder_pvt));
@ -411,7 +411,7 @@ lintoadpcm_frameout (struct ast_translator_pvt *pvt)
*/
static struct ast_frame *
adpcmtolin_sample ()
adpcmtolin_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
@ -430,7 +430,7 @@ adpcmtolin_sample ()
*/
static struct ast_frame *
lintoadpcm_sample ()
lintoadpcm_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;

@ -72,7 +72,7 @@ struct alaw_decoder_pvt
*/
static struct ast_translator_pvt *
alawtolin_new ()
alawtolin_new (void)
{
struct alaw_decoder_pvt *tmp;
tmp = malloc (sizeof (struct alaw_decoder_pvt));
@ -98,7 +98,7 @@ alawtolin_new ()
*/
static struct ast_translator_pvt *
lintoalaw_new ()
lintoalaw_new (void)
{
struct alaw_encoder_pvt *tmp;
tmp = malloc (sizeof (struct alaw_encoder_pvt));
@ -243,7 +243,7 @@ lintoalaw_frameout (struct ast_translator_pvt *pvt)
*/
static struct ast_frame *
alawtolin_sample ()
alawtolin_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
@ -262,7 +262,7 @@ alawtolin_sample ()
*/
static struct ast_frame *
lintoalaw_sample ()
lintoalaw_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;

@ -66,7 +66,7 @@ struct ast_translator_pvt {
#define lpc10_coder_pvt ast_translator_pvt
static struct ast_translator_pvt *lpc10_enc_new()
static struct ast_translator_pvt *lpc10_enc_new(void)
{
struct lpc10_coder_pvt *tmp;
tmp = malloc(sizeof(struct lpc10_coder_pvt));
@ -82,7 +82,7 @@ static struct ast_translator_pvt *lpc10_enc_new()
return tmp;
}
static struct ast_translator_pvt *lpc10_dec_new()
static struct ast_translator_pvt *lpc10_dec_new(void)
{
struct lpc10_coder_pvt *tmp;
tmp = malloc(sizeof(struct lpc10_coder_pvt));
@ -97,7 +97,7 @@ static struct ast_translator_pvt *lpc10_dec_new()
}
return tmp;
}
static struct ast_frame *lintolpc10_sample()
static struct ast_frame *lintolpc10_sample(void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
@ -112,7 +112,7 @@ static struct ast_frame *lintolpc10_sample()
return &f;
}
static struct ast_frame *lpc10tolin_sample()
static struct ast_frame *lpc10tolin_sample(void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;

@ -70,7 +70,7 @@ struct ast_translator_pvt {
#define mp3_coder_pvt ast_translator_pvt
static struct ast_translator_pvt *mp3_new()
static struct ast_translator_pvt *mp3_new(void)
{
struct mp3_coder_pvt *tmp;
tmp = malloc(sizeof(struct mp3_coder_pvt));
@ -83,7 +83,7 @@ static struct ast_translator_pvt *mp3_new()
return tmp;
}
static struct ast_frame *mp3tolin_sample()
static struct ast_frame *mp3tolin_sample(void)
{
static struct ast_frame f;
int size;

@ -72,7 +72,7 @@ struct ulaw_decoder_pvt
*/
static struct ast_translator_pvt *
ulawtolin_new ()
ulawtolin_new (void)
{
struct ulaw_decoder_pvt *tmp;
tmp = malloc (sizeof (struct ulaw_decoder_pvt));
@ -98,7 +98,7 @@ ulawtolin_new ()
*/
static struct ast_translator_pvt *
lintoulaw_new ()
lintoulaw_new (void)
{
struct ulaw_encoder_pvt *tmp;
tmp = malloc (sizeof (struct ulaw_encoder_pvt));
@ -243,7 +243,7 @@ lintoulaw_frameout (struct ast_translator_pvt *pvt)
*/
static struct ast_frame *
ulawtolin_sample ()
ulawtolin_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;
@ -262,7 +262,7 @@ ulawtolin_sample ()
*/
static struct ast_frame *
lintoulaw_sample ()
lintoulaw_sample (void)
{
static struct ast_frame f;
f.frametype = AST_FRAME_VOICE;

@ -1,11 +1,14 @@
/*
$Log$
Revision 1.14 2003/02/12 13:59:15 matteo
mer feb 12 14:56:57 CET 2003
Revision 1.15 2003/03/16 22:37:30 matteo
dom mar 16 23:37:23 CET 2003
Revision 1.1.1.1 2003/02/12 13:59:15 matteo
mer feb 12 14:56:57 CET 2003
Revision 1.1.1.2 2003/03/16 22:37:30 matteo
dom mar 16 23:37:23 CET 2003
Revision 1.2 2003/03/16 16:09:48 markster
Mere James's cleanups for fewer build warnings
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...
@ -221,11 +224,11 @@ struct lpc10_decoder_state {
*/
struct lpc10_encoder_state * create_lpc10_encoder_state ();
struct lpc10_encoder_state * create_lpc10_encoder_state (void);
void init_lpc10_encoder_state (struct lpc10_encoder_state *st);
int lpc10_encode (real *speech, INT32 *bits, struct lpc10_encoder_state *st);
struct lpc10_decoder_state * create_lpc10_decoder_state ();
struct lpc10_decoder_state * create_lpc10_decoder_state (void);
void init_lpc10_decoder_state (struct lpc10_decoder_state *st);
int lpc10_decode (INT32 *bits, real *speech, struct lpc10_decoder_state *st);

@ -65,7 +65,7 @@ extern int ast_register_indication(struct tone_zone *zone, const char *indicatio
extern int ast_unregister_indication(struct tone_zone *zone, const char *indication);
/* Start a tone-list going */
int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist);
int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
/*! Stop the tones from playing */
void ast_playtones_stop(struct ast_channel *chan);

@ -37,7 +37,7 @@ extern "C" {
* ast_log(LOG_WHATEVER, "Problem with the %s Captain. We should get some more. Will %d be enough?", "flux capacitor", 10);
* where WHATEVER is one of ERROR, DEBUG, EVENT, NOTICE, or WARNING depending on which log you wish to output to.
*/
extern void ast_log(int level, char *file, int line, char *function, char *fmt, ...)
extern void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
__attribute__ ((format (printf, 5, 6)));
//! Send a verbose message (based on verbose level)
@ -48,12 +48,12 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
* Note the abscence of a comma after the VERBOSE_PREFIX_3. This is important.
* VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined.
*/
extern void ast_verbose(char *fmt, ...)
extern void ast_verbose(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
extern int ast_register_verbose(void (*verboser)(char *string, int opos, int replacelast, int complete));
extern int ast_unregister_verbose(void (*verboser)(char *string, int opos, int replacelast, int complete));
extern int ast_verbose_dmesg(void (*verboser)(char *string, int opos, int replacelast, int complete));
extern int ast_register_verbose(void (*verboser)(const char *string, int opos, int replacelast, int complete));
extern int ast_unregister_verbose(void (*verboser)(const char *string, int opos, int replacelast, int complete));
extern int ast_verbose_dmesg(void (*verboser)(const char *string, int opos, int replacelast, int complete));
#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
#define LOG_DEBUG 0, _A_

@ -44,9 +44,9 @@ extern "C" {
#define COLOR_WHITE 37
#define COLOR_BRWHITE 37 | 128
extern char *term_color(char *outbuf, char *inbuf, int fgcolor, int bgcolor, int maxout);
extern char *term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout);
extern char *term_prompt(char *outbuf, char *inbuf, int maxout);
extern char *term_prompt(char *outbuf, const char *inbuf, int maxout);
extern char *term_prep(void);

@ -40,6 +40,7 @@ struct playtones_def {
int vol;
int reppos;
int nitems;
int interruptible;
struct playtones_item *items;
};
@ -84,7 +85,7 @@ static void * playtones_alloc(struct ast_channel *chan, void *params)
ps->items = pd->items;
}
/* Let interrupts interrupt :) */
chan->writeinterrupt = 1;
chan->writeinterrupt = pd->interruptible;
return ps;
}
@ -137,16 +138,18 @@ static struct ast_generator playtones = {
generate: playtones_generator,
};
int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst)
int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst, int interruptible)
{
char *s, *data = strdupa(playlst); /* cute */
struct playtones_def d = { vol, -1, 0, NULL};
struct playtones_def d = { vol, -1, 0, 1, NULL};
char *stringp=NULL;
if (!data)
return -1;
if (vol < 1)
d.vol = 8192;
d.interruptible = interruptible;
stringp=data;
s = strsep(&stringp,",");
while(s && *s) {
@ -156,7 +159,6 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst)
s++;
else if (d.reppos == -1)
d.reppos = d.nitems;
if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) {
/* f1+f2/time format */
} else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) {

@ -174,7 +174,7 @@ static void init_logger_chain(void)
}
static struct verb {
void (*verboser)(char *string, int opos, int replacelast, int complete);
void (*verboser)(const char *string, int opos, int replacelast, int complete);
struct verb *next;
} *verboser = NULL;
@ -219,7 +219,7 @@ int reload_logger(void)
return -1;
}
extern void ast_log(int level, char *file, int line, char *function, char *fmt, ...)
extern void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
{
char date[256];
char tmp[80];
@ -288,7 +288,7 @@ extern void ast_log(int level, char *file, int line, char *function, char *fmt,
ast_pthread_mutex_unlock(&loglock);
}
extern void ast_verbose(char *fmt, ...)
extern void ast_verbose(const char *fmt, ...)
{
static char stuff[4096];
static int pos = 0, opos;
@ -349,7 +349,7 @@ extern void ast_verbose(char *fmt, ...)
ast_pthread_mutex_unlock(&msglist_lock);
}
int ast_verbose_dmesg(void (*v)(char *string, int opos, int replacelast, int complete))
int ast_verbose_dmesg(void (*v)(const char *string, int opos, int replacelast, int complete))
{
struct msglist *m;
m = list;
@ -363,7 +363,7 @@ int ast_verbose_dmesg(void (*v)(char *string, int opos, int replacelast, int com
return 0;
}
int ast_register_verbose(void (*v)(char *string, int opos, int replacelast, int complete))
int ast_register_verbose(void (*v)(const char *string, int opos, int replacelast, int complete))
{
struct msglist *m;
struct verb *tmp;
@ -385,7 +385,7 @@ int ast_register_verbose(void (*v)(char *string, int opos, int replacelast, int
return -1;
}
int ast_unregister_verbose(void (*v)(char *string, int opos, int replacelast, int complete))
int ast_unregister_verbose(void (*v)(const char *string, int opos, int replacelast, int complete))
{
int res = -1;
struct verb *tmp, *tmpl=NULL;

@ -170,7 +170,7 @@ static void cliinput(void *data, int source, GdkInputCondition ic)
}
static void remove_module()
static void remove_module(void)
{
int res;
char *module;
@ -189,7 +189,7 @@ static void remove_module()
}
}
}
static void reload_module()
static void reload_module(void)
{
int res, x;
char *module;
@ -247,7 +247,7 @@ static void file_ok_sel(GtkWidget *w, GtkFileSelection *fs)
gtk_widget_destroy(GTK_WIDGET(fs));
}
static void add_module()
static void add_module(void)
{
char tmp[AST_CONFIG_MAX_PATH];
GtkWidget *filew;
@ -330,7 +330,7 @@ static void *consolethread(void *data)
return NULL;
}
static int cli_activate()
static int cli_activate(void)
{
char buf[256];
strncpy(buf, gtk_entry_get_text(GTK_ENTRY(cli)), sizeof(buf));
@ -341,7 +341,7 @@ static int cli_activate()
return TRUE;
}
static int show_console()
static int show_console(void)
{
GtkWidget *hbox;
GtkWidget *wbox;

@ -41,7 +41,6 @@ static pthread_t autodialer_thread;
static char buf[257];
static char lastbuf[257];//contains last partial buffer
static char sendbuf[257];
extern int errno;
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;

@ -192,9 +192,9 @@ static int handle_playtones(struct ast_channel *chan, void *data)
}
ts = ast_get_indication_tone(chan->zone, (const char*)data);
if (ts && ts->data[0])
res = ast_playtones_start(chan, 0, ts->data);
res = ast_playtones_start(chan, 0, ts->data, 0);
else
res = ast_playtones_start(chan, 0, (const char*)data);
res = ast_playtones_start(chan, 0, (const char*)data, 0);
if (res)
ast_log(LOG_NOTICE,"Unable to start playtones\n");
return res;
@ -212,7 +212,7 @@ static int handle_stopplaytones(struct ast_channel *chan, void *data)
/*
* Load module stuff
*/
static int ind_load_module()
static int ind_load_module(void)
{
struct ast_config *cfg;
struct ast_variable *v;

@ -386,8 +386,10 @@ static void *moh_alloc(struct ast_channel *chan, void *params)
moh_release(NULL, res);
res = NULL;
}
#if 0
/* Allow writes to interrupt */
chan->writeinterrupt = 1;
#endif
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Started music on hold, class '%s', on %s\n", (char *)params, chan->name);
}
@ -531,7 +533,7 @@ static void load_moh_classes(void)
}
}
void ast_moh_destroy(void)
static void ast_moh_destroy(void)
{
struct mohclass *moh;
ast_pthread_mutex_lock(&moh_lock);

@ -51,7 +51,7 @@ int term_init(void)
return 0;
}
char *term_color(char *outbuf, char *inbuf, int fgcolor, int bgcolor, int maxout)
char *term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
{
int attr=0;
char tmp[40];
@ -94,7 +94,7 @@ char *term_color(char *outbuf, char *inbuf, int fgcolor, int bgcolor, int maxout
return outbuf;
}
char *term_prompt(char *outbuf, char *inbuf, int maxout)
char *term_prompt(char *outbuf, const char *inbuf, int maxout)
{
if (!vt100compat) {
strncpy(outbuf, inbuf, maxout -1);

@ -158,7 +158,7 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *path, struct ast_frame *f,
return NULL;
}
static void rebuild_matrix()
static void rebuild_matrix(void)
{
struct ast_translator *t;
int changed;

Loading…
Cancel
Save