How to intercept / observe SIP traffic through fiddler or wireshark? - sip

I am using a free caller android app and they restrict me with limited credits. I would like to explore more about how this app works. So I started decompiling the APK file and intercepting networking requests using Fiddler.
I intercepted requests, but none of those are creating the actual call. So after decompiling the APK I understood they are using SIP server for calls. I couldn't intercept any SIP call with fiddler or wireshark.
They are using this SIP server : https://www.kamailio.org/

Kamailio is one of the powerful SIP Servers and they have good documentation and big mail-user list. You can check their wiki:
http://www.kamailio.org/wiki/
For understanding this case first you should learn "how voip works" subject. You already can not inrecept any SIP call with fiddler or wireshark. Generally, SIP server managers hide their topology for security reasons. Thats why you can not observe SIP traffic to the end of the tunnel.
Even Kamailio has its own module that provides hide your network topology with one click :)
https://www.kamailio.org/wiki/tutorials/tls/testing-and-debugging#decoding_of_tls_connections_with_wireshark

If they can limit your credits, then, of course, they will authenticate your every call and reject it if you don't have enough funds (or out of quota).
So, if you learn a little bit about SIP technology - perhaps, you'll be able to send a call request even without a dialer, but I doubt that the call will be authenticated.
An analogy: if you know a full path to some restricted page - you can paste it into the browser's address field and go there, but if you are not logged in, then you will still get an error like "you're not allowed to read this page".

Related

Cannot make calls from Skype for business mobile clients to Cisco

I have a Skype for Business system currently deployed in my work area. Before that, we were using all the Cisco Clients and other telephony clients.
I am seeing a strange behavior, that is I am able to make calls from my Skype for Business mobile clients to my Cisco phones, but when I do reverse I cannot get the call established.
What is see is SIP status code 488 (in wire shark trace) - which is codec mismatch.
I see that an invite message from Cisco phone offers media via 0 and 101 codecs.
But still not able to get the call through.
Check the path the INVITE is taking: outgoing the SfB will send the INVITE through the mediation server for audio trans-coding, but the Cisco may be attempting media bypass: trying to connect phones directly without going through the mediation server.
But this all depend on how the two are connected of-course and if a session border controller is involved or a hundred other little things.
You may want to refer to an official document: Skype for Business 2015 using SIP trunk to Cisco Unified Communications Manager Release 10.5.2 SU3
That is over 100 pages on only one method of interconnecting the two ;)

Detecting email client of the recipients

We are planing to develop an extension for a software which will detect the email client software or interface of the recipients and report it.
In many forums this subject is told that is not possible but in this site they claim that they provide a reporting in a large scale.
http://www.adestra.com/email-client-detection-with-messagefocus/
I would be glad if someone could tell or show me a way to do it in any platform.
There are 2 situations here:
- detect the client email agent of the sender
- detect the client email agent of the receiver
The SMTP protocol does not define anything that would allow you to identify the client agent. So in theory you cannot guess it. Some clients will send some sort of identification in the header, though also this is not standard, and it can be fake. You can guess the client agent base on these identifiers though.
To find out the client agent of the receiver, you need to include content that will eventually connect to an http server. From there you can get the client agent (of the browser that opens it). So again, you have to do some guessing work. (ex. if it's yahoo.com and it is chrome .. then .. if it's ie then .. and so on.)
So to cut it short, there is not reliable way of finding out the client mail agents, it's more guessing and statistics.
The only way to do this is via the user-agent from a tracking image, you need the interaction via http. From there, you could determine, although not reliably, the email client in use.

Redirect all HTTP traffic to localhost

Too much here and I've already spent hours trying to find my answer, to no avail.
I run a small ISP. We do not use any form of PPP. However, I control the clients' routers. The client router have their default gateways normally set to use my network gateway. However, if I change the client's default gateway to point to an alias of my server, whenever they try to go anywhere on the internet, even if it's google.com, I want them to go to myserver/YouHaveNotPaidYourBill.php.
I use Debian and Lighttpd on the server.
I have tried everything I can think of, and the server simply redirects the packets to the real gateway. This isn't what I want.
Any help is greatly appreciated.
Your best chance is to poison your client's DNS, and have any DNS request point to your server.
Be warned, non-http traffic will fail silently, so clients that don't browse (ie: a line used for torrenting, for VoIP, or simply, someone who chats but doesn't browse) will only see internet failing silently and will not see the dialog.
Also, you'll fail to grab HTTPS traffic as well. Since, for example, firefox uses HTTPS for google searches by default, average joe will try to access https://www.google.com, which you can't intercept to show your own message. There no way; if there where, you'd be able to intercept any other https website (ie: banks) to show your own content.
Finally: this sort of thing is also interception of packages and/or MITM, and may be ilegal, depending on wherer you live. It's not the same to drop communications (when he doesn't pay), and to intercept it like this.

Is there a SIP/VOIP-agnostic way to know when a phone goes offline?

Working on a SIP application that requires monitoring call activity/state on a phone. My app (UA) is registered with a proxy server, as is the phone being monitored. I am making use of SUBSCRIBE/NOTIFY messages to tell the phone that I want to know about its "dialog" events, and once subscribed, this works fine. I am running into two problems:
I am requesting a subscription length of 900 seconds and consistently getting some absurd amount of 4000+ seconds returned from the phone.
There is the possibility that the phone may be unplugged while the subscription is active (don't ask, but, yes, this is a possibility). When this happens, I am not getting any type of notification as to the phone no longer being available. Consequently, I have to wait for my subscription to time out, try and renew it, handle the failure, and create a new subscription.
I realize that I can renew my subscription sooner than its expiration time, but is there a better way to go about it? For example, would I be able to get "presence" events and use them to know when the phone is there or not? Are those events always guaranteed to happen on phone start-up, and even so, since there is a proxy in the middle, would I even get the notifications, or would I still not know that the phone restarted and no longer recognizes my subscription(s)? Are these "presence" updates something that I can request from the proxy?
Any insight would be great; for the moment, I'm going to simply try and refresh my subscription on a much smaller interval, but I would love to know if there is a better way to go about it. Thanks in advance.
I don't know about a SIP agnostic way other than perhaps somehow pinging the phone but there is definitely a SIP way to do presence and that's using the same subscribe/notify model you are using for dialogs but in this case for presence. The relevant standard is RFC 3856 A Presence Event Package for the Session Initiation Protocol (SIP).
Typically the presence notifications would be generated by a SIP registrar, and since you say your phone is registering with your proxy it must also have a registrar built in. The registrar would notify your UA when the other phone's registration status changes such as when it first came online or when it failed to re-register. As far as the delay between a phone "disappearing" and the registrar server detecting it there's no prescribed way to do it. You can either wait for the registration period to expire and mark the phone as offline when it fails to register or alternatively the server could actively send a packet or even a SIP request such as an OPTIONS request to the phone and mark it as offline if it got a failure response, Asterisk uses te latter approach.
When a SIP UAC client registers with a SIP UAS Registrar, the SIP client provides a Expiry Header, which indicates that maximum amount of time after which a SIP client needs to re-register itself. If the SIP client does not re-register itself in this time period, then Sip UAS proxy/registrar server will mark the client as disconnected.
Proprietary SIP packages like FreePBX and Asterisk, proactively, send SIP OPTIONS to the client, continuously, at some interval, wherein the client responds with OK. This is a more proactive way of validating if SIP clients are online; however, this technique is proprietary and not part of the actual SIP specification.

Is that possible to use SIP in LAN network?

I don't know enough about SIP. As far as I know SIP can not be used in LAN. But it's features are very good. I want to use it for a LAN messenger (with video conference facilities).
Is there any way of using SIP in LAN network ?
The SIP protocol can be used over any reliable transport (TCP, XMPP, instant messaging channel, etc...) to a service (e.g. a server such as a SIP proxy) that knows how to route the SIP INVITE message from the caller to the callee. e.g. If you send an INVITE to bob#foobar.com, there's needs to be a service that knows how to find "bob" and deliver the message. Likewise, when Bob sends back his response messages back, the messages need to route back to the caller who sent the original INVITE.
And you can do SIP without a server - provided the computer already have a connection (direct or indirect) to the other computer intended for the call.
But SIP isn't anything special. If you were to invent your own video conferencing protocol, it would probably look a lot like SIP. SIP's primary job is for both sides of a call to exchange IP/port candidates for connecting directly in addition to codec and bandwidth negotiation data.
After the SIP messages are exchanged, ICE/STUN/TURN take over and RTP packets typically flow. SIP isn't used in the call except to end the call.
What are you really trying to do anyway?
Thread is Old but still I would like to contribute to this. There are various SIP server like http://www.officesip.com/index.html which works in LAN and can be connected to hardware phone too and soft client also.
Jitsi is open source cross platform SIP/xmpp client:https://jitsi.org/
And if you want to XMPP server Openfire is the best:http://www.igniterealtime.org/projects/openfire/
I hope this will definitely help someone..!