AGI calling misc applications


Hopefully an easy question. Im using AGI to inject some custom programs in to the dial plans. However, to call an extension I issue Dial and the extension in the format SIP/XXXX format. Easy and works perfectly. Alternatively Queue and its number.

What goes however where SIP is above to dial free pbx pre-defined misc destinations, as I cant see it when watching the console. (Maybe you cant and I have to call another application? - any hints on what to look for if its an app).

Any ideas?

Thanks in advance


What you are doing doesn’t “work perfectly” because it bypasses a good portion of the FreePBX dial plan logic, although you possibly may not care (at least until some feature doesn’t work). In any case, how are you calling the AGI? If you are calling it from a bit of custom dial plan in extensions_custom.conf, I would think the best way to do it would be to call the AGI, have the AGI set some variable or exit level (probably easiest would be to return with the number you want to call in the variable EXTEN, whether that be the number of an extension, queue, or Misc Destination) and then on the next line in the custom dial plan, just do something like this:

Now I’m not saying you cannot do something similar within the AGI (I’m not really an expert on AGI’s by any means) but the point is that rather than dialing an extension, queue, or whatever directly, you should probably be going to the from-internal context (note this will give you access to anything an internal extension can dial, so be careful what you send there).

Hi, thanks for the reply, it does help but I think I need to find a way to refine it.

I’ll give the context, im still working through the API’s now trying to figure this, but the explanation will help in your response. The context is a problem, as thats the safeguard for outgoing calls (I believe - please correct if wrong - contexts are used to define who can do outbound calls etc).

My problem is that we want 3 queues, limited to for example 110 over the 3 queues, to ensure that 10 are left free for the 4 E1 (120 lines total)connections. As far as I can tell our current release and latest release - on my dev servers, only allow queue limits per queue (So setting to 110 on every queue means all lines could be used as 330 available slots on 120 lines = blocking DIDs from working). We actually just need to limit all queues to a max number roughly, to ensure we keep some lines available for fax DID’s and actual DID’s. (As the volumes on 3 queues varies depending on time of month its not realisic to split equally for good results unfortunately). Therefore:

Im directing all incomming links via, the “unofficial” or “unreleased” dialplan injection module. This passes every connection to a java fastagi program I have that monitors the queues and spawns a new fastagi to use when checking where to direct calls against shared memory. If we are under the limit it sucessfully uses the Queue command to redirect the caller to the queue, however if we are over the limit, I would like to pass back into the freepbx dialplan. In this case an announcement stating sorry we are too busy please try later, I know I could do this manually in agi but I’d prefer to keep as much in freepbx as possible, and therefore pass back into a misc application, as it makes system manipulation much more logical and simplier.

Sorry for the long reply, but hopefully it explains it, and also the context issue, as I think changing context to from-internal opens as you suggested many backdoors to the system.

Any more directions would really be appreciated, and thanks again for the response wiseoldowl - it gives me more to look at thanks :slight_smile:


P.S (Out of interest) Why are the standard queue limits set to 50 on the freepbx interface? I have tested higher by changing the .php and it seems to work, is this licence based, or just that for most purposes 50 lines with multiple tiers is the way most queues should be handled.

In Asterisk-Java I’ve managed to get to the app announcement as created by the interface by using a Goto command, in case this helps others - channel.exec(“Goto”, “app-announcement-1|s|1”); // Extracted from the asterisk console during dialling to figure out where it routes to.

If someone could confirm this I’d really appreciate it
app-announcement-X - X is the id assigned to the announcement_id field in the announcement table, in the mysql database? Seems to be the case currently?

Thanks, for the help hopefully the above may help others trying to figure this out.