diff --git a/Makefile b/Makefile index 587b272..80aa33d 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,7 @@ # # (CAPI*) # -# An implementation of Common ISDN API 2.0 for -# Asterisk/OpenPBX.org +# An implementation of Common ISDN API 2.0 for Asterisk # # Makefile, based on the Asterisk Makefile, Coypright (C) 1999, Mark Spencer # @@ -93,7 +92,9 @@ INSTALL=install 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 @@ -141,23 +142,3 @@ install_config: capi.conf 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; \ - ) - - diff --git a/README b/README index 9d48849..c759fe2 100644 --- a/README +++ b/README @@ -1,5 +1,4 @@ -(CAPI*) chan_capi a Common ISDN API 2.0 implementation -for Asterisk/OpenPBX +(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk Copyright (C) 2005-2007 Cytronics & Melware Armin Schindler @@ -8,9 +7,6 @@ for Asterisk/OpenPBX Copyright (C) 2002-2005 Junghanns.NET GmbH Klaus-Peter Junghanns - Ported to OpenPBX.org 22nd October 2004, - Rob Thomas, - 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! @@ -73,13 +69,6 @@ This chan_capi version includes: - Asterisk 1.4 jitterbuffer configuration. - 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 =============== diff --git a/README.qsig b/README.qsig index 67a9148..cea1fdc 100644 --- a/README.qsig +++ b/README.qsig @@ -1,5 +1,4 @@ -(CAPI*) chan_capi a Common ISDN API 2.0 implementation -for Asterisk/OpenPBX +(CAPI*) chan_capi a Common ISDN API 2.0 implementation for Asterisk QSIG Extension for chan_capi diff --git a/chan_capi.c b/chan_capi.c index 36c42b6..c9bc517 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * @@ -16,11 +15,6 @@ * This program is free software and may be modified and * distributed under the terms of the GNU Public License. */ -#ifdef PBX_IS_OPBX -#ifdef HAVE_CONFIG_H -#include "confdefs.h" -#endif -#endif #include #include @@ -33,58 +27,6 @@ #include #include -#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 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CC_AST_HAS_VERSION_1_4 -#include "asterisk/abstract_jb.h" -#include "asterisk/musiconhold.h" -#endif #include "xlaw.h" #include "chan_capi20.h" #include "chan_capi.h" @@ -92,14 +34,11 @@ OPENPBX_FILE_VERSION("$HeadURL$", "$Revision$") #include "chan_capi_qsig.h" #include "chan_capi_qsig_asn197ade.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 "$Revision$" -#endif /* * personal stuff @@ -115,12 +54,8 @@ static const struct ast_channel_tech capi_tech; #ifdef CC_AST_HAS_VERSION_1_4 #define AST_MODULE "chan_capi" #else -#ifdef PBX_IS_OPBX -static char *ccdesc = "Common ISDN API for OpenPBX"; -#else static char *ccdesc = "Common ISDN API for Asterisk"; #endif -#endif static char *commandtdesc = "CAPI command interface.\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); #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 _verbose with different verbose settings */ @@ -374,32 +299,6 @@ static const char * capi_command_to_string(unsigned short wCmd) 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 */ @@ -1259,7 +1158,7 @@ static void cc_disconnect_b3(struct capi_pvt *i, int wait) /* * send CONNECT_B3_REQ */ -static void cc_start_b3(struct capi_pvt *i) +void cc_start_b3(struct capi_pvt *i) { _cmsg CMSG; @@ -3313,95 +3212,6 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig 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 */ @@ -6498,10 +6308,8 @@ char *description() return ccdesc; } -#ifndef PBX_IS_OPBX char *key() { return ASTERISK_GPL_KEY; } -#endif #endif /* CC_AST_HAS_VERSION_1_4 */ diff --git a/chan_capi.h b/chan_capi.h index 000905b..5545444 100644 --- a/chan_capi.h +++ b/chan_capi.h @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * @@ -16,6 +15,33 @@ * This program is free software and may be modified and * distributed under the terms of the GNU Public License. */ + +#include "config.h" + +#ifdef CC_AST_HAS_VERSION_1_4 +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CC_AST_HAS_VERSION_1_4 +#include "asterisk/abstract_jb.h" +#include "asterisk/musiconhold.h" +#endif #ifndef _PBX_CAPI_H #define _PBX_CAPI_H @@ -101,13 +127,12 @@ static inline unsigned int read_capi_dword(void *m) #endif /* PBX_IS_OPBX */ -/* - * 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, ...); +/* */ +#define return_on_no_interface(x) \ + if (!i) { \ + cc_verbose(4, 1, "CAPI: %s no interface for PLCI=%#x\n", x, PLCI); \ + return; \ + } /* * B protocol settings @@ -529,4 +554,13 @@ struct cc_capi_controller { #define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11 #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 diff --git a/chan_capi_qsig_asn197ade.c b/chan_capi_qsig_asn197ade.c index 57f1023..58ea285 100644 --- a/chan_capi_qsig_asn197ade.c +++ b/chan_capi_qsig_asn197ade.c @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * Copyright (C) 2007 Mario Goegel diff --git a/chan_capi_qsig_asn197ade.h b/chan_capi_qsig_asn197ade.h index ca549bd..15646b2 100644 --- a/chan_capi_qsig_asn197ade.h +++ b/chan_capi_qsig_asn197ade.h @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * Copyright (C) 2007 Mario Goegel diff --git a/chan_capi_qsig_asn197no.c b/chan_capi_qsig_asn197no.c index 4ab6e9c..2c60b43 100644 --- a/chan_capi_qsig_asn197no.c +++ b/chan_capi_qsig_asn197no.c @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * Copyright (C) 2007 Mario Goegel diff --git a/chan_capi_qsig_asn197no.h b/chan_capi_qsig_asn197no.h index 9b0e7ee..52ef9b9 100644 --- a/chan_capi_qsig_asn197no.h +++ b/chan_capi_qsig_asn197no.h @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * Copyright (C) 2007 Mario Goegel diff --git a/chan_capi_qsig_core.c b/chan_capi_qsig_core.c index 4b9c309..a2b8e7c 100644 --- a/chan_capi_qsig_core.c +++ b/chan_capi_qsig_core.c @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * Copyright (C) 2007 Mario Goegel diff --git a/chan_capi_qsig_ecma.c b/chan_capi_qsig_ecma.c index 21290a0..7a4e14f 100644 --- a/chan_capi_qsig_ecma.c +++ b/chan_capi_qsig_ecma.c @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2005-2007 Cytronics & Melware * Copyright (C) 2007 Mario Goegel diff --git a/chan_capi_rtp.c b/chan_capi_rtp.c index acb3de0..39a1ae1 100644 --- a/chan_capi_rtp.c +++ b/chan_capi_rtp.c @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2006-2007 Cytronics & Melware * @@ -11,11 +10,6 @@ * This program is free software and may be modified and * distributed under the terms of the GNU Public License. */ -#ifdef PBX_IS_OPBX -#ifdef HAVE_CONFIG_H -#include "confdefs.h" -#endif -#endif #include #include @@ -27,41 +21,9 @@ #include #include -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "chan_capi20.h" #include "chan_capi.h" #include "chan_capi_rtp.h" -#endif /* RTP settings / NCPI RTP struct */ diff --git a/chan_capi_rtp.h b/chan_capi_rtp.h index bea73af..31e22bb 100644 --- a/chan_capi_rtp.h +++ b/chan_capi_rtp.h @@ -1,8 +1,7 @@ /* * (CAPI*) * - * An implementation of Common ISDN API 2.0 for - * Asterisk / OpenPBX.org + * An implementation of Common ISDN API 2.0 for Asterisk * * Copyright (C) 2006-2007 Cytronics & Melware * diff --git a/chan_capi_supplementary.c b/chan_capi_supplementary.c new file mode 100644 index 0000000..4888416 --- /dev/null +++ b/chan_capi_supplementary.c @@ -0,0 +1,111 @@ +/* + * (CAPI*) + * + * An implementation of Common ISDN API 2.0 for Asterisk + * + * Copyright (C) 2005-2007 Cytronics & Melware + * + * Armin Schindler + * + * This program is free software and may be modified and + * distributed under the terms of the GNU Public License. + */ + +#include +#include +#include + +#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); + } +} + diff --git a/chan_capi_supplementary.h b/chan_capi_supplementary.h new file mode 100644 index 0000000..9672068 --- /dev/null +++ b/chan_capi_supplementary.h @@ -0,0 +1,22 @@ +/* + * (CAPI*) + * + * An implementation of Common ISDN API 2.0 for Asterisk + * + * Copyright (C) 2006-2007 Cytronics & Melware + * + * Armin Schindler + * + * 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 diff --git a/c20msg.c b/chan_capi_utils.c similarity index 92% rename from c20msg.c rename to chan_capi_utils.c index 4b05211..dd09214 100644 --- a/c20msg.c +++ b/chan_capi_utils.c @@ -1,4 +1,20 @@ +/* + * (CAPI*) + * + * An implementation of Common ISDN API 2.0 for Asterisk + * + * Copyright (C) 2006-2007 Cytronics & Melware + * + * Armin Schindler + * + * This program is free software and may be modified and + * distributed under the terms of the GNU Public License. + */ + #include +#include "chan_capi20.h" +#include "chan_capi.h" +#include "chan_capi_utils.h" /* * 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; +} + diff --git a/chan_capi_utils.h b/chan_capi_utils.h new file mode 100644 index 0000000..f5249ac --- /dev/null +++ b/chan_capi_utils.h @@ -0,0 +1,23 @@ +/* + * (CAPI*) + * + * An implementation of Common ISDN API 2.0 for Asterisk + * + * Copyright (C) 2006-2007 Cytronics & Melware + * + * Armin Schindler + * + * 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 diff --git a/create_config.sh b/create_config.sh index 77edcc9..3e6692e 100755 --- a/create_config.sh +++ b/create_config.sh @@ -5,7 +5,7 @@ # Script to create config.h for compatibility with # different asterisk versions. # -# (C) 2005 Cytronics & Melware +# (C) 2005-2007 Cytronics & Melware # Armin Schindler # diff --git a/preparser b/preparser deleted file mode 100755 index bcc088d..0000000 Binary files a/preparser and /dev/null differ