Enable/Disable echosquelch via capicommand().
parent
743e63fbf7
commit
202a55682e
2
Makefile
2
Makefile
|
@ -43,7 +43,7 @@ CC=gcc
|
|||
INSTALL=install
|
||||
|
||||
SHAREDOS=chan_capi.so app_capiHOLD.so app_capiRETRIEVE.so \
|
||||
app_capiECT.so app_capiMCID.so app_capiNoES.so
|
||||
app_capiECT.so app_capiMCID.so
|
||||
|
||||
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
|
||||
|
||||
|
|
10
README
10
README
|
@ -58,8 +58,6 @@ This chan_capi version includes:
|
|||
- report correct DIALSTATUS and HANGUPCAUSE.
|
||||
- Updated to support the new frame->delivery field
|
||||
- Compiles with different Asterisk versions (automatic build configuration)
|
||||
- Added app_capiNoES for disabling the primitive echo suppressor, use this
|
||||
before you start recording voicemail or your files may get choppy
|
||||
- receive faxes over CAPI (see below)
|
||||
- Fixes for BSD (Jan Stocker)
|
||||
- Support 'type of number'.
|
||||
|
@ -109,6 +107,14 @@ Fax receive:
|
|||
exten => s,1,capicommand(receivefax|/tmp/${UNIQUEID}|+49 6137 555123|Asterisk)
|
||||
(more see below)
|
||||
|
||||
Enable/Disable echosquelch:
|
||||
Enable or disable a very primitive echo suppressor.
|
||||
Disable this before you start recording voicemail or your files may get choppy.
|
||||
Example:
|
||||
exten => s,1,capicommand(echosquelch|yes)
|
||||
or
|
||||
exten => s,1,capicommand(echosquelch|no)
|
||||
|
||||
|
||||
Helper applications
|
||||
===================
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* (CAPI*)
|
||||
*
|
||||
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||
*
|
||||
* Disable echo suppression (useful for fax and voicemail!)
|
||||
*
|
||||
* Copyright (C) 2005 Cytronics & Melware
|
||||
*
|
||||
* Armin Schindler <armin@melware.de>
|
||||
*
|
||||
* Reworked, but based on the work of
|
||||
* Copyright (C) 2002-2005 Junghanns.NET GmbH
|
||||
*
|
||||
* Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
|
||||
*
|
||||
* This program is free software and may be modified and
|
||||
* distributed under the terms of the GNU Public License.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <asterisk/file.h>
|
||||
#include <asterisk/logger.h>
|
||||
#include <asterisk/channel.h>
|
||||
#ifndef CC_AST_HAVE_TECH_PVT
|
||||
#include <asterisk/channel_pvt.h>
|
||||
#endif
|
||||
#include <asterisk/pbx.h>
|
||||
#include <asterisk/module.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <capi20.h>
|
||||
#include "chan_capi_pvt.h"
|
||||
#include "chan_capi_app.h"
|
||||
|
||||
|
||||
|
||||
static char *tdesc = "(CAPI*) No Echo Suppression.";
|
||||
static char *app = "capiNoES";
|
||||
static char *synopsis = "Disable Echo Suppression";
|
||||
|
||||
STANDARD_LOCAL_USER;
|
||||
|
||||
LOCAL_USER_DECL;
|
||||
|
||||
static int capiNoES_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res=0;
|
||||
struct localuser *u;
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (strcasecmp("CAPI", chan->type) == 0) {
|
||||
struct ast_capi_pvt *i = CC_AST_CHANNEL_PVT(chan);
|
||||
if (i->doES == 1) {
|
||||
i->doES = 0;
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "capiNoES only works on CAPI channels, check your extensions.conf!\n");
|
||||
}
|
||||
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return res;
|
||||
}
|
||||
|
||||
int unload_module(void)
|
||||
{
|
||||
STANDARD_HANGUP_LOCALUSERS;
|
||||
return ast_unregister_application(app);
|
||||
}
|
||||
|
||||
int load_module(void)
|
||||
{
|
||||
return ast_register_application(app, capiNoES_exec, synopsis, tdesc);
|
||||
}
|
||||
|
||||
char *description(void)
|
||||
{
|
||||
return tdesc;
|
||||
}
|
||||
|
||||
int usecount(void)
|
||||
{
|
||||
int res;
|
||||
STANDARD_USECOUNT(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
char *key()
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
38
chan_capi.c
38
chan_capi.c
|
@ -2244,10 +2244,8 @@ static void capi_handle_data_b3_indication(_cmsg *CMSG, unsigned int PLCI, unsig
|
|||
} else {
|
||||
memset(b3buf, 84, b3len);
|
||||
}
|
||||
if (capidebug) {
|
||||
ast_log(LOG_NOTICE, "%s: SUPPRESSING ECHO rx=%d, tx=%d\n",
|
||||
cc_ast_verbose(6, 1, VERBOSE_PREFIX_2 "%s: SUPPRESSING ECHO rx=%d, tx=%d\n",
|
||||
i->name, rxavg, txavg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (j = 0; j < b3len; j++) {
|
||||
|
@ -3000,6 +2998,30 @@ static void capi_handle_msg(_cmsg *CMSG)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* set echo squelch
|
||||
*/
|
||||
static int capi_echosquelch(struct ast_channel *c, char *param)
|
||||
{
|
||||
struct ast_capi_pvt *i = CC_AST_CHANNEL_PVT(c);
|
||||
|
||||
if (!param) {
|
||||
ast_log(LOG_WARNING, "Parameter for echosquelch missing.\n");
|
||||
return -1;
|
||||
}
|
||||
if (ast_true(param)) {
|
||||
i->doES = 1;
|
||||
} else if (ast_false(param)) {
|
||||
i->doES = 0;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Parameter for echosquelch invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
cc_ast_verbose(2, 1, VERBOSE_PREFIX_1 "%s: echosquelch switched %s\n",
|
||||
i->name, i->doES ? "ON":"OFF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* set early-B3 for incoming connections
|
||||
* (only for NT mode)
|
||||
|
@ -3079,6 +3101,8 @@ static int capicommand_exec(struct ast_channel *chan, void *data)
|
|||
res = capi_call_deflect(chan, params);
|
||||
} else if (!strcasecmp(command, "receivefax")) {
|
||||
res = capi_receive_fax(chan, params);
|
||||
} else if (!strcasecmp(command, "echosquelch")) {
|
||||
res = capi_echosquelch(chan, params);
|
||||
} else {
|
||||
res = -1;
|
||||
ast_log(LOG_WARNING, "Unknown command '%s' for capiCommand\n",
|
||||
|
@ -3645,8 +3669,12 @@ static int conf_interface(struct ast_capi_conf *conf, struct ast_variable *v)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
CONF_INTEGER(conf->es, "echosquelch");
|
||||
|
||||
if (!strcasecmp(v->name, "echosquelch")) {
|
||||
if (ast_true(v->value)) {
|
||||
conf->es = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!strcasecmp(v->name, "callgroup")) {
|
||||
conf->callgroup = ast_get_group(v->value);
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue