X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=dss1.cpp;h=3b143322598afb695bad0475e5d226c4f866870d;hp=79f06740ab547d159c94f983ae2d055aae4818f9;hb=efc550418c0b107c07818809a3d8e779e476dcd4;hpb=d2b113f2c4f11acfaee1b2e0fd2f03744a89f6d4 diff --git a/dss1.cpp b/dss1.cpp index 79f0674..3b14332 100644 --- a/dss1.cpp +++ b/dss1.cpp @@ -23,10 +23,11 @@ extern unsigned int mt_assign_pid; /* * 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; @@ -34,7 +35,7 @@ Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_ 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); } @@ -326,13 +327,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 +353,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 +428,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 +464,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 +517,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 +538,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 +646,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 +716,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) @@ -709,12 +780,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 +806,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); @@ -833,8 +906,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 +986,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 +1018,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 +1061,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 +1106,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 +1137,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 +1155,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 +1163,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 +1200,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 +1218,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); @@ -1167,14 +1245,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) @@ -1210,10 +1291,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)) @@ -1241,8 +1324,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; @@ -1257,6 +1339,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); } @@ -1503,6 +1586,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) @@ -1849,6 +1933,8 @@ void Pdss1::message_information(unsigned int epoint_id, int message_id, union pa 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); + if (p_m_d_ntmode || p_m_d_tespecial) + enc_ie_display(l3m, (unsigned char *)param->information.display); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m); } @@ -1864,6 +1950,7 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete 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; @@ -1890,6 +1977,7 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete // 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) @@ -1902,7 +1990,7 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete /* 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); @@ -1969,6 +2057,9 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete plan = 1; switch (p_callerinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0x0; + break; case INFO_NTYPE_INTERNATIONAL: type = 0x1; break; @@ -1978,8 +2069,8 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete case INFO_NTYPE_SUBSCRIBER: type = 0x4; break; - default: /* INFO_NTYPE_UNKNOWN */ - type = 0x0; + default: /* INFO_NTYPE_NOTPRESENT */ + type = -1; break; } switch (p_callerinfo.screen) @@ -1993,18 +2084,59 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete } 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 */ { @@ -2022,6 +2154,9 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete plan = 1; switch (p_redirinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0x0; + break; case INFO_NTYPE_INTERNATIONAL: type = 0x1; break; @@ -2031,8 +2166,8 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete case INFO_NTYPE_SUBSCRIBER: type = 0x4; break; - default: /* INFO_NTYPE_UNKNOWN */ - type = 0x0; + default: /* INFO_NTYPE_NOTPRESENT */ + type = -1; break; } switch (p_redirinfo.screen) @@ -2067,25 +2202,18 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete } 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); @@ -2117,10 +2245,10 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete } /* 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(); @@ -2136,7 +2264,7 @@ void Pdss1::message_facility(unsigned int epoint_id, int message_id, union 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 */ @@ -2152,7 +2280,7 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet { 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; @@ -2168,6 +2296,9 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet plan = 1; switch (param->notifyinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0; + break; case INFO_NTYPE_INTERNATIONAL: type = 1; break; @@ -2178,25 +2309,20 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet 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; } } @@ -2222,14 +2348,14 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet 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(); @@ -2245,6 +2371,14 @@ void Pdss1::message_overlap(unsigned int epoint_id, int message_id, union parame { 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); @@ -2256,7 +2390,7 @@ void Pdss1::message_overlap(unsigned int epoint_id, int message_id, union parame || 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); @@ -2279,7 +2413,7 @@ void Pdss1::message_proceeding(unsigned int epoint_id, int message_id, union par || 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); @@ -2304,7 +2438,7 @@ void Pdss1::message_alerting(unsigned int 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_CALL_PROCEEDING, p_m_d_l3id, l3m); new_state(PORT_STATE_IN_PROCEEDING); @@ -2321,7 +2455,7 @@ void Pdss1::message_alerting(unsigned int 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_ALERTING, p_m_d_l3id, l3m); @@ -2360,7 +2494,7 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame /* 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); @@ -2380,6 +2514,9 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame plan = 1; switch (p_connectinfo.ntype) { + case INFO_NTYPE_UNKNOWN: + type = 0x0; + break; case INFO_NTYPE_INTERNATIONAL: type = 0x1; break; @@ -2389,8 +2526,8 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame case INFO_NTYPE_SUBSCRIBER: type = 0x4; break; - default: /* INFO_NTYPE_UNKNOWN */ - type = 0x0; + default: /* INFO_NTYPE_NOTPRESENT */ + type = -1; break; } switch (param->connectinfo.screen) @@ -2404,32 +2541,26 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame } 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); @@ -2490,7 +2621,7 @@ 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); 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); @@ -2504,13 +2635,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); @@ -2585,7 +2716,7 @@ 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); end_trace(); p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m); } @@ -2599,14 +2730,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); @@ -2624,8 +2755,6 @@ wirklich erst proceeding?: */ 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); @@ -2749,7 +2878,7 @@ int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union paramete 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); @@ -2850,18 +2979,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;