Hey guys,
We have an asterisk 19.8 server with a reverse proxy in place.
In a WebRTC scenario local and remote addresses are 127.0.0.1 but we need to pass the real public ips to the provider.
We would like to expose the real public IP address of local and remote parties in Asterisk PJSIP Channel to be able to read it via Dialplan or in asterisk core.
AOR IP is not good because of the reverse proxy. I need to extract it from ice candidate (Conn in SDP) but don’t know how exactly.
For incoming and outgoing calls they need to log the real ip of that user who made or received that call. in DumpChan() all we can see is 127.0.0.1 and no public IP.
AOR IP is not good because of the reverse proxy and it shows 127.0.0.1.
I need to extract it from ice candidate (Conn in SDP) but don’t know how exactly.
No provider I know of expects to be contacted using web sockets, so my first suspicion is that you have completely the wrong transport specified.
At least for the standard, UDP, TCP and TLS transports, the external addresses are set in the type=transport section:
WebRTC does lots of things in strange ways. I think it uses dummy addresses in requests assuming that the other side will always use the underlying TCP connection, for signalling, and will use the ICE candidates for media. However, I have no real expertise one WebRTC, and I am surprised that you are not being rejected based on transport=wss.
Asterisk <–> Provider connection is UDP.
Alice <–> Asterisk is WSS / WebRTC.
Alice <–> Asterisk <–> Provider. I need all public IPs here. but Alice and Asterisk are using 127.0.0.1. So I need to extract Alice IP from C line in ICE which I don’t know how.
There is no ability to get the signaling address provided by the proxy from the HTTP signaling. You can retrieve the RTP remote address using the CHANNEL dialplan function[1].
Thanks but we tried this and because of the reverse proxy we still get 127.0.0.1 IPs.
Also tried building an asterisk patch for our use case to extract Conn from pjsip_rdata_sdp_info but don’t know the correct flow of how to get ips of both parties.
Can you guide us on how we can extract the C line from SDP in chan_pjsip.c
For INVITE (SDP) both local/remote offer and answer, and also RE-INVITE.
If you don’t mind, can you just point us to the right direction then?
Where in asterisk code can we retrieve the SDP data from, for INVITE (SDP) local/remote (offer/answer), and also RE-INVITE(SDP)?
Whilst I’m pretty sure that you are well outside the intended usage of Asterisk and should not be doing any media path optimisation, so should not be exposing addresses for the WebRTC side to the provider, my understanding of ICE is that part of the process is actually testing if candidates work, so the contents of the SDP exchange isn’t enough to determine the addresses actually used.
However, I’ve never really got into WebRTC, nor do I have deep knowledge of the chan_pjsip/PJProject code.
Also, this seems to have become a developer question, which is really outside the scope of the forum.