I can send a udp message to specific url and port (successfully) but I can't receive response message that I can see on Wireshark!
This is the code that I use for udp connection:
Byte[] sendBytes = Encoding.ASCII.GetBytes(sipMessage);
String responseData = String.Empty;
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
try
{
using (UdpClient udpClient = new UdpClient(ipaddr, 5060))
{
udpClient.Client.ReceiveTimeout = 1000;
udpClient.Send(sendBytes, sendBytes.Length);
Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
responseData = Encoding.ASCII.GetString(receiveBytes);
}
}
catch (Exception ex)
{
responseData = ex.Message;
}
If I don't set timeout, thread keeps working.
The response message is:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
The result from wireshark is below:
+-----+-----------+--------------+--------------+----------+--------+--------------------------------------------------------+
| No. | Time | Source | Destination | Protocol | Length | Info |
+-----+-----------+--------------+--------------+----------+--------+--------------------------------------------------------+
| 465 | 33.378167 | 192.168.1.61 | 192.168.1.63 | SIP | 289 | Request: MESSAGE sip:[email protected] | (text/plain) |
| 469 | 33.817460 | 192.168.1.63 | 192.168.1.61 | SIP | 254 | Status: 200 OK | |
+-----+-----------+--------------+--------------+----------+--------+--------------------------------------------------------+
addendum: 192.168.1.61 is a computer that hosts a web page, 192.168.1.63 is a wifi dect phone
I need to send a sip message to the wifi dect (which I already achieved)
phone sends back a sip message to 192.168.1.61:5060. SIP flow is like:
[Random Port] -- Message --> [5060]
[5060] <-- 200 OK -- [5060]
so, pc connect to dect as a udp client and sends message, dect sends back 200 OK sip message to pc's 5060 port. I have problem on receiving 200 OK message!
NEWS: When I stop pbx server's services, I can get the result (200 OK); otherwise, I'm not able to receive any sip message...