Summary:ASTERISK-05855: [patch] Allow for context includes in realtime (ARA)
Reporter:Steven Sokol (ssokol)Labels:
Date Opened:2005-12-16 13:23:41.000-0600Date Closed:2011-06-07 14:03:07
Versions:Frequency of
Environment:Attachments:( 0) realtime_include3.patch
Description:This is a patch which allows you to include one or more contexts within another context in the ARA (realtime) dial plan.  One of the major limitations of ARA has been the inability to include one context within another without having to creat "proxy contexts" in extensions.conf.

This patch allows you to include one context from within another by creating a specail extension in your realtime context called 'include'.  This context has one or emore priorities each of which 'includeds' one context.  The context name should be placed in the appdata field (the field which normally contains the arguments for the selected application).  The app field (where the application name goes) is ignored.  For readability sake I use 'include' as the app name.

The contexts are searched by priority order.  The system accepts the first exacto or pattern match which it finds.  BEWARE CIRCULAR INCLUSION!  YOU WILL FILL YOUR STACK AND KILL YOUR PBX!

Because of the overhead involved in executing queries, the system caches the 50 most recent 'hits' (cases where a match was found in an included context).


The system searches following the same search pattern as non-realtime Asterisk with the exception that we don't have the ability to invoke switches from RT.  The order is:

Exact Matches
_Pattern Matches
Include Context 1 Matches (Exact)
Include Context 1 Matches (_Pattern)
Include Context 2 Matches (Exact)
Include Context 2 Matches (_Pattern)

To apply this patch, simply patch pbx_realtime.c, make, make install.  Then add an "include" extension to one of your realtime contexts:

id    context      exten       priority    app         appdata
1     default      include     1           include     inside_extensions
2     default      include     2           include     standard_features

Note that this makes use of the realtime_switch_common function reentrantly.  Too many levels of inclusion could cause problems.  And don't forget that circular inclusion is a sure-fired way to kill your Asterisk.

Please test and let me know if this works for you.

Disclaimer on file.
Comments:By: Steven Sokol (ssokol) 2005-12-18 17:43:53.000-0600


Fixes caching issue.  Now properly handles recursive calls and caches the query properly.  Also fixed up some formatting glitches.

By: Steven Sokol (ssokol) 2005-12-19 12:19:13.000-0600

realtime_include3.patch - Adds a loop and redundancy check to include searches.  Makes this patch MUCH safer to run.

By: Serge Vecher (serge-v) 2006-05-01 13:39:45

Did anybody try this feature? Any comments?


By: ivix (ivix) 2006-05-15 20:00:20

Applies fine for me on 1.2.7 but causes a segfault when it is used. Does not apply against current svn.

By: Serge Vecher (serge-v) 2006-05-16 09:23:49

ssokol: are you still working on this?

By: Jared Smith (jsmith) 2006-05-16 09:35:25

I talked with Steve about this last week, and I think he's still interested in getting this into Asterisk before 1.4, if possible.  It might be something we want to discuss during the Tuesday morning developer meeting, to make sure the core developers are interested in having includes as part of the Asterisk Realtime Architecture.

By: Steven Sokol (ssokol) 2006-05-16 09:39:37

I have not done much with it in the past few months (too busy with other work).  Talking with several other developers I got the impression that ARA may be completely re-written at some point in the near future.  I can try to make this work on TRUNK if anybody wants it.

By: Serge Vecher (serge-v) 2006-09-27 13:28:16

ok, what's the status of this work ...?

By: jmls (jmls) 2006-11-01 12:21:39.000-0600

ssokol, do we have any updates for this issue ? Thanks.

By: jmls (jmls) 2006-12-05 04:42:16.000-0600

ping. housekeeping

By: Serge Vecher (serge-v) 2007-01-09 13:16:26.000-0600

please reopen if you are interested again and have the updated trunk patch available.