- first step for cleanup to move some functions into specific files.
This commit is contained in:
parent
703088c8d6
commit
5d65ee3566
27
Makefile
27
Makefile
|
@ -1,8 +1,7 @@
|
||||||
#
|
#
|
||||||
# (CAPI*)
|
# (CAPI*)
|
||||||
#
|
#
|
||||||
# An implementation of Common ISDN API 2.0 for
|
# An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
# Asterisk/OpenPBX.org
|
|
||||||
#
|
#
|
||||||
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
# Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer
|
||||||
#
|
#
|
||||||
|
@ -93,7 +92,9 @@ INSTALL=install
|
||||||
|
|
||||||
SHAREDOS=chan_capi.so
|
SHAREDOS=chan_capi.so
|
||||||
|
|
||||||
OBJECTS=chan_capi.o c20msg.o chan_capi_rtp.o chan_capi_qsig_core.o chan_capi_qsig_ecma.o chan_capi_qsig_asn197ade.o chan_capi_qsig_asn197no.o
|
OBJECTS=chan_capi.o chan_capi_utils.o chan_capi_rtp.o \
|
||||||
|
chan_capi_qsig_core.o chan_capi_qsig_ecma.o chan_capi_qsig_asn197ade.o \
|
||||||
|
chan_capi_qsig_asn197no.o chan_capi_supplementary.o
|
||||||
|
|
||||||
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
|
CFLAGS+=-Wno-missing-prototypes -Wno-missing-declarations
|
||||||
|
|
||||||
|
@ -141,23 +142,3 @@ install_config: capi.conf
|
||||||
|
|
||||||
samples: install_config
|
samples: install_config
|
||||||
|
|
||||||
openpbx:
|
|
||||||
@rm -rf openpbx
|
|
||||||
@mkdir -p openpbx/channels
|
|
||||||
@mkdir -p openpbx/include/openpbx
|
|
||||||
@mkdir -p openpbx/doc
|
|
||||||
@mkdir -p openpbx/configs
|
|
||||||
@( \
|
|
||||||
./preparser -c openpbx.ctrl chan_capi.c openpbx/channels/chan_capi.c; \
|
|
||||||
./preparser -c openpbx.ctrl chan_capi_rtp.c openpbx/channels/chan_capi_rtp.c; \
|
|
||||||
./preparser -c openpbx.ctrl c20msg.c openpbx/channels/c20msg.c; \
|
|
||||||
./preparser -c openpbx.ctrl chan_capi.h openpbx/include/openpbx/chan_capi.h; \
|
|
||||||
./preparser -c openpbx.ctrl chan_capi_rtp.h openpbx/include/openpbx/chan_capi_rtp.h; \
|
|
||||||
./preparser -c openpbx.ctrl chan_capi20.h openpbx/include/openpbx/chan_capi20.h; \
|
|
||||||
./preparser -c openpbx.ctrl xlaw.h openpbx/include/openpbx/xlaw.h; \
|
|
||||||
./preparser -c openpbx.ctrl README openpbx/doc/README.chan_capi; \
|
|
||||||
./preparser -c openpbx.ctrl capi.conf openpbx/configs/capi.conf.sample; \
|
|
||||||
true; \
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
13
README
13
README
|
@ -1,5 +1,4 @@
|
||||||
(CAPI*) chan_capi a Common ISDN API 2.0 implementation
|
(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk
|
||||||
for Asterisk/OpenPBX
|
|
||||||
|
|
||||||
Copyright (C) 2005-2007 Cytronics & Melware
|
Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
Armin Schindler <armin@melware.de>
|
Armin Schindler <armin@melware.de>
|
||||||
|
@ -8,9 +7,6 @@ for Asterisk/OpenPBX
|
||||||
Copyright (C) 2002-2005 Junghanns.NET GmbH
|
Copyright (C) 2002-2005 Junghanns.NET GmbH
|
||||||
Klaus-Peter Junghanns <kpj@junghanns.net>
|
Klaus-Peter Junghanns <kpj@junghanns.net>
|
||||||
|
|
||||||
Ported to OpenPBX.org 22nd October 2004,
|
|
||||||
Rob Thomas, <xrobau@gmail.com>
|
|
||||||
|
|
||||||
This program is free software and may be modified and distributed under
|
This program is free software and may be modified and distributed under
|
||||||
the terms of the GNU Public License. There is _NO_ warranty for this!
|
the terms of the GNU Public License. There is _NO_ warranty for this!
|
||||||
|
|
||||||
|
@ -73,13 +69,6 @@ This chan_capi version includes:
|
||||||
- Asterisk 1.4 jitterbuffer configuration.
|
- Asterisk 1.4 jitterbuffer configuration.
|
||||||
- some QSIG extensions (see README.qsig)
|
- some QSIG extensions (see README.qsig)
|
||||||
|
|
||||||
Permissions
|
|
||||||
===========
|
|
||||||
|
|
||||||
OpenPBX.org, by default, runs as the non-root user/group
|
|
||||||
openpbx/openpbx. You must make sure that the /dev/capi* device files
|
|
||||||
are readable by OpenPBX.org either by changing the ownership or the
|
|
||||||
permissions of the the device files or by running OpenPBX.org as root.
|
|
||||||
|
|
||||||
The Dial string
|
The Dial string
|
||||||
===============
|
===============
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
(CAPI*) chan_capi a Common ISDN API 2.0 implementation
|
(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk
|
||||||
for Asterisk/OpenPBX
|
|
||||||
|
|
||||||
QSIG Extension for chan_capi
|
QSIG Extension for chan_capi
|
||||||
|
|
||||||
|
|
200
chan_capi.c
200
chan_capi.c
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
*
|
*
|
||||||
|
@ -16,11 +15,6 @@
|
||||||
* This program is free software and may be modified and
|
* This program is free software and may be modified and
|
||||||
* distributed under the terms of the GNU Public License.
|
* distributed under the terms of the GNU Public License.
|
||||||
*/
|
*/
|
||||||
#ifdef PBX_IS_OPBX
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "confdefs.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
|
@ -33,58 +27,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef PBX_IS_OPBX
|
|
||||||
#include "openpbx.h"
|
|
||||||
|
|
||||||
OPENPBX_FILE_VERSION("$HeadURL$", "$Revision$")
|
|
||||||
|
|
||||||
#include "openpbx/lock.h"
|
|
||||||
#include "openpbx/frame.h"
|
|
||||||
#include "openpbx/channel.h"
|
|
||||||
#include "openpbx/logger.h"
|
|
||||||
#include "openpbx/module.h"
|
|
||||||
#include "openpbx/pbx.h"
|
|
||||||
#include "openpbx/config.h"
|
|
||||||
#include "openpbx/options.h"
|
|
||||||
#include "openpbx/features.h"
|
|
||||||
#include "openpbx/utils.h"
|
|
||||||
#include "openpbx/cli.h"
|
|
||||||
#include "openpbx/rtp.h"
|
|
||||||
#include "openpbx/causes.h"
|
|
||||||
#include "openpbx/strings.h"
|
|
||||||
#include "openpbx/devicestate.h"
|
|
||||||
#include "openpbx/dsp.h"
|
|
||||||
#include "openpbx/xlaw.h"
|
|
||||||
#include "openpbx/chan_capi20.h"
|
|
||||||
#include "openpbx/chan_capi.h"
|
|
||||||
#include "openpbx/chan_capi_rtp.h"
|
|
||||||
#else
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#ifdef CC_AST_HAS_VERSION_1_4
|
|
||||||
#include <asterisk.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <asterisk/lock.h>
|
|
||||||
#include <asterisk/frame.h>
|
|
||||||
#include <asterisk/channel.h>
|
|
||||||
#include <asterisk/logger.h>
|
|
||||||
#include <asterisk/module.h>
|
|
||||||
#include <asterisk/pbx.h>
|
|
||||||
#include <asterisk/config.h>
|
|
||||||
#include <asterisk/options.h>
|
|
||||||
#include <asterisk/features.h>
|
|
||||||
#include <asterisk/utils.h>
|
|
||||||
#include <asterisk/cli.h>
|
|
||||||
#include <asterisk/rtp.h>
|
|
||||||
#include <asterisk/causes.h>
|
|
||||||
#include <asterisk/strings.h>
|
|
||||||
#include <asterisk/dsp.h>
|
|
||||||
#include <asterisk/devicestate.h>
|
|
||||||
#ifdef CC_AST_HAS_VERSION_1_4
|
|
||||||
#include "asterisk/abstract_jb.h"
|
|
||||||
#include "asterisk/musiconhold.h"
|
|
||||||
#endif
|
|
||||||
#include "xlaw.h"
|
#include "xlaw.h"
|
||||||
#include "chan_capi20.h"
|
#include "chan_capi20.h"
|
||||||
#include "chan_capi.h"
|
#include "chan_capi.h"
|
||||||
|
@ -92,14 +34,11 @@ OPENPBX_FILE_VERSION("$HeadURL$", "$Revision$")
|
||||||
#include "chan_capi_qsig.h"
|
#include "chan_capi_qsig.h"
|
||||||
#include "chan_capi_qsig_asn197ade.h"
|
#include "chan_capi_qsig_asn197ade.h"
|
||||||
#include "chan_capi_qsig_asn197no.h"
|
#include "chan_capi_qsig_asn197no.h"
|
||||||
#endif
|
#include "chan_capi_utils.h"
|
||||||
|
#include "chan_capi_supplementary.h"
|
||||||
|
|
||||||
#ifdef PBX_IS_OPBX
|
|
||||||
#define CC_VERSION "cm-opbx-1.0"
|
|
||||||
#else
|
|
||||||
/* #define CC_VERSION "x.y.z" */
|
/* #define CC_VERSION "x.y.z" */
|
||||||
#define CC_VERSION "$Revision$"
|
#define CC_VERSION "$Revision$"
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* personal stuff
|
* personal stuff
|
||||||
|
@ -115,12 +54,8 @@ static const struct ast_channel_tech capi_tech;
|
||||||
#ifdef CC_AST_HAS_VERSION_1_4
|
#ifdef CC_AST_HAS_VERSION_1_4
|
||||||
#define AST_MODULE "chan_capi"
|
#define AST_MODULE "chan_capi"
|
||||||
#else
|
#else
|
||||||
#ifdef PBX_IS_OPBX
|
|
||||||
static char *ccdesc = "Common ISDN API for OpenPBX";
|
|
||||||
#else
|
|
||||||
static char *ccdesc = "Common ISDN API for Asterisk";
|
static char *ccdesc = "Common ISDN API for Asterisk";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
static char *commandtdesc = "CAPI command interface.\n"
|
static char *commandtdesc = "CAPI command interface.\n"
|
||||||
"The dial command:\n"
|
"The dial command:\n"
|
||||||
|
@ -253,16 +188,6 @@ static int pbx_capi_indicate(struct ast_channel *c, int condition, const void *d
|
||||||
static int pbx_capi_indicate(struct ast_channel *c, int condition);
|
static int pbx_capi_indicate(struct ast_channel *c, int condition);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* external prototypes */
|
|
||||||
extern char *capi_info_string(unsigned int info);
|
|
||||||
|
|
||||||
/* */
|
|
||||||
#define return_on_no_interface(x) \
|
|
||||||
if (!i) { \
|
|
||||||
cc_verbose(4, 1, "CAPI: %s no interface for PLCI=%#x\n", x, PLCI); \
|
|
||||||
return; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* helper for <pbx>_verbose with different verbose settings
|
* helper for <pbx>_verbose with different verbose settings
|
||||||
*/
|
*/
|
||||||
|
@ -374,32 +299,6 @@ static const char * capi_command_to_string(unsigned short wCmd)
|
||||||
return "UNDEFINED";
|
return "UNDEFINED";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* show the text for a CAPI message info value
|
|
||||||
*/
|
|
||||||
static void show_capi_info(struct capi_pvt *i, _cword info)
|
|
||||||
{
|
|
||||||
char *p;
|
|
||||||
char *name = "?";
|
|
||||||
|
|
||||||
if (info == 0x0000) {
|
|
||||||
/* no error, do nothing */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(p = capi_info_string((unsigned int)info))) {
|
|
||||||
/* message not available */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i)
|
|
||||||
name = i->vname;
|
|
||||||
|
|
||||||
cc_verbose(3, 0, VERBOSE_PREFIX_4 "%s: CAPI INFO 0x%04x: %s\n",
|
|
||||||
name, info, p);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get a new capi message number automically
|
* get a new capi message number automically
|
||||||
*/
|
*/
|
||||||
|
@ -1259,7 +1158,7 @@ static void cc_disconnect_b3(struct capi_pvt *i, int wait)
|
||||||
/*
|
/*
|
||||||
* send CONNECT_B3_REQ
|
* send CONNECT_B3_REQ
|
||||||
*/
|
*/
|
||||||
static void cc_start_b3(struct capi_pvt *i)
|
void cc_start_b3(struct capi_pvt *i)
|
||||||
{
|
{
|
||||||
_cmsg CMSG;
|
_cmsg CMSG;
|
||||||
|
|
||||||
|
@ -3313,95 +3212,6 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* CAPI FACILITY_IND supplementary services
|
|
||||||
*/
|
|
||||||
static void handle_facility_indication_supplementary(
|
|
||||||
_cmsg *CMSG, unsigned int PLCI, unsigned int NCCI, struct capi_pvt *i)
|
|
||||||
{
|
|
||||||
_cword function;
|
|
||||||
_cword infoword = 0xffff;
|
|
||||||
unsigned char length;
|
|
||||||
|
|
||||||
function = read_capi_word(&FACILITY_IND_FACILITYINDICATIONPARAMETER(CMSG)[1]);
|
|
||||||
length = FACILITY_IND_FACILITYINDICATIONPARAMETER(CMSG)[3];
|
|
||||||
|
|
||||||
if (length >= 2) {
|
|
||||||
infoword = read_capi_word(&FACILITY_IND_FACILITYINDICATIONPARAMETER(CMSG)[4]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* first check functions without interface needed */
|
|
||||||
switch (function) {
|
|
||||||
case 0x800d: /* CCBS erase call linkage ID */
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "contr%d: PLCI=%#x CCBS/CCNR erase id=0x%04x\n",
|
|
||||||
PLCI & 0xff, PLCI, infoword);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return_on_no_interface("FACILITY_IND SUPPLEMENTARY");
|
|
||||||
|
|
||||||
/* now functions bound to interface */
|
|
||||||
switch (function) {
|
|
||||||
case 0x0002: /* HOLD */
|
|
||||||
if (infoword != 0) {
|
|
||||||
/* reason != 0x0000 == problem */
|
|
||||||
i->onholdPLCI = 0;
|
|
||||||
cc_log(LOG_WARNING, "%s: unable to put PLCI=%#x onhold, REASON = 0x%04x, maybe you need to subscribe for this...\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
show_capi_info(i, infoword);
|
|
||||||
} else {
|
|
||||||
/* reason = 0x0000 == call on hold */
|
|
||||||
i->state = CAPI_STATE_ONHOLD;
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x put onhold\n",
|
|
||||||
i->vname, PLCI);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0x0003: /* RETRIEVE */
|
|
||||||
if (infoword != 0) {
|
|
||||||
cc_log(LOG_WARNING, "%s: unable to retrieve PLCI=%#x, REASON = 0x%04x\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
show_capi_info(i, infoword);
|
|
||||||
} else {
|
|
||||||
i->state = CAPI_STATE_CONNECTED;
|
|
||||||
i->PLCI = i->onholdPLCI;
|
|
||||||
i->onholdPLCI = 0;
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x retrieved\n",
|
|
||||||
i->vname, PLCI);
|
|
||||||
cc_start_b3(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0x0006: /* ECT */
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x ECT Reason=0x%04x\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
show_capi_info(i, infoword);
|
|
||||||
break;
|
|
||||||
case 0x0007: /* 3PTY begin */
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x 3PTY begin Reason=0x%04x\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
show_capi_info(i, infoword);
|
|
||||||
break;
|
|
||||||
case 0x0008: /* 3PTY end */
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x 3PTY end Reason=0x%04x\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
show_capi_info(i, infoword);
|
|
||||||
break;
|
|
||||||
case 0x8013: /* CCBS info retain */
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x CCBS unique id=0x%04x\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
break;
|
|
||||||
case 0x8015: /* CCNR info retain */
|
|
||||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x CCNR unique id=0x%04x\n",
|
|
||||||
i->vname, PLCI, infoword);
|
|
||||||
break;
|
|
||||||
case 0x800d: /* CCBS erase call linkage ID */
|
|
||||||
/* handled above */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: unhandled FACILITY_IND supplementary function %04x\n",
|
|
||||||
i->vname, function);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CAPI FACILITY_IND line interconnect
|
* CAPI FACILITY_IND line interconnect
|
||||||
*/
|
*/
|
||||||
|
@ -6498,10 +6308,8 @@ char *description()
|
||||||
return ccdesc;
|
return ccdesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PBX_IS_OPBX
|
|
||||||
char *key()
|
char *key()
|
||||||
{
|
{
|
||||||
return ASTERISK_GPL_KEY;
|
return ASTERISK_GPL_KEY;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif /* CC_AST_HAS_VERSION_1_4 */
|
#endif /* CC_AST_HAS_VERSION_1_4 */
|
||||||
|
|
52
chan_capi.h
52
chan_capi.h
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
*
|
*
|
||||||
|
@ -17,6 +16,33 @@
|
||||||
* distributed under the terms of the GNU Public License.
|
* distributed under the terms of the GNU Public License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef CC_AST_HAS_VERSION_1_4
|
||||||
|
#include <asterisk.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <asterisk/lock.h>
|
||||||
|
#include <asterisk/frame.h>
|
||||||
|
#include <asterisk/channel.h>
|
||||||
|
#include <asterisk/logger.h>
|
||||||
|
#include <asterisk/module.h>
|
||||||
|
#include <asterisk/pbx.h>
|
||||||
|
#include <asterisk/config.h>
|
||||||
|
#include <asterisk/options.h>
|
||||||
|
#include <asterisk/features.h>
|
||||||
|
#include <asterisk/utils.h>
|
||||||
|
#include <asterisk/cli.h>
|
||||||
|
#include <asterisk/rtp.h>
|
||||||
|
#include <asterisk/causes.h>
|
||||||
|
#include <asterisk/strings.h>
|
||||||
|
#include <asterisk/dsp.h>
|
||||||
|
#include <asterisk/devicestate.h>
|
||||||
|
#ifdef CC_AST_HAS_VERSION_1_4
|
||||||
|
#include "asterisk/abstract_jb.h"
|
||||||
|
#include "asterisk/musiconhold.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _PBX_CAPI_H
|
#ifndef _PBX_CAPI_H
|
||||||
#define _PBX_CAPI_H
|
#define _PBX_CAPI_H
|
||||||
|
|
||||||
|
@ -101,13 +127,12 @@ static inline unsigned int read_capi_dword(void *m)
|
||||||
|
|
||||||
#endif /* PBX_IS_OPBX */
|
#endif /* PBX_IS_OPBX */
|
||||||
|
|
||||||
/*
|
/* */
|
||||||
* prototypes
|
#define return_on_no_interface(x) \
|
||||||
*/
|
if (!i) { \
|
||||||
extern unsigned capi_ApplID;
|
cc_verbose(4, 1, "CAPI: %s no interface for PLCI=%#x\n", x, PLCI); \
|
||||||
extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
|
return; \
|
||||||
extern _cword get_capi_MessageNumber(void);
|
}
|
||||||
extern void cc_verbose(int o_v, int c_d, char *text, ...);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* B protocol settings
|
* B protocol settings
|
||||||
|
@ -529,4 +554,13 @@ struct cc_capi_controller {
|
||||||
#define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11
|
#define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11
|
||||||
#define PRI_TRANS_CAP_VIDEO 0x18
|
#define PRI_TRANS_CAP_VIDEO 0x18
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prototypes
|
||||||
|
*/
|
||||||
|
extern unsigned capi_ApplID;
|
||||||
|
extern MESSAGE_EXCHANGE_ERROR _capi_put_cmsg(_cmsg *CMSG);
|
||||||
|
extern _cword get_capi_MessageNumber(void);
|
||||||
|
extern void cc_verbose(int o_v, int c_d, char *text, ...);
|
||||||
|
extern void cc_start_b3(struct capi_pvt *i);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
* Copyright (C) 2007 Mario Goegel
|
* Copyright (C) 2007 Mario Goegel
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
* Copyright (C) 2007 Mario Goegel
|
* Copyright (C) 2007 Mario Goegel
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
* Copyright (C) 2007 Mario Goegel
|
* Copyright (C) 2007 Mario Goegel
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
* Copyright (C) 2007 Mario Goegel
|
* Copyright (C) 2007 Mario Goegel
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
* Copyright (C) 2007 Mario Goegel
|
* Copyright (C) 2007 Mario Goegel
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Cytronics & Melware
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
* Copyright (C) 2007 Mario Goegel
|
* Copyright (C) 2007 Mario Goegel
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2007 Cytronics & Melware
|
* Copyright (C) 2006-2007 Cytronics & Melware
|
||||||
*
|
*
|
||||||
|
@ -11,11 +10,6 @@
|
||||||
* This program is free software and may be modified and
|
* This program is free software and may be modified and
|
||||||
* distributed under the terms of the GNU Public License.
|
* distributed under the terms of the GNU Public License.
|
||||||
*/
|
*/
|
||||||
#ifdef PBX_IS_OPBX
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "confdefs.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -27,41 +21,9 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#ifdef PBX_IS_OPBX
|
|
||||||
#include "openpbx/lock.h"
|
|
||||||
#include "openpbx/frame.h"
|
|
||||||
#include "openpbx/channel.h"
|
|
||||||
#include "openpbx/logger.h"
|
|
||||||
#include "openpbx/module.h"
|
|
||||||
#include "openpbx/pbx.h"
|
|
||||||
#include "openpbx/config.h"
|
|
||||||
#include "openpbx/options.h"
|
|
||||||
#include "openpbx/features.h"
|
|
||||||
#include "openpbx/utils.h"
|
|
||||||
#include "openpbx/rtp.h"
|
|
||||||
#include "openpbx/strings.h"
|
|
||||||
#include "openpbx/chan_capi20.h"
|
|
||||||
#include "openpbx/chan_capi.h"
|
|
||||||
#include "openpbx/chan_capi_rtp.h"
|
|
||||||
#else
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <asterisk/lock.h>
|
|
||||||
#include <asterisk/frame.h>
|
|
||||||
#include <asterisk/channel.h>
|
|
||||||
#include <asterisk/logger.h>
|
|
||||||
#include <asterisk/module.h>
|
|
||||||
#include <asterisk/pbx.h>
|
|
||||||
#include <asterisk/config.h>
|
|
||||||
#include <asterisk/options.h>
|
|
||||||
#include <asterisk/features.h>
|
|
||||||
#include <asterisk/utils.h>
|
|
||||||
#include <asterisk/rtp.h>
|
|
||||||
#include <asterisk/strings.h>
|
|
||||||
#include "chan_capi20.h"
|
#include "chan_capi20.h"
|
||||||
#include "chan_capi.h"
|
#include "chan_capi.h"
|
||||||
#include "chan_capi_rtp.h"
|
#include "chan_capi_rtp.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/* RTP settings / NCPI RTP struct */
|
/* RTP settings / NCPI RTP struct */
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* (CAPI*)
|
* (CAPI*)
|
||||||
*
|
*
|
||||||
* An implementation of Common ISDN API 2.0 for
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
* Asterisk / OpenPBX.org
|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2007 Cytronics & Melware
|
* Copyright (C) 2006-2007 Cytronics & Melware
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* (CAPI*)
|
||||||
|
*
|
||||||
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005-2007 Cytronics & Melware
|
||||||
|
*
|
||||||
|
* Armin Schindler <armin@melware.de>
|
||||||
|
*
|
||||||
|
* This program is free software and may be modified and
|
||||||
|
* distributed under the terms of the GNU Public License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "chan_capi20.h"
|
||||||
|
#include "chan_capi.h"
|
||||||
|
#include "chan_capi_supplementary.h"
|
||||||
|
#include "chan_capi_utils.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CAPI FACILITY_IND supplementary services
|
||||||
|
*/
|
||||||
|
void handle_facility_indication_supplementary(
|
||||||
|
_cmsg *CMSG, unsigned int PLCI, unsigned int NCCI, struct capi_pvt *i)
|
||||||
|
{
|
||||||
|
_cword function;
|
||||||
|
_cword infoword = 0xffff;
|
||||||
|
unsigned char length;
|
||||||
|
|
||||||
|
function = read_capi_word(&FACILITY_IND_FACILITYINDICATIONPARAMETER(CMSG)[1]);
|
||||||
|
length = FACILITY_IND_FACILITYINDICATIONPARAMETER(CMSG)[3];
|
||||||
|
|
||||||
|
if (length >= 2) {
|
||||||
|
infoword = read_capi_word(&FACILITY_IND_FACILITYINDICATIONPARAMETER(CMSG)[4]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* first check functions without interface needed */
|
||||||
|
switch (function) {
|
||||||
|
case 0x800d: /* CCBS erase call linkage ID */
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "contr%d: PLCI=%#x CCBS/CCNR erase id=0x%04x\n",
|
||||||
|
PLCI & 0xff, PLCI, infoword);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return_on_no_interface("FACILITY_IND SUPPLEMENTARY");
|
||||||
|
|
||||||
|
/* now functions bound to interface */
|
||||||
|
switch (function) {
|
||||||
|
case 0x0002: /* HOLD */
|
||||||
|
if (infoword != 0) {
|
||||||
|
/* reason != 0x0000 == problem */
|
||||||
|
i->onholdPLCI = 0;
|
||||||
|
cc_log(LOG_WARNING, "%s: unable to put PLCI=%#x onhold, REASON = 0x%04x, maybe you need to subscribe for this...\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
show_capi_info(i, infoword);
|
||||||
|
} else {
|
||||||
|
/* reason = 0x0000 == call on hold */
|
||||||
|
i->state = CAPI_STATE_ONHOLD;
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x put onhold\n",
|
||||||
|
i->vname, PLCI);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x0003: /* RETRIEVE */
|
||||||
|
if (infoword != 0) {
|
||||||
|
cc_log(LOG_WARNING, "%s: unable to retrieve PLCI=%#x, REASON = 0x%04x\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
show_capi_info(i, infoword);
|
||||||
|
} else {
|
||||||
|
i->state = CAPI_STATE_CONNECTED;
|
||||||
|
i->PLCI = i->onholdPLCI;
|
||||||
|
i->onholdPLCI = 0;
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x retrieved\n",
|
||||||
|
i->vname, PLCI);
|
||||||
|
cc_start_b3(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x0006: /* ECT */
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x ECT Reason=0x%04x\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
show_capi_info(i, infoword);
|
||||||
|
break;
|
||||||
|
case 0x0007: /* 3PTY begin */
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x 3PTY begin Reason=0x%04x\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
show_capi_info(i, infoword);
|
||||||
|
break;
|
||||||
|
case 0x0008: /* 3PTY end */
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x 3PTY end Reason=0x%04x\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
show_capi_info(i, infoword);
|
||||||
|
break;
|
||||||
|
case 0x8013: /* CCBS info retain */
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x CCBS unique id=0x%04x\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
break;
|
||||||
|
case 0x8015: /* CCNR info retain */
|
||||||
|
cc_verbose(1, 1, VERBOSE_PREFIX_3 "%s: PLCI=%#x CCNR unique id=0x%04x\n",
|
||||||
|
i->vname, PLCI, infoword);
|
||||||
|
break;
|
||||||
|
case 0x800d: /* CCBS erase call linkage ID */
|
||||||
|
/* handled above */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
cc_verbose(3, 1, VERBOSE_PREFIX_3 "%s: unhandled FACILITY_IND supplementary function %04x\n",
|
||||||
|
i->vname, function);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* (CAPI*)
|
||||||
|
*
|
||||||
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2007 Cytronics & Melware
|
||||||
|
*
|
||||||
|
* Armin Schindler <armin@melware.de>
|
||||||
|
*
|
||||||
|
* This program is free software and may be modified and
|
||||||
|
* distributed under the terms of the GNU Public License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PBX_CAPI_SUPP_H
|
||||||
|
#define _PBX_CAPI_SUPP_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prototypes
|
||||||
|
*/
|
||||||
|
extern void handle_facility_indication_supplementary(_cmsg *CMSG, unsigned int PLCI, unsigned int NCCI, struct capi_pvt *i);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +1,20 @@
|
||||||
|
/*
|
||||||
|
* (CAPI*)
|
||||||
|
*
|
||||||
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2007 Cytronics & Melware
|
||||||
|
*
|
||||||
|
* Armin Schindler <armin@melware.de>
|
||||||
|
*
|
||||||
|
* This program is free software and may be modified and
|
||||||
|
* distributed under the terms of the GNU Public License.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "chan_capi20.h"
|
||||||
|
#include "chan_capi.h"
|
||||||
|
#include "chan_capi_utils.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* decode capi 2.0 info word
|
* decode capi 2.0 info word
|
||||||
|
@ -333,3 +349,29 @@ char *capi_info_string(unsigned int info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* show the text for a CAPI message info value
|
||||||
|
*/
|
||||||
|
void show_capi_info(struct capi_pvt *i, _cword info)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
char *name = "?";
|
||||||
|
|
||||||
|
if (info == 0x0000) {
|
||||||
|
/* no error, do nothing */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(p = capi_info_string((unsigned int)info))) {
|
||||||
|
/* message not available */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i)
|
||||||
|
name = i->vname;
|
||||||
|
|
||||||
|
cc_verbose(3, 0, VERBOSE_PREFIX_4 "%s: CAPI INFO 0x%04x: %s\n",
|
||||||
|
name, info, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* (CAPI*)
|
||||||
|
*
|
||||||
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2007 Cytronics & Melware
|
||||||
|
*
|
||||||
|
* Armin Schindler <armin@melware.de>
|
||||||
|
*
|
||||||
|
* This program is free software and may be modified and
|
||||||
|
* distributed under the terms of the GNU Public License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PBX_CAPI_UTILS_H
|
||||||
|
#define _PBX_CAPI_UTILS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prototypes
|
||||||
|
*/
|
||||||
|
extern char *capi_info_string(unsigned int info);
|
||||||
|
extern void show_capi_info(struct capi_pvt *i, _cword info);
|
||||||
|
|
||||||
|
#endif
|
|
@ -5,7 +5,7 @@
|
||||||
# Script to create config.h for compatibility with
|
# Script to create config.h for compatibility with
|
||||||
# different asterisk versions.
|
# different asterisk versions.
|
||||||
#
|
#
|
||||||
# (C) 2005 Cytronics & Melware
|
# (C) 2005-2007 Cytronics & Melware
|
||||||
# Armin Schindler <armin@melware.de>
|
# Armin Schindler <armin@melware.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue