/// <summary> /// Map a StandardMethodType to StandardMethod that can /// then be used as an index into our requests array /// </summary> /// <param name="sm"></param> /// <returns></returns> protected int MapStandardMethodTypeToIndex(Request.StandardMethodType sm) { switch (sm) { case Request.StandardMethodType.Invite: return((int)StandardMethod.Invite); case Request.StandardMethodType.Bye: return((int)StandardMethod.Bye); case Request.StandardMethodType.Info: return((int)StandardMethod.Info); case Request.StandardMethodType.Register: return((int)StandardMethod.Register); case Request.StandardMethodType.Notify: return((int)StandardMethod.Notify); case Request.StandardMethodType.Message: return((int)StandardMethod.Message); default: return((int)StandardMethod.Other); } }
/// <summary> /// increments number of requests received /// for the particular method type /// </summary> /// <param name="sm">the sip method</param> public void Update(Request.StandardMethodType sm) { Interlocked.Increment(ref requests[MapStandardMethodTypeToIndex(sm)]); }