예제 #1
0
        public static void OnReply(RClient host, string sHeader, string sContent)
        {
            //mPendingRequests.IndexOfKey(callid)

            //update mPendingRequests

            DateTime now = DateTime.Now;

            if (now.Hour == host.lastReportAt.Hour)
            {
                host.HourRecvCounter++;
                host.DayRecvCounter++;
                host.TotalRecvCounter++;
            }
            else
            {
                if (now.Day == host.lastReportAt.Day)
                {
                    host.HourRecvCounter = 0;
                    host.DayRecvCounter++;
                    host.TotalRecvCounter++;
                }
                else
                {
                    host.HourRecvCounter = 0;
                    host.DayRecvCounter  = 0;
                    host.TotalRecvCounter++;
                }
            }

            if ((sHeader == "ROUTEREQUEST") && (sContent.Length > 100))
            {
                List <string> Paras   = sContent.Split(',').ToList <string>();
                RRequest      request = host.mPendingRequests[Paras[0]];
                request.routeList.Clear();
                int iLoop = (Paras.Count - 3) / 5;
                for (int i = 0; i < iLoop; i++)
                {
                    availableRoutes ar = new availableRoutes();
                    ar.NAPName      = Paras[i * 5 + 3];
                    ar.SRC          = Paras[i * 5 + 4];
                    ar.DST          = Paras[i * 5 + 5];
                    ar.IfAlreadyTry = false;
                    ar.IfSuccess    = false;
                    ar.SuccessTime  = DateTime.MinValue;
                    ar.IP           = "123.456.78.9";
                    request.routeList.Add(ar);
                }
                request.Process_ROUTEREQUEST();
            }
            else //if ((sHeader == "ROUTEREQUEST") && (sContent.Length > 100))
            {
                //Log.Error("Unexpected reply");
            }
        }
예제 #2
0
 public RRequest(RClient _parent, string call_id)
 {
     this.parent    = _parent;
     this.CallID    = call_id;
     this.routeList = new List <availableRoutes>();
 }