示例#1
0
        public void SipContactValue_DisplayAndUri()
        {
            SipContactValue v;

            v = new SipContactValue("Jeff sip:[email protected]");
            Assert.AreEqual("sip:[email protected]", v.Uri);
            Assert.AreEqual("Jeff", v.DisplayName);
            Assert.AreEqual("\"Jeff\"<sip:[email protected]>", v.ToString());

            v = new SipContactValue("Internal<sip:[email protected]:8899>");
            Assert.AreEqual("sip:[email protected]:8899", v.Uri);
            Assert.AreEqual("Internal", v.DisplayName);
            Assert.AreEqual("\"Internal\"<sip:[email protected]:8899>", v.ToString());

            // Microsoft Speech Server sometimes does not quote the display
            // name in a SIP URI properly.  I've seen situations where it
            // sends a 180 (Ringing) response with an unquoted display name
            // with a space and an angle bracket quoted URI.  The LillTek
            // SIP stack will handle this by looking for URIs without double
            // quotes but with angle brackets and use the first angle bracket
            // as the display name termination.

            v = new SipContactValue("MSS Gateway<sip:[email protected]:8899>");
            Assert.AreEqual("sip:[email protected]:8899", v.Uri);
            Assert.AreEqual("MSS Gateway", v.DisplayName);
            Assert.AreEqual("\"MSS Gateway\"<sip:[email protected]:8899>", v.ToString());

            v = new SipContactValue("MSS Gateway \t<sip:[email protected]:8899>");
            Assert.AreEqual("sip:[email protected]:8899", v.Uri);
            Assert.AreEqual("MSS Gateway", v.DisplayName);
            Assert.AreEqual("\"MSS Gateway\"<sip:[email protected]:8899>", v.ToString());
        }
示例#2
0
        public void SipContactValue_QuotedDisplayAndQuotedUri()
        {
            SipContactValue v;

            v = new SipContactValue("\"Jeff Lill\" <sip:[email protected]>");
            Assert.AreEqual("sip:[email protected]", v.Uri);
            Assert.AreEqual("Jeff Lill", v.DisplayName);
            Assert.AreEqual("\"Jeff Lill\"<sip:[email protected]>", v.ToString());
        }
示例#3
0
        public void SipContactValue_DisplayEscapeChars()
        {
            SipContactValue v;

            v = new SipContactValue("\"Jeff \\\"The\\\\Lill\\\"\" <sip:[email protected]>");
            Assert.AreEqual("sip:[email protected]", v.Uri);
            Assert.AreEqual("Jeff \"The\\Lill\"", v.DisplayName);
            Assert.AreEqual("\"Jeff \\\"The\\\\Lill\\\"\"<sip:[email protected]>", v.ToString());
        }
示例#4
0
        public void SipContactValue_Uri()
        {
            SipContactValue v;
            SipUri          uri;

            v = new SipContactValue("sip:[email protected]");
            Assert.AreEqual("sip:[email protected]", v.Uri);
            Assert.IsNull(v.DisplayName);
            Assert.AreEqual("<sip:[email protected]>", v.ToString());

            uri = new SipUri("sip:[email protected];transport=tcp");
            v   = uri;
            Assert.AreEqual("<sip:[email protected];transport=tcp>", v.ToString());
        }
示例#5
0
        public void SipContactValue_SetProperties()
        {
            SipContactValue v;

            v = new SipContactValue(null, "sip:[email protected]");
            Assert.AreEqual("<sip:[email protected]>", v.ToString());
            Assert.AreEqual("<sip:[email protected]>", v.Text);

            v.DisplayName = "Jeff";
            Assert.AreEqual("\"Jeff\"<sip:[email protected]>", v.ToString());
            Assert.AreEqual("\"Jeff\"<sip:[email protected]>", v.Text);

            v.Uri = "sip:[email protected]";
            Assert.AreEqual("\"Jeff\"<sip:[email protected]>", v.ToString());
            Assert.AreEqual("\"Jeff\"<sip:[email protected]>", v.Text);

            v.Uri         = "sip:[email protected]";
            v.DisplayName = "Jeff \"The\\Lill\"";
            Assert.AreEqual("\"Jeff \\\"The\\\\Lill\\\"\"<sip:[email protected]>", v.ToString());
            Assert.AreEqual("\"Jeff \\\"The\\\\Lill\\\"\"<sip:[email protected]>", v.Text);
        }