Пример #1
1
        MsgPair dispatch(string msg, Fleck.IWebSocketConnection clientSock)
        {
            int separateIndex = msg.IndexOf("\r\n");
            if (separateIndex != -1)
            {
                string msgHead = msg.Substring(0, separateIndex);
                int index = msgIndex[msgHead];

                ClientMsgType msgType = (ClientMsgType)index;

                GlobalMessage globalMsg;
               
                if (msgType.Equals(ClientMsgType.LOGIN))
                    globalMsg = GlobalMessage.LOGIN;
                else if (msgType.Equals(ClientMsgType.LOGOUT))
                    globalMsg = GlobalMessage.LOGOUT;
                else if (msgType.Equals(ClientMsgType.KEEPALIVEACK))
                    globalMsg = GlobalMessage.KEEPALIVEACK;
                else
                    globalMsg = GlobalMessage.DATA;
                clientPublishMessage(msg, clientSock, globalMsg);

                string newMsg = ClientMsgDelegate[index](msg, clientSock);
                if (newMsg == null)
                    return null;
                byte[]buffer = addHead(newMsg);

                MsgPair msgPair = new MsgPair(buffer, globalMsg);
                
                return msgPair;
            }
            else
                return null;
        
        }
Пример #2
0
        public override GFXSocketResponse DoMessage(GFXServerCore server, GFXSocketInfo info, Fleck.IWebSocketConnection ws)
        {
            try
            {
                // get the lobby the player is in
                List<GFXLobbySessionRow> lobby = new List<GFXLobbySessionRow>(server.LobbySessionList.Select(string.Format("SessionId = '{0}'", info.SessionId)));

                if (lobby.Count <= 0)
                    return constructResponse(GFXResponseType.InvalidInput, "User is not playing any games!");

                GFXLobbySessionRow ownerPlayer = lobby[0];

                // get the data store
                GFXGameData dataStore = server.GameDataList[ownerPlayer.LobbyID];

                if (dataStore.UserData.ContainsKey(ownerPlayer.SessionID))
                {
                    return constructResponse(GFXResponseType.Normal, JsonConvert.SerializeObject(dataStore.UserData[ownerPlayer.SessionID]));
                }
                else
                {
                    return constructResponse(GFXResponseType.DoesNotExist, "User is not in this lobby!");
                }
            }
            catch (Exception exp)
            {
                return constructResponse(GFXResponseType.FatalError, exp.Message);
            }
        }
Пример #3
0
 public static Fleck Lerp(Fleck a, Fleck b, float t)
 {
     return(new Fleck(
                (int)Mathf.Lerp(a.A, b.A, t),
                (int)Mathf.Lerp(a.B, b.B, t)
                ));
 }
Пример #4
0
        public void analyse(string msg, Fleck.IWebSocketConnection clientSock)
        {
            //int totalLen = buffer.Length;
            //int currentIndex = 0;
            //while (currentIndex < totalLen)
            //{
            //    if (verify(buffer) == false)
            //        break;
            //    int DataLength = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(buffer, 8 + currentIndex));
            //    byte[] dataBuffer = new byte[DataLength];
            //    Array.Copy(buffer, 12 + currentIndex, dataBuffer, 0, DataLength);
                
            //    string msg = System.Text.Encoding.UTF8.GetString(dataBuffer);
            //    MsgPair msgPair = dispatch(msg, clientSock);
            //    currentIndex += DataLength + 12;
            //   // ClientUpdateMessage(byteMessage, clientSock, 2);
            //    if (msgPair != null)
            //    sendMsgToServer(msgPair.msg, clientSock, msgPair.type);
            //}
            if (!verify(msg))
                return;
            msg = msg.Substring(16);
            MsgPair msgPair = dispatch(msg, clientSock);

            if (msgPair != null)
            sendMsgToServer(msgPair.msg, clientSock, msgPair.type);
        }
Пример #5
0
        private void ZoneGrowRecursion(
            int currentIndex, int _x, int _y,
            ref int[] tempData, ref int mainCount,
            out List <Fleck> zone, out Vector2 pivot
            )
        {
            int pivotFleckCount = 0;

            pivot = new Vector2();
            zone  = new List <Fleck>();
            Queue <Fleck> queue = new Queue <Fleck>();
            Fleck         first = new Fleck(_x, _y);

            queue.Enqueue(first);

            while (queue.Count > 0)
            {
                Fleck f = queue.Dequeue();
                if (tempData[f.B * Width + f.A] != 1)
                {
                    continue;
                }
                int x = f.A;
                int y = f.B;
                tempData[y * Width + x] = currentIndex;
                mainCount++;
                pivot += new Vector2(x, y);
                pivotFleckCount++;
                bool isEdge = CheckNeighbors(tempData, x, y, 0);
                f.IsEdge = isEdge;
                if (isEdge)
                {
                    zone.Add(f);
                }

                // Check Neighbors
                bool u, d, l, r;
                CheckNeighbors(tempData, x, y, 1, out d, out u, out l, out r);
                if (d)
                {
                    queue.Enqueue(new Fleck(x, y - 1));
                }
                if (u)
                {
                    queue.Enqueue(new Fleck(x, y + 1));
                }
                if (l)
                {
                    queue.Enqueue(new Fleck(x - 1, y));
                }
                if (r)
                {
                    queue.Enqueue(new Fleck(x + 1, y));
                }
            }

            pivot /= pivotFleckCount;
        }
Пример #6
0
        private Fleck ExpandToGet(
            int[] tempData, int _x, int _y, int targetIndex, int maxCount
            )
        {
            int checkedNum = 0;
            Dictionary <Fleck, byte> CheckedFleck = new Dictionary <Fleck, byte>();
            Queue <Fleck>            queue        = new Queue <Fleck>();

            queue.Enqueue(new Fleck(_x, _y));

            while (queue.Count > 0)
            {
                Fleck f = queue.Dequeue();
                int   x = f.A;
                int   y = f.B;

                if (CheckedFleck.ContainsKey(f))
                {
                    continue;
                }
                else
                {
                    CheckedFleck.Add(f, 0);
                    checkedNum++;
                    if (checkedNum >= maxCount)
                    {
                        break;
                    }
                }

                if (tempData[y * Width + x] == targetIndex)
                {
                    if (!CheckNeighbors8(tempData, x, y, 0))
                    {
                        return(f);
                    }
                }

                if (y > 0)
                {
                    queue.Enqueue(new Fleck(x, y - 1));
                }
                if (x > 0)
                {
                    queue.Enqueue(new Fleck(x - 1, y));
                }
                if (y < Height - 1)
                {
                    queue.Enqueue(new Fleck(x, y + 1));
                }
                if (x < Width - 1)
                {
                    queue.Enqueue(new Fleck(x + 1, y));
                }
            }

            return(new Fleck(-1, -1));
        }
Пример #7
0
 public string getOperatorName(Fleck.IWebSocketConnection s)
 {
     foreach (var item in operators)
     {
         if (item.Value.sock == s)
             return item.Key;
     }
     return null;
 }
Пример #8
0
        private void OnClientConnected(Fleck.IWebSocketConnection context)
        {
            if (WebSocketConnected != null)
            {
                var socket = new FleckWebSocket(context);

                WebSocketConnected(this, new WebSocketConnectEventArgs
                {
                    WebSocket = socket,
                    Endpoint = context.ConnectionInfo.ClientIpAddress + ":" + context.ConnectionInfo.ClientPort
                });
            }
        }
Пример #9
0
        public override GFXSocketResponse DoMessage(GFXServerCore server, GFXSocketInfo info, Fleck.IWebSocketConnection ws)
        {
            try
            {
                // get the lobby the player is in
                List<GFXLobbySessionRow> lobbySessions = new List<GFXLobbySessionRow>(server.LobbySessionList.Select(string.Format("SessionId = '{0}'", info.SessionId)));

                if (lobbySessions.Count <= 0)
                    return constructResponse(GFXResponseType.InvalidInput, "User is not playing any games!");

                GFXLobbySessionRow currentPlayer = lobbySessions[0];

                // get the data store
                GFXGameData dataStore = server.GameDataList[currentPlayer.LobbyID];

                if (dataStore.UserData.ContainsKey(currentPlayer.SessionID))
                {
                    dataStore.UserData[currentPlayer.SessionID] = info.Message;

                    // send message to other connected players
                    List<GFXLobbySessionRow> players = new List<GFXLobbySessionRow>(server.LobbySessionList.Select(string.Format("LobbyId = '{0}'", lobbySessions[0].LobbyID)));

                    foreach (var player in players)
                    {
                        server.WebSocketList[player.SessionID].Send(JsonConvert.SerializeObject(new GFXSocketResponse
                            {
                                Subject = "GFX_DATA_CHANGED",
                                Message = JsonConvert.SerializeObject(dataStore),
                                ResponseCode = GFXResponseType.Normal
                            }));
                    }
                }
                else
                {
                    return constructResponse(GFXResponseType.DoesNotExist, "User is not in this lobby!");
                }

                return constructResponse(GFXResponseType.Normal, "");
            }
            catch (Exception exp)
            {
                return constructResponse(GFXResponseType.FatalError, exp.Message);
            }
        }
Пример #10
0
        public override GFXSocketResponse DoMessage(GFXServerCore server, GFXSocketInfo info, Fleck.IWebSocketConnection ws)
        {
            // get user's lobbyid
            List<GFXLobbySessionRow> sessions = new List<GFXLobbySessionRow>(server.LobbySessionList.Select(string.Format("SessionId = '{0}'", info.SessionId)));

            if (sessions.Count <= 0)
                return constructResponse(GFXResponseType.DoesNotExist, "User is not playing any games!");

            List<GFXLobbySessionRow> players = new List<GFXLobbySessionRow>(server.LobbySessionList.Select(string.Format("LobbyId = '{0}'", sessions[0].LobbyID)));

            foreach (var player in players)
            {
                // send GFX_GAME_FINISHED
                server.WebSocketList[player.SessionID].Send(JsonConvert.SerializeObject(new GFXSocketResponse
                    {
                        ResponseCode    = GFXResponseType.Normal,
                        Subject         = "GFX_GAME_FINISHED",
                        Message         = info.Message
                    }));
            }

            return constructResponse(GFXResponseType.Normal, "");
        }
Пример #11
0
        string unMuteConfMember(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #12
0
        string unSetConfBroadcast(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #13
0
 private void OnClose(Fleck.IWebSocketConnection socket)
 {
     Console.WriteLine("OnClose!");
 }
Пример #14
0
        string stopConfRoom(string msg, Fleck.IWebSocketConnection clientSock)
        {

            string others = TextFollowing(msg, "OTHERS:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string type = "SIP";


            Numbers tmpNumbers = processNumbers(others, type);

           // string sipNumbers = string.Join(";", tmpNumbers.sipNumbers.ToArray());

            //foreach (var kv in tmpNumbers.pocNumbers)
            //{
            //    sipNumbers += ";" + myGlobals.gatewayData.gateway[kv.Key].sipNo;
            //}
            //foreach (var kv in myGlobals.gatewayData.gateway)
            //{
            //    if (kv.Value.serverRoomId == serverRoomId)
            //        sipNumbers += ";" + kv.Value.sipNo;
            //}
            //msg = msg.Replace(others, sipNumbers);

            myGlobals.pocSendDeal.deleteMember(operatorName, localRoomId, serverRoomId, tmpNumbers.pocNumbers);

            string operatorNum = myGlobals.myRooms.getOperatorNum(serverRoomId);

            List<string> sipNumbers = myGlobals.myRooms.rooms[operatorNum].sipNumbers;


            if (sipNumbers.Count == 0)
                return null;
            string sipNumbersStr = string.Join(";", sipNumbers.ToArray());

            msg = msg.Replace(others, sipNumbersStr);


            return msg;

        }
Пример #15
0
 private void OnOpen(Fleck.IWebSocketConnection socket)
 {
     Console.WriteLine("OnOpen!");
 }
Пример #16
0
 public static float Distance(Fleck a, Fleck b)
 {
     return(Vector2.Distance(new Vector2(a.A, a.B), new Vector2(b.A, b.B)));
 }
Пример #17
0
 public void subscribe(Fleck.IWebSocketConnection socket)
 {
     subscribe(User.getUserFromSocket(socket));
 }
Пример #18
0
        string restartConfModel(string msg, Fleck.IWebSocketConnection clientSock)

        {
           
			return msg;

        }
Пример #19
0
        string login(string msg, Fleck.IWebSocketConnection clientSock)
        {
            string operatorName = TextFollowing(msg, "OPERATORNAME:");

            //myGlobals.clientSock_operators.Add(clientSock, operatorName);
            //myGlobals.operators_clientSock.Add(operatorName, clientSock);
            if (!myGlobals.operatorData.operators.ContainsKey(operatorName))
                myGlobals.operatorData.addOpeartor(operatorName, clientSock);
            else
            {
                string msg2Client = "LOGINACK\r\n"
                                   + "STATUS:FAILED\r\n"
                                   + "REASIONCODE:4\r\n";

                //byte[] bytes = addHead(msg2Client);
                string flagStr = "-1-2-1-2-1-2-1-2";
                string total = flagStr + msg2Client;
                sendMsgToClient(total, clientSock, GlobalMessage.DATA);
            }
            return msg;

        }
Пример #20
0
        string setOperatorState(string msg, Fleck.IWebSocketConnection clientSock)
        {

           
			return msg;
        }
Пример #21
0
        string changePassword(string msg, Fleck.IWebSocketConnection clientSock)
        {
			return msg;

        }
Пример #22
0
        string kickConfMember(string msg, Fleck.IWebSocketConnection clientSock)
        {

            string others = TextFollowing(msg, "NUMBER:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");

            //string type = TextFollowing(msg, "TYPE:");

            string type = "SIP";
            Numbers tmpNumbers = processNumbers(others, type);

            string sipNumbers = string.Join(";", tmpNumbers.sipNumbers.ToArray());
            msg = msg.Replace(others, sipNumbers);


            myGlobals.pocSendDeal.deleteMember(operatorName, localRoomId, serverRoomId, tmpNumbers.pocNumbers);

            if (tmpNumbers.sipNumbers.Count == 0)
                return null;

            string operatorNum = myGlobals.myRooms.getOperatorNum(serverRoomId);

            foreach (var value in tmpNumbers.sipNumbers)
            {
                myGlobals.myRooms.rooms[operatorNum].sipNumbers.Remove(value);
            }

			return msg;

        }
Пример #23
0
        string addConfMember(string msg, Fleck.IWebSocketConnection clientSock)
        {
            string others = TextFollowing(msg, "OTHERS:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");

            string type = TextFollowing(msg, "SPTYPE:");

            Numbers tmpNumbers = processNumbers(others, type);

            if (tmpNumbers == null)
                return null;
            foreach (var kv in tmpNumbers.pocNumbers)
            {
                if (myGlobals.gatewayData.gateway[kv.Key].serverRoomId == serverRoomId)
                {
                }
                else if(!myGlobals.gatewayData.gateway[kv.Key].isOccupied)
                {
                    myGlobals.gatewayData.gateway[kv.Key].isOccupied = true;
                    tmpNumbers.sipNumbers.Add(myGlobals.gatewayData.gateway[kv.Key].sipNo);
                }
            }

            string sipNumbers = string.Join(";", tmpNumbers.sipNumbers.ToArray());
            msg = msg.Replace(others, sipNumbers);
            myGlobals.pocSendDeal.addMember(operatorName, localRoomId, serverRoomId, tmpNumbers.pocNumbers);

            if (tmpNumbers.sipNumbers.Count == 0)
                return null;

            string operatorNum = myGlobals.myRooms.getOperatorNum(serverRoomId);

            foreach (var value in tmpNumbers.sipNumbers)
            {
                myGlobals.myRooms.rooms[operatorNum].sipNumbers.Add(value);
            }

			return msg;

        }
Пример #24
0
        string switchConfRoom(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #25
0
        string serverCreateIncomingConfRoomAck(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #26
0
        string setConfHostVideo(string msg, Fleck.IWebSocketConnection clientSock)
        {

           
			return msg;
        }
Пример #27
0
        string logout(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #28
0
        string deleteMemberNotify(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
            string number = TextFollowing(msg, "NUMBER:");
            //string type = TextFollowing(msg, "TYPE:");

            USER_INFO userInfo = new USER_INFO();
            //userInfo.name = number;
            userInfo.phone = number;
           // userInfo.type = type;
            myGlobals.dbManager.DeleteUser(userInfo);

			return msg;

        }
Пример #29
0
        string getConfRoomInfo(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #30
0
 private void OnMessage(Fleck.IWebSocketConnection socket, string message)
 {
     Console.WriteLine("OnMessage! " + message);
     socket.Send(message);
 }
Пример #31
0
        string getOperatorInfo(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #32
0
        private void BridgeAndBirthPoint(int groundCount)
        {
            int mainCount    = 0;
            int currentIndex = 2;

            int[] tempData = new int[Width * Height];
            data.CopyTo(tempData, 0);
            List <List <Fleck> > zoneList  = new List <List <Fleck> >();
            List <Vector2>       pivotList = new List <Vector2>();

            while (mainCount < groundCount)
            {
                // Start a new zone
                for (int i = 0; i < Width; i++)
                {
                    for (int j = 0; j < Height; j++)
                    {
                        if (tempData[j * Width + i] == 1)
                        {
                            List <Fleck> zone;
                            Vector2      pivot;
                            ZoneGrowRecursion(
                                currentIndex, i, j,
                                ref tempData, ref mainCount,
                                out zone, out pivot
                                );
                            zoneList.Add(zone);
                            pivotList.Add(pivot);
                            currentIndex++;

                            // Jump
                            i = Width;
                            break;
                        }
                    }
                }
            }

            // Remove Small Zone
            int minBridgeNum = (bridgeWidth + 1) * 4;

            for (int i = 0; i < zoneList.Count; i++)
            {
                if (zoneList[i].Count < minBridgeNum)
                {
                    zoneList.RemoveAt(i);
                    pivotList.RemoveAt(i);
                    i--;
                }
            }

            // Get Birth Points
            birthPoints.Clear();
            if (maxBirthPointNum > 0)
            {
                int birthCheckAdd = zoneList.Count <= maxBirthPointNum ? 1 : zoneList.Count / maxBirthPointNum;
                for (int i = 0; i < zoneList.Count; i += birthCheckAdd)
                {
                    if (zoneList[i].Count <= 0)
                    {
                        continue;
                    }
                    int   x         = (int)pivotList[i].x;
                    int   y         = (int)pivotList[i].y;
                    int   zoneIndex = tempData[zoneList[i][0].B * Width + zoneList[i][0].A];
                    Fleck target    = ExpandToGet(tempData, x, y, zoneIndex, zoneList[i].Count);
                    if (target.A > 0)
                    {
                        birthPoints.Add(new Vector2(target.A, target.B));
                        if (birthPoints.Count >= maxBirthPointNum)
                        {
                            break;
                        }
                    }
                }
            }

            // Return if no need to bridge
            if (bridgeWidth <= 0 || Iteration <= 0)
            {
                return;
            }

            // Bridge Zones
            int len = zoneList.Count;

            if (len <= 1)
            {
                return;
            }
            List <Fleck> BridgedZone = new List <Fleck>(zoneList[0]);

            zoneList.RemoveAt(0);
            for (int count = 0; count < len - 1 && count < MAX_BRIDGE_COUNT; count++)
            {
                int   indexB           = -1;
                float finalMinDistance = float.MaxValue;
                Fleck pointA           = new Fleck();
                Fleck pointB           = new Fleck();
                for (int b = 0; b < zoneList.Count; b++)
                {
                    // Get The Two Points
                    List <Fleck> zoneB    = zoneList[b];
                    int          zoneLenA = BridgedZone.Count;
                    int          zoneLenB = zoneB.Count;
                    if (zoneLenA == 0 || zoneLenB == 0)
                    {
                        continue;
                    }
                    Fleck tempPointA = BridgedZone[0];
                    Fleck tempPointB = zoneB[0];
                    float minDis     = Fleck.Distance(tempPointA, tempPointB);
                    int   addA       = zoneLenA / 100 + 1;
                    int   addB       = zoneLenB / 100 + 1;
                    for (int i = 0; i < zoneLenA; i += addA)
                    {
                        for (int j = 0; j < zoneLenB; j += addB)
                        {
                            float dis = Fleck.Distance(BridgedZone[i], zoneB[j]);
                            if (dis < minDis)
                            {
                                minDis     = dis;
                                tempPointA = BridgedZone[i];
                                tempPointB = zoneB[j];
                            }
                        }
                    }
                    // Final
                    if (minDis < finalMinDistance)
                    {
                        finalMinDistance = minDis;
                        indexB           = b;
                        pointA           = tempPointA;
                        pointB           = tempPointB;
                    }
                }

                // Check
                if (indexB < 0)
                {
                    break;
                }

                // Bridge Them
                float add = 0.5f / Mathf.Max(
                    Mathf.Abs(pointA.A - pointB.A),
                    Mathf.Abs(pointA.B - pointB.B)
                    );
                Fleck prevF = new Fleck();
                for (float t = 0f; t < 1f + add * 2f; t += add)
                {
                    Fleck f = Fleck.Lerp(pointA, pointB, t);

                    // Concat Prev
                    if (t != 0f)
                    {
                        if (f.A != prevF.A && f.B != prevF.B)
                        {
                            data[f.B * Width + prevF.A] = 1;
                        }
                    }
                    else
                    {
                        data[Mathf.Max(f.B - 1, 0) * Width + f.A]          = 1;
                        data[Mathf.Min(f.B + 1, Height - 1) * Width + f.A] = 1;
                        data[f.B * Width + Mathf.Max(f.A - 1, 0)]          = 1;
                        data[f.B * Width + Mathf.Min(f.A + 1, Width - 1)]  = 1;
                    }
                    prevF = f;

                    // Width
                    int bWidth = bridgeWidth - 1;
                    int d      = Mathf.Max(f.B - bWidth, 0);
                    int u      = Mathf.Min(f.B + bWidth, Height - 1);
                    int l      = Mathf.Max(f.A - bWidth, 0);
                    int r      = Mathf.Min(f.A + bWidth, Width - 1);

                    // Draw them
                    for (int x = l; x <= r; x++)
                    {
                        for (int y = d; y <= u; y++)
                        {
                            data[y * Width + x] = 1;
                        }
                    }
                }

                // Merge Them
                BridgedZone.AddRange(zoneList[indexB]);
                zoneList.RemoveAt(indexB);
            }
        }
Пример #33
0
        string keepAliveAck(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #34
0
        string changeOperatorNumber(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
			return msg;

        }
Пример #35
0
        string createConfRoom(string msg, Fleck.IWebSocketConnection clientSock)
        {
            string others = TextFollowing(msg, "OTHERS:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string operatorNum = TextFollowing(msg, "OPERATORNUMBER:");
            string serverRoomId = "";


            string type = "SIP";

            Numbers tmpNumbers = processNumbers(others, type);

            RoomRecord room = new RoomRecord();
            room.operatorNum = operatorNum;

            if (tmpNumbers == null)
            {
                room.sipNumbers.Add(operatorNum);
                myGlobals.myRooms.rooms.Add(operatorNum, room);
                return msg;
            }


            PlanRecord plan = new PlanRecord();
            plan.pocNumbers = tmpNumbers.pocNumbers;
            plan.operatorNum = operatorNum;

            int flag = 0;
         
            foreach (var kv in tmpNumbers.pocNumbers)
            {
               if (!myGlobals.gatewayData.gateway[kv.Key].isOccupied)
                {
                    myGlobals.gatewayData.gateway[kv.Key].isOccupied = true;
                    tmpNumbers.sipNumbers.Add(myGlobals.gatewayData.gateway[kv.Key].sipNo);
                   flag = 1;
                }
            }

            if (flag == 1)
                myGlobals.myPlans.plans.Add(operatorNum, plan);

           
            string sipNumbers = string.Join(";", tmpNumbers.sipNumbers.ToArray());
            msg = msg.Replace(others, sipNumbers);

            room.sipNumbers = tmpNumbers.sipNumbers;
            room.sipNumbers.Add(operatorNum);
            myGlobals.pocSendDeal.addMember(operatorName, localRoomId, serverRoomId, tmpNumbers.pocNumbers);

            myGlobals.myRooms.rooms.Add(operatorNum, room);

            return msg;

        }