コード例 #1
0
ファイル: Server.cs プロジェクト: richardspiers/SCIM
 public static SIPStack CreateStack(SIPApp app, string proxyIp = null, int proxyPort = -1)
 {
     SIPStack myStack = new SIPStack(app);
     if (proxyIp != null)
     {
         myStack.ProxyHost = proxyIp;
         myStack.ProxyPort = (proxyPort == -1) ? 5060 : proxyPort;
     }
     return myStack;
 }
コード例 #2
0
ファイル: Server.cs プロジェクト: richardspiers/SCIM
        static void Main(string[] args)
        {
            bool show_help = false;
            string ip = null;
            int port = 5060;
            var p = new OptionSet() {
            { "i=", "IP address to use", v => { if (v == null) ip = Helpers.GetLocalIP(); else ip = v;} },
            { "p=", "port to use", v => { if (v != null) port = Int32.Parse(v);}},
            { "h|help", "Show help and exit", (v) => show_help = v != null }
            };
            //port = 5060; else port = v;
            List<string> extra;
            try
            {
                extra = p.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine("Use --help for correct options");
                return;
            }

            if (show_help)
            {
                ShowHelp(p);
                return;
            }

            if (ip == null)
            {
                ip = Helpers.GetLocalIP();
            }

            TransportInfo localTransport = CreateTransport(ip, port);
            _app = new SIPApp(localTransport);
            Log.Info(String.Format("Starting SCIM on ip {0} port {1}",ip,port));
            _app.RequestRecvEvent += new EventHandler<SipMessageEventArgs>(AppRequestRecvEvent);
            _app.ResponseRecvEvent += new EventHandler<SipMessageEventArgs>(AppResponseRecvEvent);
            LoadData();
            const string scscfIP = "scscf.open-ims.test";
            const int scscfPort = 6060;
            //SIPStack stack = CreateStack(_app, scscfIP, scscfPort);
            //Disable sending to SCSCF first
            SIPStack stack = CreateStack(_app);
            stack.Uri = new SIPURI("*****@*****.**");
            Log.Info("Press any key to exit");
            Console.ReadKey();
            SaveData();
        }