Hosting asterisk on VPS

Hello there!!!
I am a newbie to asterisk and really looking forward for some community support so thanks in advance!!

So I’ve already set-up asterisk behind my NAT where I can easily situate calls to people on a local network by editing the pjsip.conf and extensions.conf files.

Now I hosting my asterisk server on a VPS using hostinger, I followed similar steps!! My users easily gets registered using the Softphone the calls are getting simulated but there is no audio!!! I wonder why???

Is there any other module that I have to setup for rtp voice streaming or external ip ??? I don’t really know ……

Can someone plz help me out here… any efforts will be really appreciated!!!

Don’t worry. Audio problems are something a lot of new users have to go through in the beginning.

To get help, you should post your pjsip.conf, I suggest. Don’t forget to remove sensitive data like passwords and public ip addresses.

here’s my pjsip.conf

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
;local_net= local_net=192.0.2.0/24
external_media_address= 397.x.x.34
external_signaling_address= 397.x.x.34

[user1]
type=endpoint
context=inside
disallow=all
allow=ulaw
transport=transport-udp
auth=user1
aors=user1

[user1]
type=auth
auth_type=userpass
password=***
username=user1

[user1]
type=aor
max_contacts=1

[user2]
type=endpoint
context=inside
disallow=all
allow=ulaw
transport=transport-udp
auth=user2
aors=user2

[user2]
type=auth
auth_type=userpass
password=***
username=user2

[user2]
type=aor
max_contacts=1

Doesn’t look bad for beginning.
Since propably your Users are behind NAT and your VPS isn’t, in my opinion the most important thing for you is adding

direct_media = no

to you endpoints. Otherwise your endpoints may try to send audio directly to each other, which will propably not work.

What I would also try is to add to endpoints

rtp_keepalive=1

which will send rtp packets right from the beginning, which helped me a lot in NAT scenarios.

And finally another important option for NAT at endpoints is

force_rport=yes

as it forces Asterisk to send packets back to the port where it came from and not to the port mentioned in the SIP messages, which usually can be different when mapped by a NAT router.

Also make sure to check firewall rules of your VPS. Just for example, I saw very often that lot of distros come with activated firewall services like firewalld which could also prevent the flow of audio packets.

This also causes it to take the IP address from the IP layer, not the application layer. Typically if you need this, you also need symmetric_media, and possibly rewrite_contact.

I followed the steps and now audio works!!!
thanku so much…

1 Like

thanks for the response…

1 Like

That’s great to hear. Have fun with your setup and don’t forget to also dig into security topics as now your Asterisk is in public Internet.

1 Like

I had problems with enabling TLS and CSF firewall (could be specific to CSF).
I’d suggest to set up port knocking if your users have dynamic ip addresses.
Microsip client supports this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.