Hi,
I have application where some configuration options (specific pjsip) are static, stored in config files others are added dynamically with ari (/asterisk/config/dynamic/{configClass}/{objectType}/{id}) interface. Sorcery is configured like this (shown only for endpoint):
So is there a way to easy remove all dynamically added objects. I can found two ways:
Restart asterisk. This will remove all object with sorcery wizard ‘memory’. Of course I would like to avoid asterisk restarting.
I can list all endpoints. Use some name convention to distinguish static from dynamic and remove dynamic endpoints and corresponding objects (auth, aor, identify).
Is there any batter way, preferably with ari or at least with cli. From application point of view the easiest way is to dump all dynamic objects and then rebuild them.
Because ari/endpoints returns very little info about endpoint I have to add some kind of prefix to endpoint name that can be later identified and deleted. So that I don’t delete endpoints created with other apps or from static config files. But here is a problem.
I have following pjsip configuration, which works ok.
You can configure it to use the username from auth by configuring auth_username as an endpoint identifier in pjsip.conf, otherwise it uses the name of the endpoint itself. The “from_user” option strictly configures the From username in traffic.
Interesting is that if I change endpoint section name from [cty-2000] to [2000] it works ok even with identify_by = auth_username. It looks like that endpoint section name should match user name in any all situations.
so there is no benefit switching to identify_by = auth_username, because you also get delayed endpoint identification. But it will be really good to remove section name dependency (OK it can be default value)
and add additional property where you can change section name.
Something like this:
[cty-2000]
type = endpoint
name= 2000
Sections should be used as placeholders and linking references, but you must be able to change them without breaking application.
Doing so requires additional work, because you then have to optimize all the lookup paths for that case - or else you end up looking through every endpoint for a match. Right now it’s optimized based on the name of the endpoint - so you can directly retrieve it fast.
yes of course you need two indices (or dictionaries), but it will be more flexible. It will also support scenario where you have two application using same asterisk instance in sandbox manner. So each instance can create own endpoint configuration without polluting other.