msg_t *dmsg;
mISDNuser_head_t *hh;
int i;
+ struct chan_bchannel *bchannel;
/* no device, no read */
if (mISDNdevice < 0)
}
/* look for channel instance, that has the address of this message */
- chan = chan_first;
- while(chan)
+ bchannel = bchannel_first;
+ while(bchannel)
{
- if (frm->addr == chan->b_addr)
+ if (frm->addr == bchannel->b_addr)
break;
- chan = chan->next;
+ bchannel = chan->next;
}
- if (!chan)
+ if (!bchannel)
{
- PERROR("message belongs to no chan: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, msg->len);
+ PERROR("message belongs to no bchannel: prim(0x%x) addr(0x%x) msg->len(%d)\n", frm->prim, frm->addr, msg->len);
goto out;
}
case DL_DATA | INDICATION:
case PH_CONTROL | INDICATION:
i = 0;
- chan->bchannel_receive(frm);
+ bchannel_receive(bchannel, frm);
break;
case PH_ACTIVATE | INDICATION:
case PH_ACTIVATE | CONFIRM:
case DL_ESTABLISH | CONFIRM:
PDEBUG(DEBUG_BCHANNEL, "DL_ESTABLISH confirm: bchannel is now activated (address 0x%x).\n", frm->addr);
- chan->b_active = 1;
bchannel_event(mISDNport, i, B_EVENT_ACTIVATED);
break;
case PH_DEACTIVATE | CONFIRM:
case DL_RELEASE | CONFIRM:
PDEBUG(DEBUG_BCHANNEL, "DL_RELEASE confirm: bchannel is now de-activated (address 0x%x).\n", frm->addr);
- chan->b_active = 0;
bchannel_event(mISDNport, i, B_EVENT_DEACTIVATED);
break;
return;
}
+ /* process party line */
+ if (message_type == MESSAGE_SETUP) if (param->setup.partyline)
+ {
+ j_partyline = param->setup.partyline;
+ }
+ if (j_partyline)
+ {
+ switch(message_type)
+ {
+ case MESSAGE_SETUP:
+ PDEBUG(DEBUG_JOIN, "respsone with connect in partyline mode.\n");
+ relation->type = RELATION_TYPE_CONNECT;
+ message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_CONNECT);
+ SPRINT(message->param.connectinfo.id, "%d", j_partyline);
+ message->param.connectinfo.ntype = INFO_NTYPE_UNKNOWN;
+ message_put(message);
+ j_updatebridge = 1; /* update bridge flag */
+ break;
+
+ case MESSAGE_AUDIOPATH:
+ PDEBUG(DEBUG_JOIN, "join received channel message: %d.\n", param->audiopath);
+ if (relation->channel_state != param->audiopath)
+ {
+ relation->channel_state = param->audiopath;
+ j_updatebridge = 1; /* update bridge flag */
+ if (options.deb & DEBUG_JOIN)
+ joinpbx_debug(this, "Join::message_epoint{after setting new channel state}");
+ }
+ break;
+
+ case MESSAGE_DISCONNECT:
+ PDEBUG(DEBUG_JOIN, "releasing after receiving disconnect, because join in partyline mode.\n");
+ message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_RELEASE);
+ message->param.disconnectinfo.cause = CAUSE_NORMAL;
+ message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
+ message_put(message);
+ // fall through
+
+ case MESSAGE_RELEASE:
+ PDEBUG(DEBUG_JOIN, "releasing from join\n");
+ release(relation, 0, 0);
+ break;
+
+ default:
+ PDEBUG(DEBUG_JOIN, "ignoring message, because join in partyline mode.\n");
+ }
+ return;
+ }
+
+
+ /* process messages */
switch(message_type)
{
/* process audio path message */
return; // must return, because join may be destroyed
}
- /* process party line */
- if (message_type == MESSAGE_SETUP) if (param->setup.partyline)
- {
- PDEBUG(DEBUG_JOIN, "respsone with connect in partyline mode.\n");
- j_partyline = param->setup.partyline;
- message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_CONNECT);
- message->param.setup.partyline = j_partyline;
- message_put(message);
- j_updatebridge = 1; /* update bridge flag */
- }
- if (j_partyline)
- {
- if (message_type == MESSAGE_DISCONNECT)
- {
- PDEBUG(DEBUG_JOIN, "releasing after receiving disconnect, because join in partyline mode.\n");
- message = message_create(j_serial, epoint_id, JOIN_TO_EPOINT, MESSAGE_RELEASE);
- message->param.disconnectinfo.cause = CAUSE_NORMAL;
- message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
- message_put(message);
- return;
- }
- }
- if (j_partyline)
- {
- PDEBUG(DEBUG_JOIN, "ignoring message, because join in partyline mode.\n");
- return;
- }
-
/* count relations */
num=joinpbx_countrelations(j_serial);