How to change peer to peer mode

In my asterisk 20 setup, the peers communicate through p2p only. But there is no direct routing between the peers in the network. Is there any way i can make it client-server communication in both ends?

Please explain in more detail. I’d have to guess that you using some implementation of SIP, but peer is not a term in SIP and client and server are often misused. With SIP. at the start of a call, the caller is always client, and the callee is always server, in SIP terms.

Maybe you are talking about a third PABX or proxy that can see both ends? That could be an Asterisk in the cloud. Typically you are going to have to pay someone extra to route between places that are not directly routable.

I think a network diagram is critical here, even before the .conf file contents and full log entries, for which we would normally ask.

On Sunday 31 March 2024 at 16:50:58, walter_hunt via Asterisk Community wrote:

In my asterisk 20 setup, the peers communicate through p2p only. But there
is no direct routing between the peers in the network. Is there any way i
can make it client-server communication in both ends?

Your question is not clear (to me, at least).

You say “the peers communicate through p2p only”. I interpret “p2p” to mean
“peer-to-peer”.

But then you say that “thre is no direct routing between peers”. What do you
mean by “direct”?

Is one peer able to communicate with another (which is needed for peer-to-
peer) or not?

Finally, you ask how to make it “client-server communication in both ends”,
which to me is what you have, if there is no (direct?) routing between peers.

I suggest you give specific details of your network including an IP address of
one peer, an IP address of another, and the IP address/es of your Asterisk
server, so that we can understand what sort of network setup you have.

If you wish to hide public IP addresses (although I would sincerely hope that
you don’t have peers (ie: telephones) directly on public IPs) then by all
means do so, but only in a way which leaves it still clear to us which devices
belong on which subnets.

Antony.

–
In science, one tries to tell people
in such a way as to be understood by everyone
something that no-one ever knew before.

In poetry, it is the exact opposite.

  • Paul Dirac

                                                Please reply to the list;
                                                      please *don't* CC me.
    
1 Like

If you are trying to connect two Asterisks, which are both behind NAT, you need to make sure both have the correct media and signalling addresses set, to reflect the public side of the NAT, and local networks set to indicate which addresses are inside the NAT.

If you are fighting CGNAT, you are out of my depth, but there may be some ability to use STUN or TURN.

Also, if you can solve the problem for your own VPN (VPN is confusingly used for origin hiding services, like NordVPN, but I am not talking about those), that is likely to be a better solution.

OK let me be clear. I have 2 different soft phones which can’t ping each other as they are at different LANs. But they can ping my asterisk server which is accessible to both of them in a publicly accesible LAN. When I call the other phone, and it gets answered, there is no audio in both ends. When I used Wireshark I can see that the RTP flow gets originated but gets ended at the gateway of the other soft phone’s network. And there is no RTP flow from the other phone to the caller.

I can’t give connectivity between the 2 soft phones, that’s simply not possible. As they have connectivity with my asterisk server, can’t the asterisk server pass on the RTP flow back and forth between them rather than the sip phones failing to have RTP flow between them?

On Sunday 31 March 2024 at 20:13:08, walter_hunt via Asterisk Community wrote:

OK let me be clear.

Thanks :slight_smile:

I’ve edited your comments below for efficiency…

I have 2 soft phones which are at different LANs.

they can ping my asterisk server which is accessible in a publicly accesible
LAN.

When I call the other phone, there is no audio in both ends.

So, now we have a nice succinct description of the problem.

Please:

  1. Post your pjsip configuration file from the Asterisk server (obscuring any
    sensitive stuff like SIP passwords or your public IP address)

  2. Check the routers at the locations where your softphones are, and see
    whether they have anything called “SIP helper” or “SIP ALG” (maybe just
    “ALG”). If they do, turn it OFF and test calling between the phones.

Antony.

–
“How I managed so long without this book baffles the mind.”

  • Richard Stoakley, Group Program Manager, Microsoft Corporation,
    referring to “The Art of Project Management”, O’Reilly press

                                                Please reply to the list;
                                                      please *don't* CC me.
    

Set direct_media to no in the endpoint definitions for the phones.
Make sure rtp_symmetric is enabled for them.

Note that both sides will need to have sent media before Asterisk will know the correct addresses to which to send media.

There are similar settings on the, obsolete, chan_sip driver.

This helped. Thanks !