Пример #1
0
        public static string GenerateStreamForward(string id, int port, string host = null, bool?silence = null, string options = null)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (port <= 0 || 65535 < port)
            {
                throw new ArgumentOutOfRangeException("port");
            }
            bool   silenceBool   = silence ?? false;
            string silenceString = (silence == null) ? null : silenceBool ? "true" : "false";

            SamRequestBuilder request = new SamRequestBuilder("STREAM", "FORWARD");

            request.Add("ID", id);
            request.Add("PORT", port.ToString());
            request.Add("HOST", host);
            request.Add("SILENCE", silenceString);
            request.AddDirect(options);

            string requestString = request.Join();

            return(requestString);
        }
Пример #2
0
        public static string GenerateSessionCreate(string style, string id, string destination = null, string options = null)
        {
            if (style == null)
            {
                throw new ArgumentNullException("style");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (destination == null)
            {
                destination = "TRANSIENT";
            }

            SamRequestBuilder request = new SamRequestBuilder("SESSION", "CREATE");

            request.Add("STYLE", style);
            request.Add("ID", id);
            request.Add("DESTINATION", destination);
            request.AddDirect(options);

            string requestString = request.Join();

            return(requestString);
        }
Пример #3
0
        public static string GenerateStreamAccept(string id, bool?silence = null, string options = null)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            bool   silenceBool   = silence ?? false;
            string silenceString = (silence == null) ? null : silenceBool ? "true" : "false";

            SamRequestBuilder request = new SamRequestBuilder("STREAM", "ACCEPT");

            request.Add("ID", id);
            request.Add("SILENCE", silenceString);
            request.AddDirect(options);

            string requestString = request.Join();

            return(requestString);
        }
Пример #4
0
        public static string GenerateHelloVersion(string minVersion, string maxVersion, string options = null)
        {
            if (minVersion == null)
            {
                throw new ArgumentNullException("minVersion");
            }
            if (maxVersion == null)
            {
                throw new ArgumentNullException("maxVersion");
            }

            SamRequestBuilder request = new SamRequestBuilder("HELLO", "VERSION");

            request.Add("MIN", minVersion);
            request.Add("MAX", maxVersion);
            request.AddDirect(options);

            string requestString = request.Join();

            return(requestString);
        }
Пример #5
0
        public static string GenerateStreamConnect(string id, string destination, bool?silence = null, string options = null)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (destination == null)
            {
                throw new ArgumentNullException("destination");
            }
            bool   silenceBool   = silence ?? false;
            string silenceString = (silence == null) ? null : silenceBool ? "true" : "false";

            SamRequestBuilder request = new SamRequestBuilder("STREAM", "CONNECT");

            request.Add("ID", id);
            request.Add("DESTINATION", destination);
            request.Add("SILENCE", silenceString);
            request.AddDirect(options);

            string requestString = request.Join();

            return(requestString);
        }
Пример #6
0
        public static string GenerateNamingLookup(string name, string options = null)
        {
            if (name == null)
            {
                name = "ME";
            }

            SamRequestBuilder request = new SamRequestBuilder("NAMING", "LOOKUP");

            request.Add("NAME", name);
            request.AddDirect(options);

            string requestString = request.Join();

            return(requestString);
        }
Пример #7
0
        public static string GenerateStreamForward(string id, int port, string host = null, bool? silence = null, string options = null)
        {
            if (id == null)
                throw new ArgumentNullException("id");
            if (port <= 0 || 65535 < port)
                throw new ArgumentOutOfRangeException("port");
            bool silenceBool = silence ?? false;
            string silenceString = (silence == null) ? null : silenceBool ? "true" : "false";

            SamRequestBuilder request = new SamRequestBuilder("STREAM", "FORWARD");
            request.Add("ID", id);
            request.Add("PORT", port.ToString());
            request.Add("HOST", host);
            request.Add("SILENCE", silenceString);
            request.AddDirect(options);

            string requestString = request.Join();
            return requestString;
        }
Пример #8
0
        public static string GenerateStreamConnect(string id, string destination, bool? silence = null, string options = null)
        {
            if (id == null)
                throw new ArgumentNullException("id");
            if (destination == null)
                throw new ArgumentNullException("destination");
            bool silenceBool = silence ?? false;
            string silenceString = (silence == null) ? null : silenceBool ? "true" : "false";

            SamRequestBuilder request = new SamRequestBuilder("STREAM", "CONNECT");
            request.Add("ID", id);
            request.Add("DESTINATION", destination);
            request.Add("SILENCE", silenceString);
            request.AddDirect(options);

            string requestString = request.Join();
            return requestString;
        }
Пример #9
0
        public static string GenerateStreamAccept(string id, bool? silence = null, string options = null)
        {
            if (id == null)
                throw new ArgumentNullException("id");
            bool silenceBool = silence ?? false;
            string silenceString = (silence == null) ? null : silenceBool ? "true" : "false";

            SamRequestBuilder request = new SamRequestBuilder("STREAM", "ACCEPT");
            request.Add("ID", id);
            request.Add("SILENCE", silenceString);
            request.AddDirect(options);

            string requestString = request.Join();
            return requestString;
        }
Пример #10
0
        public static string GenerateSessionCreate(string style, string id, string destination = null, string options = null)
        {
            if (style == null)
                throw new ArgumentNullException("style");
            if (id == null)
                throw new ArgumentNullException("id");
            if (destination == null)
                destination = "TRANSIENT";

            SamRequestBuilder request = new SamRequestBuilder("SESSION", "CREATE");
            request.Add("STYLE", style);
            request.Add("ID", id);
            request.Add("DESTINATION", destination);
            request.AddDirect(options);

            string requestString = request.Join();
            return requestString;
        }
Пример #11
0
        public static string GenerateNamingLookup(string name, string options = null)
        {
            if (name == null)
                name = "ME";

            SamRequestBuilder request = new SamRequestBuilder("NAMING", "LOOKUP");
            request.Add("NAME", name);
            request.AddDirect(options);

            string requestString = request.Join();
            return requestString;
        }
Пример #12
0
        public static string GenerateHelloVersion(string minVersion, string maxVersion, string options = null)
        {
            if (minVersion == null)
                throw new ArgumentNullException("minVersion");
            if (maxVersion == null)
                throw new ArgumentNullException("maxVersion");

            SamRequestBuilder request = new SamRequestBuilder("HELLO", "VERSION");
            request.Add("MIN", minVersion);
            request.Add("MAX", maxVersion);
            request.AddDirect(options);

            string requestString = request.Join();
            return requestString;
        }