public SIPDialogue( string callId, SIPRouteSet routeSet, SIPUserField localUser, SIPUserField remoteUser, int cseq, SIPURI remoteTarget, string localTag, string remoteTag, Guid cdrId, string owner, string adminMemberId, string sdp, string remoteSDP) { Id = Guid.NewGuid(); CallId = callId; RouteSet = routeSet; LocalUserField = localUser; LocalTag = localTag; RemoteUserField = remoteUser; RemoteTag = remoteTag; CSeq = cseq; RemoteTarget = remoteTarget; CDRId = cdrId; Owner = owner; AdminMemberId = adminMemberId; SDP = sdp; RemoteSDP = remoteSDP; Inserted = DateTimeOffset.UtcNow; Direction = SIPCallDirection.None; }
public SIPDialogue( string callId, SIPRouteSet routeSet, SIPUserField localUser, SIPUserField remoteUser, int cseq, SIPURI remoteTarget, string localTag, string remoteTag, Guid cdrId, string sdp, string remoteSDP, SIPEndPoint remoteEndPoint) { Id = Guid.NewGuid(); CallId = callId; RouteSet = routeSet; LocalUserField = localUser; LocalTag = localTag; RemoteUserField = remoteUser; RemoteTag = remoteTag; CSeq = cseq; RemoteTarget = remoteTarget; CDRId = cdrId; SDP = sdp; RemoteSDP = remoteSDP; Inserted = DateTime.UtcNow; Direction = SIPCallDirection.None; RemoteSIPEndPoint = remoteEndPoint?.CopyOf(); }
public static SIPUserField ParseSIPUserField(string userFieldStr) { if (string.IsNullOrWhiteSpace(userFieldStr)) { throw new ArgumentException("A SIPUserField cannot be parsed from an empty string."); } SIPUserField userField = new SIPUserField(); string trimUserField = userFieldStr.Trim(); int position = trimUserField.IndexOf('<'); if (position == -1) { // Treat the field as a URI only, except that all parameters are Header parameters and not URI parameters // (RFC3261 section 20.39 which refers to 20.10 for parsing rules). string uriStr = trimUserField; int paramDelimPosn = trimUserField.IndexOf(PARAM_TAG_DELIMITER); if (paramDelimPosn != -1) { string paramStr = trimUserField.Substring(paramDelimPosn + 1).Trim(); userField.Parameters = new SIPParameters(paramStr, PARAM_TAG_DELIMITER); uriStr = trimUserField.Substring(0, paramDelimPosn); } userField.URI = SIPURI.ParseSIPURI(uriStr); } else { if (position > 0) { userField.Name = trimUserField.Substring(0, position).Trim().Trim('"'); trimUserField = trimUserField.Substring(position, trimUserField.Length - position); } int addrSpecLen = trimUserField.Length; position = trimUserField.IndexOf('>'); if (position != -1) { addrSpecLen = position - 1; string paramStr = trimUserField.Substring(position + 1).Trim(); userField.Parameters = new SIPParameters(paramStr, PARAM_TAG_DELIMITER); string addrSpec = trimUserField.Substring(1, addrSpecLen); userField.URI = SIPURI.ParseSIPURI(addrSpec); } else { throw new SIPValidationException(SIPValidationFieldsEnum.ContactHeader, "A SIPUserField was missing the right quote, " + userFieldStr + "."); } } return(userField); }
public SIPUserField CopyOf() { SIPUserField copy = new SIPUserField(); copy.Name = Name; copy.URI = URI.CopyOf(); copy.Parameters = Parameters.CopyOf(); return(copy); }
public SIPToHeader(string toName, SIPURI toURI, string toTag) { m_userField = new SIPUserField(toName, toURI, null); ToTag = toTag; }
public SIPFromHeader(string fromName, SIPURI fromURI, string fromTag) { m_userField = new SIPUserField(fromName, fromURI, null); FromTag = fromTag; }
public SIPRoute(SIPURI uri, bool looseRouter) { m_userField = new SIPUserField(); m_userField.URI = uri; this.IsStrictRouter = !looseRouter; }
public SIPRoute(SIPURI uri) { m_userField = new SIPUserField(); m_userField.URI = uri; }
public SIPRoute(string host, bool looseRouter) { if (host.IsNullOrBlank()) { throw new SIPValidationException(SIPValidationFieldsEnum.RouteHeader, "Cannot create a Route from an blank string."); } m_userField = SIPUserField.ParseSIPUserField(host); this.IsStrictRouter = !looseRouter; }
public SIPContactHeader(SIPUserField contactUserField) { m_userField = contactUserField; }
public SIPContactHeader(string contactName, SIPURI contactURI) { m_userField = new SIPUserField(contactName, contactURI, null); }
public SIPUserField CopyOf() { SIPUserField copy = new SIPUserField(); copy.Name = Name; copy.URI = URI.CopyOf(); copy.Parameters = Parameters.CopyOf(); return copy; }
public static SIPUserField ParseSIPUserField(string userFieldStr) { if (userFieldStr.IsNullOrBlank()) { throw new ArgumentException("A SIPUserField cannot be parsed from an empty string."); } SIPUserField userField = new SIPUserField(); string trimUserField = userFieldStr.Trim(); int position = trimUserField.IndexOf('<'); if (position == -1) { // Treat the field as a URI only, except that all parameters are Header parameters and not URI parameters // (RFC3261 section 20.39 which refers to 20.10 for parsing rules). string uriStr = trimUserField; int paramDelimPosn = trimUserField.IndexOf(PARAM_TAG_DELIMITER); if (paramDelimPosn != -1) { string paramStr = trimUserField.Substring(paramDelimPosn + 1).Trim(); userField.Parameters = new SIPParameters(paramStr, PARAM_TAG_DELIMITER); uriStr = trimUserField.Substring(0, paramDelimPosn); } userField.URI = SIPURI.ParseSIPURI(uriStr); } else { if (position > 0) { userField.Name = trimUserField.Substring(0, position).Trim().Trim('"'); trimUserField = trimUserField.Substring(position, trimUserField.Length - position); } int addrSpecLen = trimUserField.Length; position = trimUserField.IndexOf('>'); if (position != -1) { addrSpecLen = trimUserField.Length - 1; if (position != -1) { addrSpecLen = position - 1; string paramStr = trimUserField.Substring(position + 1).Trim(); userField.Parameters = new SIPParameters(paramStr, PARAM_TAG_DELIMITER); } string addrSpec = trimUserField.Substring(1, addrSpecLen); userField.URI = SIPURI.ParseSIPURI(addrSpec); } else { throw new SIPValidationException(SIPValidationFieldsEnum.ContactHeader, "A SIPUserField was missing the right quote, " + userFieldStr + "."); } } return userField; }