Port 5060 not opening

Hi all,
I know this is a reoccurring issue but I haven’t found the solution yet despite all my attempts.

I’m a total noob on Asterisk, I’m currently in training and our teacher told us to install an Asterisk server but he doesn’t know how to solve my problem either.

So I have Asterisk 17 with pjsip (pjprojetct) running on Debian 9 on a VM. The service is running properly:

● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/init.d/asterisk; generated; vendor preset: enabled)
   Active: active (running) since Fri 2020-03-13 14:28:49 CET; 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1672 ExecStop=/etc/init.d/asterisk stop (code=exited, status=0/SUCCESS)
  Process: 1703 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
    Tasks: 76 (limit: 19660)
   CGroup: /system.slice/asterisk.service
           └─1715 /usr/sbin/asterisk

mars 13 14:28:49 asterisk-MD systemd[1]: Starting LSB: Asterisk PBX...
mars 13 14:28:49 asterisk-MD asterisk[1703]: Starting Asterisk PBX: asterisk.
mars 13 14:28:49 asterisk-MD systemd[1]: Started LSB: Asterisk PBX.

but netstat doesn’t show port 5060 (or 5061) as it should.
netstat -an | grep 5060 returns nothing.

Nmap shows the port is closed:

root@asterisk-MD:/home/util# nmap -v -sU localhost -p 5060

Starting Nmap 7.40 ( https://nmap.org ) at 2020-03-13 13:52 CET
Initiating UDP Scan at 13:52
Scanning localhost (127.0.0.1) [1 port]
Completed UDP Scan at 13:52, 0.22s elapsed (1 total ports)
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000090s latency).
Other addresses for localhost (not scanned): ::1
PORT     STATE  SERVICE
5060/udp closed sip

Read data files from: /usr/bin/../share/nmap
Nmap done: 1 IP address (1 host up) scanned in 0.30 seconds
           Raw packets sent: 1 (28B) | Rcvd: 2 (84B)

My (very basic) sip.conf:

[general]
language=fr
allow=alaw
allow=ulaw
bindport=5060
bindaddr=0.0.0.0

context=lab

[phone1]
type=friend
secret=poseidon
host=dynamic
callerid="morgan" <300>

[phone2]
type=friend
secret=poseidon
host=dynamic
callerid="bobby" <301>

iptables -L show all policies are set to ACCEPT.

When I try to connect a softphone (I tried with 3CX) it stays “Not connected” and nothing happens in the Asterix CLI.

When I tried netcat I suddenly saw the softphone connection attempts so it would seem the port is not blocked:

root@asterisk-MD:/home/util# netcat -l -u -p 5060
REGISTER sip:10.198.35.247:5060 SIP/2.0
Via: SIP/2.0/UDP 10.198.35.229:51434;branch=z9hG4bK-d8754z-5819e11e1b00cb29-1---d8754z-;rport
Max-Forwards: 70
Contact: <sip:phone1@10.198.35.229:51434;rinstance=0c74451ef5b70af6>
To: "morgan"<sip:phone1@10.198.35.247:5060>
From: "morgan"<sip:phone1@10.198.35.247:5060>;tag=5041c66e
Call-ID: NWU2N2Y2Yjc4ODNmYTE2N2ExMWIxN2FlNGUwMDFiMjM.
CSeq: 32 REGISTER
Expires: 120
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE
Supported: replaces
User-Agent: 3CXPhone 6.0.26523.0
Content-Length: 0

My logs:

[Mar 13 13:50:42] NOTICE[672] loader.c: 299 modules will be loaded.
[Mar 13 13:50:42] NOTICE[672] cdr.c: CDR simple logging enabled.
[Mar 13 13:50:43] NOTICE[672] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Mar 13 13:50:43] WARNING[672] res_phoneprov.c: Unable to find a valid server address or name.
[Mar 13 13:50:43] WARNING[672] chan_dahdi.c: Ignoring any changes to 'userbase' (on reload) at line 23.
[Mar 13 13:50:43] WARNING[672] chan_dahdi.c: Ignoring any changes to 'vmsecret' (on reload) at line 31.
[Mar 13 13:50:43] WARNING[672] chan_dahdi.c: Ignoring any changes to 'hassip' (on reload) at line 35.
[Mar 13 13:50:43] WARNING[672] chan_dahdi.c: Ignoring any changes to 'hasiax' (on reload) at line 39.
[Mar 13 13:50:43] WARNING[672] chan_dahdi.c: Ignoring any changes to 'hasmanager' (on reload) at line 47.
[Mar 13 13:50:43] NOTICE[672] chan_skinny.c: Configuring skinny from skinny.conf
[Mar 13 13:50:43] ERROR[672] ari/config.c: No configured users for ARI
[Mar 13 13:50:43] NOTICE[672] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge
[Mar 13 13:50:43] NOTICE[672] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[Mar 13 13:50:43] ERROR[672] codec_dahdi.c: Failed to open /dev/dahdi/transcode: No such file or directory
[Mar 13 13:50:43] WARNING[672] loader.c: Some non-required modules failed to load.
[Mar 13 13:50:43] ERROR[672] loader.c: cdr_sqlite3_custom declined to load.
[Mar 13 13:50:43] ERROR[672] loader.c: cel_sqlite3_custom declined to load.

I tried uninstalling/reinstalling it but nothing changed.

Also, I think others in my group have the same issue, so it might be something in our install (we installed from sources). During the Asterisk ./configure we also didn’t get the prompt to enter the phone prefix.

If anyone has any suggestions as to what I could do…
Thanks a lot!

The sip.conf configuration file is for configuring the chan_sip module, not for chan_pjsip. The chan_pjsip module is configured using pjsip.conf and a basic PBX example file is present in the tree[1]. There are also wizard examples on the wiki for phones[2] and non-wizard examples[3].

[1] https://github.com/asterisk/asterisk/blob/master/configs/basic-pbx/pjsip.conf
[2] https://wiki.asterisk.org/wiki/display/AST/PJSIP+Configuration+Wizard
[3] https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples

Thanks a bunch ! I’m going to try and make this work.

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