2005-11-01 22:04:14 +00:00
|
|
|
#ifndef ISDN_LIB_INTERN
|
2005-12-09 11:01:18 +00:00
|
|
|
#define ISDN_LIB_INTERN
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
|
2005-12-09 11:01:18 +00:00
|
|
|
#include <mISDNuser/mISDNlib.h>
|
|
|
|
#include <mISDNuser/isdn_net.h>
|
|
|
|
#include <mISDNuser/l3dss1.h>
|
|
|
|
#include <mISDNuser/net_l3.h>
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#include "isdn_lib.h"
|
|
|
|
|
2007-07-11 14:38:01 +00:00
|
|
|
#ifndef MISDNUSER_VERSION_CODE
|
|
|
|
#error "You need a newer version of mISDNuser ..."
|
|
|
|
#elif MISDNUSER_VERSION_CODE < MISDNUSER_VERSION(1, 0, 3)
|
2006-08-15 16:49:26 +00:00
|
|
|
#error "You need a newer version of mISDNuser ..."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-12-09 11:01:18 +00:00
|
|
|
#define QI_ELEMENT(a) a.off
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef mISDNUSER_HEAD_SIZE
|
|
|
|
|
|
|
|
#define mISDNUSER_HEAD_SIZE (sizeof(mISDNuser_head_t))
|
2006-02-08 16:10:21 +00:00
|
|
|
/*#define mISDNUSER_HEAD_SIZE (sizeof(mISDN_head_t))*/
|
2005-11-01 22:04:14 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-10-30 16:49:02 +00:00
|
|
|
#if 0
|
2008-08-18 21:07:28 +00:00
|
|
|
ibuffer_t *astbuf; /* Not used */
|
|
|
|
ibuffer_t *misdnbuf; /* Not used */
|
2008-10-30 16:49:02 +00:00
|
|
|
#endif
|
2005-11-01 22:04:14 +00:00
|
|
|
|
Merged revisions 62912 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r62912 | crichter | 2007-05-03 16:36:32 +0200 (Do, 03 Mai 2007) | 17 lines
Merged revisions 61357,61770,62885 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r61357 | crichter | 2007-04-11 14:05:57 +0200 (Mi, 11 Apr 2007) | 1 line
some fixes for PMP Hold/Retrieve, it should work now, when briding=no
........
r61770 | crichter | 2007-04-24 15:50:05 +0200 (Di, 24 Apr 2007) | 1 line
added lock for sending messages to avoid double sending. shuffled some empty_chans after the cb_event calls, this avoids that a release_complete from a quite different call releases a fresh created setup by accident.
........
r62885 | crichter | 2007-05-03 15:59:00 +0200 (Do, 03 Mai 2007) | 1 line
fixed the problem that misdn_write did not return -1 when called with 0 samples in a frame this resultet in a deadlock in some circumstances, when the call ended because of a busy extension. added encoding of keypad.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@64955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-18 09:50:33 +00:00
|
|
|
struct send_lock {
|
|
|
|
pthread_mutex_t lock;
|
|
|
|
};
|
|
|
|
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
struct isdn_msg {
|
|
|
|
unsigned long misdn_msg;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
2005-11-01 22:04:14 +00:00
|
|
|
enum event_e event;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
2005-11-01 22:04:14 +00:00
|
|
|
void (*msg_parser)(struct isdn_msg *msgs, msg_t *msg, struct misdn_bchannel *bc, int nt);
|
|
|
|
msg_t *(*msg_builder)(struct isdn_msg *msgs, struct misdn_bchannel *bc, int nt);
|
|
|
|
char *info;
|
2008-08-18 21:07:28 +00:00
|
|
|
} ;
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
/* for isdn_msg_parser.c */
|
|
|
|
msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
|
|
|
|
|
2009-04-21 17:44:01 +00:00
|
|
|
#if defined(AST_MISDN_ENHANCEMENTS)
|
|
|
|
/* Max call-completion REGISTER signaling links per stack/port */
|
|
|
|
#define MISDN_MAX_REGISTER_LINKS MAX_BCHANS
|
|
|
|
#else
|
|
|
|
/* Max call-completion REGISTER signaling links per stack/port */
|
|
|
|
#define MISDN_MAX_REGISTER_LINKS 0
|
|
|
|
#endif /* defined(AST_MISDN_ENHANCEMENTS) */
|
2005-11-01 22:04:14 +00:00
|
|
|
|
2009-04-21 17:44:01 +00:00
|
|
|
#define MAXPROCS 0x100
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
struct misdn_stack {
|
|
|
|
/** is first element because &nst equals &mISDNlist **/
|
|
|
|
net_stack_t nst;
|
|
|
|
manager_t mgr;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief D Channel mISDN driver stack ID (Parent stack ID) */
|
2005-11-01 22:04:14 +00:00
|
|
|
int d_stid;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! /brief Number of B channels supported by this port */
|
2005-11-01 22:04:14 +00:00
|
|
|
int b_num;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief B Channel mISDN driver stack IDs (Child stack IDs) */
|
2005-11-01 22:04:14 +00:00
|
|
|
int b_stids[MAX_BCHANS + 1];
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief TRUE if Point-To-Point(PTP) (Point-To-Multipoint(PTMP) otherwise) */
|
2005-11-01 22:04:14 +00:00
|
|
|
int ptp;
|
2005-12-09 11:01:18 +00:00
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief Number of consecutive times PTP Layer 2 declared down */
|
2006-06-29 20:12:19 +00:00
|
|
|
int l2upcnt;
|
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
int l2_id; /* Not used */
|
|
|
|
|
|
|
|
/*! \brief Lower layer mISDN ID (addr) (Layer 1/3) */
|
2005-11-01 22:04:14 +00:00
|
|
|
int lower_id;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief Upper layer mISDN ID (addr) (Layer 2/4) */
|
2005-11-01 22:04:14 +00:00
|
|
|
int upper_id;
|
2006-08-03 16:38:00 +00:00
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief TRUE if port is blocked */
|
2006-08-03 16:38:00 +00:00
|
|
|
int blocked;
|
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief TRUE if Layer 2 is UP */
|
2005-11-01 22:04:14 +00:00
|
|
|
int l2link;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief TRUE if Layer 1 is UP */
|
2005-11-01 22:04:14 +00:00
|
|
|
int l1link;
|
2007-11-12 13:33:13 +00:00
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief TRUE if restart has been sent to the other side after stack startup */
|
2007-11-12 13:33:13 +00:00
|
|
|
int restart_sent;
|
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief mISDN device handle returned by mISDN_open() */
|
2005-11-01 22:04:14 +00:00
|
|
|
int midev;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief TRUE if NT side of protocol (TE otherwise) */
|
2005-12-09 11:01:18 +00:00
|
|
|
int nt;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
|
|
|
/*! \brief TRUE if ISDN-PRI (ISDN-BRI otherwise) */
|
2005-11-01 22:04:14 +00:00
|
|
|
int pri;
|
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief CR Process ID allocation table. TRUE if ID allocated */
|
2009-04-21 17:44:01 +00:00
|
|
|
int procids[MAXPROCS];
|
2005-11-01 22:04:14 +00:00
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief Queue of Event messages to send to mISDN */
|
2005-11-01 22:04:14 +00:00
|
|
|
msg_queue_t downqueue;
|
2008-08-18 21:07:28 +00:00
|
|
|
msg_queue_t upqueue; /* No code puts anything on this queue */
|
|
|
|
int busy; /* Not used */
|
|
|
|
|
|
|
|
/*! \brief Logical Layer 1 port associated with this stack */
|
2005-11-01 22:04:14 +00:00
|
|
|
int port;
|
2008-08-18 21:07:28 +00:00
|
|
|
|
2009-04-21 17:44:01 +00:00
|
|
|
/*!
|
|
|
|
* \brief B Channel record pool array
|
|
|
|
* (Must be dimensioned the same as struct misdn_stack.channels[])
|
|
|
|
*/
|
|
|
|
struct misdn_bchannel bc[MAX_BCHANS + 1 + MISDN_MAX_REGISTER_LINKS];
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Array of B channels in use (a[0] = B1). TRUE if B channel in use.
|
|
|
|
* (Must be dimensioned the same as struct misdn_stack.bc[])
|
|
|
|
*/
|
|
|
|
char channels[MAX_BCHANS + 1 + MISDN_MAX_REGISTER_LINKS];
|
2005-11-01 22:04:14 +00:00
|
|
|
|
2008-08-18 21:07:28 +00:00
|
|
|
/*! \brief List of holded channels */
|
|
|
|
struct misdn_bchannel *holding;
|
|
|
|
|
|
|
|
/*! \brief Next stack in the list of stacks */
|
2005-11-01 22:04:14 +00:00
|
|
|
struct misdn_stack *next;
|
2008-08-18 21:07:28 +00:00
|
|
|
};
|
2005-11-01 22:04:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc);
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
int isdn_msg_get_index(struct isdn_msg msgs[], msg_t *frm, int nt);
|
|
|
|
enum event_e isdn_msg_get_event(struct isdn_msg msgs[], msg_t *frm, int nt);
|
|
|
|
int isdn_msg_parse_event(struct isdn_msg msgs[], msg_t *frm, struct misdn_bchannel *bc, int nt);
|
|
|
|
char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt);
|
|
|
|
msg_t * isdn_msg_build_event(struct isdn_msg msgs[], struct misdn_bchannel *bc, enum event_e event, int nt);
|
|
|
|
int isdn_msg_get_index_by_event(struct isdn_msg msgs[], enum event_e event, int nt);
|
|
|
|
char * isdn_msg_get_info(struct isdn_msg msgs[], msg_t *msg, int nt);
|
2006-08-03 16:38:00 +00:00
|
|
|
|
|
|
|
|
2005-11-01 22:04:14 +00:00
|
|
|
#endif
|