Is there a way to retrieve the sessions allocated by rtpproxy? - sip

I have an OpenSIPS proxy running with RTPProxy. The calls are working fine and the media is relayed to RTPProxy. Is there a way to figure out what are the allocations used by the server? Can I query RTPProxy for all available sessions and see the allocated ports?
What I tried so far is to intercept the communication between RTPProxy and OpenSIPS, and I have information about the allocations, but not about the UAC/UAS port numbers.

Yes you can.
There's a UDP based interface that transfers Bencoded data, it's how OpenSIPs and Kamailio interface with RTPproxy - It's called the ng protocol.
The full documentation is in the Readme on GitHub,
I wrote an example Python client for rtpengine's ng protocol a while back. It just lists the current calls so probably quite a good place to start if you're a Python fan.

Related

Can we send command for Quectel M66 from STM32F103C8T6 via UART port?

I am currently working with STM32F103C8T6 and Quectel M66 module. I need to send some command from STM32's UART port for creating a socket connection in M66 and to send some data via that socket to a server in Quectel M66. Is there any way to do that? And I am using FreeRTOS for this.
And what kind of data are possible to send via UART port of STM32?
Any help would be greatly appreciated...Thanks in Advance
There's two ways you can achieve this:
Using AT commands and TCP/IP stack built into the module. In this mode you send AT commands to connect/listen/send/receive/close sockets.
Using PPP and TCP/IP stack inside the microcontroller. In this mode you initially configure the modem using AT commands (which you have to do in both approaches anyway), then you switch the modem to data mode, at which point it starts communicating with you using PPP protocol. You use this to integrate it with the TCP/IP stack in your microcontroller. That way you use all the functionality of the stack you choose (socket API, DNS etc.) and you're not limited to what API quectel provided. You can also take advantage of having multiple network interfaces connected to your microcontroller, for example to perform routing.
How you approach it is totally up to you. If you want just the basic socket functionality, first approach will probably be better for you as it's easier to get it to work. Second approach takes quite a bit more effort but yields better results / more flexible product for the future.
For AT commands documentation check out this link (especially the TCP/IP application note): https://www.quectel.com/product/m66.htm

When 2 computer interact over a network connection then first they have to make a socket connection?

Please answers in yes or no. This will solve my doubt.
1. Is a post/get request sent from computer-1 to Computer-2 then first they have to make a socket connection?
2. When 2 computers connect with ssh then first they have to make a socket connection , then only then can talk to each other ?
The examples you give involve network connections and sockets are a common abstraction used when communicating over modern computer networks; however, other abstractions could be used. This is what Damien_The_Unbeliever is saying in the comments. For example, you could ask whether for loops are the only way to iterate over an array. The answer is the same: for loops are a common abstraction to loop over elements of an array, but there are other equivalent (in a machine-code sense) methods of doing so using other abstractions.
More fundamentally, computers can communicate with each other without using networks at all. You could have computers communicate over an interface consisting of webcams and monitors; sending is accomplished by putting something on the screen and receiving is accomplished by receiving the video feed. You could do the same with microphones and speakers. You could do the same with robotic arms, keyboards and mice. Two computers can communicate with each other using a human courier; my work and home computers do it regularly! Computers could write letters and mail them, deliver them or use carrier pigeons to send them to other computers designed to accept information in those formats.
Please answers in yes or no. This will solve my doubt.
[ok]
Is a post/get request sent from computer-1 to Computer-2 then first they have to make a socket connection?
In this case, Yes, but if request is going from browser then it do for you.You can see thr url for get and post have the port number in them. If not mentioned the default port is 80, in general. For example If you use WebSphere Application Server, the default port is 9081 or 80 if IBM HTTP Server is configured.
When 2 computers connect with ssh then first they have to make a socket connection , then only then can talk to each other ?
In this Case, again Yes, the port is 22 in ssh

Connect sockets directly after introduction through server

I'm looking for the name of a protocol and example code that permits handing off IP/port connections to establish unmediated P2P after introduction through a server.
Simple example:
You and I both start chat programs that connect to chatintroduce.com (fictional server). I send you a "Hi! Wanna chat?" message. It doesn't get sent. Instead my chat program tells chatintroduce to send your chat program a request for connection. You respond to a prompt and your chat program tells chatintroduce to broker the connection. Chatintroduce establishes an initial two-way connection between us. Now, this final step is important, chatintroduce releases control and our two chat programs now talk directly to each other without any traffic through chatintroduce.
In other words, I construct packets which have your IP address and you receive them without interference from firewalls, NATs or any other technologies. In other words, true peer-to-peer connection independent of intermediate server.
I need to know what search terms to use to find appropriate technology. An RFC name would suffice. I've been searching for days without success.
I think what you are looking for is TCP/UDP hole punching which typically coordinates the P2P connection using a STUN server to determine the "capabilities" of the firewalls (e.g. is it a full cone nat? symmetric?).
https://en.wikipedia.org/wiki/Hole_punching_(networking)
We employed this at a company I worked for to create a kind of BitTorrent that could circumvent firewalls for streaming video between two peers.
Note that sometimes it is NOT possible to establish a connection without the intermediary.
What you are looking for is ICE protocol. RFC 5245. This protocol is used for connecting two peers through NAT traversal. There are some open source libraries and also some proprietary libraries for this. You can search google with ICE implementation.
You will also need to read about some additional protocols. These are used with ICE protocol. They are STUN and TURN.
For some cases you can't make P2P call 100% time. You will have to use a relay server. Like if the NAT combination of two peers are Symmetric vs Symmetric/PRC. That relay server is called TURN server.
Some technique like Port forwarding and TCP/UDP hole punching will help you to increase P2P rates.
See this answer for more information about which combination of NAT will require a relay server and which don't.
Thank you. I will be looking further into ICE, STUN, TURN, and hole-punching.
I also found n2n which looks like almost exactly what I wanted.
https://github.com/meyerd/n2n
http://xmodulo.com/configure-peer-to-peer-vpn-linux.html
With n2n, one makes a VPN with a super node that all other edge nodes know.
But once the introductions are made, the super node can be absent.
This was exactly what I wanted. I hope it works across platforms (linux, MacOS, Windows).
Again, I am still researching before implementation, so your advice was very important to me.
Thank you.
Use PJNATH. Its open source.
http://www.pjsip.org/pjnath/docs/html/
There is not much open source on NAT Traversal. As far as I know PJNATH is good.
For server you can use Google's Open source STUN and TURN server.

Client/Server communication via internet

Which is the best solution to communicate bidirectionally between a
remote server and a client behind an internet box?
UPnP with Sockets.
HTTPS/Database Server and the client make 1 request every Xsec to know
if there is new data.
Client opens 1 connection on the server and it maintains open to make a
tunnel.
It totally depends on the application (though you can immediately rule out UPnP, which is an ugly hack suitable for local networks only.) Start reading about the Internet foundation set of protocols - the TCP/IP, pick up the Stevens book - you will get a much better understanding of your options.

Detecting Port Utilized by Webbrowser

When the webbrowser control issues an HTTP request to a URL, it is assigned a port - which is utilized for the length of that connection.
Is there away to find out which port is being utilized for each connection the webbrowser control establishes/issues?
Every request is potentially using a different port. Since most requests are resolved in a couple of seconds and then closed, having the port information on the client isn't going to be very helpful.
If you're interested from a historical perspective, you can add the port number to the logs that many web servers generate.
In order to view this information live you can use a tool such as TCPView
Now for the real question. What are you trying to do? There may be an easier way.
you can run in background:
netstat -bn
and parse output to get information about your application (ports, ips, etc.)