- /* find the port object for the join object ref */
- if (!(epoint = find_epoint_id(joinremote->j_epoint_id)))
- {
- PDEBUG(DEBUG_BCHANNEL, "join %d has no endpoint (anymore)\n", joinremote->j_serial);
- return;
- }
- if (!epoint->ep_portlist)
- {
- PDEBUG(DEBUG_BCHANNEL, "join %d has no port (anymore in portlist)\n", joinremote->j_serial);
- return;
- }
- if (epoint->ep_portlist->next)
- {
- PERROR("join %d has enpoint %d with more than one port. this shall not happen to remote joins.\n", joinremote->j_serial, epoint->ep_serial);
- }
- if (!(port = find_port_id(epoint->ep_portlist->port_id)))
- {
- PDEBUG(DEBUG_BCHANNEL, "join %d has no port (anymore as object)\n", joinremote->j_serial);
- return;
- }
- if ((port->p_type&PORT_CLASS_MASK) != PORT_CLASS_mISDN)
- {
- PERROR("join %d has port %d not of mISDN type. This shall not happen.\n", joinremote->j_serial, port->p_serial);
- }
- isdnport = (class PmISDN *)port;
-
- /* release */
- if (!isdnport->p_m_remote_id)
- {
- PERROR("join %d recevied bchannel release from remote, but channel is already released.\n", joinremote->j_serial);
- break;
- }
- mISDNport = isdnport->p_m_mISDNport;
- i = isdnport->p_m_b_index;
- chan_trace_header(mISDNport, isdnport, "MESSAGE_BCHANNEL (from remote application)", DIRECTION_NONE);
- add_trace("type", NULL, "export request");
- end_trace();
- isdnport->p_m_remote_ref = 0;
- isdnport->p_m_remote_id = 0;
- if (mISDNport && i>=0)
- {
- bchannel_event(mISDNport, i, B_EVENT_IMPORTREQUEST);
- }
- break;
-