/* BEGIN: chan_misdn.h */
+ast_mutex_t release_lock;
enum misdn_chan_state {
/** Isdn asks us to release channel, pendant to misdn_hangup **/
static void release_chan(struct misdn_bchannel *bc) {
struct ast_channel *ast=NULL;
+
+ ast_mutex_lock(&release_lock);
{
struct chan_list *ch=find_chan_by_bc(cl_te, bc);
if (!ch) {
chan_misdn_log(1, bc->port, "release_chan: Ch not found!\n");
+ ast_mutex_unlock(&release_lock);
return;
}
/* chan is already cleaned, so exiting */
}
}
+
+ ast_mutex_unlock(&release_lock);
}
/*** release end **/
}
ast_mutex_init(&cl_te_lock);
+ ast_mutex_init(&release_lock);
misdn_cfg_update_ptp();
misdn_cfg_get_ports_string(ports);
int channel=bc->channel-1-(bc->channel>16);
int b_stid=stack->b_stids[channel>=0?channel:0];
-
+
switch (bc->bc_state) {
case BCHAN_CLEANED:
break;
cb_log(5, stack->port, "$$$ Setting up bc with stid :%x\n", b_stid);
+ /*check if the b_stid is alread initialized*/
+ int i;
+ for (i=0; i <= stack->b_num; i++) {
+ if (stack->bc[i].b_stid == b_stid) {
+ cb_log(0, bc->port, "setup_bc: b_stid:%x already in use !!!\n", b_stid);
+ return -1;
+ }
+ }
+
if (b_stid <= 0) {
cb_log(0, stack->port," -- Stid <=0 at the moment in channel:%d\n",channel);