2007-04-15 19:39:49 +00:00
|
|
|
/*
|
|
|
|
* An implementation of Common ISDN API 2.0 for Asterisk
|
|
|
|
*
|
2009-01-17 17:35:55 +00:00
|
|
|
* Copyright (C) 2006-2009 Cytronics & Melware
|
2007-04-15 19:39:49 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2007-04-15 20:29:12 +00:00
|
|
|
extern int capidebug;
|
|
|
|
extern char *emptyid;
|
|
|
|
|
2009-03-10 22:39:04 +00:00
|
|
|
extern void cc_verbose_internal(char *text, ...);
|
|
|
|
|
2009-04-10 07:23:20 +00:00
|
|
|
static inline int cc_verbose_check(int o_v, int c_d)
|
|
|
|
{
|
|
|
|
if (unlikely(((o_v == 0) || (option_verbose > o_v)) &&
|
|
|
|
((!c_d) || ((c_d) && (capidebug))))) {
|
|
|
|
return 1;
|
|
|
|
}
|
2009-03-13 00:46:09 +00:00
|
|
|
|
2009-04-10 07:23:20 +00:00
|
|
|
return 0;
|
2009-03-11 09:10:04 +00:00
|
|
|
}
|
|
|
|
|
2009-03-10 22:39:04 +00:00
|
|
|
/*
|
|
|
|
* helper for <pbx>_verbose with different verbose settings
|
|
|
|
*/
|
|
|
|
#define cc_verbose(o_v,c_d,text, args...) do { \
|
2009-04-10 07:23:20 +00:00
|
|
|
if (cc_verbose_check(o_v, c_d) != 0) { \
|
|
|
|
cc_verbose_internal(text , ## args); \
|
2009-03-10 22:39:04 +00:00
|
|
|
} \
|
2009-04-10 07:23:20 +00:00
|
|
|
} while(0)
|
2009-03-10 22:39:04 +00:00
|
|
|
|
2007-04-15 20:29:12 +00:00
|
|
|
extern _cword get_capi_MessageNumber(void);
|
2007-04-29 22:28:30 +00:00
|
|
|
extern struct capi_pvt *capi_find_interface_by_msgnum(unsigned short msgnum);
|
|
|
|
extern struct capi_pvt *capi_find_interface_by_plci(unsigned int plci);
|
2007-04-20 08:17:29 +00:00
|
|
|
extern MESSAGE_EXCHANGE_ERROR capi_wait_conf(struct capi_pvt *i, unsigned short wCmd);
|
2007-04-15 20:29:12 +00:00
|
|
|
extern MESSAGE_EXCHANGE_ERROR capidev_check_wait_get_cmsg(_cmsg *CMSG);
|
2007-04-15 19:39:49 +00:00
|
|
|
extern char *capi_info_string(unsigned int info);
|
|
|
|
extern void show_capi_info(struct capi_pvt *i, _cword info);
|
2007-04-29 22:28:30 +00:00
|
|
|
extern unsigned capi_ListenOnController(unsigned int CIPmask, unsigned controller);
|
2009-02-13 21:58:19 +00:00
|
|
|
extern unsigned capi_ManufacturerAllowOnController(unsigned controller);
|
2007-04-29 22:28:30 +00:00
|
|
|
extern void capi_parse_dialstring(char *buffer, char **interface, char **dest, char **param, char **ocid);
|
2007-04-15 20:29:12 +00:00
|
|
|
extern char *capi_number_func(unsigned char *data, unsigned int strip, char *buf);
|
2007-04-17 21:04:42 +00:00
|
|
|
extern int cc_add_peer_link_id(struct ast_channel *c);
|
|
|
|
extern struct ast_channel *cc_get_peer_link_id(const char *p);
|
2007-05-08 16:30:03 +00:00
|
|
|
extern void capi_remove_nullif(struct capi_pvt *i);
|
2008-03-23 13:04:30 +00:00
|
|
|
extern struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned long long controllermask);
|
2010-09-20 11:05:58 +00:00
|
|
|
struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long controllermask, struct capi_pvt *data_plci_ifc, cc_format_t codecs, int all);
|
2007-04-29 22:28:30 +00:00
|
|
|
extern int capi_create_reader_writer_pipe(struct capi_pvt *i);
|
|
|
|
extern struct ast_frame *capi_read_pipeframe(struct capi_pvt *i);
|
|
|
|
extern int capi_write_frame(struct capi_pvt *i, struct ast_frame *f);
|
2009-04-15 12:28:40 +00:00
|
|
|
extern int capi_verify_resource_plci(const struct capi_pvt *i);
|
2010-11-03 22:04:22 +00:00
|
|
|
extern const char* pbx_capi_get_cid (const struct ast_channel* c, const char *notAvailableVisual);
|
|
|
|
extern const char* pbx_capi_get_callername (const struct ast_channel* c, const char *notAvailableVisual);
|
|
|
|
const char* pbx_capi_get_connectedname (const struct ast_channel* c, const char *notAvailableVisual);
|
2007-04-15 20:29:12 +00:00
|
|
|
|
|
|
|
#define capi_number(data, strip) \
|
|
|
|
capi_number_func(data, strip, alloca(AST_MAX_EXTENSION))
|
2007-04-15 19:39:49 +00:00
|
|
|
|
2007-04-19 20:24:15 +00:00
|
|
|
typedef struct capi_prestruct_s {
|
|
|
|
unsigned short wLen;
|
|
|
|
unsigned char *info;
|
|
|
|
} capi_prestruct_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Eicon's capi_sendf() function to create capi messages easily
|
|
|
|
* and send this message.
|
|
|
|
* Copyright by Eicon Networks / Dialogic
|
|
|
|
*/
|
|
|
|
extern MESSAGE_EXCHANGE_ERROR capi_sendf(
|
2007-04-20 08:17:29 +00:00
|
|
|
struct capi_pvt *capii, int waitconf,
|
2009-04-10 07:23:20 +00:00
|
|
|
_cword command, _cdword Id, _cword Number, char * format, ...);
|
2007-04-19 20:24:15 +00:00
|
|
|
|
2010-10-29 21:51:03 +00:00
|
|
|
/*!
|
|
|
|
\brief nulliflist
|
|
|
|
*/
|
|
|
|
const struct capi_pvt *pbx_capi_get_nulliflist(void);
|
|
|
|
/*!
|
|
|
|
\brief cc_mutex_lock(&nullif_lock)
|
|
|
|
*/
|
|
|
|
void pbx_capi_nulliflist_lock(void);
|
|
|
|
/*!
|
|
|
|
\brief cc_mutex_unlock(&nullif_lock)
|
|
|
|
*/
|
|
|
|
void pbx_capi_nulliflist_unlock(void);
|
|
|
|
|
2007-04-15 19:39:49 +00:00
|
|
|
#endif
|