PJSIP endpoints unavailable when retrieved from realtime cURL

Hello, I’m encountering this weird behaviour when I retrieve a single endpoint using res_config_curl as realtime backend. When Asterisk starts it performs a cURL request to fetch all endpoints and aors (POST /[endpoints|aor]/multi), al these endpoints have the Not in use state, this seems to be the desired behavior. But whenever a call is made to an non existing endpoint it performs a single cURL request (POST /[endpoints|aor]/single), these endpoints show as unavailable until a reload of PJSIP is done. The endpoint however is being called, even with the Unavailable state, but it does give problems when that endpoint is also a member of a queue.

I tried this exact scenario with an ODBC backend and this seems to be working as expecting where a single endpoint request does show up as Not in use state.

Relevant configs:

modules.conf:

[modules]
autoload=yes

preload=res_config_curl.so

sorcery.conf:

[res_pjsip]
endpoint/cache=memory_cache,object_lifetime_stale=3600,full_backend_cache=yes
endpoint=config,pjsip.conf,criteria=type=endpoint
endpoint=realtime,ps_endpoints

aor/cache=memory_cache,object_lifetime_stale=3600,full_backend_cache=yes
aor=config,pjsip.conf,criteria=type=aor
aor=realtime,ps_aors

extconfig.conf

[settings]
ps_endpoints => curl,https://webserver/endpoints
ps_aors => curl,https://webserver/aors
queue_members => curl,https://webserver/queue_members

I’m not sure if this is a bug, if I’m doing something wrong or if this is the desired behaviour.

You may be the first person who has used curl with it, and it is entirely possible that there’s some weird interaction going on.

1 Like

Wow, thank you for such a fast reply!
So, it’s not so a good idea to use that module then, is there a better way to retrieve endpoints dynamically without using a DB directly? I’ve been searching for a while but could only find curl.

People who use realtime generally use a database, I don’t know of what others are doing or have recommendations in that area.

Thank you for your help @jcolp, I might have a look at res_config_curl if I find something that causes this behaviour or go another direction.