X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=dss1.cpp;h=4a3f3a63bac2945e242c8728672a0469fe529fc4;hp=8f23c743db813282a6147f35106b64f022e074b1;hb=6552bc36271c4926a8ac5615f4f84f7391034732;hpb=bf3c4d173ad6ecf845de2d9e6d11ab87769d0943 diff --git a/dss1.cpp b/dss1.cpp index 8f23c74..4a3f3a6 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -42,8 +42,8 @@ Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_ p_m_d_ces = -1; p_m_d_queue = NULL; p_m_d_notify_pending = NULL; - p_m_d_collect_cause = CAUSE_NOUSER; - p_m_d_collect_location = LOCATION_PRIVATE_LOCAL; + p_m_d_collect_cause = 0; + p_m_d_collect_location = 0; PDEBUG(DEBUG_ISDN, "Created new mISDNPort(%s). Currently %d objects use, %s port #%d\n", portname, mISDNport->use, (mISDNport->ntmode)?"NT":"TE", p_m_portnum); } @@ -164,7 +164,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex end_trace(); /* activate our exclusive channel */ - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); } else if (p_m_b_channel) { @@ -185,7 +185,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex add_trace("connect", "channel", "%d", p_m_b_channel); end_trace(); p_m_b_exclusive = 1; // we are done - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); return(0); } @@ -212,7 +212,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex end_trace(); /* activate channel given by remote */ - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); } else if (p_m_b_reserve) { @@ -248,7 +248,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex end_trace(); /* activate channel given by remote */ - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); } else { /*** we sent 'no channel available' ***/ @@ -277,7 +277,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex p_m_b_exclusive = 1; // we are done /* activate channel given by remote */ - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); return(0); } @@ -312,7 +312,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex p_m_b_exclusive = 1; // we are done /* activate channel given by remote */ - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); } return(0); @@ -731,12 +731,12 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data) p_m_delete = 1; return; } - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); /* create endpoint */ if (p_epointlist) FATAL("Incoming call but already got an endpoint.\n"); - if (!(epoint = new Endpoint(p_serial, 0, 0))) + if (!(epoint = new Endpoint(p_serial, 0))) FATAL("No memory for Endpoint instance\n"); if (!(epoint->ep_app = new DEFAULT_ENDPOINT_APP(epoint))) FATAL("No memory for Endpoint Application instance\n"); @@ -746,6 +746,7 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data) message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_SETUP); message->param.setup.isdn_port = p_m_portnum; message->param.setup.port_type = p_type; + message->param.setup.dtmf = !p_m_mISDNport->ifport->nodtmf; memcpy(&message->param.setup.dialinginfo, &p_dialinginfo, sizeof(struct dialing_info)); memcpy(&message->param.setup.callerinfo, &p_callerinfo, sizeof(struct caller_info)); memcpy(&message->param.setup.redirinfo, &p_redirinfo, sizeof(struct redir_info)); @@ -812,7 +813,7 @@ void Pdss1::setup_acknowledge_ind(unsigned long prim, unsigned long dinfo, void end_trace(); /* process channel */ - ret = received_first_reply_to_setup(prim, exclusive, channel); + ret = received_first_reply_to_setup(prim, channel, exclusive); if (ret < 0) { message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE); @@ -849,7 +850,7 @@ void Pdss1::proceeding_ind(unsigned long prim, unsigned long dinfo, void *data) dec_ie_redir_dn(proceeding->REDIR_DN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, &present, (unsigned char *)redir, sizeof(redir)); end_trace(); - ret = received_first_reply_to_setup(prim, exclusive, channel); + ret = received_first_reply_to_setup(prim, channel, exclusive); if (ret < 0) { message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE); @@ -933,7 +934,7 @@ void Pdss1::alerting_ind(unsigned long prim, unsigned long dinfo, void *data) end_trace(); /* process channel */ - ret = received_first_reply_to_setup(prim, exclusive, channel); + ret = received_first_reply_to_setup(prim, channel, exclusive); if (ret < 0) { message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE); @@ -1024,7 +1025,7 @@ void Pdss1::connect_ind(unsigned long prim, unsigned long dinfo, void *data) /* select channel */ bchannel_before = p_m_b_channel; - ret = received_first_reply_to_setup(prim, exclusive, channel); + ret = received_first_reply_to_setup(prim, channel, exclusive); if (ret < 0) { message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE); @@ -1285,8 +1286,15 @@ void Pdss1::t312_timeout(unsigned long prim, unsigned long dinfo, void *data) while(p_epointlist) { message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE); - message->param.disconnectinfo.cause = p_m_d_collect_cause; - message->param.disconnectinfo.location = p_m_d_collect_location; + if (p_m_d_collect_cause) + { + message->param.disconnectinfo.cause = p_m_d_collect_cause; + message->param.disconnectinfo.location = p_m_d_collect_location; + } else + { + message->param.disconnectinfo.cause = CAUSE_NOUSER; + message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL; + } message_put(message); /* remove epoint */ free_epointlist(p_epointlist); @@ -1303,10 +1311,11 @@ void Pdss1::notify_ind(unsigned long prim, unsigned long dinfo, void *data) NOTIFY_t *notifying = (NOTIFY_t *)((unsigned long)data + headerlen); struct message *message; int notify, type, plan, present; + unsigned char notifyid[sizeof(message->param.notifyinfo.id)]; l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN); dec_ie_notify(notifying->NOTIFY, (Q931_info_t *)((unsigned long)data+headerlen), ¬ify); - dec_ie_redir_dn(notifying->REDIR_DN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, &present, (unsigned char *)message->param.notifyinfo.id, sizeof(message->param.notifyinfo.id)); + dec_ie_redir_dn(notifying->REDIR_DN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, &present, notifyid, sizeof(notifyid)); end_trace(); if (!ACTIVE_EPOINT(p_epointlist)) @@ -1317,6 +1326,7 @@ void Pdss1::notify_ind(unsigned long prim, unsigned long dinfo, void *data) notify |= 0x80; message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_NOTIFY); message->param.notifyinfo.notify = notify; + SCPY(message->param.notifyinfo.id, (char *)notifyid); /* redirection number */ switch (present) { @@ -1463,7 +1473,7 @@ void Pdss1::retrieve_ind(unsigned long prim, unsigned long dinfo, void *data) cause = -ret; goto reject; } - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); /* set hold state */ p_m_hold = 0; @@ -1635,7 +1645,7 @@ void Pdss1::resume_ind(unsigned long prim, unsigned long dinfo, void *data) p_m_delete = 1; return; } - bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_ACTIVATE); + bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE); /* create endpoint */ if (p_epointlist) @@ -3130,6 +3140,9 @@ int stack2manager_nt(void *dat, void *arg) time(&mISDNport->l2establish); PDEBUG(DEBUG_ISDN, "because we are ptp, we set a l2establish timer.\n"); } +#warning debugging usleep crash + printf("JOLLY release port %d\n", mISDNport->portnum); + usleep(1); break; case CC_SETUP | INDICATION: