Proper reload when pjsip and extensions are changed

Hi,

I’m wondering what is the best way to reload SIP (pjsip) configuration when changing the file pjsip_wizard.conf, as well as extensions (dialplan).

I understand that “module reload” should be OK. Especially if:

module show like sip
Module                         Description                              Use Count  Status      Support Level
app_adsiprog.so                Asterisk ADSI Programming Application    0          Running        deprecated
chan_pjsip.so                  PJSIP Channel Driver                     0          Running              core
chan_sip.so                    Session Initiation Protocol (SIP)        0          Not Running      extended
func_pjsip_aor.so              Get information about a PJSIP AOR        0          Running              core
func_pjsip_contact.so          Get information about a PJSIP contact    0          Running              core
func_pjsip_endpoint.so         Get information about a PJSIP endpoint   0          Running              core
res_pjsip.so                   Basic SIP resource                       45         Running              core
res_pjsip_acl.so               PJSIP ACL Resource                       0          Running              core
res_pjsip_authenticator_digest.so PJSIP authentication resource            0          Running              core
res_pjsip_caller_id.so         PJSIP Caller ID Support                  1          Running              core
res_pjsip_config_wizard.so     PJSIP Config Wizard                      1          Running              core
res_pjsip_dialog_info_body_generator.so PJSIP Extension State Dialog Info+XML Pr 0          Running              core
res_pjsip_diversion.so         PJSIP Add Diversion Header Support       1          Running              core
res_pjsip_dlg_options.so       SIP OPTIONS in dialog handler            0          Running              core
res_pjsip_dtmf_info.so         PJSIP DTMF INFO Support                  0          Running              core
res_pjsip_empty_info.so        PJSIP Empty INFO Support                 0          Running              core
res_pjsip_endpoint_identifier_anonymous.so PJSIP Anonymous endpoint identifier      0          Running              core
res_pjsip_endpoint_identifier_ip.so PJSIP IP endpoint identifier             0          Running              core
res_pjsip_endpoint_identifier_user.so PJSIP username endpoint identifier       0          Running              core
res_pjsip_exten_state.so       PJSIP Extension State Notifications      0          Running              core
res_pjsip_header_funcs.so      PJSIP Header Functions                   0          Running              core
res_pjsip_history.so           PJSIP History                            0          Running          extended
res_pjsip_logger.so            PJSIP Packet Logger                      0          Running              core
res_pjsip_messaging.so         PJSIP Messaging Support                  0          Running              core
res_pjsip_mwi.so               PJSIP MWI resource                       0          Running              core
res_pjsip_mwi_body_generator.so PJSIP MWI resource                       0          Running              core
res_pjsip_nat.so               PJSIP NAT Support                        0          Running              core
res_pjsip_notify.so            CLI/AMI PJSIP NOTIFY Support             0          Not Running          core
res_pjsip_one_touch_record_info.so PJSIP INFO One Touch Recording Support   0          Running              core
res_pjsip_outbound_authenticator_digest.so PJSIP authentication resource            0          Running              core
res_pjsip_outbound_publish.so  PJSIP Outbound Publish Support           2          Running              core
res_pjsip_outbound_registration.so PJSIP Outbound Registration Support      0          Running              core
res_pjsip_path.so              PJSIP Path Header Support                0          Running              core
res_pjsip_phoneprov_provider.so PJSIP Phoneprov Provider                 0          Not Running      extended
res_pjsip_pidf_body_generator.so PJSIP Extension State PIDF Provider      0          Running              core
res_pjsip_pidf_digium_body_supplement.so PJSIP PIDF Digium presence supplement    0          Running              core
res_pjsip_pidf_eyebeam_body_supplement.so PJSIP PIDF Eyebeam supplement            0          Running              core
res_pjsip_publish_asterisk.so  PJSIP Asterisk Event PUBLISH Support     0          Running              core
res_pjsip_pubsub.so            PJSIP event resource                     12         Running              core
res_pjsip_refer.so             PJSIP Blind and Attended Transfer Suppor 1          Running              core
res_pjsip_registrar.so         PJSIP Registrar Support                  0          Running              core
res_pjsip_rfc3326.so           PJSIP RFC3326 Support                    0          Running              core
res_pjsip_sdp_rtp.so           PJSIP SDP RTP/AVP stream handler         0          Running              core
res_pjsip_send_to_voicemail.so PJSIP REFER Send to Voicemail Support    0          Running              core
res_pjsip_session.so           PJSIP Session resource                   17         Running              core
res_pjsip_sips_contact.so      UAC SIPS Contact support                 0          Running              core
res_pjsip_t38.so               PJSIP T.38 UDPTL Support                 0          Running              core
res_pjsip_transport_websocket.so PJSIP WebSocket Transport Support        0          Running              core
res_pjsip_xpidf_body_generator.so PJSIP Extension State PIDF Provider      0          Running              core
49 modules loaded

Well, maybe I still need to “dialplan reload” if I change something in extensions.conf, right?

However, after a “module reload” the new/updated pjsip account credentials are NOT loaded. SIP clients can only connect if I restart Asterisk completely. I suppose a pjsip reload might also work, but before doing so I would like to know why a “modules reload” isn’t enough.

Thanks

Yes.

Sadly, it is both not enough and too much at the same time!

I’ve found this to be a nice 1-2 punch to the PJSIP guts on some installs:

  1. module reload res_pjsip.so
  2. module reload res_pjsip_phoneprov_provider.so

Thanks, but I’m wondering how to solve the following problem.

I have a whole bunch of pjsip extensions configured withthe pjsip wizard. Now, I need to update (eg. change password) or add a new one. If I run the following command then it seems to work for the new/updated extension, but it also interrupts all the other extensions that may be online (eg. the webrtc clients get a websocket error and have to reconnect).

asterisk -rx "module reload res_pjsip.so"

How can I make effective an extension update or a new extension in pjsip WITHOUT disrupting the rest of the extensions?

I am using flat files, no realtime DB.

Thanks

Only WebRTC clients need reconnect ?

I didn’t work that much with PJSIP — but is there no command like “pjsip reload”, like there is a “sip reload” with chan_sip?
That does not disrupt any calls.

For now, they are moslty webrtc clients, yes. However, I might need to do the same for UDP SIP clients in the future.

There is no such command (“pjsip reload”). It must be something like this:
pjsip reload qualify {aor,endpoint} <id>

Please note that I’m using pjsip wizard, not pjsip – if that makes any difference, I don’t know.

This is what happens when I try to reload the module:

*CLI> module reload res_pjsip.so
*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups
Asterisk ending (0).

It doesn’t make any sense that the whole Asterisk PBX goes down and restarts just because I want to reload pjsip…

Whenever I run module reload res_pjsip.so or pjsip reload I get an Asterisk failure:

asterisk: Asterisk terminated with Signal: 6

It restarts automatically because I have a wrapper.
I guess it’s a bug.

Signal 6 is Abort, which means the code has explicitly declared a crash. Normally this is the result of an assertion failure, i.e. the code has checked a condition which should be true, but wasn’t.

In that case, a message will have been written. Even if you aren’t capturing standard error, the message should be visible in the parameters in the backtrace from the bug.

Typical reasons for assertion failures are bugs relating to incorrect locking and more general memory corruption.

The normal guidance about retrying with the latest sub-version apply. NB many people misunderstand cert version and RC versions. The former are often not the most reliable versions and the latter should be assumed to be unsafe, unless you want to detect bugs early.

I’m running Asterisk 16.13.0 which is the latest available in my distro. I’ve read it could be a segfault, as you say, which is bad… Before reporting this as a bug, I guess I’ll have to get a trace with gdb.
I don’t see any meaningful messages yet.
Thanks

What distribution are you using? There’s been no reports of crashes from reloads in a long time. There is also a guide on the wiki[1] for collecting information.

[1] https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace