示例#1
0
        public EndPoint GetPluginLocalEndPointIfConfigured(Server server)
        {
            var plugin = _pluginsByServer.GetOrAdd(
                server,
                x => Sip003Plugin.CreateIfConfigured(x, _config.showPluginOutput));

            if (plugin == null)
            {
                return(null);
            }

            try
            {
                if (plugin.StartIfNeeded())
                {
                    logger.Info(
                        $"Started SIP003 plugin for {server.Identifier()} on {plugin.LocalEndPoint} - PID: {plugin.ProcessId}");
                }
            }
            catch (Exception ex)
            {
                logger.Error("Failed to start SIP003 plugin: " + ex.Message);
                throw;
            }

            return(plugin.LocalEndPoint);
        }
示例#2
0
        public void TestSip003Plugin_NoPlugin()
        {
            var NoPlugin = Sip003Plugin.CreateIfConfigured(new Server
            {
                server      = "192.168.100.1",
                server_port = 8888,
                password    = "******",
                method      = "bf-cfb"
            });

            RunPluginSupportTest(
                NoPlugin,
                "",
                "",
                "",
                "192.168.100.1",
                8888);
        }
示例#3
0
        public void TestSip003Plugin_PluginWithArgs()
        {
            var PluginWithArgs = Sip003Plugin.CreateIfConfigured(new Server
            {
                server      = "192.168.100.1",
                server_port = 8888,
                password    = "******",
                method      = "bf-cfb",
                plugin      = fake_plugin,
                plugin_args = "_test"
            });

            RunPluginSupportTest(
                PluginWithArgs,
                fake_plugin,
                "",
                "_test",
                "192.168.100.1",
                8888);
        }
示例#4
0
        public void TestSip003Plugin_PluginWithOptsAndArgsReplaced()
        {
            var PluginWithOptsAndArgsReplaced = Sip003Plugin.CreateIfConfigured(new Server
            {
                server      = "192.168.100.1",
                server_port = 8888,
                password    = "******",
                method      = "bf-cfb",
                plugin      = fake_plugin,
                plugin_opts = "_option",
                plugin_args = "_test,%SS_REMOTE_HOST%,%SS_PLUGIN_OPTIONS%"
            });

            RunPluginSupportTest(
                PluginWithOptsAndArgsReplaced,
                fake_plugin,
                "_option",
                "_test,192.168.100.1,_option",
                "192.168.100.1",
                8888);
        }
示例#5
0
        public void TestSip003Plugin_PluginWithArgsReplaced()
        {
            var PluginWithArgsReplaced = Sip003Plugin.CreateIfConfigured(
                new Server
            {
                server      = "192.168.100.1",
                server_port = 8888,
                password    = "******",
                method      = "bf-cfb",
                plugin      = fake_plugin,
                plugin_args = "_test,%SS_REMOTE_HOST%"
            },
                false);

            RunPluginSupportTest(
                PluginWithArgsReplaced,
                fake_plugin,
                "",
                "_test,192.168.100.1",
                "192.168.100.1",
                8888);
        }