Newbie need some help

Hello,

I’m 100% newbie on VOIP and i try to make it work, sorry if my question is a bit stupid.

This is my first post so i don’t know if i post inside the right topics cat…

I’m running a debian 11 on a proxomox 8.0.3 Pve.
Then i have installed with succes Asterisk 18.

root@Asterisk:/etc/asterisk# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Sun 2023-07-23 15:28:38 CEST; 15s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1382 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
      Tasks: 79 (limit: 9565)
     Memory: 143.0M
        CPU: 568ms
     CGroup: /system.slice/asterisk.service
             └─1394 /usr/sbin/asterisk

Everythinks seems to be ok, i have edited the sip.conf folder like that:

[general]
language=fr
allow=alaw
allow=ulaw


context=lab

[phone1]
type=friend
secret=123456
host=dynamic
callerid="test1" <300>

[phone2]
type=friend
secret=654321
host=dynamic
callerid="test2" <301>

And the extensions.conf folder like that:

[general]

[labo]
exten => 300,1,Answer
exten => 300,2,Dial(SIP/phone1)
exten => 300,3,Hangup

exten => 301,1,Answer
exten => 301,2,Dial(SIP/phone1)
exten => 301,3,Hangup


My problem is the SIP port 5060 is not open when i check:

root@Asterisk:/etc/asterisk# netstat -anup
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale          Adresse distante        Etat        PID/Program name
udp        0      0 0.0.0.0:2727            0.0.0.0:*                           1394/asterisk
udp        0      0 0.0.0.0:68              0.0.0.0:*                           360/dhclient
udp        0      0 0.0.0.0:53368           0.0.0.0:*                           1394/asterisk
udp        0      0 0.0.0.0:4520            0.0.0.0:*                           1394/asterisk
udp        0      0 0.0.0.0:4569            0.0.0.0:*                           1394/asterisk
udp        0      0 0.0.0.0:5000            0.0.0.0:*                           1394/asterisk
udp6       0      0 :::35923                :::*                                1394/asterisk

I have no clue what i did wrong, could you please help?

Thanks

Asterisk 18 won’t load chan_sip by default, at least when built directly from the standard sources. As a newbie, you should not be using it; you should be using chan_pjsip. chan_sip is no longer in the master branch on GitHub.

I assume that the above is the fundamental reason for your problem, although you should also note that:

allow= should alway be preceded by disallow=all (not just chan_sip).

type=friend should not be used unless the phones share the same IP address.

“lab” is not the same as “labo”.

It is not normally necessary or desirable to call Answer before Dial. Where calls are chargeable to the caller, it will cause charging to start.

Calling Hangup explicitly is redundant, although there is an argument that, with complex dialplans, using patterns, it can avoid accidents.

It is generally easier to maintain dialplans if you use same and n, e.g.:

exten => 300,1,Answer
same => n,Dial(SIP/phone1)
same => n,Hangup
1 Like

Tks for the reply!

So whitch action actions i have to do tu using chan_pjsip?

To install asterisk i have used this command:

sudo curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz

Inside the usr/src repo

Change SIP/ to PJSIP/ and replace sip.conf with pjsip.conf, which does not have the same format. Your basic pattern for pjsip.conf is the first example in res_pjsip Configuration Examples - Asterisk Project - Asterisk Project Wiki although you should also look at the, more general, third one.

Once again tks!

If i have understand What you say to me, the file sip.conf is no longer used to configure the callers.

I just have to write inside pjsip.conf instead, is that correct?
So if i edit the file with :

exten => 300,1,Answer
same => n,Dial(SIP/phone1)
same => n,Hangup

The sip port steel 5060 with pjsip?

PJSIp is the long term replacement for SIP (see https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip for the process to migrate). Has been since Asterisk 12 and is no longer in the main line post LTS 18.

That said - if you use rely on the very popular CISCO phone specific patches from https://usecallmanager.nz/documentation-overview.html then you may be `stuck’ on SIP for a while longer.

Dw.

1 Like

The standard SIP port is defined by RFC 3261. Both chan_sip and chan_pjsip implement that RFC, but the latter is generally a more complete and better supported implementation.

As of Asterisk 18, the specimen modules.conf does not load chan_sip:

as of the current master version, which will become Asterisk 21, chan_sip does not exist.

If you define a valid psjip.conf, which doesn’t override the port number, chan_pjsip should start and bind to port 5060.

1 Like

So… I have edit the file pjsip.conf like that:

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0

[6001]
type = endpoint
context = internal
disallow = all
allow = ulaw
allow = alaw
aors = 6001
auth = auth6001

[6001]
type = aor
max_contacts = 1

[auth6001]
type=auth
auth_type=userpass
password=1234
username=6001

[6002]
type = endpoint
context = internal
disallow = all
allow = ulaw
allow = alow
aors = 6002
auth = auth6002

[6002]
type = aor
contact = max_contacts = 1

[auth6002]
type=auth
auth_type=userpass
password=1234
username=6002

Then i edit the extensions.conf file like that :

[internal]

exten => 6001,Answer
same => n,Dial(SIP/6001)
same => n,Hangup

exten => 6002,Answer
same => n,Dial(SIP/6002)
same => n,Hangup

The SIP port seem to be ok (ican see the 5060 SIP port open) :

root@Asterisk:/etc/asterisk# netstat -anup
Connexions Internet actives (serveurs et établies)
Proto Recv-Q Send-Q Adresse locale          Adresse distante        Etat        PID/Program name
udp        0      0 0.0.0.0:43045           0.0.0.0:*                           2705/asterisk
udp        0      0 0.0.0.0:2727            0.0.0.0:*                           2705/asterisk
udp        0      0 0.0.0.0:68              0.0.0.0:*                           360/dhclient
udp        0      0 0.0.0.0:4520            0.0.0.0:*                           2705/asterisk
udp        0      0 0.0.0.0:4569            0.0.0.0:*                           2705/asterisk
udp        0      0 0.0.0.0:5000            0.0.0.0:*                           2705/asterisk
udp        0      0 0.0.0.0:5060            0.0.0.0:*                           2705/asterisk
udp6       0      0 :::52928                :::*                                2705/asterisk

But when i try to put my credentials on a softphone is not working, i receive time out on connexion:

Change the Dial command to PJSIP/6001 instead of SIP/6001. Same for 6002.

I did the change but same error (time out).

[internal]

exten => 6001,Answer
same => n,Dial(PJSIP/6001)
same => n,Hangup

exten => 6002,Answer
same => n,Dial(PJSIP/6002)
same => n,Hangup

Do i need to do something else ?

It didn’t register. Try updating the ‘bind’ with this:

bind=0.0.0.0:5080

Update the softphone with the new port.

bind corresponding to the host ip? should not be 127.0.0.0?

i have try :5080

[simpletrans]
type=transport
protocol=udp
bind=0.0.0.0:5080

[6001]
type = endpoint
context = internal
disallow = all
allow = ulaw
allow = alaw
aors = 6001
auth = auth6001

[6001]
type = aor
max_contacts = 1

[auth6001]
type=auth
auth_type=userpass
password=1234
username=6001

[6002]
type = endpoint
context = internal
disallow = all
allow = ulaw
allow = alow
aors = 6002
auth = auth6002

[6002]
type = aor
contact = max_contacts = 1

[auth6002]
type=auth
auth_type=userpass
password=1234
username=6002

And update on the softphone :

But same issue (time out) I perform systemctl restart asterisk when i do changes

0.0.0.0 is correct. That binds to all interfaces, including loopback. Binding to the loophack interface would be strange. It would only half make sense if the phones were also on the same machine.

You should be looking at the logging, on Asterisk, to see whether the registration is arriving. Typically you want to un-comment full in logger.conf, and to enable verbose logging, at at least level 3, and also turn on protocal logging, with “pjsip set logger on”.

I don’t know why a change in port number was suggested. Unless there is a specific theory as to what is wrong, using the default is safest until you have something workiing.

1 Like

can you chech if your firewall is enable/disabled

Hello @TheMark , i have allready disable my firewall on the lan

“i have allready disable my firewall on the lan”

I sincerely hope this does not mean that you have now exposed an Asterisk
server to the Internet.

Antony.

Most attacks are for toll fraud, and the OP has no chargeable call capability, yet. As this is a learning configuration, they are probably within a site or house level firewall.

That’s just mean i have no rules on the lan network, otherwise for the wan the firewall is enable

Correct

Hello there, sorry for my late reply i just come back from hollidays .)

so i have edit the logger.conf files (uncomment everythings):

Logging Configuration

In this file, you configure logging to files or to
the syslog system.

"logger reload" at the CLI will reload configuration
of the logging system.

[general]

Customize the display of debug message time stamps
this example is the ISO 8601 date format (yyyy-mm-dd HH:MM:SS)

see strftime(3) Linux manual for format specifiers.  Note that there is also
a fractional second parameter which may be used in this field.  Use %1q
for tenths, %2q for hundredths, etc.

dateformat=%F %T        ISO 8601 date format
dateformat=%F %T.%3q    with milliseconds

 This makes Asterisk write callids to log messages
 (defaults to yes)
use_callids = yes

This appends the hostname to the name of the log files.
appendhostname = yes

This determines whether or not we log queue events to a file
(defaults to yes).
queue_log = yes

Determines whether the queue_log always goes to a file, even
when a realtime backend is present (defaults to no).
queue_log_to_file = yes
Set the queue_log filename
(defaults to queue_log)
queue_log_name = queue_log

When using realtime for the queue log, use GMT for the timestamp
 instead of localtime.  The default of this option is 'no'.
queue_log_realtime_use_gmt = yes

Log rotation strategy:
none:  Do not perform any logrotation at all.  You should make
       very sure to set up some external logrotate mechanism
        as the asterisk logs can get very large, very quickly.
sequential:  Rename archived logs in order, such that the newest
             has the highest sequence number [default].  When
             exec_after_rotate is set, ${filename} will specify
             the new archived logfile.
rotate:  Rotate all the old files, such that the oldest has the
        highest sequence number [this is the expected behavior
        for Unix administrators].  When exec_after_rotate is
        set, ${filename} will specify the original root filename.
timestamp:  Rename the logfiles using a timestamp instead of a
            sequence number when "logger rotate" is executed.
           When exec_after_rotate is set, ${filename} will
           specify the new archived logfile.
rotatestrategy = rotate

Run a system command after rotating the files.  This is mainly
useful for rotatestrategy=rotate. The example allows the last
two archive files to remain uncompressed, but after that point,
 they are compressed on disk.

exec_after_rotate=gzip -9 ${filename}.2


For each file, specify what to log.

For console logging, you set options at start of
Asterisk with -v for verbose and -d for debug
See 'asterisk -h' for more information.

Directory for log files is configures in asterisk.conf
option astlogdir

Then type root@Asterisk:/etc/asterisk# asterisk -rcvvvvvvvv

so i’m connected to the cli:

Connected to Asterisk 18.19.0 currently running on Asterisk (pid = 1020)
No '=' (equal sign) in line 23 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 24 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 129 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 130 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 131 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 132 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 133 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 134 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 135 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 136 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 137 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 181 of /etc/asterisk/logger.conf
No '=' (equal sign) in line 185 of /etc/asterisk/logger.conf
Asterisk*CLI>

But when i try to connected with my softphone nothing appear on the cli log…

Don’t know what to test next?