jainsip processResponse not called - jain-sip

I have successfylly used jainsip to register clients. The method processRequest is working. I am sending an Invite from the proxy to the phone and the phone is ringing. The source port of the invite is 5060 and the ip the ip of the server. I have used a sniffer to verify that 100Trying and 180Ringing are sent from the client to the server/proxy on port 5060. There are two clients registered on the server and as mentioned, processRequest is working, but the 100Trying and 180Ringing responses arenot picked up by the SIpListener or the method processResponse just isn't called. I am using these jars:
<dependency>
<groupId>javax.sip</groupId>
<artifactId>jain-sip-api</artifactId>
<version>1.2.1.4</version>
</dependency>
<dependency>
<groupId>javax.sip</groupId>
<artifactId>jain-sip-ri</artifactId>
<version>1.2.167</version>
</dependency>
I am sending invite using this code:
ClientTransaction clientTransaction = sipProviderStatic.getNewClientTransaction(inviteRequest);
clientTransaction.sendRequest();
The registrations are going throug fine so it is not a firewall problem, I even tried turning it off.
Does anyone have an idea?

first thing is you have to redirect the port if you are testing in two emulators by sending request and getting response like the following:
go to command than enter "telnet localhost 5554" and enter same for another emulator
than enter "redir add udp:5070:5070" for server code and
than enter "redir add udp:5060:5060" for client code which is sending request ... than you can able to see the request and response between those two emulators

Related

Weird network issue

We are facing a technical issue with networking, which I'm not able to comprehend.
We are using Linphone Client to connect to x.x.x.125(Freeswitch box) via x.x.x.101 i.e .101 being a SIP proxy Flexisip.
The SIP flow look as below.
[ Linphone box ] <-> [ `.101` box ] <-> [ `.125` box ]
Now when we register i.e SIP REGISTER request (without VPN connected) to .125 via .101 it works i.e Registration is a success, saying this because I was sniffing around the traffic with TCP dump on both .101 and Linphone Client box (both had 200 OK Response for Register request).
Now here is the deal, when we make a call i.e send SIP INVITE request without VPN connected. We see no traffic on .101 box but same can be found on Linphone box hinting that request is directed to .101.(but at the same time I can constantly see OPTIONS request appearing from .101 to Linphone Machine and also a 200K response getting sent from Linphone machine for OPTIONS request.)
Now, The sooner we connect to VPN, we see the request appearing on the .101 box from Linphone box
Now, had this behaviour would have stayed constant, I would have suspected the Firewall rule but the it would work during SIP REGISTER and not using Regular INVITE invite is something I'm able to understand here.
And when we are connected to VPN it work.
NOTE: If I assume this is a packet loss as a part of UDP even the retransmission too does not go through and this happen in multiple run..
It's only the INVITE packet would not be sent always does not happen with REGISTER request.
Here how the sip flow looks like
Given the REGISTER requests are getting through that rules out an IP routing and firewall issue (assuming it's not doing deep inspection on SIP packets).
That leaves the two most likely culprits as the client software (in this case Linphone) using the wrong network interface,
Try running a test with a tool like sipp where you can explicitly set the local address to use and the type of SIP request to send.
# To test the user agent client scenario (which sends INVITE requests) use:
sipp -bind_local 10.1.10.1 -sn uac -m 1 x.x.x.125
Update:
Some observations from inspecting the packet captures:
In the no VPN case:
there is a NAPT between the softphone and the Proxy translating 10.1.10.1 to 49.36.13.47, e.g. 10.1.10.1:39248 mapped to 49.36.13.47:44150.
REGISTER responses do appear to be coming from the FreeSWITCH server at 63.211.239.125 according to the User Agent string of Flexisip... on the response.
in agreement with the original post there are no responses at all to INVITE requests in the capture.
there are no fragmented UDP packets captured.
In the VPN case:
there is no NAPT between the softphone and the Proxy. The softphone traffic is originating from 172.17.8.37.
the softphone is using an IP address of 192.168.29.134 in it's SDP offer which means the device likely has multiple network interfaces.
there is a fragmented UDP packet recorded when the softphone sends an INVITE request to the Proxy but it doesn't seem to be an issue as the Proxy happily forwards the request to the FreeSWITCH server.
Missing Data:
The no VPN capture does not contain the traffic between the Proxy and the FreeSWITCH server. This is the most crucial leg for the analysis since it could show whether the Proxy is forwarding the INVITE request or not.
Running tcpdump directly on the Proxy would be able to provide this missing information.
Updated Guess:
Based on the still incomplete information my best guess would now be that that Proxy has misconfigured (or perhaps deliberate) SIP settings and is silently dropping INVITE requests received on public interfaces.
When the softphone connects on the VPN the INVITE requests are forwarded because they are considered to originate from an internal network.
For REGISTER requests the Proxy could have a rule that says always forward them no matter which interface the Proxy receives them on since they are not as risky as INVITES.
If the path is different, the INVITE will go through different networks and they may not behave the same.
I can see 2 possible issues with the network used when VPN is not active:
A NAT has an ALG which, being broken, would drop the INVITE and let the other ones go through. This is unlikely, because it's happening for several User-Agent your tried.
The network is configured to drop packet larger than a specific size. This is very likely because the INVITE, with all User-Agent, is always the largest SIP message being sent.
I would advise you:
Try TCP: This should confirm it's a UDP only issue.
Try to remove all codecs and keep only PCMA, with UDP: if it works, it's likely a UDP/MTU/SIZE issue.
EDIT:
To make it clear, you certainly have an MTU issue.
Thus, I advise you to test your UDP network and the MTU size limit with and without the VPN. You don't have to use your android, but you need to use the same network.
On sip server, starts:
$> nc -u -l -p 2399
On LAN side, any PC with same network with netcat tool...
$> cat invite1000.example | nc -u sip.antisip.com 2399
$> cat invite1200.example | nc -u sip.antisip.com 2399
$> cat invite1500.example | nc -u sip.antisip.com 2399
$> cat invite2000.example | nc -u sip.antisip.com 2399
$> cat invite8000.example | nc -u sip.antisip.com 2399
Make several invitexxx.example files with any data, but with specific number of char in it.
In theory, nc/netcat on the server will stop receiving the packets when going over the MTU (or the packet will be incomplete).
Then, this will confirm it's an MTU issue.

Java Web application not sending Email on Ubuntu server

My play framework web application sends automatically emails to user using Apache commons email library, everything works fine on my machine, but when I deploy it on an Ubuntu server it is unable to send email.
It throws exceptions like org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.googlemail.com:465 (I also tried different configuration with smtp.google.mail port 465,25 and 587 with or without ssl and tls)
and connection timed out.
I starting to believe that is a problem of some configuration of my ubuntu server.
Any suggestion?
If i type ufw status command I receive status disabled.
Thanks
I am going to close this question, because I found the solution. Basically my Server provider (Scaleway) has a security configuration where SMTP is blocked. I asked them to unlock It.

Freeswitch server getting INVITE request in ngrep but nothing in fs_cli

I am trying to route the call from opensips server to freeswitch server. My freeswitch server is actually a container which i have created using 'lxc/lxd' and it is running CentOS.
When I route the call from opensips server to freeswitch server container i got the INVITE requests sip log in 'ngrep' but getting nothing in Freeswitch log as in nothing in fs_cli and my call is failing with the disposition 'SIP 408 - Request Timeout'
I have tried with routing the call from opensips server to other freeswitch server which is actually having a physical ip and not the container server and when I tried that, i am able to get the logs in freeswitch as in fs_cli.
Sip profile parameters auth-calls, auth-all-packets, aggressive-nat-detection set to true, there is no firewall or iptable rule between opensips and freeswitch servers. i can access the osips server from freeswitch server and vice versa.
So, what am i missing here. please suggest me something.
In fs_cli, sofia status will show you on which IP address the SIP profile is bound. Probably it's not the address you're sending invites to.
Your freeswitch server is not listening on the port with interface on
which you are sending. Just check out freeswitch profile on which
port and interface they are listening.

Connect to C++ REST sdk SERVER on Windows from LAN

I have a server written on C++ REST SDK.
There's http_listener which listens to "http://localhost:34568".
When I try to send a request in browser or from the client to localhost it works fine and I get the responses from my server. But the point is to use the application in network. And here where the problem comes.
When I try to request the server from the other PC using IP(192.168.1.103:34568) I get "HTTP Error 400. The request hostname is invalid."
I'm aware that that could be some firewall issues but it's turned off. Also I tried to set port rules in brandmauer and it didn't help.
And even more! I got XAMPP running Apache server and when I do the same thing but with (192.168.1.103:80) I do get the response from Apache and have an access.
Anybody had something similar or somebody knows what the problem is about?
Listen to local ip address or to your network name (dns):
"http://xxx.xxx.xxx.xxx:34568" or
"http://your_network_name:34568"
So, if you have multiple network adapters, you can choose which one.

Called failed in Linphone iPhone

I have successfully compiled (according to readme file provided by Linphone) and installed Linphone client on simulator and it is successfully registered to local sip server. But it shows "Call failed, Cannot call xxxxxxxxx, Reason was: no response" if I dial any number. I checked captured packet using WireShark, it only shows register sip request, but no invite request.
Any idea whats wrong? Kindly share your valuable knowledge on that.
Because may be you are dialling wrong number OR the number you are dialling is not yet registered on your SIP server.
You should also log in with other number to make call. Means on different PC run linphone on simulator or device. Then try to make call.