Res_pjsip fails to load

Hi all, I am running Asterisk 20.7.0 , and after adding a couple of endpoints to pjsip.conf, the module res_pjsip will not load. I tried reverting pjsip.conf to its original state to see if it would load then, but it did not. I checked the logs, and this is the first one:

sorcery.c: Error attempting to apply configuration res_pjsip to sorcery.

after this it says that red_pjsip failed to load, as well as all the modules that depend on it. As a result, asterisk no longer works.

This is incredibly confusing as i changed pjsip.conf back to its original state, restarted asterisk, and attemped to reload all of the modules. What am I doing wrong here?

What’s the contents of sorcery.conf? What is the actual full console output at startup? Did you use realtime previously? Are you selectively loading modules in modules.conf?

I have never used realtime, nor have I made a config change that would modify its behavior. I am not selectively loading modules nor have I ever opened modules.conf . Before I added the endpoints to pjsip.conf, asterisk was working, and listening for traffic on port 5060. I noticed that we had a phone trying to register and it was being denied. At that point, I added an endpoint so it would be allowed to register. After modifying the file, I started getting errors about how res_pjsip would not load. Thank you so much for helping. Here is the contents of sorcery.conf:

; Sample configuration file for Sorcery Data Access Layer

;
; Wizards
;
; Wizards are the persistence mechanism for objects. They are loaded as Asterisk modules and register
; themselves with the sorcery core. All implementation specific details of how objects are persisted is isolated
; within wizards.
;

;
; Caching
;
; A wizard can optionally be marked as an object cache by adding “/cache” to the object type within the mapping.
; If an object is returned from a non-object cache it is immediately given to the cache to be created. Multiple
; object caches can be configured for a single object type.
;

;
; Object Type Mappings
;
; To allow configuration of where and how an object is persisted object mappings can be defined within this file
; on a per-module basis. The mapping consists of the object type, options, wizard name, and wizard configuration
; data. This has the following format:
;
; object type [/options] = wizard name, wizard configuration data
;
; For example to configure an in-memory wizard for the ‘bob’ object type:
;
; bob = memory
;
; Or to configure the object type ‘joe’ from a configuration file:
;
; joe = config,joe.conf
;
; Note that an object type can have multiple mappings defined. Each mapping will be consulted in the order in which
; it appears within the configuration file. This means that if you are configuring a wizard as a cache it should
; appear as the first mapping so the cache is consulted before all other mappings.
;

;
; The following object mappings are used by the unit test to test certain functionality of sorcery.
;
[test_sorcery_section]
test=memory

[test_sorcery_cache]
test/cache=test
test=memory

;
; The following object mapping is the default mapping of external MWI mailbox
; objects to give persistence to the message counts.
;
;[res_mwi_external]
;mailboxes=astdb,mwi_external

;
; The following object mappings set PJSIP objects to use realtime database mappings from extconfig
; with the table names used when automatically generating configuration from the alembic script.
;
[res_pjsip]
endpoint=realtime,ps_endpoints
;auth=realtime,ps_auths
;aor=realtime,ps_aors
;domain_alias=realtime,ps_domain_aliases

;[res_pjsip_endpoint_identifier_ip]
;identify=realtime,ps_endpoint_id_ips

;[res_pjsip_outbound_publish]
;outbound-publish=realtime,ps_outbound_publishes

;[res_pjsip_pubsub]
;inbound-publication=realtime,ps_inbound_publications

;[res_pjsip_publish_asterisk]
;asterisk-publication=realtime,ps_asterisk_publications

;[res_stir_shaken]
;tn=realtime,stir_tn

According to that sorcery.conf it would seem as though endpoints have been configured to come from realtime. That is not the default. The line “endpoint=realtime,ps_endpoints” should be commented out.

on startup:

Loading res_pjsip.so.
[Jun 26 13:46:32] WARNING[3809]: sorcery.c:923 __ast_sorcery_object_type_insert_wizard: Wizard ‘realtime’ failed to open mapping for object type ‘endpoint’ with data: ps_endpoints
[Jun 26 13:46:32] ERROR[3809]: sorcery.c:650 __ast_sorcery_open: Error attempting to apply configuration res_pjsip to sorcery.
[Jun 26 13:46:32] ERROR[3809]: res_pjsip/config_system.c:182 ast_sip_initialize_system: Failed to open SIP system sorcery
[Jun 26 13:46:32] ERROR[3809]: res_pjsip.c:3957 load_module: Failed to initialize SIP ‘system’ configuration section. Aborting load
Loading res_http_websocket.so.

I tried the fix in sorcery.conf that you suggested… Now I can’t start asterisk at all.

when i attempt ‘asterisk start’, i get the message ‘unable to open specified master config file ‘etc/asterisk/asterisk.conf’ using built in defaults’

when i attempt asterisk -cvvvvvddd i get the same message.

Changing sorcery.conf would not have caused such a thing, and as stated it would fall back to defaults for asterisk.conf anyway.

Yeah your right, my terminal didnt have the priveledges to do it. I elevated them and I was able to connect. Still have to verify this works, but sorry about that.

I had to comment out a few more config items that were unnecessary, but it did eventually work. Thank you your a lifesaver! Can you recommend a good book so I can figure these things out on my own?