Added new option to interface.conf: "nonotify" to disable notify messages.
[lcr.git] / dss1.cpp
index c8adb27..75ff448 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -402,7 +402,7 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        int bearer_coding, bearer_capability, bearer_mode, bearer_rate, bearer_multi, bearer_user;
        int exclusive, channel;
        int ret;
-       unsigned char keypad[32] = "";
+       unsigned char keypad[33] = "";
        unsigned char useruser[128];
        int useruser_len = 0, useruser_protocol;
        class Endpoint *epoint;
@@ -473,6 +473,12 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
                case 0:
                p_callerinfo.screen = INFO_SCREEN_USER;
                break;
+               case 1:
+               p_callerinfo.screen = INFO_SCREEN_USER_VERIFIED_PASSED;
+               break;
+               case 2:
+               p_callerinfo.screen = INFO_SCREEN_USER_VERIFIED_FAILED;
+               break;
                default:
                p_callerinfo.screen = INFO_SCREEN_NETWORK;
                break;
@@ -516,6 +522,12 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
                case 0:
                p_callerinfo.screen2 = INFO_SCREEN_USER;
                break;
+               case 1:
+               p_callerinfo.screen2 = INFO_SCREEN_USER_VERIFIED_PASSED;
+               break;
+               case 2:
+               p_callerinfo.screen2 = INFO_SCREEN_USER_VERIFIED_FAILED;
+               break;
                default:
                p_callerinfo.screen2 = INFO_SCREEN_NETWORK;
                break;
@@ -574,6 +586,12 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
                case 0:
                p_redirinfo.screen = INFO_SCREEN_USER;
                break;
+               case 1:
+               p_redirinfo.screen = INFO_SCREEN_USER_VERIFIED_PASSED;
+               break;
+               case 2:
+               p_redirinfo.screen = INFO_SCREEN_USER_VERIFIED_FAILED;
+               break;
                default:
                p_redirinfo.screen = INFO_SCREEN_NETWORK;
                break;
@@ -728,7 +746,7 @@ 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] = "", display[128] = "";
+       unsigned char keypad[33] = "", display[128] = "";
        struct lcr_msg *message;
 
        l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_IND, DIRECTION_IN);
@@ -753,7 +771,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);
+       SCPY(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);
@@ -1007,6 +1025,12 @@ void Pdss1::connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
                case 0:
                p_connectinfo.screen = INFO_SCREEN_USER;
                break;
+               case 1:
+               p_connectinfo.screen = INFO_SCREEN_USER_VERIFIED_PASSED;
+               break;
+               case 2:
+               p_connectinfo.screen = INFO_SCREEN_USER_VERIFIED_FAILED;
+               break;
                default:
                p_connectinfo.screen = INFO_SCREEN_NETWORK;
                break;
@@ -1064,8 +1088,10 @@ void Pdss1::disconnect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3
        dec_ie_display(l3m, (unsigned char *)display, sizeof(display));
        end_trace();
 
-       if (cause < 0)
+       if (cause < 0) {
                cause = 16;
+               location = LOCATION_PRIVATE_LOCAL;
+       }
 
        /* release if remote sends us no tones */
        if (!p_m_mISDNport->earlyb) {
@@ -1152,8 +1178,10 @@ void Pdss1::release_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        dec_ie_display(l3m, (unsigned char *)display, sizeof(display));
        end_trace();
 
-       if (cause < 0)
+       if (cause < 0) {
                cause = 16;
+               location = LOCATION_PRIVATE_LOCAL;
+       }
 
        /* sending release to endpoint */
        if (location == LOCATION_PRIVATE_LOCAL)
@@ -1203,8 +1231,10 @@ void Pdss1::release_complete_ind(unsigned int cmd, unsigned int pid, struct l3_m
        if (location == LOCATION_PRIVATE_LOCAL)
                location = LOCATION_PRIVATE_REMOTE;
 
-       if (cause < 0)
+       if (cause < 0) {
                cause = 16;
+               location = LOCATION_PRIVATE_LOCAL;
+       }
 
        /* sending release to endpoint */
        while(p_epointlist) {
@@ -1860,7 +1890,7 @@ void Pdss1::message_information(unsigned int epoint_id, int message_id, union pa
                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 = "";
+                       display = (char *)"";
                }
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m);
@@ -1870,8 +1900,6 @@ void Pdss1::message_information(unsigned int epoint_id, int message_id, union pa
 }
 
 
-int newteid = 0;
-
 /* MESSAGE_SETUP */
 void Pdss1::message_setup(unsigned int epoint_id, int message_id, union parameter *param)
 {
@@ -1902,7 +1930,6 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        memcpy(&p_dialinginfo, &param->setup.dialinginfo, sizeof(p_dialinginfo));
        memcpy(&p_capainfo, &param->setup.capainfo, sizeof(p_capainfo));
        memcpy(&p_redirinfo, &param->setup.redirinfo, sizeof(p_redirinfo));
-//             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);
@@ -1997,6 +2024,12 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                case INFO_SCREEN_USER:
                screen = 0;
                break;
+               case INFO_SCREEN_USER_VERIFIED_PASSED:
+               screen = 1;
+               break;
+               case INFO_SCREEN_USER_VERIFIED_FAILED:
+               screen = 2;
+               break;
                default: /* INFO_SCREEN_NETWORK */
                screen = 3;
                break;
@@ -2035,6 +2068,12 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                case INFO_SCREEN_USER:
                screen2 = 0;
                break;
+               case INFO_SCREEN_USER_VERIFIED_PASSED:
+               screen2 = 1;
+               break;
+               case INFO_SCREEN_USER_VERIFIED_FAILED:
+               screen2 = 2;
+               break;
                default: /* INFO_SCREEN_NETWORK */
                screen2 = 3;
                break;
@@ -2059,6 +2098,9 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                enc_ie_called_pn(l3m, 0, 1, (unsigned char *)p_dialinginfo.id, max);
                SCPY(p_m_d_queue, p_dialinginfo.id + max);
        }
+       /* keypad */
+       if (p_dialinginfo.keypad[0])
+               enc_ie_keypad(l3m, (unsigned char *)p_dialinginfo.keypad);
        /* sending complete */
        if (p_dialinginfo.sending_complete)
                enc_ie_complete(l3m, 1);
@@ -2089,6 +2131,12 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                case INFO_SCREEN_USER:
                screen = 0;
                break;
+               case INFO_SCREEN_USER_VERIFIED_PASSED:
+               screen = 1;
+               break;
+               case INFO_SCREEN_USER_VERIFIED_FAILED:
+               screen = 2;
+               break;
                default: /* INFO_SCREE_NETWORK */
                screen = 3;
                break;
@@ -2192,7 +2240,14 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet
        int notify;
        int plan = 0, type = -1, present = 0;
 
-       printf("if = %d\n", param->notifyinfo.notify);
+       if (p_m_mISDNport->ifport->nonotify) {
+               l1l2l3_trace_header(p_m_mISDNport, this, L3_NOTIFY_REQ, DIRECTION_OUT);
+               add_trace("info", NULL, "blocked by config");
+               end_trace();
+               return;
+       }
+
+//     printf("if = %d\n", param->notifyinfo.notify);
        if (param->notifyinfo.notify>INFO_NOTIFY_NONE)
                notify = param->notifyinfo.notify & 0x7f;
        else
@@ -2426,6 +2481,12 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
                case INFO_SCREEN_USER:
                screen = 0;
                break;
+               case INFO_SCREEN_USER_VERIFIED_PASSED:
+               screen = 1;
+               break;
+               case INFO_SCREEN_USER_VERIFIED_FAILED:
+               screen = 2;
+               break;
                default: /* INFO_SCREE_NETWORK */
                screen = 3;
                break;