aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_misdn.c
diff options
context:
space:
mode:
authornadi <nadi@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-26 10:21:56 +0000
committernadi <nadi@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-26 10:21:56 +0000
commit0ea0ccfc2f968ae8897ca826fddbc3f3c3167435 (patch)
tree78701fdfba6a9d443bc6e2bf66fa257daf74f0dd /channels/chan_misdn.c
parent759622c84fa374fc6ad9e41d6ceb9c0afd41ac4e (diff)
mISDN >= 1.2 provides a dsp pipeline for i.e. echo cancellation modules, make chan_misdn use it.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@59199 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_misdn.c')
-rw-r--r--channels/chan_misdn.c60
1 files changed, 53 insertions, 7 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 4d29fd33c..2f0921cb0 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -283,9 +283,6 @@ static int tracing = 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 */
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);
+#ifdef MISDN_1_2
+static int update_pipeline_config(struct misdn_bchannel *bc);
+#else
static int update_ec_config(struct misdn_bchannel *bc);
+#endif
/*************** Helpers *****************/
@@ -773,7 +774,11 @@ static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel
" --> activated: %d\n"
" --> state: %s\n"
" --> capability: %s\n"
+#ifdef MISDN_1_2
+ " --> pipeline: %s\n"
+#else
" --> echo_cancel: %d\n"
+#endif
" --> notone : rx %d tx:%d\n"
" --> bc_hold: %d\n",
help->ast->name,
@@ -786,7 +791,11 @@ static void print_bc_info (int fd, struct chan_list* help, struct misdn_bchannel
bc->active,
bc_state2str(bc->bc_state),
bearer2str(bc->capability),
+#ifdef MISDN_1_2
+ bc->pipeline,
+#else
bc->ec_enable,
+#endif
help->norxtone,help->notxtone,
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;
if (tmp->toggle_ec) {
+#ifdef MISDN_1_2
+ update_pipeline_config(tmp->bc);
+#else
update_ec_config(tmp->bc);
+#endif
manager_ec_enable(tmp->bc);
} else {
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)
{
int ec;
@@ -1423,7 +1452,7 @@ static int update_ec_config(struct misdn_bchannel *bc)
return 0;
}
-
+#endif
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));
+#ifdef MISDN_1_2
+ update_pipeline_config(bc);
+#else
update_ec_config(bc);
+#endif
{
int eb3;
@@ -1721,9 +1754,15 @@ static int misdn_call(struct ast_channel *ast, char *dest, int timeout)
int bridging;
misdn_cfg_get( 0, MISDN_GEN_BRIDGING, &bridging, sizeof(int));
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->other_ch->bc->ec_enable=0;
+#endif
}
r=misdn_lib_send_event( newbc, EVENT_SETUP );
@@ -4563,15 +4602,22 @@ static int misdn_set_opt_exec(struct ast_channel *chan, void *data)
if (neglect) {
chan_misdn_log(1, ch->bc->port, " --> disabled\n");
+#ifdef MISDN_1_2
+ *ch->bc->pipeline=0;
+#else
ch->bc->ec_enable=0;
-
+#endif
} else {
+#ifdef MISDN_1_2
+ update_pipeline_config(ch->bc);
+#else
ch->bc->ec_enable=1;
ch->bc->orig=ch->orginator;
tok++;
- if (tok) {
+ if (*tok) {
ch->bc->ec_deftaps=atoi(tok);
}
+#endif
}
break;