Migration from Asterisk 18.11.2 to 20.5.2

Hello.

I’m having issues upgrading from the dockerized andrius/asterisk:alpine-latest-20.5.2 to andrius/asterisk:18.11.2-alpine_latest.

Here are very simplified working versions of /etc/asterisk/sip.conf and /etc/asterisk/extensions.conf:

  • sip.conf:
[general] 
type=friend
allow=all
insecure=port,invite
context=recording
allowguest=yes
directmedia=no
host=172.18.0.2
  • extensions.conf
[recording]
exten => _X!,1,Answer()
same => n,Record(/recordings/recording-${EPOCH}.wav,,,kq)
exten => h,1,Hangup()

For reference, 172.18.0.2 is the IP of a SIPp container for testing, which generates “fake” SIP and RTP packets. But I don’t think this matters much.

I have tried these scenarios:

  • Copy all of Asterisk 18’s /etc/asterisk and /var/lib/asterisk into Asterisk 20
  • Only copy /etc/asterisk/sip.conf and /etc/asterisk/extensions.conf from Asterisk 18 into Asterisk 20
  • Only copy /etc/asterisk/sip.conf and /etc/asterisk/extensions.conf from Asterisk 18 into Asterisk 20 and copy /etc/asterisk/sip.conf to /etc/asterisk/pjsip.conf

In all cases, asterisk -rvvv does not display anything on Asterisk 20, and SIPp shows that the packets were retransmitted 5 times before it failed:

------------------------------ Scenario Screen -------- [1-9]: Change Screen --
  Call rate (length)   Port   Total-time  Total-calls  Remote-host
  1.0(0 ms)/1.000s   12001     32.51 s            1  10.20.0.186:5060(UDP)

  Call limit 1 hit, 0.0 s period          0 ms scheduler resolution            
  0 calls (limit 1)                       Peak was 1 calls, after 1 s
  0 Running, 2 Paused, 0 Woken up
  0 dead call msg (discarded)             0 out-of-call msg (discarded)
  0 open sockets                          0/0/0 UDP errors (send/recv/cong)

                                 Messages  Retrans   Timeout   Unexpected-Msg
      INVITE ---------->         1         5         1                         
         100 <----------         0         0         0         0               
         180 <----------         0         0         0         0               
         183 <----------         0         0         0         0               
         200 <----------  E-RTD1 0         0         0         0               
         ACK ---------->         0         0                                   
       Pause [     4:00]         0                             0        
         BYE ---------->         0         0         0                         
         200 <----------         0         0         0         0               

------------------------------ Test Terminated --------------------------------

It works fine on Asterisk 18.

Any ideas on what I have to do to properly migrate?

Thank you,

The chan_sip module is not built by default in Asterisk 20. Does the container build it and have it included? If not, then there would be nothing listening for SIP.

1 Like

When I do module show like sip on Asterisk 20, the only thing a bit related I see is chan_pjsip.so, while on Asterisk 18 I get chan_sip.so.

How do I install it? Or would it be better to use pjsip, and if so, how? I am not well versed in telecom, so I don’t even know the difference between SIP and PJSIP.

I can’t comment on the container, I have no knowledge or involvement of it. The chan_pjsip module is the default module going forward, and chan_sip has been removed as of Asterisk 21. PJSIP is just a different implementation of SIP, it’s still SIP. There’s docs[1] covering different aspects for configuration and migrating.

[1] Overview - Asterisk Documentation

1 Like

Thanks for the link!

After conversion, my sip.conf file went from this

[general](!)
type=friend
allow=all
;dtmfmode=rfc2833
insecure=port,invite
context=recording
allowguest=yes
directmedia=no

[general-00](general)
host=10.20.3.5

[general-01](general)
host=10.21.3.5

[general-99](general)
host=172.18.0.2

to this pjsip.conf

;--
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Non mapped elements start
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[general]
insecure = port,invite

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Non mapped elements end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--;


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

[general-00]
type = identify
endpoint = general-00
match = 10.20.3.5

[general-00]
type = endpoint
context = recording
allow = all
direct_media = no
aors = general-00

[general-00]
type = aor
contact = sip:10.20.3.5

[general-01]
type = identify
endpoint = general-01
match = 10.21.3.5

[general-01]
type = endpoint
context = recording
allow = all
direct_media = no
aors = general-01

[general-01]
type = aor
contact = sip:10.21.3.5

[general-99]
type = identify
endpoint = general-99
match = 172.18.0.2

[general-99]
type = endpoint
context = recording
allow = all
direct_media = no
aors = general-99

[general-99]
type = aor
contact = sip:172.18.0.2

Does this look correct? What’s up with the “Non mapped elements” section?

Here’s the output of the script, containing some errors:

\asterisk\contrib\scripts\sip_to_pjsip\astconfigparser.py:243: SyntaxWarning: invalid escape sequence '\s'
  match = re.match('^#include\s*([^;]+).*$', line)
Please, report any issue at:
    https://github.com/asterisk/asterisk/issues/
Reading sip.conf
Converting to PJSIP...
lookup error
lookup error
lookup error
Writing pjsip.conf

There is no equivalent “insecure” option in chan_pjsip, so it’s not mapped. It looks pretty much the same functionally - but you should really try to understand the different parts and their meanings yourself.

1 Like

Thanks for bearing with me. Once done, I will try to understand what everything means. I am a web & AI developer, with very little experience in VoIP, but willing to learn :slight_smile: I’ve already been researching, but didn’t know where to even start looking. Now I know thanks to you.

Should I remove the the “Non mapped elements” section or keep [general]without insecure?

It is commented out, so it won’t be read/loaded. You can remove it if you want.

1 Like

Ah yes, my bad. Didn’t realize ;-- --; was a multiline comment.

I will try this file and get back to you.

After restarting Asterisk, I still have the same issue.

module show like pjsip shows that chan_pjsip.so is running.

Do troubleshooting:

  1. Verify that the configuration was read and understood (look at console output at startup, use CLI commands to examine
  2. Use “pjsip set logger on” to see if traffic is being received
  3. If no traffic is received then verify that port 5060 is being listened on
  4. Double check that the IP address of where SIP traffic is going matches the container
1 Like

Here are the warnings and errors I get on startup, but I don’t think it’s related to my issue:

[Oct 15 10:13:25] WARNING[1]: loader.c:2409 load_modules: Some non-required modules failed to load.
[Oct 15 10:13:25] WARNING[1]: loader.c:2509 load_modules: The deprecated module 'res_adsi.so' has been loaded and is running, it may be removed in a future version
[Oct 15 10:13:25] WARNING[1]: loader.c:2509 load_modules: The deprecated module 'app_getcpeid.so' has been loaded and is running, it may be removed in a future version
[Oct 15 10:13:25] WARNING[1]: loader.c:2509 load_modules: The deprecated module 'app_adsiprog.so' has been loaded and is running, it may be removed in a future version
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: Failed to resolve dependencies for res_stir_shaken
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: res_stir_shaken declined to load.
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: cdr_sqlite3_custom declined to load.
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: cel_sqlite3_custom declined to load.
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: Failed to resolve dependencies for res_http_media_cache
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: res_http_media_cache declined to load.
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: Failed to resolve dependencies for res_pjsip_stir_shaken
[Oct 15 10:13:25] ERROR[1]: loader.c:2524 load_modules: res_pjsip_stir_shaken declined to load.
[Oct 15 10:13:25] Asterisk Ready.

And here are the warnings and errors I get after core reload:

[Oct 15 10:18:43] ERROR[92]: res_pjsip/config_system.c:267 system_create_resolver_and_set_nameservers: There are no local system nameservers configured, resorting to system resolution
[Oct 15 10:18:43] WARNING[91]: res_phoneprov.c:1249 get_defaults: Unable to find a valid server address or name.
[Oct 15 10:18:43] ERROR[91]: ari/config.c:312 process_config: No configured users for ARI
[Oct 15 10:18:43] NOTICE[91]: cel_custom.c:92 load_config: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.

I already tried, but nothing gets printed.


Both the Asterisk 18 and Asterisk 20 containers are on the host network (I only run one of them at a time to avoid conflicts), with port 5060 open. I can capture the packets on Asterisk 18.


This is already the case since both Asterisk containers are on the same IP.

What have you done to verify that Asterisk is listening on port 5060?

If nothing shows up in “pjsip set logger on” then traffic is not getting to Asterisk, which means:

  1. It’s not actually listening on port 5060
  2. Traffic isn’t actually being sent to it
  3. Something else is blocking it

Sorry, when I re-deployed the container, extensions.conf got reset to default since I haven’t yet created a Docker volume.

It works now, thanks a lot for your time!

I would also add that attempting to set in the general section rings alarm bells for me. You either have a very unusual system, in which case you need a detailed understanding of how the configurations work, or you have created a major security vulnerability.

insecure=invite is a work round for historic limitations in chan_sip; remotesecret is a better way,but everyone blindly copies, so it rarely gets used, and it would be unusual to require insecure=port, when using UDP.

You should review the use of allowguest. That is sometime needed, as a work round for other chan_sip limitations, It doesn’t seem to have been translated into the chan_pjsip configuration.

1 Like

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