Asterisk not listening port 5060

Hi, im running asterisk on an ec2 instance, with a twilio account connected to make the calls through, and running it via a script with ari-client, everything works as expected.
I want to add support to call my zoiper account, so i added these configs to my pjsip:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_media_address=ec2_ip
external_signaling_address=ec2_ip
local_net=local_net_ip

[zoiper_user]
type=endpoint
context=outbound
disallow=all
allow=ulaw
auth=zoiper_user_auth
aors=zoiper_user_aor

[zoiper_user_auth]
type=auth
auth_type=userpass
password=password
username=kubanigal

[zoiper_user_aor]
type=aor
max_contacts=1

Im unable to connect with zoiper to asterisk, after alot of digging i narrowed down the issue to that port 5060 isnt listened by asterisk, this command returns nothing - netstat -an | grep 5060
i know my transport is ok because it already works when i try to call any number, i havent been able to locate anything to help me fix this.
Thanks, Gal

Look at the actual console output when Asterisk starts to see what it says. As well, if Twilio is working then you have a transport listening already - unless you’re using chan_sip for that. If you already have a transport listening, why add a second one?

i dont use chan_sip, im working on a project that will use twilio to make outbound calls, but i want to test them locally with zoiper…
i have only one transport, the one i sent above, i thought it works for both twilio and zoiper, is that not the case?

It does. Your previous comment was confusing and made it sound like you added another transport.

Do you see Zoiper traffic in the output of “pjsip set logger on” when attempting to do a call?
Have you set up your AWS rules so that the ports are forwarded to Asterisk?

First of all thanks for the quick replies its not taken for granted :slight_smile:
When I attempt to make a call to the zoiper endpoint i get this from the pjsip logger:
chan_pjsip.c:2669 request: Unable to create PJSIP channel - endpoint ‘zoiper_user’ was not found
The aws rules are set correctly, theres another developer using the same security group as I me that managed to make zoiper connect with asterisk on a seperate instance.
As far as we could tell the only difference between them is that mine doesnt listen to 5060.

Is “zoiper_user” in “pjsip show endpoints”? What happens if you do “module reload res_pjsip.so”? Does it say it can’t create the endpoint? Has Zoiper registered to Asterisk?

I should also add that generally the name of the AOR and the endpoint have to match, unless the SIP client allows them to be configured independently which they usually don’t.

It does not show on endpoints, when i reload this is the response, seems valid:
Module ‘res_pjsip.so’ reloaded successfully.
– Reloading module ‘res_pjsip.so’ (Basic SIP resource)
– Reloading module ‘res_pjsip.so’ (Basic SIP resource)
[2024-06-17 12:26:24] NOTICE[431910]: sorcery.c:1348 sorcery_object_load: Type ‘system’ is not reloadable, maintaining previous values
[2024-06-17 12:26:24] NOTICE[431910]: sorcery.c:1348 sorcery_object_load: Type ‘system’ is not reloadable, maintaining previous values

I also updated the pjsip conf names like you said to make sure, and restarted asterisk
Not sure what you mean by if Zoiper registered to Asterisk but on their end when i try to connect I can see that the SIP UDP isnt working

How about when Asterisk is started? I see no reason your endpoint can’t exist from the provided configuration.

i stopped the server then ran:
sudo asterisk -cvvvvvv | tee /tmp/asterisk_startup.log
then ran grep -E -i “zoiper” /tmp/asterisk_startup.log and got no results, was this where you meant?
ill attach everything i added to pjsip including the setup that works with twilio:

;+14433488756 TWILIO

[0014433488756]
type=auth
auth_type=userpass
password=pw
username=user

[0014433488756]
type=aor
contact=sip:twilio-working

[0014433488756]
type=endpoint
context=outbound
disallow=all
allow=alaw,ulaw,slin,gsm,g729,g723
outbound_auth=0014433488756
aors=0014433488756

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_media_address=ip
external_signaling_address=ip
local_net=localip

[zoiper_user]
type=endpoint
context=outbound
disallow=all
allow=ulaw
auth=zoiper_user
aors=zoiper_user

[zoiper_user]
type=auth
auth_type=userpass
password=pw
username=kubanigal

[zoiper_user]
type=aor
max_contacts=1

Please let me know if theres anything i can provide

The Asterisk log is normally at /var/log/asterisk/messages or /var/log/asterisk/full, and don’t just grep - actually look through the startup and loading process to see if anything sticks out.

ok i found something wierd, a massive amount of messages like this:
[Jun 12 00:44:15] NOTICE[111340] chan_sip.c: Registration from ‘“105” sip:105@13.36.36.179’ failed for ‘78.31.71.235:5621’ - Wrong password
[Jun 12 00:44:15] NOTICE[111340] chan_sip.c: Registration from ‘“1004” sip:1004@13.36.36.179’ failed for ‘93.186.201.53:5480’ - Wrong password

what could cause these messages? its not from the zoiper endpoint i dont know where these came from

Welcome to the public internet, where things will constantly be trying to register/attack/use your system.

1 Like

The logs dont mention zoiper at all, which is wierd because they do mention the other endpoint and the transport:
res_pjsip/pjsip_resolver.c: ‘UDP+IPv4’ is an available SIP transport
res_pjsip/pjsip_configuration.c: Endpoint 0014433488756 is now Reachable

If you don’t recognize those IP’s you will need to “block” them via your firewall

After messing around with the configs, was somehow able to get zoiper to register as an endpoint
for some other reason its not connecting, the logs show me that i get a 401 from the udp request even though im sending the exact same username and password

On Monday 17 June 2024 at 16:10:30, FrancoSmash via Asterisk Community wrote:

If you don’t recognize those IP’s you will need to “block” them via your
firewall

If you haven’t discovered fail2ban yet, this might be a good time to do so.

Antony.


You can spend the whole of your life trying to be popular,
but at the end of the day the size of the crowd at your funeral
will be largely dictated by the weather.

  • Frank Skinner

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

You don’t actually send a user and password, you send a hash function of that and and other information, some of that comes from the 401, and if it has changed since the 401 you are using, you will get a new 401. This is done so that people cannot replay old responses.

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