[Asterisk-cvs] asterisk/channels/misdn isdn_lib_intern.h, NONE,
1.1 ie.c, 1.1, 1.2 isdn_lib.c, 1.1, 1.2 isdn_lib.h, 1.1,
1.2 isdn_msg_parser.c, 1.1, 1.2
kpfleming
kpfleming
Tue Nov 1 17:12:17 CST 2005
Update of /usr/cvsroot/asterisk/channels/misdn
In directory mongoose.digium.com:/tmp/cvs-serv17004/channels/misdn
Modified Files:
ie.c isdn_lib.c isdn_lib.h isdn_msg_parser.c
Added Files:
isdn_lib_intern.h
Log Message:
issue #5566
--- NEW FILE: isdn_lib_intern.h ---
#ifndef ISDN_LIB_INTERN
#define ISDN_LIB_INTER
#include <mISDNlib.h>
#include <isdn_net.h>
#include <l3dss1.h>
#include <net_l3.h>
#include <pthread.h>
#include "isdn_lib.h"
#ifndef mISDNUSER_HEAD_SIZE
#ifdef MISDNUSER_JOLLY
#define mISDNUSER_HEAD_SIZE (sizeof(mISDNuser_head_t))
#else
#define mISDNUSER_HEAD_SIZE (sizeof(mISDN_head_t))
#endif
#endif
ibuffer_t *astbuf;
ibuffer_t *misdnbuf;
struct isdn_msg {
unsigned long misdn_msg;
enum layer_e layer;
enum event_e event;
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);
void (*msg_printer)(struct isdn_msg *msgs);
char *info;
} ;
/* for isdn_msg_parser.c */
msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
struct misdn_stack {
/** is first element because &nst equals &mISDNlist **/
net_stack_t nst;
manager_t mgr;
int d_stid;
int b_num;
int b_stids[MAX_BCHANS + 1];
int ptp;
int lower_id;
int upper_id;
int l2link;
time_t l2establish;
int l1link;
int midev;
enum mode_e {NT_MODE, TE_MODE} mode;
int pri;
int procids[0x100+1];
msg_queue_t downqueue;
int busy;
int port;
struct misdn_bchannel bc[MAX_BCHANS + 1];
struct misdn_bchannel* bc_list;
int channels[MAX_BCHANS + 1];
struct misdn_bchannel *holding; /* Queue which holds holded channels :) */
struct misdn_stack *next;
};
struct misdn_stack* get_stack_by_bc(struct misdn_bchannel *bc);
#endif
Index: ie.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/ie.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ie.c 31 Oct 2005 23:30:09 -0000 1.1
+++ ie.c 1 Nov 2005 22:04:14 -0000 1.2
@@ -20,7 +20,17 @@
if qi is not NULL (TE-mode), offset is set
*/
-#include "isdn_lib.h"
+
+#include <string.h>
+
+
+#include "isdn_lib_intern.h"
+
+#include <mISDNlib.h>
+#include <isdn_net.h>
+#include <l3dss1.h>
+#include <net_l3.h>
+
#define CENTREX_FAC 0x88
#define CENTREX_ID 0xa1
@@ -667,8 +677,9 @@
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
int l;
- int pri = bc->stack->pri;
-
+ struct misdn_stack *stack=get_stack_by_bc(bc);
+ int pri = stack->pri;
+
if (exclusive<0 || exclusive>1)
{
printf("%s: ERROR: exclusive(%d) is out of range.\n", __FUNCTION__, exclusive);
@@ -738,7 +749,8 @@
void dec_ie_channel_id(unsigned char *p, Q931_info_t *qi, int *exclusive, int *channel, int nt, struct misdn_bchannel *bc)
{
- int pri = bc->stack->pri;
+ struct misdn_stack *stack=get_stack_by_bc(bc);
+ int pri =stack->pri;
*exclusive = -1;
*channel = -1;
@@ -1332,7 +1344,8 @@
void dec_ie_facility(unsigned char *p, Q931_info_t *qi, unsigned char *facility, int *facility_len, int nt, struct misdn_bchannel *bc)
{
int i;
-
+ struct misdn_stack *stack=get_stack_by_bc(bc);
+
*facility_len = 0;
if (!nt)
@@ -1350,10 +1363,10 @@
i = 0;
while(i < *facility_len)
{
- cb_log(3, bc->stack->port, " %02x", facility[i]);
+ cb_log(3, stack->port, " %02x", facility[i]);
i++;
}
- cb_log(3, bc->stack->port, " facility\n");
+ cb_log(3, stack->port, " facility\n");
}
Index: isdn_lib.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/isdn_lib.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- isdn_lib.c 31 Oct 2005 23:30:09 -0000 1.1
+++ isdn_lib.c 1 Nov 2005 22:04:14 -0000 1.2
@@ -11,6 +11,75 @@
* the GNU General Public License
*/
+#include "isdn_lib_intern.h"
+
+
+int misdn_ibuf_freecount(void *buf)
+{
+ return ibuf_usedcount( (ibuffer_t*)buf);
+}
+
[...1223 lines suppressed...]
+
+
+void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2) {
+ manager_ph_control(bc1, CMX_RECEIVE_OFF, 0);
+ manager_ph_control(bc2, CMX_RECEIVE_OFF, 0);
+
+ manager_ph_control(bc1, CMX_CONF_JOIN, (bc1->pid<<1) +1);
+ manager_ph_control(bc2, CMX_CONF_JOIN, (bc1->pid<<1) +1);
+}
+
+void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2)
+{
+
+ manager_ph_control(bc1, CMX_RECEIVE_ON, 0) ;
+ manager_ph_control(bc2, CMX_RECEIVE_ON, 0);
+
+ manager_ph_control(bc1, CMX_CONF_SPLIT, (bc1->pid<<1) +1);
+ manager_ph_control(bc2, CMX_CONF_SPLIT, (bc1->pid<<1) +1);
+
+}
Index: isdn_lib.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/isdn_lib.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- isdn_lib.h 31 Oct 2005 23:30:09 -0000 1.1
+++ isdn_lib.h 1 Nov 2005 22:04:14 -0000 1.2
@@ -14,37 +14,13 @@
#ifndef TE_LIB
#define TE_LIB
-#include <mISDNlib.h>
-#include <isdn_net.h>
-#include <l3dss1.h>
-#include <net_l3.h>
-
-#include <pthread.h>
-
-#ifndef mISDNUSER_HEAD_SIZE
-
-#ifdef MISDNUSER_JOLLY
-#define mISDNUSER_HEAD_SIZE (sizeof(mISDNuser_head_t))
-#else
-#define mISDNUSER_HEAD_SIZE (sizeof(mISDN_head_t))
-#endif
-#endif
-
-#define MISDN_ASTERISK_TECH_PVT(ast) ast->tech_pvt
-#define MISDN_ASTERISK_PVT(ast) 1
-#define MISDN_ASTERISK_TYPE(ast) ast->tech->type
-
-
-/* #include "ies.h" */
-
-#define MAX_BCHANS 30
-
-
/** For initialization usage **/
/* typedef int ie_nothing_t ;*/
/** end of init usage **/
+#define MAX_BCHANS 30
+
enum bc_state_e {
STATE_NOTHING=0,
STATE_NULL,
@@ -173,12 +149,20 @@
FACILITY_CALLDEFLECT
};
+
+
+
struct misdn_bchannel {
+
+ int nt;
+ int port;
/** init stuff **/
int b_stid;
/* int b_addr; */
int layer_id;
-
+
+
+
/** var stuff**/
int l3_id;
int pid;
@@ -194,11 +178,13 @@
int bframe_len;
int time_usec;
- sem_t astsem;
- sem_t misdnsem;
- ibuffer_t *astbuf;
- ibuffer_t *misdnbuf;
-
+
+ void *astbuf;
+ void *misdnbuf;
+
+
+ int te_choose_channel;
+
/* dtmf digit */
int dtmf;
int send_dtmf;
@@ -297,58 +283,8 @@
int rxgain;
struct misdn_bchannel *next;
- struct misdn_stack *stack;
};
-struct misdn_stack {
- /** is first element because &nst equals &mISDNlist **/
- net_stack_t nst;
- manager_t mgr;
-
- int d_stid;
-
- int b_num;
-
- int b_stids[MAX_BCHANS + 1];
-
- int ptp;
- int lower_id;
- int upper_id;
-
- int l2link;
-
- time_t l2establish;
-
- int l1link;
- int midev;
-
- enum mode_e {NT_MODE, TE_MODE} mode;
- int pri;
-
-
- int procids[0x100+1];
-
- msg_queue_t downqueue;
- int busy;
-
- int port;
- struct misdn_bchannel bc[MAX_BCHANS + 1];
-
- struct misdn_bchannel* bc_list;
-
- int channels[MAX_BCHANS + 1];
-
-
-
- int te_choose_channel;
-
-
- struct misdn_bchannel *holding; /* Queue which holds holded channels :) */
-
- struct misdn_stack *next;
-};
-
-struct misdn_stack* get_misdn_stack( void );
enum event_response_e (*cb_event) (enum event_e event, struct misdn_bchannel *bc, void *user_data);
void (*cb_log) (int level, int port, char *tmpl, ...);
@@ -400,35 +336,26 @@
int misdn_lib_send_facility(struct misdn_bchannel *bc, enum facility_type fac, void *data);
-struct isdn_msg {
- unsigned long misdn_msg;
-
- enum layer_e layer;
- enum event_e event;
-
- 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);
- void (*msg_printer)(struct isdn_msg *msgs);
-
- char *info;
-
-} ;
-
-
-
-
+void manager_ec_enable(struct misdn_bchannel *bc);
+void manager_ec_disable(struct misdn_bchannel *bc);
+void get_show_stack_details(int port, char *buf);
+/** Ibuf interface **/
+int misdn_ibuf_usedcount(void *buf);
+int misdn_ibuf_freecount(void *buf);
+void misdn_ibuf_memcpy_r(char *to, void *from, int len);
+void misdn_ibuf_memcpy_w(void *buf, char *from, int len);
-void manager_ec_enable(struct misdn_bchannel *bc);
-void manager_ec_disable(struct misdn_bchannel *bc);
+/** Ibuf interface End **/
-/* for isdn_msg_parser.c */
-msg_t *create_l3msg(int prim, int mt, int dinfo , int size, int nt);
+void misdn_lib_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
+void misdn_lib_split_bridge( struct misdn_bchannel * bc1, struct misdn_bchannel *bc2);
+int misdn_lib_is_ptp(int port);
#define PRI_TRANS_CAP_SPEECH 0x0
#define PRI_TRANS_CAP_DIGITAL 0x08
Index: isdn_msg_parser.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/misdn/isdn_msg_parser.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- isdn_msg_parser.c 31 Oct 2005 23:30:09 -0000 1.1
+++ isdn_msg_parser.c 1 Nov 2005 22:04:14 -0000 1.2
@@ -20,6 +20,8 @@
{
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
CALL_PROCEEDING_t *proceeding=(CALL_PROCEEDING_t*)((unsigned long)msg->data+ HEADER_LEN);
+ struct misdn_stack *stack=get_stack_by_bc(bc);
+
{
int exclusive, channel;
dec_ie_channel_id(proceeding->CHANNEL_ID, (Q931_info_t *)proceeding, &exclusive, &channel, nt,bc);
@@ -28,7 +30,7 @@
channel=-1;
/* ALERT: is that everytime true ? */
- if (channel > 0 && bc->stack->mode == NT_MODE)
+ if (channel > 0 && stack->mode == NT_MODE)
bc->channel = channel;
}
@@ -37,8 +39,6 @@
#if DEBUG
printf("Parsing PROCEEDING Msg\n");
#endif
-
-
}
msg_t *build_proceeding (struct isdn_msg msgs[], struct misdn_bchannel *bc, int nt)
{
@@ -819,7 +819,9 @@
{
int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
RESTART_t *restart=(RESTART_t*)((unsigned long)(msg->data+HEADER_LEN));
-
+
+ struct misdn_stack *stack=get_stack_by_bc(bc);
+
#if DEBUG
printf("Parsing RESTART Msg\n");
#endif
@@ -829,7 +831,7 @@
dec_ie_channel_id(restart->CHANNEL_ID, (Q931_info_t *)restart, &exclusive, &channel, nt,bc);
if (channel==0xff) /* any channel */
channel=-1;
- cb_log(0, bc->stack->port, "CC_RESTART Request on channel:%d on port:%d\n",bc->stack->port);
+ cb_log(0, stack->port, "CC_RESTART Request on channel:%d on port:%d\n",stack->port);
}
@@ -892,6 +894,9 @@
RELEASE_COMPLETE_t *release_complete=(RELEASE_COMPLETE_t*)((unsigned long)(msg->data+HEADER_LEN));
int location;
iframe_t *frm = (iframe_t*) msg->data;
+
+ struct misdn_stack *stack=get_stack_by_bc(bc);
+
#ifdef MISDNUSER_JOLLY
mISDNuser_head_t *hh;
hh=(mISDNuser_head_t*)msg->data;
@@ -902,12 +907,12 @@
if (nt) {
if (hh->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
- cb_log(0, bc->stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] port:%d\n",bc->stack->port);
+ cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [NT] port:%d\n",stack->port);
return;
}
} else {
if (frm->prim == (CC_RELEASE_COMPLETE|CONFIRM)) {
- cb_log(0, bc->stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] port:%d\n",bc->stack->port);
+ cb_log(0, stack->port, "CC_RELEASE_COMPLETE|CONFIRM [TE] port:%d\n",stack->port);
return;
}
}
More information about the svn-commits
mailing list