Configure Ring Group using ARI/Sorcery

How do I configure a ring group using ARI/Sorcery? I want to be able to ring multiple endpoints if a single extension is called. I need to dynamically create the ring group from the dynamically created endpoints I made using ARI/Sorcery.

Also, how do you configure sorcery so that both the extensions that are in the .conf files and the ones created in sorcery are available to use? When I configure sorcery only the sorcery extensions/endpoints exist.

Asterisk has no concept of a ring group. This is something you yourself create in extensions.conf, which is not accessible using ARI/Sorcery.

As for having both available you would need to add multiple lines to sorcery.conf. The line for the .conf file is:

endpoint=config,pjsip.conf,criteria=type=endpoint

Thank you jcolp! That got me going. My sorcery.conf file now looks like this…

[res_pjsip]
endpoint=config,pjsip.conf,astdb,ps_endpoints,criteria=type=endpoint
auth=astdb,ps_auths
aor=astdb,ps_aors
domain_alias=astdb,ps_domain_aliases
contact=astdb,ps_contacts
system=astdb,ps_systems

[res_pjsip_endpoint_identifier_ip]
identify=astdb,ps_endpoint_id_ips

[res_pjsip_outbound_registration]
registration=astdb,ps_registrations

I’m not sure if I need to add those fields that I added to endpoint to the auth, for, domain, etc?

One thing I do need to figure out now is how to determine which endpoint was created using the config files and which ones by sorcery. I can probably do this by checking the context field. I can get the list of endpoints with /ari/asterisk/config/dynamic/res_pjsip/endpoint but it gives limited information.

I have tried to use /ari/asterisk/config/dynamic/res_pjsip/endpoint/[endpoint name] but that just returns Object with id not found. So it seems that the functionality is there but I’m not sure where to get the object id?

The object id is the name of the endpoint, but the ARI functionality was designed to work with data stores that allow manipulation (such as astdb). If you want to use .conf files for other types, then they also need a similar .conf line like endpoint has.

Over all I’m not quite sure what you are trying to achieve or how you are expecting/using things, so I can’t answer further.

Ok thanks Jcolp once again. Much appreciate the insights.

What about modules and accessing their configs? Looks like I can get limited access using ARI. However I’ve finally had a look at AMI. Would AMI be the better path for this sort of thing? I believe the data is stored in the DB for this particular module I’m looking to modify it’s settings.

I need to dig into AMI a bit more to bring forth any educated questions first. My apologies. But just curious if it’s the right path to dig down in? Seems like a fairly simple API and I do have a stateful application I can use to access it.

If you are using Asterisk Realtime Architecture, you access the database directly, not through any Asterisk API.

AMI provides a different feature set and functionality, if its actions can do what you need then you can use it. It’s just not clear exactly what you are trying to achieve and how you are building the system.

What I would like to do is to dial multiple endpoints at the same time from a single originate. Once one endpoint answers the other endpoints cease to ring. Think of it like calling a home phone and all the phones in the house ring and then stop ringing as soon as one of the phones is picked up.

I know Sangoma has a module that might do this but I need a way to manipulate it’s configs dynamically and it doesn’t support ARI.

Aside from that module. I’m not sure how else I would do what I need without having to build a module myself which will take some learning to figure out what apis to call. Unless there is some other way to intercept the originate and then start ringing the other endpoints. Then somehow only connect one endpoint and stop the INVITE to the others when one picks up. Not even sure how I’d do this by making my own module to be honest.

You can use a Local channel to call an extension in the dialplan. In the dialplan logic you can do whatever you want to determine what to dial. You can retrieve information from a database (external or AstDB), do a web query, etc. That is how people do that. Although they usually just explicitly configure it in the dialplan.

exten => EXTEN, Dial(tech/phone1&tech/phone2&tech/phone3&…)

Phones must not prematurely answer.

Thanks David.

So that needs to be set in the conf file. But what if I’m dynamically creating the extensions using ARI and Sorcery? I assume I would need to edit the conf file and restart Asterisk each time? Hoping to not have to do that if possible as the extensions will be changing and updating quite often. Essentially they will be provisioned out for a day or two and then removed. More will come and go. Welcome any suggestions here. Would AMI or the Asterisk Realtime Architecture help here?

I think I come back to the question already raised as to why the fixation on ARI and Sorcery.

What is this system trying to achieve, and why does it justify the expense of developing with such low level tools?

I’m not sure how else to create endpoints/extensions dynamically? Is there another, easier way to go about this? The need will be to be able to create unique endpoints that will be deleted and added by my application on demand. So I won’t know what endpoints are needed and when. Which is why I need some sort of mechanism to add, delete endpoints (and the aor and auth of course too). Have I made this more difficult than it needs to be using ARI and Sorcery?

Endpoints and Extensions are two different things.

Have you thought about using Real-time dialplan for your extensions?

Definitively I prefer realtime for both cases, extensions and sip devices but you are using PJSIP so not sure if that channel support realtime as CHAN_SIP does.

It does support realtime and there’s a guide on the wiki[1] for showing how to set it up.

[1] https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime

1 Like

There you go, realtime for devices and extensions to add/remove it dynamically.

1 Like