CgwMonitorManage.T28181.SipStackAdapter.GetInviteRemoteIPPort C# (CSharp) Method

GetInviteRemoteIPPort() private method

获取收流的IP、端口
private GetInviteRemoteIPPort ( string strRemoteBody, string &pRemoteSendStreamIp, uint &uiRemoteSendStreamVideoPort ) : void
strRemoteBody string 消息体
pRemoteSendStreamIp string IP
uiRemoteSendStreamVideoPort uint 端口
return void
        private void GetInviteRemoteIPPort(string strRemoteBody, ref string pRemoteSendStreamIp, ref uint uiRemoteSendStreamVideoPort)
        {
            NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log);
            logEx.Trace("Enter: SipStackAdapter.GetInviteRemoteIPPort strRemoteBody = {0}.", strRemoteBody);

            try
            {
                //获取返回值字符串的第六个字段,收流的IP
                string[] strList = strRemoteBody.Split(new string[] { "\r\n" }, StringSplitOptions.None); ;
                foreach (string str in strList)
                {
                    if (str.IndexOf("c=") > -1)
                    {
                        string[] strListIP = str.Split(' ');
                        if (strListIP.Length > 0)
                        {
                            pRemoteSendStreamIp = strListIP[strListIP.Length - 1];
                            pRemoteSendStreamIp = pRemoteSendStreamIp.Trim('\r');
                        }
                    }
                    if (str.IndexOf("m=") > -1)
                    {
                        if (str.IndexOf("video") > -1)
                        {
                            string[] mVideo = str.Split(' ');
                            uint a = 0;
                            if (uint.TryParse(mVideo[1], out a) == true) //判断port是否可以转换为uint
                            {
                                uiRemoteSendStreamVideoPort = Convert.ToUInt32(mVideo[1]);
                                if (uiRemoteSendStreamVideoPort < 0)
                                {
                                    logEx.Error("when m=video ,the port is wrong,it can not be smaller than 0");
                                }
                            }
                            else
                            {
                                logEx.Trace("the port is {0}", a);
                                logEx.Error("when m=video ,the port is wrong,it is not number");
                            }
                        }
                    }
                }
                logEx.Trace("SipStackAdapter.RemoteIP = {0}.", pRemoteSendStreamIp);
                logEx.Trace("Leave: SipStackAdapter.GetInviteRemoteIPPort");
                logEx.Trace("the RemoteIPPort is {0}", uiRemoteSendStreamVideoPort);
            }
            catch (System.Exception ex)
            {
                pRemoteSendStreamIp = "";
                uiRemoteSendStreamVideoPort = 0;
                logEx.Error("GetInviteRemoteIPPort failed.Exception message:{0}", ex.Message);
            }
        }