Esempio n. 1
0
        protected TSIP_Transport(TSIP_Stack stack, String host, ushort port, TNET_Socket.tnet_socket_type_t type, String description)
            : base(host, port, type, description)
        {
            mStack  = stack;
            mScheme = TNET_Socket.IsTLSType(type) ? "sips" : "sip";
            if (TNET_Socket.IsStreamType(type))
            {
                mProtocol = "tcp";

                if (TNET_Socket.IsTLSType(type))
                {
                    mViaProtocol = "TLS";
                    mService     = "SIPS+D2T";
                }
                else
                {
                    mViaProtocol = "TCP";
                    mService     = "SIP+D2T";
                }
            }
            else
            {
                mProtocol    = "udp";
                mViaProtocol = "UDP";
                mService     = "SIP+D2U";
            }
        }
 internal TSIP_TransportLayer(TSIP_Stack stack)
 {
     mStack = stack;
     mTransports = new List<TSIP_Transport>();
     #if WINDOWS_PHONE
     mMutex = new Mutex(false, TSK_String.Random());
     #else
     mMutex = new Mutex();
     #endif
 }
 internal TSIP_DialogLayer(TSIP_Stack stack)
 {
     mStack = stack;
     mDialogs = new Dictionary<Int64, TSIP_Dialog>();
     #if WINDOWS_PHONE
     mMutex = new Mutex(false, TSK_String.Random());
     #else
     mMutex = new Mutex();
     #endif
 }
Esempio n. 4
0
        internal TSIP_DialogLayer(TSIP_Stack stack)
        {
            mStack   = stack;
            mDialogs = new Dictionary <Int64, TSIP_Dialog>();
#if WINDOWS_PHONE
            mMutex = new Mutex(false, TSK_String.Random());
#else
            mMutex = new Mutex();
#endif
        }
        internal TSIP_TransportLayer(TSIP_Stack stack)
        {
            mStack      = stack;
            mTransports = new List <TSIP_Transport>();
#if WINDOWS_PHONE
            mMutex = new Mutex(false, TSK_String.Random());
#else
            mMutex = new Mutex();
#endif
        }
 internal TSIP_TransacLayer(TSIP_Stack stack)
 {
     mSipStack = stack;
     mTransactions = new Dictionary<Int64,TSIP_Transac>();
     mReliable = TNET_Socket.IsStreamType(mSipStack.ProxyType);
     #if WINDOWS_PHONE
     mMutex = new Mutex(false, TSK_String.Random());
     #else
     mMutex = new Mutex();
     #endif
 }
        internal TSIP_TransacLayer(TSIP_Stack stack)
        {
            mSipStack     = stack;
            mTransactions = new Dictionary <Int64, TSIP_Transac>();
            mReliable     = TNET_Socket.IsStreamType(mSipStack.ProxyType);
#if WINDOWS_PHONE
            mMutex = new Mutex(false, TSK_String.Random());
#else
            mMutex = new Mutex();
#endif
        }
 internal TSIP_TransportTCP(TSIP_Stack stack, String host, ushort port, String description)
     : this(stack, host, port, false, description)
 {
 }
Esempio n. 9
0
 internal TSIP_TransportIPSec(TSIP_Stack stack, String host, ushort port, String description)
     : this(stack, host, port, false, description)
 {
 }
 internal TSIP_TransportTCP(TSIP_Stack stack, String host, ushort port, bool useIPv6, String description)
     : base(stack, host, port, useIPv6 ? tnet_socket_type_t.tnet_socket_type_tcp_ipv6 : tnet_socket_type_t.tnet_socket_type_tcp_ipv4, description)
 {
 }
 internal TSIP_TransportUDP(TSIP_Stack stack, Boolean useIPv6, String description)
     : this(stack, TNET_Socket.TNET_SOCKET_HOST_ANY, TNET_Socket.TNET_SOCKET_PORT_ANY, useIPv6, description)
 {
 }
Esempio n. 12
0
 internal TSIP_TransportIPSec(TSIP_Stack stack, String host, ushort port, bool useIPv6, String description)
     : base(stack, host, port, useIPv6 ? tnet_socket_type_t.tnet_socket_type_udp_ipsec_ipv6 : tnet_socket_type_t.tnet_socket_type_udp_ipsec_ipv4, description)
 {
 }
 public TSIP_SessionRegister(TSIP_Stack stack)
     : this(stack,  null)
 {
 }
Esempio n. 14
0
        static void Main(string[] args)
        {
            //Test_FSM.DefaultTest();

            //TSIP_TransportUDP transportUdp = new TSIP_TransportUDP("192.168.0.13", TNET_Socket.TNET_SOCKET_PORT_ANY, false, "Sip Tansport using UDP");
            //IPEndPoint remoteEP = TNET_Socket.CreateEndPoint("192.168.0.10", 5060);
            // Int32 count = transportUdp.SendTo(remoteEP, Encoding.UTF8.GetBytes("test"));

            //Test_UriParser.TestUriParser();
            //Test_UriParser.TestMessageParser();

            /*List<TSIP_HeaderVia> headers = TSIP_HeaderVia.Parse("Via: SIP/2.0/tcp 127.0.0.1:5082;branch=z9hG4bKc16be5aee32df400d01015675ab911ba,SIP/2.0/udp 127.0.0.1:5082;branch=z9hG4bKeec53b25db240bec92ea250964b8c1fa;received_port_ext=5081;received=192.168.0.13,SIP/2.0/UDP 192.168.0.12:57121;rport=57121;branch=z9hG4bK1274980921982;received_port_ext=5081;received=192.168.0.12\r\n");
             * foreach (TSIP_HeaderVia h in headers)
             * {
             *  Console.WriteLine(h.ToString(true, true, true));
             * }*/

            //TSIP_HeaderTo header = TSIP_HeaderTo.Parse("t:    <sip:[email protected]>;tag= 12345\r\n");
            //if (header != null)
            //{
            //    Console.WriteLine(header.ToString(true, true, true));
            //}

            TSIP_Stack sipStack = new TSIP_Stack(
                TSIP_Uri.Create("sip:doubango.org"),
                "004",
                TSIP_Uri.Create("sip:[email protected]"),
                "192.168.0.10", 5060
                );

            sipStack.LocalIP = "192.168.0.13";//FIXME

            sipStack.Callback = delegate(TSIP_Event @event)
            {
                switch (@event.Type)
                {
                case TSIP_Event.tsip_event_type_t.DIALOG:
                {
                    TSIP_EventDialog eventDialog = (@event as TSIP_EventDialog);
                    break;
                }

                case TSIP_Event.tsip_event_type_t.REGISTER:
                {
                    TSIP_EventRegister eventDialog = (@event as TSIP_EventRegister);
                    break;
                }

                default:
                {
                    return(false);
                }
                }
                return(true);
            };


            if (sipStack.Start())
            {
                TSIP_SessionRegister register = new TSIP_SessionRegister(sipStack);
                register.Register();
            }

            Console.ReadLine();
        }
Esempio n. 15
0
 internal TSIP_Challenge(TSIP_Stack stack, Boolean isproxy, String scheme, String realm, String nonce, String opaque, String algorithm, String qop)
 {
     mStack = stack;
     mProxy = isproxy;
     Update(scheme, realm, nonce, opaque, algorithm, qop);
 }
Esempio n. 16
0
 internal TSIP_Challenge(TSIP_Stack stack)
     : this(stack, false, null, null, null, null, null, null)
 {
 }
Esempio n. 17
0
 internal TSIP_Challenge(TSIP_Stack stack, Boolean isproxy, String scheme, String realm, String nonce, String opaque, String algorithm, String qop)
 {
     mStack = stack;
     mProxy = isproxy;
     Update(scheme, realm, nonce, opaque, algorithm, qop);
 }
 // internal construction used to create server-side session
 internal TSIP_SessionRegister(TSIP_Stack stack, TSIP_Message message)
     : base(stack, message)
 {
 }
 internal TSIP_TransportUDP(TSIP_Stack stack, String host, ushort port, Boolean useIPv6, String description)
     : base(stack, host, port, useIPv6 ? tnet_socket_type_t.tnet_socket_type_udp_ipv6 : tnet_socket_type_t.tnet_socket_type_udp_ipv4, description)
 {
 }
Esempio n. 20
0
 protected TSIP_Transport(TSIP_Stack stack, TNET_Socket.tnet_socket_type_t type, String description)
     : this(stack, TNET_Socket.TNET_SOCKET_HOST_ANY, TNET_Socket.TNET_SOCKET_PORT_ANY, type, description)
 {
 }
 internal TSIP_TransportUDP(TSIP_Stack stack, Boolean useIPv6, String description)
     : this(stack, TNET_Socket.TNET_SOCKET_HOST_ANY, TNET_Socket.TNET_SOCKET_PORT_ANY, useIPv6, description)
 {
 }
Esempio n. 22
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();


            String mm = "SIP/2.0 200 OK\r\n" +
                        "Via: SIP/2.0/UDP 192.168.0.13:5060;branch=z9hG4bK_56ef1cda-aef6-4d76-ab7e-d148af3b18ac;rport=51049\r\n" +
                        "Record-Route: <sip:192.168.0.10:5060;lr;transport=udp>\r\n" +
                        "To: <sip:[email protected]>\r\n" +
                        "From: <sip:[email protected]>;tag=9bff9c34-35e3-4fa8-8de4-290ce275c981\r\n" +
                        "Call-ID: 272b67b9-08b2-4fce-8f6e-6ccaf5e5ec9a\r\n" +
                        "CSeq: 1990525622 REGISTER\r\n" +
                        "Server: mjsip stack 1.6\r\n" +
                        "Contact: <sip:[email protected]:5060>;expires=10\r\n" +
                        "Content-Length: 0\r\n" +
                        "\r\n";

            /*TSIP_Message message = TSIP_ParserMessage.Parse(UTF8Encoding.UTF8.GetBytes(mm), true);
             * if (message != null)
             * {
             * }*/



            TSIP_Stack sipStack = new TSIP_Stack(
                TSIP_Uri.Create("sip:doubango.org"),
                "004",
                TSIP_Uri.Create("sip:[email protected]"),
                "192.168.0.10", 5060
                );

            // sipStack.Headers.Add(new TSK_Param("User-Agent", "wp-ngn-stack"));
            sipStack.AoRIP   = "192.168.0.13";
            sipStack.AoRPort = 5060;

            sipStack.Callback = delegate(TSIP_Event @event)
            {
                switch (@event.Type)
                {
                case TSIP_Event.tsip_event_type_t.DIALOG:
                {
                    TSIP_EventDialog eventDialog = (@event as TSIP_EventDialog);
                    break;
                }

                case TSIP_Event.tsip_event_type_t.REGISTER:
                {
                    TSIP_EventRegister eventDialog = (@event as TSIP_EventRegister);
                    break;
                }

                default:
                {
                    return(false);
                }
                }
                return(true);
            };


            if (sipStack.Start())
            {
                TSIP_SessionRegister register = new TSIP_SessionRegister(sipStack);
                register.Register();
            }
        }
Esempio n. 23
0
 internal TSIP_Challenge(TSIP_Stack stack)
     : this(stack, false, null, null, null, null, null, null)
 {
 }
 public TSIP_SessionRegister(TSIP_Stack stack)
     : this(stack, null)
 {
 }
 // internal construction used to create server-side session
 internal TSIP_SessionRegister(TSIP_Stack stack, TSIP_Message message)
     : base(stack, message)
 {
 }