// 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(); } }
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(); }