MCID is now done via capicommand()
parent
202a55682e
commit
d057edc4e7
3
Makefile
3
Makefile
|
@ -42,8 +42,7 @@ LIBS=-ldl -lpthread -lm
|
|||
CC=gcc
|
||||
INSTALL=install
|
||||
|
||||
SHAREDOS=chan_capi.so app_capiHOLD.so app_capiRETRIEVE.so \
|
||||
app_capiECT.so app_capiMCID.so
|
||||
SHAREDOS=chan_capi.so app_capiHOLD.so app_capiRETRIEVE.so app_capiECT.so
|
||||
|
||||
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
|
||||
|
||||
|
|
7
README
7
README
|
@ -112,9 +112,14 @@ Enable/Disable echosquelch:
|
|||
Disable this before you start recording voicemail or your files may get choppy.
|
||||
Example:
|
||||
exten => s,1,capicommand(echosquelch|yes)
|
||||
or
|
||||
or
|
||||
exten => s,1,capicommand(echosquelch|no)
|
||||
|
||||
Malicious Call Identification:
|
||||
Report a call of malicious nature.
|
||||
Example:
|
||||
exten => s,1,capicommand(malicious)
|
||||
|
||||
|
||||
Helper applications
|
||||
===================
|
||||
|
|
123
app_capiMCID.c
123
app_capiMCID.c
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
* (CAPI*)
|
||||
*
|
||||
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||
*
|
||||
* Malicious Caller ID
|
||||
*
|
||||
* 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*) Malicious Caller ID, the evil thing.";
|
||||
static char *app = "capiMCID";
|
||||
static char *synopsis = "malicious caller id";
|
||||
|
||||
STANDARD_LOCAL_USER;
|
||||
|
||||
LOCAL_USER_DECL;
|
||||
|
||||
static int capiMCID_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
struct ast_capi_pvt *i = CC_AST_CHANNEL_PVT(chan);
|
||||
MESSAGE_EXCHANGE_ERROR Info;
|
||||
_cmsg CMSG;
|
||||
char fac[4];
|
||||
int res = 0;
|
||||
struct localuser *u;
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
/* Do our thing here */
|
||||
|
||||
/*
|
||||
if ((i->state != CAPI_STATE_CONNECTED) && (i->state != CAPI_STATE_BCONNECTED)) {
|
||||
ast_log(LOG_ERROR, "need to accept the call first to MCID!\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
fac[0] = 3; /* len */
|
||||
fac[1] = 0x0d;
|
||||
fac[2] = 0x00;
|
||||
fac[3] = 0;
|
||||
|
||||
FACILITY_REQ_HEADER(&CMSG,ast_capi_ApplID, get_ast_capi_MessageNumber(),0);
|
||||
FACILITY_REQ_PLCI(&CMSG) = i->PLCI;
|
||||
FACILITY_REQ_FACILITYSELECTOR(&CMSG) = 0x0003; /* sservices */
|
||||
FACILITY_REQ_FACILITYREQUESTPARAMETER(&CMSG) = (char *)&fac;
|
||||
|
||||
if ((Info = _capi_put_cmsg(&CMSG)) != 0) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return Info;
|
||||
} else {
|
||||
if (capidebug) {
|
||||
ast_log(LOG_NOTICE,"sent FACILITY_REQ PLCI = %#x\n",
|
||||
i->PLCI);
|
||||
}
|
||||
}
|
||||
|
||||
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, capiMCID_exec, synopsis, tdesc);
|
||||
}
|
||||
|
||||
char *description(void)
|
||||
{
|
||||
return tdesc;
|
||||
}
|
||||
|
||||
int usecount(void)
|
||||
{
|
||||
int res;
|
||||
STANDARD_USECOUNT(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
char *key()
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
28
chan_capi.c
28
chan_capi.c
|
@ -2997,6 +2997,32 @@ static void capi_handle_msg(_cmsg *CMSG)
|
|||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* report malicious call
|
||||
*/
|
||||
static int capi_malicious(struct ast_channel *c, char *param)
|
||||
{
|
||||
struct ast_capi_pvt *i = CC_AST_CHANNEL_PVT(c);
|
||||
_cmsg CMSG;
|
||||
char fac[4];
|
||||
|
||||
fac[0] = 3; /* len */
|
||||
fac[1] = 0x0e; /* MCID */
|
||||
fac[2] = 0x00;
|
||||
fac[3] = 0;
|
||||
|
||||
FACILITY_REQ_HEADER(&CMSG,ast_capi_ApplID, get_ast_capi_MessageNumber(),0);
|
||||
FACILITY_REQ_PLCI(&CMSG) = i->PLCI;
|
||||
FACILITY_REQ_FACILITYSELECTOR(&CMSG) = FACILITYSELECTOR_SUPPLEMENTARY;
|
||||
FACILITY_REQ_FACILITYREQUESTPARAMETER(&CMSG) = (char *)&fac;
|
||||
|
||||
_capi_put_cmsg(&CMSG);
|
||||
|
||||
cc_ast_verbose(2, 1, VERBOSE_PREFIX_1 "%s: sent MCID for PLCI=%#x\n",
|
||||
i->name, i->PLCI);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* set echo squelch
|
||||
|
@ -3103,6 +3129,8 @@ static int capicommand_exec(struct ast_channel *chan, void *data)
|
|||
res = capi_receive_fax(chan, params);
|
||||
} else if (!strcasecmp(command, "echosquelch")) {
|
||||
res = capi_echosquelch(chan, params);
|
||||
} else if (!strcasecmp(command, "malicious")) {
|
||||
res = capi_malicious(chan, params);
|
||||
} else {
|
||||
res = -1;
|
||||
ast_log(LOG_WARNING, "Unknown command '%s' for capiCommand\n",
|
||||
|
|
Loading…
Reference in New Issue