public static SIPReplacesParameter Parse(string replaces) { var callIDMatch = Regex.Match(replaces, "^(?<callid>.*?);"); if (replaces.IndexOf(';') != -1) { var toTagMatch = Regex.Match(replaces, "to-tag=(?<totag>.*?)(;|$)", RegexOptions.IgnoreCase); var fromTagMatch = Regex.Match(replaces, "from-tag=(?<fromtag>.*?)(;|$)", RegexOptions.IgnoreCase); if (toTagMatch.Success && fromTagMatch.Success) { SIPReplacesParameter replacesParam = new SIPReplacesParameter(); replacesParam.CallID = replaces.Substring(0, replaces.IndexOf(';')); replacesParam.ToTag = toTagMatch.Result("${totag}"); replacesParam.FromTag = fromTagMatch.Result("${fromtag}"); return replacesParam; } } return null; }
public static SIPReplacesParameter Parse(string replaces) { var callIDMatch = Regex.Match(replaces, "^(?<callid>.*?);"); if (replaces.IndexOf(';') != -1) { var toTagMatch = Regex.Match(replaces, "to-tag=(?<totag>.*?)(;|$)", RegexOptions.IgnoreCase); var fromTagMatch = Regex.Match(replaces, "from-tag=(?<fromtag>.*?)(;|$)", RegexOptions.IgnoreCase); if (toTagMatch.Success && fromTagMatch.Success) { SIPReplacesParameter replacesParam = new SIPReplacesParameter(); replacesParam.CallID = replaces.Substring(0, replaces.IndexOf(';')); replacesParam.ToTag = toTagMatch.Result("${totag}"); replacesParam.FromTag = fromTagMatch.Result("${fromtag}"); return(replacesParam); } } return(null); }