X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=dss1.cpp;h=707cfc2be0315c26f8e7bf77e9fcac7950582923;hp=8e0ffc7a931635d3077ce3c69c2dd9aa0d0387bb;hb=fb6e219eda69fe19fdd16457570dd51d07099320;hpb=026b04fc75011a144285f399b82890803b4315bd diff --git a/dss1.cpp b/dss1.cpp index 8e0ffc7..707cfc2 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -16,25 +16,26 @@ extern "C" { } #include -extern unsigned long mt_assign_pid; +extern unsigned int mt_assign_pid; #include "ie.cpp" /* * constructor */ -Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive) : PmISDN(type, mISDNport, portname, settings, channel, exclusive) +Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode) : PmISDN(type, mISDNport, portname, settings, channel, exclusive, mode) { p_callerinfo.itype = (mISDNport->ifport->interface->extension)?INFO_ITYPE_ISDN_EXTENSION:INFO_ITYPE_ISDN; p_m_d_ntmode = mISDNport->ntmode; + p_m_d_tespecial = mISDNport->tespecial; p_m_d_l3id = 0; p_m_d_ces = -1; - p_m_d_queue = NULL; + p_m_d_queue[0] = '\0'; p_m_d_notify_pending = NULL; 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); + PDEBUG(DEBUG_ISDN, "Created new mISDNPort(%s). Currently %d objects use, %s%s port #%d\n", portname, mISDNport->use, (mISDNport->ntmode)?"NT":"TE", (mISDNport->tespecial)?" (special)":"", p_m_portnum); } @@ -44,9 +45,6 @@ Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_ Pdss1::~Pdss1() { /* remove queued message */ - if (p_m_d_queue) - message_free(p_m_d_queue); - if (p_m_d_notify_pending) message_free(p_m_d_notify_pending); } @@ -73,7 +71,7 @@ static struct l3_msg *create_l3msg(void) * return: <0: error, call is released, -cause is given * 0: ok, nothing to do */ -int Pdss1::received_first_reply_to_setup(unsigned long cmd, int channel, int exclusive) +int Pdss1::received_first_reply_to_setup(unsigned int cmd, int channel, int exclusive) { int ret; l3_msg *l3m; @@ -326,13 +324,22 @@ int Pdss1::hunt_bchannel(int channel, int exclusive) /* exclusive channel requests must be in the list */ if (exclusive) { + /* no exclusive channel */ if (!channel) { add_trace("conclusion", NULL, "exclusively requested channel not in list"); end_trace(); return(-6); // channel unacceptable } - i = selchannel->channel-1-(selchannel->channel>=17); + /* get index for channel */ + i = channel-1-(channel>=17); + if (i < 0 || i >= p_m_mISDNport->b_num || channel == 16) + { + add_trace("conclusion", NULL, "exclusively requested channel outside interface range"); + end_trace(); + return(-6); // channel unacceptable + } + /* check if busy */ if (p_m_mISDNport->b_port[i] == NULL) goto use_channel; add_trace("conclusion", NULL, "exclusively requested channel is busy"); @@ -343,7 +350,12 @@ int Pdss1::hunt_bchannel(int channel, int exclusive) /* requested channels in list will be used */ if (channel) { - i = selchannel->channel-1-(selchannel->channel>=17); + /* get index for channel */ + i = channel-1-(channel>=17); + if (i < 0 || i >= p_m_mISDNport->b_num || channel == 16) + { + add_trace("info", NULL, "requested channel %d outside interface range", channel); + } else /* if inside range (else) check if available */ if (p_m_mISDNport->b_port[i] == NULL) goto use_channel; } @@ -413,6 +425,7 @@ use_channel: void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) { int calling_type, calling_plan, calling_present, calling_screen; + int calling_type2, calling_plan2, calling_present2, calling_screen2; int called_type, called_plan; int redir_type, redir_plan, redir_present, redir_screen, redir_reason; int hlc_coding, hlc_presentation, hlc_interpretation, hlc_hlc, hlc_exthlc; @@ -448,18 +461,18 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) end_trace(); l1l2l3_trace_header(p_m_mISDNport, this, L3_SETUP_IND, DIRECTION_IN); - dec_ie_calling_pn(l3m, &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id)); + dec_ie_calling_pn(l3m, &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id), &calling_type2, &calling_plan2, &calling_present2, &calling_screen2, (unsigned char *)p_callerinfo.id2, sizeof(p_callerinfo.id2)); dec_ie_called_pn(l3m, &called_type, &called_plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id)); dec_ie_keypad(l3m, (unsigned char *)keypad, sizeof(keypad)); /* te-mode: CNIP (calling name identification presentation) */ - if (!p_m_d_ntmode) - dec_facility_centrex(l3m, (unsigned char *)p_callerinfo.name, sizeof(p_callerinfo.name)); + dec_facility_centrex(l3m, (unsigned char *)p_callerinfo.name, sizeof(p_callerinfo.name)); dec_ie_useruser(l3m, &useruser_protocol, useruser, &useruser_len); dec_ie_complete(l3m, &p_dialinginfo.sending_complete); dec_ie_redir_nr(l3m, &redir_type, &redir_plan, &redir_present, &redir_screen, &redir_reason, (unsigned char *)p_redirinfo.id, sizeof(p_redirinfo.id)); dec_ie_channel_id(l3m, &exclusive, &channel); dec_ie_hlc(l3m, &hlc_coding, &hlc_interpretation, &hlc_presentation, &hlc_hlc, &hlc_exthlc); dec_ie_bearer(l3m, &bearer_coding, &bearer_capability, &bearer_mode, &bearer_rate, &bearer_multi, &bearer_user); + dec_ie_display(l3m, (unsigned char *)p_dialinginfo.display, sizeof(p_dialinginfo.display)); end_trace(); /* if blocked, release call with MT_RELEASE_COMPLETE */ @@ -501,9 +514,10 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) switch (calling_type) { case -1: + p_callerinfo.ntype = INFO_NTYPE_NOTPRESENT; + break; + case 0x0: p_callerinfo.ntype = INFO_NTYPE_UNKNOWN; - p_callerinfo.present = INFO_PRESENT_NOTAVAIL; - p_callerinfo.screen = INFO_SCREEN_NETWORK; break; case 0x1: p_callerinfo.ntype = INFO_NTYPE_INTERNATIONAL; @@ -521,6 +535,50 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) p_callerinfo.isdn_port = p_m_portnum; SCPY(p_callerinfo.interface, p_m_mISDNport->ifport->interface->name); + /* caller info2 */ + switch (calling_present2) + { + case 1: + p_callerinfo.present2 = INFO_PRESENT_RESTRICTED; + break; + case 2: + p_callerinfo.present2 = INFO_PRESENT_NOTAVAIL; + break; + default: + p_callerinfo.present2 = INFO_PRESENT_ALLOWED; + break; + } + switch (calling_screen2) + { + case 0: + p_callerinfo.screen2 = INFO_SCREEN_USER; + break; + default: + p_callerinfo.screen2 = INFO_SCREEN_NETWORK; + break; + } + switch (calling_type2) + { + case -1: + p_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT; + break; + case 0x0: + p_callerinfo.ntype2 = INFO_NTYPE_UNKNOWN; + break; + case 0x1: + p_callerinfo.ntype2 = INFO_NTYPE_INTERNATIONAL; + break; + case 0x2: + p_callerinfo.ntype2 = INFO_NTYPE_NATIONAL; + break; + case 0x4: + p_callerinfo.ntype2 = INFO_NTYPE_SUBSCRIBER; + break; + default: + p_callerinfo.ntype2 = INFO_NTYPE_UNKNOWN; + break; + } + /* dialing information */ SCAT(p_dialinginfo.id, (char *)keypad); switch (called_type) @@ -585,9 +643,10 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) switch (redir_type) { case -1: + p_redirinfo.ntype = INFO_NTYPE_NOTPRESENT; + break; + case 0x0: p_redirinfo.ntype = INFO_NTYPE_UNKNOWN; - p_redirinfo.present = INFO_PRESENT_NULL; /* not redirecting */ - p_redirinfo.reason = INFO_REDIR_UNKNOWN; break; case 0x1: p_redirinfo.ntype = INFO_NTYPE_INTERNATIONAL; @@ -654,6 +713,15 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) break; } + /* set bchannel mode */ + if (p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED + || p_capainfo.bearer_capa==INFO_BC_DATARESTRICTED + || p_capainfo.bearer_capa==INFO_BC_VIDEO) + p_capainfo.source_mode = B_MODE_HDLC; + else + p_capainfo.source_mode = B_MODE_TRANSPARENT; + p_m_b_mode = p_capainfo.source_mode; + /* hunt channel */ ret = channel = hunt_bchannel(channel, exclusive); if (ret < 0) @@ -692,7 +760,7 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) 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; +// 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)); @@ -709,12 +777,13 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) void Pdss1::information_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) { int type, plan; - unsigned char keypad[32] = ""; + unsigned char keypad[32] = "", display[128] = ""; struct lcr_msg *message; l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_IND, DIRECTION_IN); dec_ie_called_pn(l3m, &type, &plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id)); dec_ie_keypad(l3m, (unsigned char *)keypad, sizeof(keypad)); + dec_ie_display(l3m, (unsigned char *)display, sizeof(display)); dec_ie_complete(l3m, &p_dialinginfo.sending_complete); end_trace(); @@ -734,6 +803,7 @@ void Pdss1::information_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l p_dialinginfo.ntype = INFO_NTYPE_UNKNOWN; break; } + SCAT(p_dialinginfo.display, (char *)display); message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_INFORMATION); memcpy(&message->param.information, &p_dialinginfo, sizeof(struct dialing_info)); message_put(message); @@ -748,6 +818,9 @@ void Pdss1::setup_acknowledge_ind(unsigned int cmd, unsigned int pid, struct l3_ int coding, location, progress; int ret; struct lcr_msg *message; + int max = p_m_mISDNport->ifport->dialmax; + char *number; + l3_msg *nl3m; l1l2l3_trace_header(p_m_mISDNport, this, L3_SETUP_ACKNOWLEDGE_IND, DIRECTION_IN); dec_ie_channel_id(l3m, &exclusive, &channel); @@ -771,6 +844,21 @@ void Pdss1::setup_acknowledge_ind(unsigned int cmd, unsigned int pid, struct l3_ message_put(message); new_state(PORT_STATE_OUT_OVERLAP); + + number = p_m_d_queue; + while (number[0]) /* as long we have something to dial */ + { + if (max > strlen(number) || max == 0) + max = strlen(number); + + nl3m = create_l3msg(); + l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT); + enc_ie_called_pn(nl3m, 0, 1, (unsigned char *)number, max); + end_trace(); + p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, nl3m); + number += max; + } + p_m_d_queue[0] = '\0'; } /* CC_PROCEEDING INDICATION */ @@ -833,8 +921,7 @@ void Pdss1::proceeding_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3 switch (type) { case -1: - message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN; - message->param.notifyinfo.present = INFO_PRESENT_NULL; + message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT; break; case 1: message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL; @@ -914,8 +1001,7 @@ void Pdss1::alerting_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) switch (type) { case -1: - message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN; - message->param.notifyinfo.present = INFO_PRESENT_NULL; + message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT; break; case 1: message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL; @@ -947,9 +1033,9 @@ void Pdss1::connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) l1l2l3_trace_header(p_m_mISDNport, this, L3_CONNECT_IND, DIRECTION_IN); dec_ie_channel_id(l3m, &exclusive, &channel); dec_ie_connected_pn(l3m, &type, &plan, &present, &screen, (unsigned char *)p_connectinfo.id, sizeof(p_connectinfo.id)); + dec_ie_display(l3m, (unsigned char *)p_connectinfo.display, sizeof(p_connectinfo.display)); /* te-mode: CONP (connected name identification presentation) */ - if (!p_m_d_ntmode) - dec_facility_centrex(l3m, (unsigned char *)p_connectinfo.name, sizeof(p_connectinfo.name)); + dec_facility_centrex(l3m, (unsigned char *)p_connectinfo.name, sizeof(p_connectinfo.name)); end_trace(); /* select channel */ @@ -990,9 +1076,8 @@ void Pdss1::connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) } switch (type) { - case 0x0: - p_connectinfo.present = INFO_PRESENT_NULL; /* no COLP info */ - p_connectinfo.ntype = INFO_NTYPE_UNKNOWN; + case -1: + p_connectinfo.ntype = INFO_NTYPE_NOTPRESENT; break; case 0x1: p_connectinfo.ntype = INFO_NTYPE_INTERNATIONAL; @@ -1036,10 +1121,12 @@ void Pdss1::disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3 int location, cause; int coding, proglocation, progress; struct lcr_msg *message; + unsigned char display[128] = ""; l1l2l3_trace_header(p_m_mISDNport, this, L3_DISCONNECT_IND, DIRECTION_IN); dec_ie_progress(l3m, &coding, &proglocation, &progress); dec_ie_cause(l3m, &location, &cause); + dec_ie_display(l3m, (unsigned char *)display, sizeof(display)); end_trace(); if (cause < 0) @@ -1065,6 +1152,7 @@ void Pdss1::disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3 message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE); message->param.disconnectinfo.cause = cause; message->param.disconnectinfo.location = location; + SCAT(message->param.disconnectinfo.display, (char *)display); message_put(message); /* remove epoint */ free_epointlist(p_epointlist); @@ -1082,6 +1170,7 @@ void Pdss1::disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3 message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_DISCONNECT); message->param.disconnectinfo.location = location; message->param.disconnectinfo.cause = cause; + SCAT(message->param.disconnectinfo.display, (char *)display); message_put(message); } while(INACTIVE_EPOINT(p_epointlist)) @@ -1089,6 +1178,7 @@ void Pdss1::disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3 message = message_create(p_serial, INACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE); message->param.disconnectinfo.location = location; message->param.disconnectinfo.cause = cause; + SCAT(message->param.disconnectinfo.display, (char *)display); message_put(message); /* remove epoint */ free_epointid(INACTIVE_EPOINT(p_epointlist)); @@ -1125,9 +1215,11 @@ void Pdss1::release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) { int location, cause; struct lcr_msg *message; + unsigned char display[128] = ""; l1l2l3_trace_header(p_m_mISDNport, this, L3_RELEASE_IND, DIRECTION_IN); dec_ie_cause(l3m, &location, &cause); + dec_ie_display(l3m, (unsigned char *)display, sizeof(display)); end_trace(); if (cause < 0) @@ -1141,6 +1233,7 @@ void Pdss1::release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE); message->param.disconnectinfo.cause = cause; message->param.disconnectinfo.location = location; + SCAT(message->param.disconnectinfo.display, (char *)display); message_put(message); /* remove epoint */ free_epointlist(p_epointlist); @@ -1150,6 +1243,15 @@ void Pdss1::release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) p_m_delete = 1; } +/* CC_RESTART INDICATION */ +void Pdss1::restart_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) +{ + l1l2l3_trace_header(p_m_mISDNport, this, L3_RESTART_IND, DIRECTION_IN); + end_trace(); + + // L3 process is not toucht. (not even by network stack) +} + /* CC_RELEASE_COMPLETE INDICATION (a reject) */ void Pdss1::release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) { @@ -1158,14 +1260,17 @@ void Pdss1::release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_m l1l2l3_trace_header(p_m_mISDNport, this, L3_RELEASE_COMPLETE_IND, DIRECTION_IN); /* in case layer 2 is down during setup, we send cause 27 loc 5 */ - if (p_state == PORT_STATE_OUT_SETUP && !p_m_mISDNport->l1link) + if (p_state == PORT_STATE_OUT_SETUP && p_m_mISDNport->l1link == 0) { cause = 27; location = 5; } else { dec_ie_cause(l3m, &location, &cause); - add_trace("layer 1", NULL, (p_m_mISDNport->l1link)?"up":"down"); + if (p_m_mISDNport->l1link < 0) + add_trace("layer 1", NULL, "unknown"); + else + add_trace("layer 1", NULL, (p_m_mISDNport->l1link)?"up":"down"); } end_trace(); if (location == LOCATION_PRIVATE_LOCAL) @@ -1201,10 +1306,12 @@ void Pdss1::notify_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) struct lcr_msg *message; int notify, type, plan, present; unsigned char notifyid[sizeof(message->param.notifyinfo.id)]; + unsigned char display[128] = ""; l1l2l3_trace_header(p_m_mISDNport, this, L3_NOTIFY_IND, DIRECTION_IN); dec_ie_notify(l3m, ¬ify); dec_ie_redir_dn(l3m, &type, &plan, &present, notifyid, sizeof(notifyid)); + dec_ie_display(l3m, (unsigned char *)display, sizeof(display)); end_trace(); if (!ACTIVE_EPOINT(p_epointlist)) @@ -1232,8 +1339,7 @@ void Pdss1::notify_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) switch (type) { case -1: - message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN; - message->param.notifyinfo.present = INFO_PRESENT_NULL; + message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT; break; case 1: message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL; @@ -1248,6 +1354,7 @@ void Pdss1::notify_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN; break; } + SCAT(message->param.notifyinfo.display, (char *)display); message->param.notifyinfo.isdn_port = p_m_portnum; message_put(message); } @@ -1494,6 +1601,7 @@ void Pdss1::resume_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) if (ret < 0) goto no_channel; +// mode (if hdlc parked) to be done. never mind, this is almost never requested /* open channel */ ret = seize_bchannel(channel, 1); if (ret < 0) @@ -1691,6 +1799,10 @@ void Pdss1::message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m) release_complete_ind(cmd, pid, l3m); break; + case MT_RESTART: + restart_ind(cmd, pid, l3m); + break; + case MT_NOTIFY: notify_ind(cmd, pid, l3m); break; @@ -1827,17 +1939,28 @@ int Pdss1::handler(void) * handles all messages from endpoint */ /* MESSAGE_INFORMATION */ -void Pdss1::message_information(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_information(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; + char *display = param->information.display; + char *number = param->information.id; + int max = p_m_mISDNport->ifport->dialmax; - if (param->information.id[0]) /* only if we have something to dial */ + while (number[0]) /* as long we have something to dial */ { + if (max > strlen(number) || max == 0) + max = strlen(number); + l3m = create_l3msg(); l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT); - enc_ie_called_pn(l3m, 0, 1, (unsigned char *)param->information.id); + enc_ie_called_pn(l3m, 0, 1, (unsigned char *)number, max); + if ((p_m_d_ntmode || p_m_d_tespecial) && display[0]) { + enc_ie_display(l3m, (unsigned char *)display); + display = ""; + } end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m); + number += max; } new_state(p_state); } @@ -1846,14 +1969,16 @@ void Pdss1::message_information(unsigned long epoint_id, int message_id, union p int newteid = 0; /* MESSAGE_SETUP */ -void Pdss1::message_setup(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_setup(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; int ret; int plan, type, screen, present, reason; + int plan2, type2, screen2, present2; int capability, mode, rate, coding, user, presentation, interpretation, hlc, exthlc; int channel, exclusive; struct epoint_list *epointlist; + int max = p_m_mISDNport->ifport->dialmax; /* release if port is blocked */ if (p_m_mISDNport->ifport->block) @@ -1877,6 +2002,7 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet // SCPY(&p_m_tones_dir, param->setup.ext.tones_dir); /* screen outgoing caller id */ do_screen(1, p_callerinfo.id, sizeof(p_callerinfo.id), &p_callerinfo.ntype, &p_callerinfo.present, p_m_mISDNport->ifport->interface); + do_screen(1, p_callerinfo.id2, sizeof(p_callerinfo.id2), &p_callerinfo.ntype2, &p_callerinfo.present2, p_m_mISDNport->ifport->interface); /* only display at connect state: this case happens if endpoint is in connected mode */ if (p_state==PORT_STATE_CONNECT) @@ -1889,7 +2015,7 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet /* sending information */ l3m = create_l3msg(); l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT); - if (p_m_d_ntmode) + if (p_m_d_ntmode || p_m_d_tespecial) enc_ie_display(l3m, (unsigned char *)p_callerinfo.display); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m); @@ -1956,6 +2082,9 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet plan = 1; switch (p_callerinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0x0; + break; case INFO_NTYPE_INTERNATIONAL: type = 0x1; break; @@ -1965,8 +2094,8 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet case INFO_NTYPE_SUBSCRIBER: type = 0x4; break; - default: /* INFO_NTYPE_UNKNOWN */ - type = 0x0; + default: /* INFO_NTYPE_NOTPRESENT */ + type = -1; break; } switch (p_callerinfo.screen) @@ -1980,22 +2109,66 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet } switch (p_callerinfo.present) { + case INFO_PRESENT_ALLOWED: + present = 0; + break; case INFO_PRESENT_RESTRICTED: present = 1; break; - case INFO_PRESENT_NOTAVAIL: + default: /* INFO_PRESENT_NOTAVAIL */ present = 2; break; - default: /* INFO_PRESENT_ALLOWED */ - present = 0; + } + /* caller information 2 */ + plan2 = 1; + switch (p_callerinfo.ntype2) + { + case INFO_NTYPE_UNKNOWN: + type2 = 0x0; + break; + case INFO_NTYPE_INTERNATIONAL: + type2 = 0x1; + break; + case INFO_NTYPE_NATIONAL: + type2 = 0x2; + break; + case INFO_NTYPE_SUBSCRIBER: + type2 = 0x4; + break; + default: /* INFO_NTYPE_NOTPRESENT */ + type2 = -1; + break; + } + switch (p_callerinfo.screen2) + { + case INFO_SCREEN_USER: + screen2 = 0; + break; + default: /* INFO_SCREEN_NETWORK */ + screen2 = 3; + break; + } + switch (p_callerinfo.present2) + { + case INFO_PRESENT_ALLOWED: + present2 = 0; + break; + case INFO_PRESENT_RESTRICTED: + present2 = 1; + break; + default: /* INFO_PRESENT_NOTAVAIL */ + present2 = 2; break; } if (type >= 0) - enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id); + enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id, type2, plan2, present2, screen2, (unsigned char *)p_callerinfo.id2); /* dialing information */ if (p_dialinginfo.id[0]) /* only if we have something to dial */ { - enc_ie_called_pn(l3m, 0, 1, (unsigned char *)p_dialinginfo.id); + if (max > strlen(p_dialinginfo.id) || max == 0) + max = strlen(p_dialinginfo.id); + enc_ie_called_pn(l3m, 0, 1, (unsigned char *)p_dialinginfo.id, max); + SCPY(p_m_d_queue, p_dialinginfo.id + max); } /* sending complete */ if (p_dialinginfo.sending_complete) @@ -2009,6 +2182,9 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet plan = 1; switch (p_redirinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0x0; + break; case INFO_NTYPE_INTERNATIONAL: type = 0x1; break; @@ -2018,8 +2194,8 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet case INFO_NTYPE_SUBSCRIBER: type = 0x4; break; - default: /* INFO_NTYPE_UNKNOWN */ - type = 0x0; + default: /* INFO_NTYPE_NOTPRESENT */ + type = -1; break; } switch (p_redirinfo.screen) @@ -2054,25 +2230,18 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet } switch (p_redirinfo.present) { - case INFO_PRESENT_NULL: /* no redir at all */ - present = -1; - screen = -1; - reason = -1; - plan = -1; - type = -1; + case INFO_PRESENT_ALLOWED: + present = 0; break; case INFO_PRESENT_RESTRICTED: present = 1; break; - case INFO_PRESENT_NOTAVAIL: + default: /* INFO_PRESENT_NOTAVAIL */ present = 2; break; - default: /* INFO_PRESENT_ALLOWED */ - present = 0; - break; } /* sending redirecting number only in ntmode */ - if (type >= 0 && p_m_d_ntmode) + if (type >= 0 && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_redir_nr(l3m, type, plan, present, screen, reason, (unsigned char *)p_redirinfo.id); /* bearer capability */ //printf("hlc=%d\n",p_capainfo.hlc); @@ -2104,10 +2273,10 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet } /* display */ - if (p_callerinfo.display[0] && p_m_d_ntmode) + if (p_callerinfo.display[0] && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_display(l3m, (unsigned char *)p_callerinfo.display); /* nt-mode: CNIP (calling name identification presentation) */ -// if (p_callerinfo.name[0] && p_m_d_ntmode) +// if (p_callerinfo.name[0] && (p_m_d_ntmode || p_m_d_tespecial)) // enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1); end_trace(); @@ -2118,12 +2287,12 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet } /* MESSAGE_FACILITY */ -void Pdss1::message_facility(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_facility(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; /* facility will not be sent to external lines */ - if (!p_m_d_ntmode) + if (!p_m_d_ntmode && !p_m_d_tespecial) return; /* sending facility */ @@ -2135,11 +2304,11 @@ void Pdss1::message_facility(unsigned long epoint_id, int message_id, union para } /* MESSAGE_NOTIFY */ -void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_notify(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; int notify; - int plan, type = -1, present; + int plan = 0, type = -1, present = 0; if (param->notifyinfo.notify>INFO_NOTIFY_NONE) notify = param->notifyinfo.notify & 0x7f; @@ -2155,6 +2324,9 @@ void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parame plan = 1; switch (param->notifyinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0; + break; case INFO_NTYPE_INTERNATIONAL: type = 1; break; @@ -2165,25 +2337,20 @@ void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parame type = 4; break; default: /* INFO_NTYPE_UNKNOWN */ - type = 0; + type = -1; break; } switch (param->notifyinfo.present) { - case INFO_PRESENT_NULL: /* no redir at all */ - present = -1; - plan = -1; - type = -1; + case INFO_PRESENT_ALLOWED: + present = 0; break; case INFO_PRESENT_RESTRICTED: present = 1; break; - case INFO_PRESENT_NOTAVAIL: + default: /* INFO_PRESENT_NOTAVAIL */ present = 2; break; - default: /* INFO_PRESENT_ALLOWED */ - present = 0; - break; } } @@ -2209,14 +2376,14 @@ void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parame l1l2l3_trace_header(p_m_mISDNport, this, L3_NOTIFY_REQ, DIRECTION_OUT); enc_ie_notify(l3m, notify); /* sending redirection number only in ntmode */ - if (type >= 0 && p_m_d_ntmode) + if (type >= 0 && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_redir_dn(l3m, type, plan, present, (unsigned char *)param->notifyinfo.id); - if (param->notifyinfo.display[0] && p_m_d_ntmode) + if (param->notifyinfo.display[0] && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_display(l3m, (unsigned char *)param->notifyinfo.display); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_NOTIFY, p_m_d_l3id, l3m); } - } else if (p_m_d_ntmode) + } else if (p_m_d_ntmode || p_m_d_tespecial) { /* sending information */ l3m = create_l3msg(); @@ -2228,10 +2395,18 @@ void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parame } /* MESSAGE_OVERLAP */ -void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_overlap(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; + /* in case of sending complete, we proceed */ + if (p_dialinginfo.sending_complete) + { + PDEBUG(DEBUG_ISDN, "sending proceeding instead of setup_acknowledge, because address is complete.\n"); + message_proceeding(epoint_id, message_id, param); + return; + } + /* sending setup_acknowledge */ l3m = create_l3msg(); l1l2l3_trace_header(p_m_mISDNport, this, L3_SETUP_ACKNOWLEDGE_REQ, DIRECTION_OUT); @@ -2243,7 +2418,7 @@ void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union param || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) if (p_m_mISDNport->tones) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_SETUP_ACKNOWLEDGE, p_m_d_l3id, l3m); @@ -2251,7 +2426,7 @@ void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union param } /* MESSAGE_PROCEEDING */ -void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_proceeding(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -2266,7 +2441,7 @@ void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union pa || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) if (p_m_mISDNport->tones) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); @@ -2274,7 +2449,7 @@ void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union pa } /* MESSAGE_ALERTING */ -void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_alerting(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; @@ -2290,7 +2465,8 @@ void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union para if (p_capainfo.bearer_capa==INFO_BC_SPEECH || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + if (p_m_mISDNport->tones) + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); new_state(PORT_STATE_IN_PROCEEDING); @@ -2307,7 +2483,7 @@ void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union para || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) if (p_m_mISDNport->tones) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_ALERTING, p_m_d_l3id, l3m); @@ -2315,7 +2491,7 @@ void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union para } /* MESSAGE_CONNECT */ -void Pdss1::message_connect(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; int type, plan, present, screen; @@ -2329,11 +2505,6 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param l1l2l3_trace_header(p_m_mISDNport, this, L3_PROCEEDING_REQ, DIRECTION_OUT); /* channel information */ enc_ie_channel_id(l3m, 1, p_m_b_channel); -// /* progress information */ -// if (p_capainfo.bearer_capa==INFO_BC_SPEECH -// || p_capainfo.bearer_capa==INFO_BC_AUDIO -// || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) -// enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); new_state(PORT_STATE_IN_PROCEEDING); @@ -2351,7 +2522,7 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param /* sending information */ l3m = create_l3msg(); l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT); - if (p_m_d_ntmode) + if (p_m_d_ntmode || p_m_d_tespecial) enc_ie_display(l3m, (unsigned char *)p_connectinfo.display); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m); @@ -2371,6 +2542,9 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param plan = 1; switch (p_connectinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0x0; + break; case INFO_NTYPE_INTERNATIONAL: type = 0x1; break; @@ -2380,8 +2554,8 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param case INFO_NTYPE_SUBSCRIBER: type = 0x4; break; - default: /* INFO_NTYPE_UNKNOWN */ - type = 0x0; + default: /* INFO_NTYPE_NOTPRESENT */ + type = -1; break; } switch (param->connectinfo.screen) @@ -2395,32 +2569,26 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param } switch (p_connectinfo.present) { - case INFO_PRESENT_NULL: /* no colp at all */ - present = -1; - screen = -1; - plan = -1; - type = -1; + case INFO_PRESENT_ALLOWED: + present = 0; break; case INFO_PRESENT_RESTRICTED: present = 1; break; - case INFO_PRESENT_NOTAVAIL: + default: /* INFO_PRESENT_NOTAVAIL */ present = 2; break; - default: /* INFO_PRESENT_ALLOWED */ - present = 0; - break; } if (type >= 0) enc_ie_connected_pn(l3m, type, plan, present, screen, (unsigned char *)p_connectinfo.id); /* display */ - if (p_connectinfo.display[0] && p_m_d_ntmode) + if (p_connectinfo.display[0] && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_display(l3m, (unsigned char *)p_connectinfo.display); /* nt-mode: CONP (connected name identification presentation) */ -// if (p_connectinfo.name[0] && p_m_d_ntmode) +// if (p_connectinfo.name[0] && (p_m_d_ntmode || p_m_d_tespecial)) // enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0); /* date & time */ - if (p_m_d_ntmode) + if (p_m_d_ntmode || p_m_d_tespecial) { epoint = find_epoint_id(epoint_id); enc_ie_date(l3m, now, p_settings.no_seconds); @@ -2437,7 +2605,7 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param } /* MESSAGE_DISCONNECT */ -void Pdss1::message_disconnect(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_disconnect(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; struct lcr_msg *message; @@ -2480,7 +2648,8 @@ if (/* ||*/ p_state==PORT_STATE_OUT_SETUP) if (p_capainfo.bearer_capa==INFO_BC_SPEECH || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + if (p_m_mISDNport->tones) + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); new_state(PORT_STATE_IN_PROCEEDING); @@ -2494,13 +2663,13 @@ if (/* ||*/ p_state==PORT_STATE_OUT_SETUP) || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) if (p_m_mISDNport->tones) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); /* send cause */ enc_ie_cause(l3m, (!p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_REMOTE:param->disconnectinfo.location, param->disconnectinfo.cause); /* send display */ if (param->disconnectinfo.display[0]) p = param->disconnectinfo.display; - if (p) if (*p && p_m_d_ntmode) + if (p) if (*p && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_display(l3m, (unsigned char *)p); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_DISCONNECT, p_m_d_l3id, l3m); @@ -2508,7 +2677,7 @@ if (/* ||*/ p_state==PORT_STATE_OUT_SETUP) } /* MESSAGE_RELEASE */ -void Pdss1::message_release(unsigned long epoint_id, int message_id, union parameter *param) +void Pdss1::message_release(unsigned int epoint_id, int message_id, union parameter *param) { l3_msg *l3m; class Endpoint *epoint; @@ -2541,8 +2710,6 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param */ if (p_state==PORT_STATE_IN_SETUP || p_state==PORT_STATE_OUT_SETUP) -// // NOTE: a bug in mISDNuser (see disconnect_req_out !!!) -// || p_state==PORT_STATE_OUT_DISCO) { //#warning remove me //PDEBUG(DEBUG_LOG, "JOLLY sending release complete %d\n", p_serial); @@ -2576,7 +2743,8 @@ wirklich erst proceeding?: if (p_capainfo.bearer_capa==INFO_BC_SPEECH || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + if (p_m_mISDNport->tones) + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); } @@ -2590,14 +2758,14 @@ wirklich erst proceeding?: || p_capainfo.bearer_capa==INFO_BC_AUDIO || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES) if (p_m_mISDNport->tones) - enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8); + enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8); /* send cause */ enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause); /* send display */ epoint = find_epoint_id(epoint_id); if (param->disconnectinfo.display[0]) p = param->disconnectinfo.display; - if (p) if (*p && p_m_d_ntmode) + if (p) if (*p && (p_m_d_ntmode || p_m_d_tespecial)) enc_ie_display(l3m, (unsigned char *)p); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_DISCONNECT, p_m_d_l3id, l3m); @@ -2613,10 +2781,8 @@ wirklich erst proceeding?: /* * endpoint sends messages to the port */ -int Pdss1::message_epoint(unsigned long epoint_id, int message_id, union parameter *param) +int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union parameter *param) { - struct lcr_msg *message; - if (PmISDN::message_epoint(epoint_id, message_id, param)) return(1); @@ -2740,7 +2906,7 @@ int Pdss1::message_epoint(unsigned long epoint_id, int message_id, union paramet break; default: - PERROR("Pdss1(%s) isdn port with (caller id %s) received a wrong message: %d\n", p_name, p_callerinfo.id, message); + PERROR("Pdss1(%s) isdn port with (caller id %s) received a wrong message: %d\n", p_name, p_callerinfo.id, message_id); } return(1); @@ -2841,18 +3007,18 @@ int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pi switch(cmd) { case MT_SETUP: - /* creating port object */ + /* creating port object, transparent until setup with hdlc */ SPRINT(name, "%s-%d-in", mISDNport->ifport->interface->name, mISDNport->portnum); - if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0))) + if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0, B_MODE_TRANSPARENT))) FATAL("Cannot create Port instance.\n"); pdss1->message_isdn(cmd, pid, l3m); break; case MT_RESUME: - /* creating port object */ + /* creating port object, transparent until setup with hdlc */ SPRINT(name, "%s-%d-in", mISDNport->ifport->interface->name, mISDNport->portnum); - if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0))) + if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0, B_MODE_TRANSPARENT))) FATAL("Cannot create Port instance.\n"); pdss1->message_isdn(cmd, pid, l3m); break; @@ -2890,56 +3056,6 @@ int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pi } -#if 0 -/* - * sending message that were queued during L1 activation - * or releasing port if link is down - */ -void setup_queue(struct mISDNport *mISDNport, int link) -{ - class Port *port; - class Pdss1 *pdss1; - struct lcr_msg *message; - - if (!mISDNport->ntmode) - return; - - /* check all port objects for pending message */ - port = port_first; - while(port) - { - if ((port->p_type&PORT_CLASS_mISDN_MASK) == PORT_CLASS_mISDN_DSS1) - { - pdss1 = (class Pdss1 *)port; - if (pdss1->p_m_mISDNport == mISDNport) - { - if (pdss1->p_m_d_queue) - { - if (link) - { - PDEBUG(DEBUG_ISDN, "the L1 became active, so we send queued message for portnum=%d (%s).\n", mISDNport->portnum, pdss1->p_name); - /* LAYER 1 is up, so we send */ - pdss1->message_setup(pdss1->p_m_d_queue->id_from, pdss1->p_m_d_queue->type, &pdss1->p_m_d_queue->param); - message_free(pdss1->p_m_d_queue); - pdss1->p_m_d_queue = NULL; - } else - { - PDEBUG(DEBUG_ISDN, "the L1 became NOT active, so we release port for portnum=%d (%s).\n", mISDNport->portnum, pdss1->p_name); - message = message_create(pdss1->p_serial, pdss1->p_m_d_queue->id_from, PORT_TO_EPOINT, MESSAGE_RELEASE); - message->param.disconnectinfo.cause = 27; - message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL; - message_put(message); - pdss1->new_state(PORT_STATE_RELEASE); - pdss1->p_m_delete = 1; - } - } - } - } - port = port->next; - } -} - -#endif