public RegisterRequest(Reception reception) { Expires = 1800;//デフォルト値 To = new SipUri(reception.Header.GetVal("To")); From = new SipUri(reception.Header.GetVal("From")); var contact = reception.Header.GetVal("Contact"); Contact = new SipUri(contact); if (contact != null){ var index = contact.IndexOf(";"); if (index != -1){ var tmp = contact.Substring(index + 1); var i = tmp.ToLower().IndexOf("expires"); if (i != -1){ var expires = tmp.Substring(i+8); var result = 0; if (Int32.TryParse(expires, out result)){ Expires = result; } } } } var s = reception.Header.GetVal("Expires"); if (s != null){ var result = 0; if (Int32.TryParse(s, out result)) { Expires = result; } } Server = reception.StartLine.RequestUri; }
public void Portの解釈(string str, int port) { //setup var sut = new SipUri(str); var exception = port; //exercise var actual = sut.Port; //verify Assert.That(actual, Is.EqualTo(exception)); }
public void Nameの解釈(string str, string name) { //setup var sut = new SipUri(str); var exception = name; //exercise var actual = sut.Name; //verify Assert.That(actual, Is.EqualTo(exception)); }
public void Hostの解釈(string str, string host) { //setup var sut = new SipUri(str); var exception = host; //exercise var actual = sut.Host; //verify Assert.That(actual, Is.EqualTo(exception)); }
public void Detailの解釈(string str, string display) { //setup var sut = new SipUri(str); var exception = display; //exercise var actual = sut.Display; //verify Assert.That(actual, Is.EqualTo(exception)); }
public RegisterRequest(Reception reception) { Expires = 1800;//デフォルト値 To = new SipUri(reception.Header.GetVal("To")); From = new SipUri(reception.Header.GetVal("From")); var contact = reception.Header.GetVal("Contact"); Contact = new SipUri(contact); if (contact != null) { var index = contact.IndexOf(";"); if (index != -1) { var tmp = contact.Substring(index + 1); var i = tmp.ToLower().IndexOf("expires"); if (i != -1) { var expires = tmp.Substring(i + 8); var result = 0; if (Int32.TryParse(expires, out result)) { Expires = result; } } } } var s = reception.Header.GetVal("Expires"); if (s != null) { var result = 0; if (Int32.TryParse(s, out result)) { Expires = result; } } Server = reception.StartLine.RequestUri; }
public void Protocolの解釈(string str, Protocol protocol) { //setup var sut = new SipUri(str); var exception = protocol; //exercise var actual = sut.Protocol; //verify Assert.That(actual, Is.EqualTo(exception)); }