Пример #1
0
        private void Initialise_Click(object sender, EventArgs e)
        {
            if (m_opalContext == null)
            {
                Initialise.Enabled = false;
                LogLevel.Enabled   = false;
                LogFile.Enabled    = false;
                StunServer.Enabled = false;

                m_opalContext = new OpalContext();
                if (m_opalContext.Initialise(OPAL.OPAL_PREFIX_SIP + " " + OPAL.OPAL_PREFIX_PCSS +
                                             " --trace-level " + LogLevel.Value + " --output " + LogFile.Text) == 0)
                {
                    MessageBox.Show("Failed to initialise", "OPAL", MessageBoxButtons.OK);
                }
                else
                {
                    m_opalThread = new System.Threading.Thread(new System.Threading.ThreadStart(HandleOpalMessages));
                    m_opalThread.Start();

                    OpalMessagePtr   msg = new OpalMessagePtr(OpalMessageType.OpalCmdSetGeneralParameters);
                    OpalParamGeneral gen = msg.GetGeneralParams();
                    gen.natMethod          = "STUN";
                    gen.natServer          = StunServer.Text;
                    gen.autoRxMedia        = gen.autoTxMedia = "audio video";
                    gen.mediaMask          = "!G.711*\n!H.263*"; // Kind of backwards, it's a mask with negative entries, so just get G.711/H.263
                    gen.videoOutputDevice  = "MSWIN STYLE=0x50000000 PARENT=" + VideoDisplay.Handle + " X=0 Y=0 WIDTH=" + VideoDisplay.Width + " HEIGHT=" + VideoDisplay.Height;
                    gen.videoPreviewDevice = "MSWIN STYLE=0x50000000 PARENT=" + VideoPreview.Handle + " X=0 Y=0 WIDTH=" + VideoPreview.Width + " HEIGHT=" + VideoPreview.Height;
                    OpalMessagePtr result = new OpalMessagePtr();
                    if (!m_opalContext.SendMessage(msg, result))
                    {
                        MessageBox.Show("Could not set general parameters: " + result.GetCommandError(), "OPAL", MessageBoxButtons.OK);
                    }
                    else
                    {
                        msg = new OpalMessagePtr(OpalMessageType.OpalCmdSetProtocolParameters);
                        OpalParamProtocol proto = msg.GetProtocolParams();
                        proto.prefix             = OPAL.OPAL_PREFIX_SIP;
                        proto.interfaceAddresses = "0.0.0.0"; // All interfaces
                        if (!m_opalContext.SendMessage(msg))
                        {
                            MessageBox.Show("Could not set general parameters", "OPAL", MessageBoxButtons.OK);
                        }
                        else
                        {
                            Shutdown.Enabled = true;
                            Register.Enabled = true;
                            Call.Enabled     = true;
                            return;
                        }
                    }
                }

                Initialise.Enabled = true;
                LogLevel.Enabled   = true;
                LogFile.Enabled    = true;
                StunServer.Enabled = true;
            }
        }
Пример #2
0
        private void Shutdown_Click(object sender, EventArgs e)
        {
            if (m_opalContext != null)
            {
                Shutdown.Enabled   = false;
                Register.Enabled   = false;
                Unregister.Enabled = false;
                Call.Enabled       = false;
                HangUp.Enabled     = false;

                m_opalContext.ShutDown(); // This will make GetMessage() return false
                m_opalThread.Join();
                m_opalThread  = null;
                m_opalContext = null;

                Initialise.Enabled = true;
                LogLevel.Enabled   = true;
                LogFile.Enabled    = true;
                StunServer.Enabled = true;
            }
        }
Пример #3
0
        public IEnumerable <User> GetAllUsers()
        {
            OpalContext _context = new OpalContext();

            return(_context.Users.ToList());
        }
Пример #4
0
 internal static HandleRef getCPtr(OpalContext obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Пример #5
0
        private void Initialise_Click(object sender, EventArgs e)
        {
            if (m_opalContext == null)
            {
                Initialise.Enabled = false;
                LogLevel.Enabled   = false;
                LogFile.Enabled    = false;
                StunServer.Enabled = false;

                m_opalContext = new OpalContext();
                if (m_opalContext.Initialise(OPAL.OPAL_PREFIX_SIP + " " + OPAL.OPAL_PREFIX_PCSS +
                                             " --trace-level " + LogLevel.Value + " --output \"" + LogFile.Text + "\"") == 0)
                {
                    MessageBox.Show("Failed to initialise", "OPAL", MessageBoxButtons.OK);
                }
                else
                {
                    m_opalThread = new System.Threading.Thread(new System.Threading.ThreadStart(HandleOpalMessages));
                    m_opalThread.Start();

                    OpalMessagePtr   msg = new OpalMessagePtr(OpalMessageType.OpalCmdSetGeneralParameters);
                    OpalParamGeneral gen = msg.GetGeneralParams();
                    gen.natMethod          = "STUN";
                    gen.natServer          = StunServer.Text;
                    gen.autoRxMedia        = gen.autoTxMedia = "audio video";
                    gen.mediaMask          = "!*uLaw*\n!*264-0\nH.263*"; // Kind of backwards, it's a mask with negative entries
                    gen.mediaOptions       = "video:Frame Width=640\nvideo:Frame Height=480\nvideo:Target Bit Rate=256000";
                    gen.audioPlayerDevice  = "Default communications";
                    gen.audioRecordDevice  = "Default communications";
                    gen.videoOutputDevice  = "MSWIN STYLE=0x50000000 PARENT=" + VideoDisplay.Handle + " X=0 Y=0 WIDTH=" + VideoDisplay.Width + " HEIGHT=" + VideoDisplay.Height + " NO-MOUSE";
                    gen.videoPreviewDevice = "MSWIN STYLE=0x50000000 PARENT=" + VideoPreview.Handle + " X=0 Y=0 WIDTH=" + VideoPreview.Width + " HEIGHT=" + VideoPreview.Height + " NO-MOUSE";
                    gen.noMediaTimeout     = 15000;
                    OpalMessagePtr result = new OpalMessagePtr();
                    if (!m_opalContext.SendMessage(msg, result))
                    {
                        MessageBox.Show("Could not set general parameters: " + result.GetCommandError(), "OPAL", MessageBoxButtons.OK);
                    }
                    else
                    {
                        msg = new OpalMessagePtr(OpalMessageType.OpalCmdSetProtocolParameters);
                        OpalParamProtocol proto = msg.GetProtocolParams();
                        proto.prefix             = OPAL.OPAL_PREFIX_SIP;
                        proto.interfaceAddresses = "0.0.0.0"; // All interfaces
                        proto.displayName        = "OPAL C# Sample";
                        if (!m_opalContext.SendMessage(msg))
                        {
                            MessageBox.Show("Could not set protool parameters", "OPAL", MessageBoxButtons.OK);
                        }
                        else
                        {
                            Shutdown.Enabled = true;
                            Register.Enabled = true;
                            Call.Enabled     = true;
                            return;
                        }
                    }
                }

                Initialise.Enabled = true;
                LogLevel.Enabled   = true;
                LogFile.Enabled    = true;
                StunServer.Enabled = true;
            }
        }
Пример #6
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(OpalContext obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Пример #7
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(OpalContext obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Пример #8
0
        private void Shutdown_Click(object sender, EventArgs e)
        {
            if (m_opalContext != null)
            {
                Shutdown.Enabled = false;
                Register.Enabled = false;
                Unregister.Enabled = false;
                Call.Enabled = false;
                HangUp.Enabled = false;

                m_opalContext.ShutDown(); // This will make GetMessage() return false
                m_opalThread.Join();
                m_opalThread = null;
                m_opalContext = null;

                Initialise.Enabled = true;
                LogLevel.Enabled = true;
                LogFile.Enabled = true;
                StunServer.Enabled = true;
            }
        }
Пример #9
0
        private void Initialise_Click(object sender, EventArgs e)
        {
            if (m_opalContext == null)
            {
                Initialise.Enabled = false;
                LogLevel.Enabled = false;
                LogFile.Enabled = false;
                StunServer.Enabled = false;

                m_opalContext = new OpalContext();
                if (m_opalContext.Initialise(OPAL.OPAL_PREFIX_SIP + " " + OPAL.OPAL_PREFIX_PCSS +
                                             " --trace-level " + LogLevel.Value + " --output " + LogFile.Text) == 0)
                    MessageBox.Show("Failed to initialise", "OPAL", MessageBoxButtons.OK);
                else
                {
                    m_opalThread = new System.Threading.Thread(new System.Threading.ThreadStart(HandleOpalMessages));
                    m_opalThread.Start();

                    OpalMessagePtr msg = new OpalMessagePtr(OpalMessageType.OpalCmdSetGeneralParameters);
                    OpalParamGeneral gen = msg.GetGeneralParams();
                    gen.natMethod = "STUN";
                    gen.natServer = StunServer.Text;
                    gen.autoRxMedia = gen.autoTxMedia = "audio video";
                    gen.mediaMask = "!G.711*\n!H.263*"; // Kind of backwards, it's a mask with negative entries, so just get G.711/H.263
                    gen.videoOutputDevice = "MSWIN STYLE=0x50000000 PARENT=" + VideoDisplay.Handle + " X=0 Y=0 WIDTH=" + VideoDisplay.Width + " HEIGHT=" + VideoDisplay.Height;
                    gen.videoPreviewDevice = "MSWIN STYLE=0x50000000 PARENT=" + VideoPreview.Handle + " X=0 Y=0 WIDTH=" + VideoPreview.Width + " HEIGHT=" + VideoPreview.Height;
                    OpalMessagePtr result = new OpalMessagePtr();
                    if (!m_opalContext.SendMessage(msg, result))
                        MessageBox.Show("Could not set general parameters: " + result.GetCommandError(), "OPAL", MessageBoxButtons.OK);
                    else
                    {
                        msg = new OpalMessagePtr(OpalMessageType.OpalCmdSetProtocolParameters);
                        OpalParamProtocol proto = msg.GetProtocolParams();
                        proto.prefix = OPAL.OPAL_PREFIX_SIP;
                        proto.interfaceAddresses = "0.0.0.0"; // All interfaces
                        if (!m_opalContext.SendMessage(msg))
                            MessageBox.Show("Could not set general parameters", "OPAL", MessageBoxButtons.OK);
                        else
                        {
                            Shutdown.Enabled = true;
                            Register.Enabled = true;
                            Call.Enabled = true;
                            return;
                        }
                    }
                }

                Initialise.Enabled = true;
                LogLevel.Enabled = true;
                LogFile.Enabled = true;
                StunServer.Enabled = true;
            }
        }
Пример #10
0
 internal static HandleRef getCPtr(OpalContext obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }