automerge commit

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@59354 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Automerge Script 19 years ago
parent 58500a4c7f
commit c23816ba19

@ -94,7 +94,7 @@ static void retrieve_file(char *dir)
int res; int res;
int fd=-1; int fd=-1;
size_t fdlen = 0; size_t fdlen = 0;
void *fdm=NULL; void *fdm = MAP_FAILED;
SQLHSTMT stmt; SQLHSTMT stmt;
char sql[256]; char sql[256];
char fmt[80]=""; char fmt[80]="";
@ -161,7 +161,7 @@ static void retrieve_file(char *dir)
if (fd > -1) if (fd > -1)
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
} }
if (fdm) { if (fdm != MAP_FAILED) {
memset(fdm, 0, fdlen); memset(fdm, 0, fdlen);
res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize); res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, fdlen, &colsize);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
@ -174,7 +174,7 @@ static void retrieve_file(char *dir)
} while (0); } while (0);
} else } else
ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database); ast_log(LOG_WARNING, "Failed to obtain database object for '%s'!\n", odbc_database);
if (fdm) if (fdm != MAP_FAILED)
munmap(fdm, fdlen); munmap(fdm, fdlen);
if (fd > -1) if (fd > -1)
close(fd); close(fd);

@ -61,6 +61,11 @@ static char *descrip =
"will be returned at the location of the Goto.\n" "will be returned at the location of the Goto.\n"
"If ${MACRO_OFFSET} is set at termination, Macro will attempt to continue\n" "If ${MACRO_OFFSET} is set at termination, Macro will attempt to continue\n"
"at priority MACRO_OFFSET + N + 1 if such a step exists, and N + 1 otherwise.\n" "at priority MACRO_OFFSET + N + 1 if such a step exists, and N + 1 otherwise.\n"
"Extensions: While a macro is being executed, it becomes the current context.\n"
" This means that if a hangup occurs, for instance, that the macro\n"
" will be searched for an 'h' extension, NOT the context from which\n"
" the macro was called. So, make sure to define all appropriate\n"
" extensions in your macro! (you can use 'catch' in AEL) \n"
"WARNING: Because of the way Macro is implemented (it executes the priorities\n" "WARNING: Because of the way Macro is implemented (it executes the priorities\n"
" contained within it via sub-engine), and a fixed per-thread\n" " contained within it via sub-engine), and a fixed per-thread\n"
" memory stack allowance, macros are limited to 7 levels\n" " memory stack allowance, macros are limited to 7 levels\n"

@ -836,7 +836,7 @@ static int retrieve_file(char *dir, int msgnum)
int res; int res;
int fd=-1; int fd=-1;
size_t fdlen = 0; size_t fdlen = 0;
void *fdm=NULL; void *fdm = MAP_FAILED;
SQLSMALLINT colcount=0; SQLSMALLINT colcount=0;
SQLHSTMT stmt; SQLHSTMT stmt;
char sql[PATH_MAX]; char sql[PATH_MAX];
@ -944,7 +944,7 @@ static int retrieve_file(char *dir, int msgnum)
} }
/* Read out in small chunks */ /* Read out in small chunks */
for (offset = 0; offset < colsize; offset += CHUNKSIZE) { for (offset = 0; offset < colsize; offset += CHUNKSIZE) {
if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) { if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == MAP_FAILED) {
ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno); ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
SQLFreeHandle(SQL_HANDLE_STMT, stmt); SQLFreeHandle(SQL_HANDLE_STMT, stmt);
goto yuck; goto yuck;
@ -1207,7 +1207,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
int x = 0; int x = 0;
int res; int res;
int fd = -1; int fd = -1;
void *fdm=NULL; void *fdm = MAP_FAILED;
size_t fdlen = -1; size_t fdlen = -1;
SQLHSTMT stmt; SQLHSTMT stmt;
SQLINTEGER len; SQLINTEGER len;
@ -1262,7 +1262,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
lseek(fd, 0, SEEK_SET); lseek(fd, 0, SEEK_SET);
printf("Length is %d\n", fdlen); printf("Length is %d\n", fdlen);
fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0); fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0);
if (!fdm) { if (fdm == MAP_FAILED) {
ast_log(LOG_WARNING, "Memory map failed!\n"); ast_log(LOG_WARNING, "Memory map failed!\n");
goto yuck; goto yuck;
} }
@ -1319,7 +1319,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms
yuck: yuck:
if (cfg) if (cfg)
ast_config_destroy(cfg); ast_config_destroy(cfg);
if (fdm) if (fdm != MAP_FAILED)
munmap(fdm, fdlen); munmap(fdm, fdlen);
if (fd > -1) if (fd > -1)
close(fd); close(fd);

@ -383,7 +383,6 @@ static int odbc_do_query(void)
if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) { if ((ODBC_res != SQL_SUCCESS) && (ODBC_res != SQL_SUCCESS_WITH_INFO)) {
if (option_verbose > 10) if (option_verbose > 10)
ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error in Query %d\n", ODBC_res); ast_verbose( VERBOSE_PREFIX_4 "cdr_odbc: Error in Query %d\n", ODBC_res);
SQLGetDiagRec(SQL_HANDLE_DBC, ODBC_con, 1, (unsigned char *)ODBC_stat, &ODBC_err, (unsigned char *)ODBC_msg, 100, &ODBC_mlen);
SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt); SQLFreeHandle(SQL_HANDLE_STMT, ODBC_stmt);
odbc_disconnect(); odbc_disconnect();
return -1; return -1;

@ -88,6 +88,10 @@ ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/mISDNuser/mISDNlib.h),)
CFLAGS+=-Imisdn CFLAGS+=-Imisdn
endif endif
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/mISDNdsp.h),)
CFLAGS+=-DMISDN_1_2
endif
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/alsa/asoundlib.h),) ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/alsa/asoundlib.h),)
@ -243,7 +247,7 @@ chan_h323.so: chan_h323.o h323/libchanh323.a
endif endif
misdn/chan_misdn_lib.a: misdn/chan_misdn_lib.a:
make -C misdn make CROSS_COMPILE_TARGET=$(CROSS_COMPILE_TARGET) -C misdn
chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN $(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN

@ -176,6 +176,7 @@ static int max_reg_expire;
static int timingfd = -1; /* Timing file descriptor */ static int timingfd = -1; /* Timing file descriptor */
static struct ast_netsock_list *netsock; static struct ast_netsock_list *netsock;
static struct ast_netsock_list *outsock; /*!< used if sourceaddress specified and bindaddr == INADDR_ANY */
static int defaultsockfd = -1; static int defaultsockfd = -1;
static int usecnt; static int usecnt;
@ -8225,20 +8226,40 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
if (res == 0) { if (res == 0) {
/* ip address valid. */ /* ip address valid. */
sin.sin_port = htons(port); sin.sin_port = htons(port);
sock = ast_netsock_find(netsock, &sin); if (!(sock = ast_netsock_find(netsock, &sin)))
sock = ast_netsock_find(outsock, &sin);
if (sock) { if (sock) {
sockfd = ast_netsock_sockfd(sock); sockfd = ast_netsock_sockfd(sock);
nonlocal = 0; nonlocal = 0;
} else {
unsigned int orig_saddr = sin.sin_addr.s_addr;
/* INADDR_ANY matches anyway! */
sin.sin_addr.s_addr = INADDR_ANY;
if (ast_netsock_find(netsock, &sin)) {
sin.sin_addr.s_addr = orig_saddr;
sock = ast_netsock_bind(outsock, io, srcaddr, port, tos, socket_read, NULL);
if (sock) {
sockfd = ast_netsock_sockfd(sock);
ast_netsock_unref(sock);
nonlocal = 0;
} else {
nonlocal = 2;
}
}
} }
} }
} }
peer->sockfd = sockfd; peer->sockfd = sockfd;
if (nonlocal) { if (nonlocal == 1) {
ast_log(LOG_WARNING, "Non-local or unbound address specified (%s) in sourceaddress for '%s', reverting to default\n", ast_log(LOG_WARNING, "Non-local or unbound address specified (%s) in sourceaddress for '%s', reverting to default\n",
srcaddr, peer->name); srcaddr, peer->name);
return -1; return -1;
} else if (nonlocal == 2) {
ast_log(LOG_WARNING, "Unable to bind to sourceaddress '%s' for '%s', reverting to default\n",
srcaddr, peer->name);
return -1;
} else { } else {
ast_log(LOG_DEBUG, "Using sourceaddress %s for '%s'\n", srcaddr, peer->name); ast_log(LOG_DEBUG, "Using sourceaddress %s for '%s'\n", srcaddr, peer->name);
return 0; return 0;
@ -8942,7 +8963,16 @@ static int set_config(char *config_file, int reload)
ast_netsock_unref(ns); ast_netsock_unref(ns);
} }
} }
if (reload) {
ast_netsock_release(outsock);
outsock = ast_netsock_list_alloc();
if (!outsock) {
ast_log(LOG_ERROR, "Could not allocate outsock list.\n");
return -1;
}
ast_netsock_init(outsock);
}
if (min_reg_expire > max_reg_expire) { if (min_reg_expire > max_reg_expire) {
ast_log(LOG_WARNING, "Minimum registration interval of %d is more than maximum of %d, resetting minimum to %d\n", ast_log(LOG_WARNING, "Minimum registration interval of %d is more than maximum of %d, resetting minimum to %d\n",
min_reg_expire, max_reg_expire, max_reg_expire); min_reg_expire, max_reg_expire, max_reg_expire);
@ -9665,6 +9695,7 @@ static int __unload_module(void)
pthread_join(netthreadid, NULL); pthread_join(netthreadid, NULL);
} }
ast_netsock_release(netsock); ast_netsock_release(netsock);
ast_netsock_release(outsock);
for (x=0;x<IAX_MAX_CALLS;x++) for (x=0;x<IAX_MAX_CALLS;x++)
if (iaxs[x]) if (iaxs[x])
iax2_destroy(x); iax2_destroy(x);
@ -9743,6 +9774,13 @@ int load_module(void)
} }
ast_netsock_init(netsock); ast_netsock_init(netsock);
outsock = ast_netsock_list_alloc();
if (!outsock) {
ast_log(LOG_ERROR, "Could not allocate outsock list.\n");
return -1;
}
ast_netsock_init(outsock);
ast_mutex_init(&iaxq.lock); ast_mutex_init(&iaxq.lock);
ast_mutex_init(&userl.lock); ast_mutex_init(&userl.lock);
ast_mutex_init(&peerl.lock); ast_mutex_init(&peerl.lock);
@ -9773,6 +9811,7 @@ int load_module(void)
} else { } else {
ast_log(LOG_ERROR, "Unable to start network thread\n"); ast_log(LOG_ERROR, "Unable to start network thread\n");
ast_netsock_release(netsock); ast_netsock_release(netsock);
ast_netsock_release(outsock);
} }
ast_mutex_lock(&reg_lock); ast_mutex_lock(&reg_lock);

@ -283,9 +283,6 @@ static int tracing = 0 ;
static int usecnt=0; static int usecnt=0;
static char **misdn_key_vector=NULL;
static int misdn_key_vector_size=0;
/* Only alaw and mulaw is allowed for now */ /* Only alaw and mulaw is allowed for now */
static int prefformat = AST_FORMAT_ALAW ; /* AST_FORMAT_SLINEAR ; AST_FORMAT_ULAW | */ static int prefformat = AST_FORMAT_ALAW ; /* AST_FORMAT_SLINEAR ; AST_FORMAT_ULAW | */
@ -325,7 +322,11 @@ static int misdn_facility_exec(struct ast_channel *chan, void *data);
int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len); int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
#ifdef MISDN_1_2
static int update_pipeline_config(struct misdn_bchannel *bc);
#else
static int update_ec_config(struct misdn_bchannel *bc); static int update_ec_config(struct misdn_bchannel *bc);
#endif
/*************** Helpers *****************/ /*************** Helpers *****************/
@ -773,7 +774,11 @@ static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel
" --> activated: %d\n" " --> activated: %d\n"
" --> state: %s\n" " --> state: %s\n"
" --> capability: %s\n" " --> capability: %s\n"
#ifdef MISDN_1_2
" --> pipeline: %s\n"
#else
" --> echo_cancel: %d\n" " --> echo_cancel: %d\n"
#endif
" --> notone : rx %d tx:%d\n" " --> notone : rx %d tx:%d\n"
" --> bc_hold: %d\n", " --> bc_hold: %d\n",
help->ast->name, help->ast->name,
@ -786,7 +791,11 @@ static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel
bc->active, bc->active,
bc_state2str(bc->bc_state), bc_state2str(bc->bc_state),
bearer2str(bc->capability), bearer2str(bc->capability),
#ifdef MISDN_1_2
bc->pipeline,
#else
bc->ec_enable, bc->ec_enable,
#endif
help->norxtone,help->notxtone, help->norxtone,help->notxtone,
bc->holded bc->holded
@ -1005,7 +1014,11 @@ static int misdn_toggle_echocancel (int fd, int argc, char *argv[])
tmp->toggle_ec=tmp->toggle_ec?0:1; tmp->toggle_ec=tmp->toggle_ec?0:1;
if (tmp->toggle_ec) { if (tmp->toggle_ec) {
#ifdef MISDN_1_2
update_pipeline_config(tmp->bc);
#else
update_ec_config(tmp->bc); update_ec_config(tmp->bc);
#endif
manager_ec_enable(tmp->bc); manager_ec_enable(tmp->bc);
} else { } else {
manager_ec_disable(tmp->bc); manager_ec_disable(tmp->bc);
@ -1404,9 +1417,25 @@ void debug_numplan(int port, int numplan, char *type)
} }
} }
#ifdef MISDN_1_2
static int update_pipeline_config(struct misdn_bchannel *bc)
{
int ec;
misdn_cfg_get(bc->port, MISDN_CFG_PIPELINE, bc->pipeline, sizeof(bc->pipeline));
if (*bc->pipeline)
return 0;
misdn_cfg_get(bc->port, MISDN_CFG_ECHOCANCEL, &ec, sizeof(int));
if (ec == 1)
snprintf(bc->pipeline, sizeof(bc->pipeline) - 1, "mg2ec");
else if (ec > 1)
snprintf(bc->pipeline, sizeof(bc->pipeline) - 1, "mg2ec(deftaps=%d)", ec);
return 0;
}
#else
static int update_ec_config(struct misdn_bchannel *bc) static int update_ec_config(struct misdn_bchannel *bc)
{ {
int ec; int ec;
@ -1423,7 +1452,7 @@ static int update_ec_config(struct misdn_bchannel *bc)
return 0; return 0;
} }
#endif
static int read_config(struct chan_list *ch, int orig) { static int read_config(struct chan_list *ch, int orig) {
@ -1493,7 +1522,11 @@ static int read_config(struct chan_list *ch, int orig) {
ast_copy_string (ast->context,ch->context,sizeof(ast->context)); ast_copy_string (ast->context,ch->context,sizeof(ast->context));
#ifdef MISDN_1_2
update_pipeline_config(bc);
#else
update_ec_config(bc); update_ec_config(bc);
#endif
{ {
int eb3; int eb3;
@ -1721,9 +1754,15 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
int bridging; int bridging;
misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int)); misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int));
if (bridging && ch->other_ch) { if (bridging && ch->other_ch) {
chan_misdn_log(0, port, "Disabling EC on both Sides\n"); #ifdef MISDN_1_2
chan_misdn_log(0, port, "Disabling EC (aka Pipeline) on both Sides\n");
*ch->bc->pipeline=0;
*ch->other_ch->bc->pipeline=0;
#else
chan_misdn_log(0, port, "Disabling EC on both Sides\n");
ch->bc->ec_enable=0; ch->bc->ec_enable=0;
ch->other_ch->bc->ec_enable=0; ch->other_ch->bc->ec_enable=0;
#endif
} }
r=misdn_lib_send_event( newbc, EVENT_SETUP ); r=misdn_lib_send_event( newbc, EVENT_SETUP );
@ -3863,7 +3902,8 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
if (ch->ast) { if (ch->ast) {
ch->ast->hangupcause=bc->cause; ch->ast->hangupcause=bc->cause;
ast_queue_control(ch->ast, AST_CONTROL_BUSY); if (bc->cause == 17)
ast_queue_control(ch->ast, AST_CONTROL_BUSY);
} }
ch->need_busy=0; ch->need_busy=0;
break; break;
@ -4563,15 +4603,22 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
if (neglect) { if (neglect) {
chan_misdn_log(1, ch->bc->port, " --> disabled\n"); chan_misdn_log(1, ch->bc->port, " --> disabled\n");
#ifdef MISDN_1_2
*ch->bc->pipeline=0;
#else
ch->bc->ec_enable=0; ch->bc->ec_enable=0;
#endif
} else { } else {
#ifdef MISDN_1_2
update_pipeline_config(ch->bc);
#else
ch->bc->ec_enable=1; ch->bc->ec_enable=1;
ch->bc->orig=ch->orginator; ch->bc->orig=ch->orginator;
tok++; tok++;
if (tok) { if (*tok) {
ch->bc->ec_deftaps=atoi(tok); ch->bc->ec_deftaps=atoi(tok);
} }
#endif
} }
break; break;

@ -11405,16 +11405,16 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
/* ignore means "don't do anything with it" but still have to /* ignore means "don't do anything with it" but still have to
respond appropriately */ respond appropriately */
ignore=1; ignore=1;
} } else if (e) {
e = ast_skip_blanks(e);
e = ast_skip_blanks(e); if (sscanf(e, "%d %n", &respid, &len) != 1) {
if (sscanf(e, "%d %n", &respid, &len) != 1) { ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
ast_log(LOG_WARNING, "Invalid response: '%s'\n", e); } else {
} else { /* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
/* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */ if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
if ((respid == 200) || ((respid >= 300) && (respid <= 399))) extract_uri(p, req);
extract_uri(p, req); handle_response(p, respid, e + len, req, ignore, seqno);
handle_response(p, respid, e + len, req, ignore, seqno); }
} }
return 0; return 0;
} }

@ -9,6 +9,9 @@ CFLAGS = -pipe -c -Wall -ggdb
ifeq ($(shell uname -m),x86_64) ifeq ($(shell uname -m),x86_64)
CFLAGS += -fPIC CFLAGS += -fPIC
endif endif
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/mISDNdsp.h),)
CFLAGS+=-DMISDN_1_2
endif
SOURCES = isdn_lib.c isdn_msg_parser.c SOURCES = isdn_lib.c isdn_msg_parser.c
OBJDIR = . OBJDIR = .
OBJS = isdn_lib.o isdn_msg_parser.o fac.o OBJS = isdn_lib.o isdn_msg_parser.o fac.o

@ -52,7 +52,9 @@ enum misdn_cfg_elements {
MISDN_CFG_EARLY_BCONNECT, /* int (bool) */ MISDN_CFG_EARLY_BCONNECT, /* int (bool) */
MISDN_CFG_INCOMING_EARLY_AUDIO, /* int (bool) */ MISDN_CFG_INCOMING_EARLY_AUDIO, /* int (bool) */
MISDN_CFG_ECHOCANCEL, /* int */ MISDN_CFG_ECHOCANCEL, /* int */
MISDN_CFG_ECHOCANCELWHENBRIDGED, /* int (bool) */ #ifdef MISDN_1_2
MISDN_CFG_PIPELINE, /* char[] */
#endif
MISDN_CFG_NEED_MORE_INFOS, /* bool */ MISDN_CFG_NEED_MORE_INFOS, /* bool */
MISDN_CFG_NTTIMEOUT, /* bool */ MISDN_CFG_NTTIMEOUT, /* bool */
MISDN_CFG_JITTERBUFFER, /* int */ MISDN_CFG_JITTERBUFFER, /* int */

@ -573,13 +573,16 @@ void empty_bc(struct misdn_bchannel *bc)
bc->active = 0; bc->active = 0;
bc->early_bconnect = 1; bc->early_bconnect = 1;
#ifdef MISDN_1_2
*bc->pipeline = 0;
#else
bc->ec_enable = 0; bc->ec_enable = 0;
bc->ec_deftaps = 128; bc->ec_deftaps = 128;
bc->ec_whenbridged = 0;
#ifdef EC_TRAIN #ifdef EC_TRAIN
bc->ec_training = 1; bc->ec_training = 1;
#endif
#endif #endif
bc->orig=0; bc->orig=0;
@ -4240,16 +4243,21 @@ void misdn_lib_send_tone(struct misdn_bchannel *bc, enum tone_e tone)
void manager_ec_enable(struct misdn_bchannel *bc) void manager_ec_enable(struct misdn_bchannel *bc)
{ {
int ec_arr[2];
struct misdn_stack *stack=get_stack_by_bc(bc); struct misdn_stack *stack=get_stack_by_bc(bc);
cb_log(4, stack?stack->port:0,"ec_enable\n"); cb_log(4, stack?stack->port:0,"ec_enable\n");
if (!misdn_cap_is_speech(bc->capability)) { if (!misdn_cap_is_speech(bc->capability)) {
cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n"); cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n");
return; } else {
#ifdef MISDN_1_2
if (*bc->pipeline) {
cb_log(3, stack?stack->port:0,"Sending Control PIPELINE_CFG %s\n",bc->pipeline);
manager_ph_control_block(bc, PIPELINE_CFG, bc->pipeline, strlen(bc->pipeline) + 1);
} }
#else
int ec_arr[2];
if (bc->ec_enable) { if (bc->ec_enable) {
cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training); cb_log(3, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
@ -4276,6 +4284,8 @@ void manager_ec_enable(struct misdn_bchannel *bc)
manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr)); manager_ph_control_block(bc, ECHOCAN_ON, ec_arr, sizeof(ec_arr));
} }
#endif
}
} }
@ -4291,10 +4301,14 @@ void manager_ec_disable(struct misdn_bchannel *bc)
return; return;
} }
#ifdef MISDN_1_2
manager_ph_control_block(bc, PIPELINE_CFG, "", 0);
#else
if ( ! bc->ec_enable) { if ( ! bc->ec_enable) {
cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n"); cb_log(3, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");
manager_ph_control(bc, ECHOCAN_OFF, 0); manager_ph_control(bc, ECHOCAN_OFF, 0);
} }
#endif
} }
struct misdn_stack* get_misdn_stack() { struct misdn_stack* get_misdn_stack() {

@ -354,10 +354,13 @@ struct misdn_bchannel {
/** list stuf **/ /** list stuf **/
#ifdef MISDN_1_2
char pipeline[128];
#else
int ec_enable; int ec_enable;
int ec_deftaps; int ec_deftaps;
int ec_whenbridged;
int ec_training; int ec_training;
#endif
#ifdef WITH_BEROEC #ifdef WITH_BEROEC
beroec_t *ec; beroec_t *ec;

@ -113,6 +113,9 @@ static const struct misdn_cfg_spec port_spec[] = {
{ "early_bconnect", MISDN_CFG_EARLY_BCONNECT, MISDN_CTYPE_BOOL, "yes", NONE }, { "early_bconnect", MISDN_CFG_EARLY_BCONNECT, MISDN_CTYPE_BOOL, "yes", NONE },
{ "incoming_early_audio", MISDN_CFG_INCOMING_EARLY_AUDIO, MISDN_CTYPE_BOOL, "no", NONE }, { "incoming_early_audio", MISDN_CFG_INCOMING_EARLY_AUDIO, MISDN_CTYPE_BOOL, "no", NONE },
{ "echocancel", MISDN_CFG_ECHOCANCEL, MISDN_CTYPE_BOOLINT, "0", 128 }, { "echocancel", MISDN_CFG_ECHOCANCEL, MISDN_CTYPE_BOOLINT, "0", 128 },
#ifdef MISDN_1_2
{ "pipeline", MISDN_CFG_PIPELINE, MISDN_CTYPE_STR, NO_DEFAULT, NONE },
#endif
{ "need_more_infos", MISDN_CFG_NEED_MORE_INFOS, MISDN_CTYPE_BOOL, "0", NONE }, { "need_more_infos", MISDN_CFG_NEED_MORE_INFOS, MISDN_CTYPE_BOOL, "0", NONE },
{ "nttimeout", MISDN_CFG_NTTIMEOUT, MISDN_CTYPE_BOOL, "no", NONE }, { "nttimeout", MISDN_CFG_NTTIMEOUT, MISDN_CTYPE_BOOL, "no", NONE },
{ "jitterbuffer", MISDN_CFG_JITTERBUFFER, MISDN_CTYPE_INT, "4000", NONE }, { "jitterbuffer", MISDN_CFG_JITTERBUFFER, MISDN_CTYPE_INT, "4000", NONE },

@ -251,7 +251,6 @@ static int load_odbc_config(void)
char *cat, *dsn, *username, *password; char *cat, *dsn, *username, *password;
int enabled; int enabled;
int connect = 0; int connect = 0;
char *env_var;
odbc_obj *obj; odbc_obj *obj;
@ -260,16 +259,10 @@ static int load_odbc_config(void)
for (cat = ast_category_browse(config, NULL); cat; cat=ast_category_browse(config, cat)) { for (cat = ast_category_browse(config, NULL); cat; cat=ast_category_browse(config, cat)) {
if (!strcmp(cat, "ENV")) { if (!strcmp(cat, "ENV")) {
for (v = ast_variable_browse(config, cat); v; v = v->next) { for (v = ast_variable_browse(config, cat); v; v = v->next) {
env_var = malloc(strlen(v->name) + strlen(v->value) + 2); setenv(v->name, v->value, 1);
if (env_var) {
sprintf(env_var, "%s=%s", v->name, v->value);
ast_log(LOG_NOTICE, "Adding ENV var: %s=%s\n", v->name, v->value);
putenv(env_var);
free(env_var);
}
} }
cat = ast_category_browse(config, cat); cat = ast_category_browse(config, cat);
} }
dsn = username = password = NULL; dsn = username = password = NULL;

Loading…
Cancel
Save