Get() 공개 메소드

public Get ( string name ) : string
name string
리턴 string
예제 #1
0
            public void QuotedStringParamExtractTest()
            {
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);

                string        methodsParam      = ";methods=\"INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER\"";
                SIPParameters serverParam       = new SIPParameters(methodsParam, ';');
                string        methodsParamValue = serverParam.Get("methods");

                Console.WriteLine("Parameter string=" + serverParam.ToString() + ".");
                Console.WriteLine("The methods parameter is=" + methodsParamValue + ".");

                Assert.IsTrue(methodsParamValue == "\"INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER\"", "The method parameter was not correctly extracted.");
            }
예제 #2
0
            public void RouteParamExtractTest()
            {
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);

                string        routeParam       = ";lr;server=hippo";
                SIPParameters serverParam      = new SIPParameters(routeParam, ';');
                string        serverParamValue = serverParam.Get("server");

                Console.WriteLine("Parameter string=" + serverParam.ToString() + ".");
                Console.WriteLine("The server parameter is=" + serverParamValue + ".");

                Assert.IsTrue(serverParamValue == "hippo", "The server parameter was not correctly extracted.");
            }
예제 #3
0
        /// <summary>
        /// Reverses The SIPEndPoint.ToString() method.
        /// </summary>
        /// <param name="serialisedSIPEndPoint">The serialised SIP end point MUST be in the form protocol:socket[;connid=abcd].
        /// Valid examples are udp:10.0.0.1:5060 and ws:10.0.0.1:5060;connid=abcd. An invalid example is 10.0.0.1:5060.</param>
        private static SIPEndPoint ParseSerialisedSIPEndPoint(string serialisedSIPEndPoint)
        {
            string channelID    = null;
            string connectionID = null;
            string endPointStr  = null;
            string protcolStr   = serialisedSIPEndPoint.Substring(0, serialisedSIPEndPoint.IndexOf(':'));

            if (serialisedSIPEndPoint.Contains(";"))
            {
                endPointStr = serialisedSIPEndPoint.Slice(':', ';');
                var paramsStr = serialisedSIPEndPoint.Substring(serialisedSIPEndPoint.IndexOf(';') + 1)?.Trim();

                var endPointParams = new SIPParameters(paramsStr, ';');

                if (endPointParams.Has(CHANNELID_ATTRIBUTE_NAME))
                {
                    channelID = endPointParams.Get(CHANNELID_ATTRIBUTE_NAME);
                }

                if (endPointParams.Has(CONNECTIONID_ATTRIBUTE_NAME))
                {
                    connectionID = endPointParams.Get(CONNECTIONID_ATTRIBUTE_NAME);
                }
            }
            else
            {
                endPointStr = serialisedSIPEndPoint.Substring(serialisedSIPEndPoint.IndexOf(':') + 1);
            }

            if (!IPSocket.TryParseIPEndPoint(endPointStr, out var endPoint))
            {
                throw new ApplicationException($"Could not parse SIPEndPoint host {endPointStr} as an IP end point.");
            }

            return(new SIPEndPoint(SIPProtocolsType.GetProtocolType(protcolStr), endPoint, channelID, connectionID));
        }
예제 #4
0
            public void RouteParamExtractTest()
            {
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);

                string routeParam = ";lr;server=hippo";
                SIPParameters serverParam = new SIPParameters(routeParam, ';');
                string serverParamValue = serverParam.Get("server");

                Console.WriteLine("Parameter string=" + serverParam.ToString() + ".");
                Console.WriteLine("The server parameter is=" + serverParamValue + ".");

                Assert.IsTrue(serverParamValue == "hippo", "The server parameter was not correctly extracted.");
            }
예제 #5
0
            public void QuotedStringParamExtractTest()
            {
                Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);

                string methodsParam = ";methods=\"INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER\"";
                SIPParameters serverParam = new SIPParameters(methodsParam, ';');
                string methodsParamValue = serverParam.Get("methods");

                Console.WriteLine("Parameter string=" + serverParam.ToString() + ".");
                Console.WriteLine("The methods parameter is=" + methodsParamValue + ".");

                Assert.IsTrue(methodsParamValue == "\"INVITE, MESSAGE, INFO, SUBSCRIBE, OPTIONS, BYE, CANCEL, NOTIFY, ACK, REFER\"", "The method parameter was not correctly extracted.");
            }