aboutsummaryrefslogtreecommitdiffstats
path: root/channels/misdn
diff options
context:
space:
mode:
authorcrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-11 19:30:35 +0000
committercrichter <crichter@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-11 19:30:35 +0000
commitb55dc5f39295a441dbfd05b34472364b39ec4366 (patch)
tree20b000ef1e99ec8616ff7a8fbe661e8168412b4a /channels/misdn
parente3ad207f586cd641e5c6a83c27c860daa69f8b71 (diff)
* Introducing a new way for the l1watcher thread using the ast_sched way. Now l1watcher timeouts can be configured separately for every portgroup.
* added a signal handler to allow waking up the misdn task thread (that may sleep in a poll call) via misdn_tasks_wakeup(). * overlap_dial functionality implemented. * fixes a bug which leads to a segfault after reordering config elements in the enum or struct git-svn-id: http://svn.digium.com/svn/asterisk/trunk@37382 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/misdn')
-rw-r--r--channels/misdn/chan_misdn_config.h5
-rw-r--r--channels/misdn/isdn_lib.c77
-rw-r--r--channels/misdn/isdn_lib.h5
3 files changed, 27 insertions, 60 deletions
diff --git a/channels/misdn/chan_misdn_config.h b/channels/misdn/chan_misdn_config.h
index c05f07c34..8e0140471 100644
--- a/channels/misdn/chan_misdn_config.h
+++ b/channels/misdn/chan_misdn_config.h
@@ -59,9 +59,11 @@ enum misdn_cfg_elements {
MISDN_CFG_PICKUPGROUP, /* ast_group_t */
MISDN_CFG_MAX_IN, /* int */
MISDN_CFG_MAX_OUT, /* int */
+ MISDN_CFG_L1_TIMEOUT, /* int */
+ MISDN_CFG_OVERLAP_DIAL, /* int (bool)*/
MISDN_CFG_MSNS, /* char[] */
- MISDN_CFG_PTP, /* int (bool) */
MISDN_CFG_FAXDETECT, /* char[] */
+ MISDN_CFG_PTP, /* int (bool) */
MISDN_CFG_LAST,
/* general config items */
@@ -75,7 +77,6 @@ enum misdn_cfg_elements {
MISDN_GEN_DYNAMIC_CRYPT, /* int (bool) */
MISDN_GEN_CRYPT_PREFIX, /* char[] */
MISDN_GEN_CRYPT_KEYS, /* char[] */
- MISDN_GEN_L1_TIMEOUT, /* int */
MISDN_GEN_NTDEBUGFLAGS, /* int */
MISDN_GEN_NTDEBUGFILE, /* char[] */
MISDN_GEN_LAST
diff --git a/channels/misdn/isdn_lib.c b/channels/misdn/isdn_lib.c
index 93a5bbdeb..ae8283cb3 100644
--- a/channels/misdn/isdn_lib.c
+++ b/channels/misdn/isdn_lib.c
@@ -108,12 +108,9 @@ struct misdn_lib {
int midev;
int midev_nt;
- pthread_t l1watcher_thread;
pthread_t event_thread;
pthread_t event_handler_thread;
- int l1watcher_timeout;
-
void *user_data;
msg_queue_t upqueue;
@@ -163,7 +160,6 @@ static struct misdn_lib *glob_mgr;
unsigned char tone_425_flip[TONE_425_SIZE];
unsigned char tone_silence_flip[TONE_SILENCE_SIZE];
-static void misdn_lib_isdn_l1watcher(void *arg);
static void misdn_lib_isdn_event_catcher(void *arg);
static int handle_event_nt(void *dat, void *arg);
@@ -2810,30 +2806,20 @@ msg_t *fetch_msg(int midev)
return NULL;
}
-static void misdn_lib_isdn_l1watcher(void *arg)
+void misdn_lib_isdn_l1watcher(int port)
{
- struct misdn_lib *mgr = arg;
struct misdn_stack *stack;
- while (1) {
- sleep(mgr->l1watcher_timeout);
-
- /* look out for l1 which are down
- and try to pull the up.
+ for (stack = glob_mgr->stack_list; stack && (stack->port != port); stack = stack->next)
+ ;
- We might even try to pull the l2 up in the
- ptp case.
- */
- for (stack = mgr->stack_list;
- stack;
- stack = stack->next) {
- cb_log(4,stack->port,"Checking L1 State\n");
- if (!stack->l1link) {
- cb_log(4,stack->port,"L1 State Down, trying to get it up again\n");
- misdn_lib_get_short_status(stack);
- misdn_lib_get_l1_up(stack);
- misdn_lib_get_l2_up(stack);
- }
+ if (stack) {
+ cb_log(4, port, "Checking L1 State\n");
+ if (!stack->l1link) {
+ cb_log(4, port, "L1 State Down, trying to get it up again\n");
+ misdn_lib_get_short_status(stack);
+ misdn_lib_get_l1_up(stack);
+ misdn_lib_get_l2_up(stack);
}
}
}
@@ -3703,7 +3689,7 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
if (sem_init(&mgr->new_msg, 1, 0)<0)
sem_init(&mgr->new_msg, 0, 0);
-
+
for (tok=strtok_r(plist," ,",&tokb );
tok;
tok=strtok_r(NULL," ,",&tokb)) {
@@ -3726,20 +3712,20 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
exit(1);
}
+ {
+ int i;
+ for(i=0;i<stack->b_num; i++) {
+ int r;
+ if ((r=init_bc(stack, &stack->bc[i], stack->midev,port,i, "", 1))<0) {
+ cb_log(-1, port, "Got Err @ init_bc :%d\n",r);
+ exit(1);
+ }
+ }
+ }
+
if (stack && first) {
mgr->stack_list=stack;
first=0;
- {
- int i;
- for(i=0;i<stack->b_num; i++) {
- int r;
- if ((r=init_bc(stack, &stack->bc[i], stack->midev,port,i, "", 1))<0) {
- cb_log(-1, port, "Got Err @ init_bc :%d\n",r);
- exit(1);
- }
- }
- }
-
continue;
}
@@ -3747,20 +3733,7 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
struct misdn_stack * help;
for ( help=mgr->stack_list; help; help=help->next )
if (help->next == NULL) break;
-
-
help->next=stack;
-
- {
- int i;
- for(i=0;i<stack->b_num; i++) {
- int r;
- if ((r=init_bc(stack, &stack->bc[i], stack->midev,port,i, "",1 ))<0) {
- cb_log(-1, port, "Got Err @ init_bc :%d\n",r);
- exit(1);
- }
- }
- }
}
}
@@ -3777,12 +3750,6 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface *iface, void *user_dat
cb_log(4, 0, "Event Catcher started\n");
- if (iface->l1watcher_timeout > 0) {
- mgr->l1watcher_timeout=iface->l1watcher_timeout;
- cb_log(4, 0, "Starting L1 watcher\n");
- pthread_create( &mgr->l1watcher_thread, NULL, (void*)misdn_lib_isdn_l1watcher, mgr);
- }
-
global_state= MISDN_INITIALIZED;
return (mgr == NULL);
diff --git a/channels/misdn/isdn_lib.h b/channels/misdn/isdn_lib.h
index 5e93b3d7e..d5e5a3bbd 100644
--- a/channels/misdn/isdn_lib.h
+++ b/channels/misdn/isdn_lib.h
@@ -341,12 +341,9 @@ void (*cb_log) (int level, int port, char *tmpl, ...);
int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
struct misdn_lib_iface {
-
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, ...);
int (*cb_jb_empty)(struct misdn_bchannel *bc, char *buffer, int len);
-
- int l1watcher_timeout;
};
/***** USER IFACE **********/
@@ -357,6 +354,8 @@ int misdn_lib_init(char *portlist, struct misdn_lib_iface* iface, void *user_dat
int misdn_lib_send_event(struct misdn_bchannel *bc, enum event_e event );
void misdn_lib_destroy(void);
+void misdn_lib_isdn_l1watcher(int port);
+
void misdn_lib_log_ies(struct misdn_bchannel *bc);
char *manager_isdn_get_info(enum event_e event);