Add -lncurses to LDD flags
[lcr.git] / socket_server.c
index 0f7f6d0..28dccd9 100644 (file)
@@ -618,23 +618,42 @@ int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin)
                return(-1);
        }
 
-       /* new join. the reply (NEWREF assignment) is sent from constructor */
+       /* new remote instance. the reply (NEWREF assignment) is sent from constructor */
        if (msg->type == MESSAGE_NEWREF) {
                char name[32];
                /* find remote port */
                interface = interface_first;
                while(interface) {
-                       if (interface->remote && !strcmp(interface->remote_app, admin->remote_name))
-                               break;
+                       /* interface must match the remote application */
+                       if (interface->remote && !strcmp(interface->remote_app, admin->remote_name)) {
+                               /* interface must match the name, if given */
+                               if (!msg->param.newref.interface[0] || !strcmp(msg->param.newref.interface, interface->name))
+                                       break;
+                       }
                        interface = interface->next;
                }
                if (!interface) {
                        union parameter param;
+                       unsigned int ref = new_remote++;
 
+                       start_trace(-1,
+                               NULL,
+                               NULL,
+                               NULL,
+                               DIRECTION_NONE,
+                               0,
+                               0,
+                               "REMOTE APP illegal interface");
+                       add_trace("app", "name", "%s", admin->remote_name);
+                       add_trace("interface", "name", "%s", msg->param.newref.interface);
+                       end_trace();
+                       memset(&param, 0, sizeof(union parameter));
+                       param.newref.direction = 0;
+                       admin_message_from_lcr(admin->sock, ref, MESSAGE_NEWREF, &param);
                        memset(&param, 0, sizeof(union parameter));
                        param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
                        param.disconnectinfo.cause = CAUSE_RESSOURCEUNAVAIL;
-                       admin_message_from_lcr(admin->sock, 0, MESSAGE_RELEASE, &param);
+                       admin_message_from_lcr(admin->sock, ref, MESSAGE_RELEASE, &param);
                        return 0;
                }
                /* creating port object, transparent until setup with hdlc */
@@ -733,7 +752,6 @@ int admin_state(struct admin_queue **responsep)
        class Pdss1             *pdss1;
        struct mISDNport        *mISDNport;
        struct select_channel   *selchannel;
-       int                     anybusy;
 #endif
        struct interface        *interface;
        struct interface_port   *ifport;
@@ -918,7 +936,6 @@ int admin_state(struct admin_queue **responsep)
                                }
                                /* channel state */
                                i = 0;
-                               anybusy = 0;
                                while(i < mISDNport->b_num) {
                                        response->am[num].u.i.busy[i] = mISDNport->b_state[i];
                                        if (mISDNport->b_port[i])
@@ -957,8 +974,10 @@ int admin_state(struct admin_queue **responsep)
                /* serial */
                response->am[num].u.j.serial = join->j_serial;
                /* partyline */
-               if (join->j_type == JOIN_TYPE_PBX)
+               if (join->j_type == JOIN_TYPE_PBX) {
                        response->am[num].u.j.partyline = ((class JoinPBX *)join)->j_partyline;
+                       response->am[num].u.j.threepty = ((class JoinPBX *)join)->j_3pty;
+               }
                /* */
                join = join->next;
                num++;