1999-10-27 00:56:38 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
1999-10-27 00:56:38 +00:00
|
|
|
*
|
2006-02-12 04:28:58 +00:00
|
|
|
* Copyright (C) 1999 - 2006, Digium, Inc.
|
2005-08-30 18:32:10 +00:00
|
|
|
*
|
|
|
|
* Mark Spencer <markster@digium.com>
|
1999-10-27 00:56:38 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
1999-10-27 00:56:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
2005-08-30 18:32:10 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
1999-10-27 00:56:38 +00:00
|
|
|
*/
|
2005-08-30 18:32:10 +00:00
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
|
|
|
* \brief Core PBX routines and definitions.
|
2005-08-30 18:32:10 +00:00
|
|
|
*/
|
|
|
|
|
1999-10-27 00:56:38 +00:00
|
|
|
#ifndef _ASTERISK_PBX_H
|
|
|
|
#define _ASTERISK_PBX_H
|
|
|
|
|
2010-09-10 22:15:47 +00:00
|
|
|
#include "asterisk/channel.h"
|
2005-04-21 06:02:45 +00:00
|
|
|
#include "asterisk/sched.h"
|
2009-07-08 22:15:06 +00:00
|
|
|
#include "asterisk/devicestate.h"
|
2012-06-04 20:26:12 +00:00
|
|
|
#include "asterisk/presencestate.h"
|
2007-11-22 03:50:04 +00:00
|
|
|
#include "asterisk/chanvars.h"
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
#include "asterisk/hashtab.h"
|
2008-11-01 21:10:07 +00:00
|
|
|
#include "asterisk/stringfields.h"
|
2009-05-22 17:52:35 +00:00
|
|
|
#include "asterisk/xmldoc.h"
|
2011-02-03 16:22:10 +00:00
|
|
|
#include "asterisk/format.h"
|
1999-10-27 00:56:38 +00:00
|
|
|
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2006-05-09 15:17:12 +00:00
|
|
|
#define AST_MAX_APP 32 /*!< Max length of an application */
|
|
|
|
|
2009-04-09 19:10:02 +00:00
|
|
|
#define AST_PBX_GOTO_FAILED -3
|
1999-10-27 00:56:38 +00:00
|
|
|
#define AST_PBX_KEEP 0
|
|
|
|
#define AST_PBX_REPLACE 1
|
|
|
|
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! \brief Special return values from applications to the PBX
|
|
|
|
* @{ */
|
Merged revisions 152535 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r152535 | murf | 2008-10-28 22:36:32 -0600 (Tue, 28 Oct 2008) | 46 lines
The magic trick to avoid this crash is not to
try to find the channel by name in the list,
which is slow and resource consuming, but rather
to pay attention to the result codes from the
ast_bridge_call, to which I added the
AST_PBX_NO_HANGUP_PEER_PARKED value, which
now are returned when a channel is parked.
Why? because CDR's aren't generated via parking,
so nothing is needed, but if a transfer occurred,
there are critical things I need.
If you get AST_PBX_KEEPALIVE,
then don't touch the channel pointer.
If you get AST_PBX_NO_HANGUP_PEER, or
AST_PBX_NO_HANGUP_PEER_PARKED, then don't
touch the peer pointer.
Updated the several places where the results
from a bridge were not being properly obeyed,
and fixed some code I had introduced so that
the results of the bridge were not overridden
(in trunk).
All the places that previously tested for
AST_PBX_NO_HANGUP_PEER now have to check for
both AST_PBX_NO_HANGUP_PEER and AST_PBX_NO_HANGUP_PEER_PARKED.
I tested this against the 4 common parking
scenarios:
1. A calls B; B answers; A parks B; B hangs up while A is getting the parking
slot announcement, immediately after being put on hold.
2. A calls B; B answers; A parks B; B hangs up after A has been hung up, but
before the park times out.
3. A calls B; B answers; B parks A; A hangs up while B is getting the parking slot announcement, immediately after being put on hold.
4. A calls B; B answers; B parks A; A hangs up after B has been hung up, but before the park times out.
No crash.
I also ran the scenarios above against valgrind, and accesses looked good.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@152536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-10-29 05:01:00 +00:00
|
|
|
#define AST_PBX_HANGUP -1 /*!< Jump to the 'h' exten */
|
|
|
|
#define AST_PBX_OK 0 /*!< No errors */
|
|
|
|
#define AST_PBX_ERROR 1 /*!< Jump to the 'e' exten */
|
|
|
|
#define AST_PBX_INCOMPLETE 12 /*!< Return to PBX matching, allowing more digits for the extension */
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @} */
|
2000-01-23 01:06:34 +00:00
|
|
|
|
2006-04-05 19:32:40 +00:00
|
|
|
#define PRIORITY_HINT -1 /*!< Special Priority for a hint */
|
2003-03-30 22:55:42 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Extension states
|
|
|
|
* \note States can be combined
|
|
|
|
* \ref AstExtState
|
|
|
|
*/
|
2005-08-27 23:55:14 +00:00
|
|
|
enum ast_extension_states {
|
2006-04-05 19:32:40 +00:00
|
|
|
AST_EXTENSION_REMOVED = -2, /*!< Extension removed */
|
|
|
|
AST_EXTENSION_DEACTIVATED = -1, /*!< Extension hint removed */
|
|
|
|
AST_EXTENSION_NOT_INUSE = 0, /*!< No device INUSE or BUSY */
|
|
|
|
AST_EXTENSION_INUSE = 1 << 0, /*!< One or more devices INUSE */
|
|
|
|
AST_EXTENSION_BUSY = 1 << 1, /*!< All devices BUSY */
|
|
|
|
AST_EXTENSION_UNAVAILABLE = 1 << 2, /*!< All devices UNAVAILABLE/UNREGISTERED */
|
|
|
|
AST_EXTENSION_RINGING = 1 << 3, /*!< All devices RINGING */
|
2006-07-08 02:24:07 +00:00
|
|
|
AST_EXTENSION_ONHOLD = 1 << 4, /*!< All devices ONHOLD */
|
2005-08-29 23:53:29 +00:00
|
|
|
};
|
|
|
|
|
2013-10-25 20:51:13 +00:00
|
|
|
/*!
|
|
|
|
* \brief extension matchcid types
|
|
|
|
* \note matchcid in ast_exten retains 0/1, this adds 3rd state for functions to specify all
|
|
|
|
* \see ast_context_remove_extension_callerid
|
|
|
|
*/
|
|
|
|
enum ast_ext_matchcid_types {
|
|
|
|
AST_EXT_MATCHCID_OFF = 0, /*!< Match only extensions with matchcid=0 */
|
|
|
|
AST_EXT_MATCHCID_ON = 1, /*!< Match only extensions with matchcid=1 AND cidmatch matches */
|
|
|
|
AST_EXT_MATCHCID_ANY = 2, /*!< Match both - used only in functions manipulating ast_exten's */
|
|
|
|
};
|
2005-08-29 23:53:29 +00:00
|
|
|
|
1999-10-27 00:56:38 +00:00
|
|
|
struct ast_context;
|
2009-10-13 17:11:46 +00:00
|
|
|
struct ast_exten;
|
2001-09-19 14:40:16 +00:00
|
|
|
struct ast_include;
|
|
|
|
struct ast_ignorepat;
|
|
|
|
struct ast_sw;
|
2017-12-22 09:23:22 -05:00
|
|
|
|
2012-06-04 20:26:12 +00:00
|
|
|
enum ast_state_cb_update_reason {
|
|
|
|
/*! The extension state update is a result of a device state changing on the extension. */
|
|
|
|
AST_HINT_UPDATE_DEVICE = 1,
|
|
|
|
/*! The extension state update is a result of presence state changing on the extension. */
|
|
|
|
AST_HINT_UPDATE_PRESENCE = 2,
|
|
|
|
};
|
|
|
|
|
2012-08-09 14:52:16 +00:00
|
|
|
struct ast_device_state_info {
|
|
|
|
enum ast_device_state device_state;
|
|
|
|
struct ast_channel *causing_channel;
|
|
|
|
char device_name[1];
|
|
|
|
};
|
|
|
|
|
2012-06-04 20:26:12 +00:00
|
|
|
struct ast_state_cb_info {
|
|
|
|
enum ast_state_cb_update_reason reason;
|
|
|
|
enum ast_extension_states exten_state;
|
2012-08-09 14:52:16 +00:00
|
|
|
struct ao2_container *device_state_info; /* holds ast_device_state_info, must be referenced by callback if stored */
|
2012-06-04 20:26:12 +00:00
|
|
|
enum ast_presence_state presence_state;
|
|
|
|
const char *presence_subtype;
|
|
|
|
const char *presence_message;
|
|
|
|
};
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2006-04-05 19:32:40 +00:00
|
|
|
/*! \brief Typedef for devicestate and hint callbacks */
|
2016-04-06 17:57:20 -05:00
|
|
|
typedef int (*ast_state_cb_type)(const char *context, const char *exten, struct ast_state_cb_info *info, void *data);
|
2003-03-30 22:55:42 +00:00
|
|
|
|
2011-12-23 02:35:13 +00:00
|
|
|
/*! \brief Typedef for devicestate and hint callback removal indication callback */
|
|
|
|
typedef void (*ast_state_cb_destroy_type)(int id, void *data);
|
|
|
|
|
2006-04-05 19:32:40 +00:00
|
|
|
/*! \brief Data structure associated with a custom dialplan function */
|
2005-05-05 05:39:33 +00:00
|
|
|
struct ast_custom_function {
|
2008-11-01 21:10:07 +00:00
|
|
|
const char *name; /*!< Name */
|
|
|
|
AST_DECLARE_STRING_FIELDS(
|
|
|
|
AST_STRING_FIELD(synopsis); /*!< Synopsis text for 'show functions' */
|
|
|
|
AST_STRING_FIELD(desc); /*!< Description (help text) for 'show functions <name>' */
|
|
|
|
AST_STRING_FIELD(syntax); /*!< Syntax text for 'core show functions' */
|
|
|
|
AST_STRING_FIELD(arguments); /*!< Arguments description */
|
|
|
|
AST_STRING_FIELD(seealso); /*!< See also */
|
|
|
|
);
|
|
|
|
enum ast_doc_src docsrc; /*!< Where the documentation come from */
|
2009-04-29 18:53:01 +00:00
|
|
|
/*! Read function, if read is supported */
|
2010-09-10 22:15:47 +00:00
|
|
|
ast_acf_read_fn_t read; /*!< Read function, if read is supported */
|
2009-04-29 18:53:01 +00:00
|
|
|
/*! Read function, if read is supported. Note: only one of read or read2
|
|
|
|
* needs to be implemented. In new code, read2 should be implemented as
|
|
|
|
* the way forward, but they should return identical results, within the
|
|
|
|
* constraints of buffer size, if both are implemented. That is, if the
|
|
|
|
* read function is handed a 16-byte buffer, and the result is 17 bytes
|
|
|
|
* long, then the first 15 bytes (remember NULL terminator) should be
|
|
|
|
* the same for both the read and the read2 methods. */
|
2010-09-10 22:15:47 +00:00
|
|
|
ast_acf_read2_fn_t read2;
|
2009-04-29 18:53:01 +00:00
|
|
|
/*! If no read2 function is provided, what maximum size? */
|
|
|
|
size_t read_max;
|
|
|
|
/*! Write function, if write is supported */
|
2010-09-10 22:15:47 +00:00
|
|
|
ast_acf_write_fn_t write; /*!< Write function, if write is supported */
|
2007-07-16 18:24:29 +00:00
|
|
|
struct ast_module *mod; /*!< Module this custom function belongs to */
|
2013-12-16 19:11:51 +00:00
|
|
|
unsigned int read_escalates:1; /*!< The read function is to be considered
|
|
|
|
* 'dangerous', and should not be run directly
|
|
|
|
* from external interfaces (AMI, ARI, etc.)
|
|
|
|
* \since 12 */
|
|
|
|
unsigned int write_escalates:1; /*!< The write function is to be considerd
|
|
|
|
* 'dangerous', and should not be run directly
|
|
|
|
* from external interfaces (AMI, ARI, etc.)
|
|
|
|
* \since 12 */
|
|
|
|
|
2006-11-02 21:40:53 +00:00
|
|
|
AST_RWLIST_ENTRY(ast_custom_function) acflist;
|
2005-03-04 06:36:18 +00:00
|
|
|
};
|
|
|
|
|
2006-03-30 21:29:39 +00:00
|
|
|
/*! \brief All switch functions have the same interface, so define a type for them */
|
|
|
|
typedef int (ast_switch_f)(struct ast_channel *chan, const char *context,
|
|
|
|
const char *exten, int priority, const char *callerid, const char *data);
|
|
|
|
|
2006-04-05 19:32:40 +00:00
|
|
|
/*!< Data structure associated with an Asterisk switch */
|
2001-09-19 14:40:16 +00:00
|
|
|
struct ast_switch {
|
2006-05-08 11:20:19 +00:00
|
|
|
AST_LIST_ENTRY(ast_switch) list;
|
2006-04-05 19:32:40 +00:00
|
|
|
const char *name; /*!< Name of the switch */
|
|
|
|
const char *description; /*!< Description of the switch */
|
2009-10-13 17:11:46 +00:00
|
|
|
|
2006-03-30 21:29:39 +00:00
|
|
|
ast_switch_f *exists;
|
|
|
|
ast_switch_f *canmatch;
|
|
|
|
ast_switch_f *exec;
|
|
|
|
ast_switch_f *matchmore;
|
2001-09-19 14:40:16 +00:00
|
|
|
};
|
|
|
|
|
2004-11-11 21:23:45 +00:00
|
|
|
struct ast_timing {
|
2008-12-13 08:36:35 +00:00
|
|
|
int hastime; /*!< If time construct exists */
|
|
|
|
unsigned int monthmask; /*!< Mask for month */
|
|
|
|
unsigned int daymask; /*!< Mask for date */
|
|
|
|
unsigned int dowmask; /*!< Mask for day of week (sun-sat) */
|
|
|
|
unsigned int minmask[48]; /*!< Mask for minute */
|
2008-12-16 22:57:17 +00:00
|
|
|
char *timezone; /*!< NULL, or zoneinfo style timezone */
|
2004-11-11 21:23:45 +00:00
|
|
|
};
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Construct a timing bitmap, for use in time-based conditionals.
|
2008-12-16 22:57:17 +00:00
|
|
|
* \param i Pointer to an ast_timing structure.
|
|
|
|
* \param info Standard string containing a timerange, weekday range, monthday range, and month range, as well as an optional timezone.
|
|
|
|
* \retval Returns 1 on success or 0 on failure.
|
|
|
|
*/
|
2006-04-14 21:00:59 +00:00
|
|
|
int ast_build_timing(struct ast_timing *i, const char *info);
|
2008-12-16 22:57:17 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified.
|
2008-12-16 22:57:17 +00:00
|
|
|
* \param i Pointer to an ast_timing structure.
|
|
|
|
* \retval Returns 1, if the time matches or 0, if the current time falls outside of the specified range.
|
|
|
|
*/
|
2006-04-14 21:00:59 +00:00
|
|
|
int ast_check_timing(const struct ast_timing *i);
|
2004-11-11 21:23:45 +00:00
|
|
|
|
2010-01-13 21:27:34 +00:00
|
|
|
/*!
|
|
|
|
* \brief Evaluate a pre-constructed bitmap as to whether a particular time falls within the range specified.
|
|
|
|
* \param i Pointer to an ast_timing structure.
|
|
|
|
* \param tv Specified time
|
|
|
|
* \retval Returns 1, if the time matches or 0, if the time falls outside of the specified range.
|
|
|
|
*/
|
|
|
|
int ast_check_timing2(const struct ast_timing *i, const struct timeval tv);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Deallocates memory structures associated with a timing bitmap.
|
2008-12-16 22:57:17 +00:00
|
|
|
* \param i Pointer to an ast_timing structure.
|
2009-04-01 20:13:28 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval non-zero failure (number suitable to pass to \see strerror)
|
2008-12-16 22:57:17 +00:00
|
|
|
*/
|
|
|
|
int ast_destroy_timing(struct ast_timing *i);
|
|
|
|
|
2003-06-11 12:14:38 +00:00
|
|
|
struct ast_pbx {
|
2008-05-01 23:06:23 +00:00
|
|
|
int dtimeoutms; /*!< Timeout between digits (milliseconds) */
|
|
|
|
int rtimeoutms; /*!< Timeout for response (milliseconds) */
|
2003-06-11 12:14:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-04-05 19:32:40 +00:00
|
|
|
* \brief Register an alternative dialplan switch
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param sw switch to register
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This function registers a populated ast_switch structure with the
|
|
|
|
* asterisk switching architecture.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-04-01 20:13:28 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval non-zero failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
int ast_register_switch(struct ast_switch *sw);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Unregister an alternative switch
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param sw switch to unregister
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* Unregisters a switch from asterisk.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return nothing
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
void ast_unregister_switch(struct ast_switch *sw);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Look up an application
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param app name of the app
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This function searches for the ast_app structure within
|
|
|
|
* the apps that are registered for the one with the name
|
|
|
|
* you passed in.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return the ast_app structure that matches on success, or NULL on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
struct ast_app *pbx_findapp(const char *app);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Execute an application
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param c channel to execute on
|
|
|
|
* \param app which app to execute
|
|
|
|
* \param data the data passed into the app
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This application executes an application on a given channel. It
|
2006-12-12 22:32:20 +00:00
|
|
|
* saves the stack and executes the given application passing in
|
2001-11-06 17:34:13 +00:00
|
|
|
* the given data.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-04-01 20:13:28 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval -1 failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-05-21 21:13:09 +00:00
|
|
|
int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2006-11-30 20:34:23 +00:00
|
|
|
/*!
|
|
|
|
* \brief Register a new context or find an existing one
|
|
|
|
*
|
|
|
|
* \param extcontexts pointer to the ast_context structure pointer
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
* \param exttable pointer to the hashtable that contains all the elements in extcontexts
|
2006-11-30 20:34:23 +00:00
|
|
|
* \param name name of the new context
|
|
|
|
* \param registrar registrar of the context
|
|
|
|
*
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
* This function allows you to play in two environments: the global contexts (active dialplan)
|
|
|
|
* or an external context set of your choosing. To act on the external set, make sure extcontexts
|
|
|
|
* and exttable are set; for the globals, make sure both extcontexts and exttable are NULL.
|
|
|
|
*
|
2006-11-30 20:34:23 +00:00
|
|
|
* This will first search for a context with your name. If it exists already, it will not
|
|
|
|
* create a new one. If it does not exist, it will create a new one with the given name
|
|
|
|
* and registrar.
|
|
|
|
*
|
|
|
|
* \return NULL on failure, and an ast_context structure on success
|
|
|
|
*/
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar);
|
2003-07-14 15:33:21 +00:00
|
|
|
|
2016-03-28 13:31:29 -03:00
|
|
|
/*!
|
|
|
|
* \brief Enable or disable autohints support on a context
|
|
|
|
*
|
|
|
|
* \param con pointer to the context
|
|
|
|
* \param enabled whether autohints are enabled
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void ast_context_set_autohints(struct ast_context *con, int enabled);
|
|
|
|
|
2003-07-14 15:33:21 +00:00
|
|
|
/*!
|
2009-10-13 17:11:46 +00:00
|
|
|
* \brief Merge the temporary contexts into a global contexts list and delete from the
|
2006-03-18 17:38:51 +00:00
|
|
|
* global list the ones that are being added
|
|
|
|
*
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
* \param extcontexts pointer to the ast_context structure
|
|
|
|
* \param exttable pointer to the ast_hashtab structure that contains all the elements in extcontexts
|
2009-10-13 17:11:46 +00:00
|
|
|
* \param registrar of the context; if it's set the routine will delete all contexts
|
|
|
|
* that belong to that registrar; if NULL only the contexts that are specified
|
2006-03-18 17:38:51 +00:00
|
|
|
* in extcontexts
|
2003-07-14 15:33:21 +00:00
|
|
|
*/
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2015-06-08 11:09:57 -04:00
|
|
|
* \brief Destroy a context by name
|
|
|
|
*
|
|
|
|
* \param context Name of the context to destroy
|
|
|
|
* \param registrar who registered it
|
|
|
|
*
|
|
|
|
* You can optionally leave out the registrar parameter. It will find it
|
|
|
|
* based on the context name.
|
|
|
|
*
|
|
|
|
* \retval -1 context not found
|
|
|
|
* \retval 0 Success
|
|
|
|
*/
|
|
|
|
int ast_context_destroy_by_name(const char *context, const char *registrar);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroy a context (matches the specified context or ANY context if NULL)
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param con context to destroy
|
|
|
|
* \param registrar who registered it
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* You can optionally leave out either parameter. It will find it
|
|
|
|
* based on either the ast_context or the registrar name.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return nothing
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
void ast_context_destroy(struct ast_context *con, const char *registrar);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Find a context
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param name name of the context to find
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* Will search for the context with the given name.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return the ast_context on success, NULL on failure.
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
struct ast_context *ast_context_find(const char *name);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief The result codes when starting the PBX on a channel with ast_pbx_start.
|
|
|
|
* \note AST_PBX_CALL_LIMIT refers to the maxcalls call limit in asterisk.conf
|
|
|
|
* \see ast_pbx_start
|
2006-11-30 20:34:23 +00:00
|
|
|
*/
|
2005-09-13 21:59:45 +00:00
|
|
|
enum ast_pbx_result {
|
|
|
|
AST_PBX_SUCCESS = 0,
|
|
|
|
AST_PBX_FAILED = -1,
|
|
|
|
AST_PBX_CALL_LIMIT = -2,
|
|
|
|
};
|
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Create a new thread and start the PBX
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param c channel to start the pbx on
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2007-07-16 02:51:56 +00:00
|
|
|
* \see ast_pbx_run for a synchronous function to run the PBX in the
|
2006-03-18 17:38:51 +00:00
|
|
|
* current thread, as opposed to starting a new one.
|
|
|
|
*
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval Zero on success
|
|
|
|
* \retval non-zero on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2005-09-13 21:59:45 +00:00
|
|
|
enum ast_pbx_result ast_pbx_start(struct ast_channel *c);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Execute the PBX in the current thread
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param c channel to run the pbx on
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2005-09-13 21:59:45 +00:00
|
|
|
* This executes the PBX on a given channel. It allocates a new
|
2001-11-06 17:34:13 +00:00
|
|
|
* PBX structure for the channel, and provides all PBX functionality.
|
2006-03-18 17:38:51 +00:00
|
|
|
* See ast_pbx_start for an asynchronous function to run the PBX in a
|
|
|
|
* new thread as opposed to the current one.
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval Zero on success
|
|
|
|
* \retval non-zero on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2005-09-13 21:59:45 +00:00
|
|
|
enum ast_pbx_result ast_pbx_run(struct ast_channel *c);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2008-12-18 19:33:42 +00:00
|
|
|
/*!
|
|
|
|
* \brief Options for ast_pbx_run()
|
|
|
|
*/
|
|
|
|
struct ast_pbx_args {
|
|
|
|
union {
|
|
|
|
/*! Pad this out so that we have plenty of room to add options
|
|
|
|
* but still maintain ABI compatibility over time. */
|
|
|
|
uint64_t __padding;
|
|
|
|
struct {
|
|
|
|
/*! Do not hangup the channel when the PBX is complete. */
|
|
|
|
unsigned int no_hangup_chan:1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Execute the PBX in the current thread
|
|
|
|
*
|
|
|
|
* \param c channel to run the pbx on
|
|
|
|
* \param args options for the pbx
|
|
|
|
*
|
|
|
|
* This executes the PBX on a given channel. It allocates a new
|
|
|
|
* PBX structure for the channel, and provides all PBX functionality.
|
|
|
|
* See ast_pbx_start for an asynchronous function to run the PBX in a
|
|
|
|
* new thread as opposed to the current one.
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2008-12-18 19:33:42 +00:00
|
|
|
* \retval Zero on success
|
|
|
|
* \retval non-zero on failure
|
|
|
|
*/
|
|
|
|
enum ast_pbx_result ast_pbx_run_args(struct ast_channel *c, struct ast_pbx_args *args);
|
|
|
|
|
2012-06-29 17:02:32 +00:00
|
|
|
/*!
|
|
|
|
* \brief Run the h exten from the given context.
|
|
|
|
* \since 11.0
|
|
|
|
*
|
|
|
|
* \param chan Channel to run the h exten on.
|
|
|
|
* \param context Context the h exten is in.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
void ast_pbx_h_exten_run(struct ast_channel *chan, const char *context);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Run all hangup handlers on the channel.
|
|
|
|
* \since 11.0
|
|
|
|
*
|
|
|
|
* \param chan Channel to run the hangup handlers on.
|
|
|
|
*
|
|
|
|
* \note Absolutely _NO_ channel locks should be held before calling this function.
|
|
|
|
*
|
|
|
|
* \retval Zero if no hangup handlers run.
|
|
|
|
* \retval non-zero if hangup handlers were run.
|
|
|
|
*/
|
|
|
|
int ast_pbx_hangup_handler_run(struct ast_channel *chan);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Init the hangup handler container on a channel.
|
|
|
|
* \since 11.0
|
|
|
|
*
|
|
|
|
* \param chan Channel to init the hangup handler container on.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
void ast_pbx_hangup_handler_init(struct ast_channel *chan);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Destroy the hangup handler container on a channel.
|
|
|
|
* \since 11.0
|
|
|
|
*
|
|
|
|
* \param chan Channel to destroy the hangup handler container on.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
void ast_pbx_hangup_handler_destroy(struct ast_channel *chan);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Pop the top of the channel hangup handler stack.
|
|
|
|
* \since 11.0
|
|
|
|
*
|
|
|
|
* \param chan Channel to push the hangup handler onto.
|
|
|
|
*
|
|
|
|
* \retval TRUE if a handler was popped off of the stack.
|
|
|
|
*/
|
|
|
|
int ast_pbx_hangup_handler_pop(struct ast_channel *chan);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Push the given hangup handler onto the channel hangup handler stack.
|
|
|
|
* \since 11.0
|
|
|
|
*
|
|
|
|
* \param chan Channel to push the hangup handler onto.
|
|
|
|
* \param handler Gosub application parameter string.
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
void ast_pbx_hangup_handler_push(struct ast_channel *chan, const char *handler);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Add and extension to an extension context.
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param context context to add the extension to
|
|
|
|
* \param replace
|
|
|
|
* \param extension extension to add
|
|
|
|
* \param priority priority level of extension addition
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param label extension label
|
2006-03-18 17:38:51 +00:00
|
|
|
* \param callerid pattern to match CallerID, or NULL to match any CallerID
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param application application to run on the extension with that priority level
|
|
|
|
* \param data data to pass to the application
|
|
|
|
* \param datad
|
|
|
|
* \param registrar who registered the extension
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_add_extension(const char *context, int replace, const char *extension,
|
2006-03-18 17:38:51 +00:00
|
|
|
int priority, const char *label, const char *callerid,
|
2004-10-03 04:19:59 +00:00
|
|
|
const char *application, void *data, void (*datad)(void *), const char *registrar);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Add an extension to an extension context, this time with an ast_context *.
|
|
|
|
*
|
2016-12-19 15:03:52 -06:00
|
|
|
* \param registrar_file optional configuration file that defines this extension
|
|
|
|
* \param registrar_line optional line number of configuration file that defines extension
|
|
|
|
*
|
|
|
|
* \note For details about the other arguments, check ast_add_extension()
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
int ast_add_extension2(struct ast_context *con, int replace, const char *extension,
|
2009-10-13 17:11:46 +00:00
|
|
|
int priority, const char *label, const char *callerid,
|
2016-12-19 15:03:52 -06:00
|
|
|
const char *application, void *data, void (*datad)(void *), const char *registrar,
|
|
|
|
const char *registrar_file, int registrar_line);
|
2013-06-07 16:07:18 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Same as ast_add_extension2, but assumes you have already locked context
|
|
|
|
* \since 12.0.0
|
|
|
|
*
|
|
|
|
* \note con must be write locked prior to calling. For details about the arguments,
|
|
|
|
* check ast_add_extension2()
|
|
|
|
*/
|
|
|
|
int ast_add_extension2_nolock(struct ast_context *con, int replace, const char *extension,
|
|
|
|
int priority, const char *label, const char *callerid,
|
2016-12-19 15:03:52 -06:00
|
|
|
const char *application, void *data, void (*datad)(void *), const char *registrar,
|
|
|
|
const char *registrar_file, int registrar_line);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2009-07-08 22:15:06 +00:00
|
|
|
/*!
|
|
|
|
* \brief Map devstate to an extension state.
|
|
|
|
*
|
2010-06-08 14:38:18 +00:00
|
|
|
* \param[in] devstate device state
|
2009-07-08 22:15:06 +00:00
|
|
|
*
|
|
|
|
* \return the extension state mapping.
|
|
|
|
*/
|
|
|
|
enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Uses hint and devicestate callback to get the state of an extension
|
|
|
|
*
|
2003-03-30 22:55:42 +00:00
|
|
|
* \param c this is not important
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return extension state as defined in the ast_extension_states enum
|
2003-03-30 22:55:42 +00:00
|
|
|
*/
|
2006-01-04 21:54:09 +00:00
|
|
|
int ast_extension_state(struct ast_channel *c, const char *context, const char *exten);
|
2003-03-30 22:55:42 +00:00
|
|
|
|
2012-08-09 14:52:16 +00:00
|
|
|
/*!
|
|
|
|
* \brief Uses hint and devicestate callback to get the extended state of an extension
|
|
|
|
* \since 11
|
|
|
|
*
|
|
|
|
* \param c this is not important
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
|
|
|
* \param[out] device_state_info ptr to an ao2_container with extended state info, must be unref'd after use.
|
|
|
|
*
|
|
|
|
* \return extension state as defined in the ast_extension_states enum
|
|
|
|
*/
|
|
|
|
int ast_extension_state_extended(struct ast_channel *c, const char *context, const char *exten,
|
|
|
|
struct ao2_container **device_state_info);
|
|
|
|
|
2012-06-04 20:26:12 +00:00
|
|
|
/*!
|
|
|
|
* \brief Uses hint and presence state callback to get the presence state of an extension
|
|
|
|
*
|
|
|
|
* \param c this is not important
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
|
|
|
* \param[out] subtype Further information regarding the presence returned
|
|
|
|
* \param[out] message Custom message further describing current presence
|
|
|
|
*
|
|
|
|
* \note The subtype and message are dynamically allocated and must be freed by
|
|
|
|
* the caller of this function.
|
|
|
|
*
|
|
|
|
* \return returns the presence state value.
|
|
|
|
*/
|
|
|
|
int ast_hint_presence_state(struct ast_channel *c, const char *context, const char *exten, char **subtype, char **message);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Return string representation of the state of an extension
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2005-08-29 23:53:29 +00:00
|
|
|
* \param extension_state is the numerical state delivered by ast_extension_state
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return the state of an extension as string
|
2005-08-29 23:53:29 +00:00
|
|
|
*/
|
|
|
|
const char *ast_extension_state2str(int extension_state);
|
|
|
|
|
2011-12-23 02:35:13 +00:00
|
|
|
/*!
|
2016-04-07 12:26:57 -05:00
|
|
|
* \brief Add watcher for extension states with destructor.
|
2011-12-23 02:35:13 +00:00
|
|
|
* \since 1.8.9
|
|
|
|
* \since 10.1.0
|
|
|
|
*
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
|
|
|
* \param change_cb callback to call if state changed
|
2016-04-07 12:26:57 -05:00
|
|
|
* \param destroy_cb callback to call when the watcher is destroyed.
|
|
|
|
* \param data to pass to callbacks
|
|
|
|
*
|
|
|
|
* \note If context and exten are NULL then the added watcher is global.
|
|
|
|
* The change_cb is called for every extension's state change.
|
2011-12-23 02:35:13 +00:00
|
|
|
*
|
|
|
|
* \note The change_cb is called if the state of an extension is changed.
|
|
|
|
*
|
2016-04-07 12:26:57 -05:00
|
|
|
* \note The destroy_cb is called when the watcher is deleted so the
|
|
|
|
* watcher can release any associated resources.
|
2011-12-23 02:35:13 +00:00
|
|
|
*
|
|
|
|
* \retval -1 on failure
|
2016-04-07 12:26:57 -05:00
|
|
|
* \retval 0 Global watcher added successfully
|
2011-12-23 02:35:13 +00:00
|
|
|
* \retval ID on success
|
|
|
|
*/
|
|
|
|
int ast_extension_state_add_destroy(const char *context, const char *exten,
|
|
|
|
ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data);
|
|
|
|
|
2012-08-09 14:52:16 +00:00
|
|
|
/*!
|
2016-04-07 12:26:57 -05:00
|
|
|
* \brief Add watcher for extended extension states with destructor.
|
2012-08-09 14:52:16 +00:00
|
|
|
* \since 11
|
|
|
|
*
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
|
|
|
* \param change_cb callback to call if state changed
|
2016-04-07 12:26:57 -05:00
|
|
|
* \param destroy_cb callback to call when the watcher is destroyed.
|
|
|
|
* \param data to pass to callbacks
|
|
|
|
*
|
|
|
|
* \note If context and exten are NULL then the added watcher is global.
|
|
|
|
* The change_cb is called for every extension's state change.
|
2012-08-09 14:52:16 +00:00
|
|
|
*
|
|
|
|
* \note The change_cb is called if the state of an extension is changed.
|
|
|
|
* The extended state is passed to the callback in the device_state_info
|
|
|
|
* member of ast_state_cb_info.
|
|
|
|
*
|
2016-04-07 12:26:57 -05:00
|
|
|
* \note The destroy_cb is called when the watcher is deleted so the
|
|
|
|
* watcher can release any associated resources.
|
2012-08-09 14:52:16 +00:00
|
|
|
*
|
|
|
|
* \retval -1 on failure
|
2016-04-07 12:26:57 -05:00
|
|
|
* \retval 0 Global watcher added successfully
|
2012-08-09 14:52:16 +00:00
|
|
|
* \retval ID on success
|
|
|
|
*/
|
|
|
|
int ast_extension_state_add_destroy_extended(const char *context, const char *exten,
|
|
|
|
ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data);
|
|
|
|
|
2003-03-30 22:55:42 +00:00
|
|
|
/*!
|
2016-04-07 12:26:57 -05:00
|
|
|
* \brief Add watcher for extension states.
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2003-03-30 22:55:42 +00:00
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
2011-12-23 02:35:13 +00:00
|
|
|
* \param change_cb callback to call if state changed
|
2003-03-30 22:55:42 +00:00
|
|
|
* \param data to pass to callback
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2016-04-07 12:26:57 -05:00
|
|
|
* \note If context and exten are NULL then the added watcher is global.
|
|
|
|
* The change_cb is called for every extension's state change.
|
|
|
|
*
|
2011-12-23 02:35:13 +00:00
|
|
|
* \note The change_cb is called if the state of an extension is changed.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \retval -1 on failure
|
2016-04-07 12:26:57 -05:00
|
|
|
* \retval 0 Global watcher added successfully
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval ID on success
|
2009-10-13 17:11:46 +00:00
|
|
|
*/
|
|
|
|
int ast_extension_state_add(const char *context, const char *exten,
|
2011-12-23 02:35:13 +00:00
|
|
|
ast_state_cb_type change_cb, void *data);
|
2003-03-30 22:55:42 +00:00
|
|
|
|
2012-08-09 14:52:16 +00:00
|
|
|
/*!
|
2016-04-07 12:26:57 -05:00
|
|
|
* \brief Add watcher for extended extension states.
|
2012-08-09 14:52:16 +00:00
|
|
|
* \since 11
|
|
|
|
*
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to get state
|
|
|
|
* \param change_cb callback to call if state changed
|
|
|
|
* \param data to pass to callback
|
|
|
|
*
|
2016-04-07 12:26:57 -05:00
|
|
|
* \note If context and exten are NULL then the added watcher is global.
|
|
|
|
* The change_cb is called for every extension's state change.
|
|
|
|
*
|
2012-08-09 14:52:16 +00:00
|
|
|
* \note The change_cb is called if the state of an extension is changed.
|
|
|
|
* The extended state is passed to the callback in the device_state_info
|
|
|
|
* member of ast_state_cb_info.
|
|
|
|
*
|
|
|
|
* \retval -1 on failure
|
2016-04-07 12:26:57 -05:00
|
|
|
* \retval 0 Global watcher added successfully
|
2012-08-09 14:52:16 +00:00
|
|
|
* \retval ID on success
|
|
|
|
*/
|
|
|
|
int ast_extension_state_add_extended(const char *context, const char *exten,
|
|
|
|
ast_state_cb_type change_cb, void *data);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2016-04-07 12:26:57 -05:00
|
|
|
* \brief Deletes a state change watcher by ID
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2016-04-07 12:26:57 -05:00
|
|
|
* \param id of the state watcher to delete (0 for global watcher)
|
2011-12-23 02:35:13 +00:00
|
|
|
* \param change_cb callback to call if state changed (Used if id == 0 (global))
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 failure
|
2003-03-30 22:55:42 +00:00
|
|
|
*/
|
2011-12-23 02:35:13 +00:00
|
|
|
int ast_extension_state_del(int id, ast_state_cb_type change_cb);
|
2003-03-30 22:55:42 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-11-30 20:34:23 +00:00
|
|
|
* \brief If an extension hint exists, return non-zero
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2003-03-30 22:55:42 +00:00
|
|
|
* \param hint buffer for hint
|
2009-04-01 20:13:28 +00:00
|
|
|
* \param hintsize size of hint buffer, in bytes
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param name buffer for name portion of hint
|
2009-04-01 20:13:28 +00:00
|
|
|
* \param namesize size of name buffer
|
|
|
|
* \param c Channel from which to return the hint. This is only important when the hint or name contains an expression to be expanded.
|
2003-03-30 22:55:42 +00:00
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to search for
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \return If an extension within the given context with the priority PRIORITY_HINT
|
2009-04-01 20:13:28 +00:00
|
|
|
* is found, a non zero value will be returned.
|
2003-03-30 22:55:42 +00:00
|
|
|
* Otherwise, 0 is returned.
|
|
|
|
*/
|
2009-04-01 20:13:28 +00:00
|
|
|
int ast_get_hint(char *hint, int hintsize, char *name, int namesize,
|
2006-03-18 17:38:51 +00:00
|
|
|
struct ast_channel *c, const char *context, const char *exten);
|
2003-03-30 22:55:42 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2009-04-29 18:53:01 +00:00
|
|
|
* \brief If an extension hint exists, return non-zero
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2009-04-29 18:53:01 +00:00
|
|
|
* \param hint buffer for hint
|
|
|
|
* \param hintsize Maximum size of hint buffer (<0 to prevent growth, >0 to limit growth to that number of bytes, or 0 for unlimited growth)
|
|
|
|
* \param name buffer for name portion of hint
|
|
|
|
* \param namesize Maximum size of name buffer (<0 to prevent growth, >0 to limit growth to that number of bytes, or 0 for unlimited growth)
|
|
|
|
* \param c Channel from which to return the hint. This is only important when the hint or name contains an expression to be expanded.
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to search for
|
|
|
|
*
|
|
|
|
* \return If an extension within the given context with the priority PRIORITY_HINT
|
|
|
|
* is found, a non zero value will be returned.
|
|
|
|
* Otherwise, 0 is returned.
|
|
|
|
*/
|
|
|
|
int ast_str_get_hint(struct ast_str **hint, ssize_t hintsize, struct ast_str **name, ssize_t namesize,
|
|
|
|
struct ast_channel *c, const char *context, const char *exten);
|
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Determine whether an extension exists
|
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param c this is not important
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to search for
|
|
|
|
* \param priority priority of the action within the extension
|
|
|
|
* \param callerid callerid to search for
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2008-12-15 19:51:24 +00:00
|
|
|
* \note It is possible for autoservice to be started and stopped on c during this
|
|
|
|
* function call, it is important that c is not locked prior to calling this. Otherwise
|
|
|
|
* a deadlock may occur
|
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \return If an extension within the given context(or callerid) with the given priority
|
2006-03-18 17:38:51 +00:00
|
|
|
* is found a non zero value will be returned. Otherwise, 0 is returned.
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten,
|
2006-03-18 17:38:51 +00:00
|
|
|
int priority, const char *callerid);
|
2004-10-03 04:19:59 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Find the priority of an extension that has the specified label
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2004-10-03 04:19:59 +00:00
|
|
|
* \param c this is not important
|
|
|
|
* \param context which context to look in
|
|
|
|
* \param exten which extension to search for
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param label label of the action within the extension to match to priority
|
2004-10-03 04:19:59 +00:00
|
|
|
* \param callerid callerid to search for
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2008-12-15 19:51:24 +00:00
|
|
|
* \note It is possible for autoservice to be started and stopped on c during this
|
|
|
|
* function call, it is important that c is not locked prior to calling this. Otherwise
|
|
|
|
* a deadlock may occur
|
|
|
|
*
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval the priority which matches the given label in the extension
|
|
|
|
* \retval -1 if not found.
|
2006-03-18 17:38:51 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_findlabel_extension(struct ast_channel *c, const char *context,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *exten, const char *label, const char *callerid);
|
2004-10-03 16:15:44 +00:00
|
|
|
|
2001-11-06 17:34:13 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Find the priority of an extension that has the specified label
|
|
|
|
*
|
2008-12-15 19:51:24 +00:00
|
|
|
* \note It is possible for autoservice to be started and stopped on c during this
|
|
|
|
* function call, it is important that c is not locked prior to calling this. Otherwise
|
|
|
|
* a deadlock may occur
|
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \note This function is the same as ast_findlabel_extension, except that it accepts
|
|
|
|
* a pointer to an ast_context structure to specify the context instead of the
|
|
|
|
* name of the context. Otherwise, the functions behave the same.
|
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *con,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *exten, const char *label, const char *callerid);
|
1999-12-25 22:31:01 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Looks for a valid matching extension
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \param c not really important
|
|
|
|
* \param context context to serach within
|
|
|
|
* \param exten extension to check
|
|
|
|
* \param priority priority of extension path
|
|
|
|
* \param callerid callerid of extension being searched for
|
|
|
|
*
|
2008-12-15 19:51:24 +00:00
|
|
|
* \note It is possible for autoservice to be started and stopped on c during this
|
|
|
|
* function call, it is important that c is not locked prior to calling this. Otherwise
|
|
|
|
* a deadlock may occur
|
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \return If "exten" *could be* a valid extension in this context with or without
|
|
|
|
* some more digits, return non-zero. Basically, when this returns 0, no matter
|
|
|
|
* what you add to exten, it's not going to be a valid extension anymore
|
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_canmatch_extension(struct ast_channel *c, const char *context,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *exten, int priority, const char *callerid);
|
2002-11-10 03:20:35 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
|
|
|
|
*
|
|
|
|
* \param c not really important XXX
|
|
|
|
* \param context context to serach within
|
|
|
|
* \param exten extension to check
|
|
|
|
* \param priority priority of extension path
|
|
|
|
* \param callerid callerid of extension being searched for
|
|
|
|
*
|
2008-12-15 19:51:24 +00:00
|
|
|
* \note It is possible for autoservice to be started and stopped on c during this
|
|
|
|
* function call, it is important that c is not locked prior to calling this. Otherwise
|
|
|
|
* a deadlock may occur
|
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \return If "exten" *could match* a valid extension in this context with
|
|
|
|
* some more digits, return non-zero. Does NOT return non-zero if this is
|
|
|
|
* an exact-match only. Basically, when this returns 0, no matter
|
|
|
|
* what you add to exten, it's not going to be a valid extension anymore
|
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_matchmore_extension(struct ast_channel *c, const char *context,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *exten, int priority, const char *callerid);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Determine if a given extension matches a given pattern (in NXX format)
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param pattern pattern to match
|
|
|
|
* \param extension extension to check against the pattern.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* Checks whether or not the given extension matches the given pattern.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* \retval 1 on match
|
|
|
|
* \retval 0 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_extension_match(const char *pattern, const char *extension);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2004-11-24 03:07:08 +00:00
|
|
|
int ast_extension_close(const char *pattern, const char *data, int needmore);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2007-11-02 15:36:34 +00:00
|
|
|
* \brief Determine if one extension should match before another
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2007-11-02 15:36:34 +00:00
|
|
|
* \param a extension to compare with b
|
|
|
|
* \param b extension to compare with a
|
|
|
|
*
|
|
|
|
* Checks whether or extension a should match before extension b
|
|
|
|
*
|
|
|
|
* \retval 0 if the two extensions have equal matching priority
|
|
|
|
* \retval 1 on a > b
|
|
|
|
* \retval -1 on a < b
|
|
|
|
*/
|
|
|
|
int ast_extension_cmp(const char *a, const char *b);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Launch a new extension (i.e. new stack)
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param c not important
|
|
|
|
* \param context which context to generate the extension within
|
|
|
|
* \param exten new extension to add
|
|
|
|
* \param priority priority of new extension
|
|
|
|
* \param callerid callerid of extension
|
2007-11-12 23:44:20 +00:00
|
|
|
* \param found
|
2009-10-13 17:11:46 +00:00
|
|
|
* \param combined_find_spawn
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This adds a new extension to the asterisk extension list.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2008-12-15 19:53:29 +00:00
|
|
|
* \note It is possible for autoservice to be started and stopped on c during this
|
|
|
|
* function call, it is important that c is not locked prior to calling this. Otherwise
|
|
|
|
* a deadlock may occur
|
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure.
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_spawn_extension(struct ast_channel *c, const char *context,
|
This commits the performance mods that give the priority processing engine in the pbx, a 25-30% speed boost. The two updates used, are, first, to merge the ast_exists_extension() and the ast_spawn_extension() where they are called sequentially in a loop in the code, into a slightly upgraded version of ast_spawn_extension(), with a few extra args; and, second, I modified the substitute_variables_helper_full, so it zeroes out the byte after the evaluated string instead of demanding you pre-zero the buffer; I also went thru the code and removed the code that zeroed this buffer before every call to the substitute_variables_helper_full. The first fix provides about a 9% speedup, and the second the rest. These figures come from the 'PIPS' benchmark I describe in blogs, conf. reports, etc.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-01 22:26:51 +00:00
|
|
|
const char *exten, int priority, const char *callerid, int *found, int combined_find_spawn);
|
1999-10-27 00:56:38 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Add a context include
|
|
|
|
*
|
|
|
|
* \param context context to add include to
|
|
|
|
* \param include new include to add
|
|
|
|
* \param registrar who's registering it
|
|
|
|
*
|
|
|
|
* Adds an include taking a char * string as the context parameter
|
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on error
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_add_include(const char *context, const char *include,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *registrar);
|
2001-11-06 17:34:13 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Add a context include
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \param con context to add the include to
|
2012-09-22 20:43:30 +00:00
|
|
|
* \param value include value to add
|
2006-03-18 17:38:51 +00:00
|
|
|
* \param registrar who registered the context
|
|
|
|
*
|
|
|
|
* Adds an include taking a struct ast_context as the first parameter
|
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_add_include2(struct ast_context *con, const char *include,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *registrar);
|
2001-03-30 16:31:28 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Remove a context include
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \note See ast_context_add_include for information on arguments
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_remove_include(const char *context, const char *include,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *registrar);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Removes an include by an ast_context structure
|
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \note See ast_context_add_include2 for information on arguments
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on success
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_remove_include2(struct ast_context *con, const char *include,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *registrar);
|
2001-03-30 16:31:28 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Verifies includes in an ast_contect structure
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2003-10-25 17:50:06 +00:00
|
|
|
* \param con context in which to verify the includes
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 if no problems found
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 if there were any missing context
|
2003-10-25 17:50:06 +00:00
|
|
|
*/
|
|
|
|
int ast_context_verify_includes(struct ast_context *con);
|
2009-10-13 17:11:46 +00:00
|
|
|
|
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Add a switch
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param context context to which to add the switch
|
|
|
|
* \param sw switch to add
|
|
|
|
* \param data data to pass to switch
|
2005-01-13 05:14:56 +00:00
|
|
|
* \param eval whether to evaluate variables when running switch
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param registrar whoever registered the switch
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This function registers a switch with the asterisk switch architecture
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_add_switch(const char *context, const char *sw, const char *data,
|
2006-03-18 17:38:51 +00:00
|
|
|
int eval, const char *registrar);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Adds a switch (first param is a ast_context)
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \note See ast_context_add_switch() for argument information, with the exception of
|
|
|
|
* the first argument. In this case, it's a pointer to an ast_context structure
|
|
|
|
* as opposed to the name.
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_add_switch2(struct ast_context *con, const char *sw, const char *data,
|
2006-03-18 17:38:51 +00:00
|
|
|
int eval, const char *registrar);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Remove a switch
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* Removes a switch with the given parameters
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_remove_switch(const char *context, const char *sw,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *data, const char *registrar);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
int ast_context_remove_switch2(struct ast_context *con, const char *sw,
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *data, const char *registrar);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Simply remove extension from context
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param context context to remove extension from
|
|
|
|
* \param extension which extension to remove
|
2008-07-04 16:06:34 +00:00
|
|
|
* \param priority priority of extension to remove (0 to remove all)
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param registrar registrar of the extension
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This function removes an extension from a given context.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2009-04-01 20:13:28 +00:00
|
|
|
*
|
|
|
|
* @{
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_context_remove_extension(const char *context, const char *extension, int priority,
|
|
|
|
const char *registrar);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_context_remove_extension2(struct ast_context *con, const char *extension,
|
2008-06-16 20:43:46 +00:00
|
|
|
int priority, const char *registrar, int already_locked);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2008-07-04 16:06:34 +00:00
|
|
|
int ast_context_remove_extension_callerid(const char *context, const char *extension,
|
|
|
|
int priority, const char *callerid, int matchcid, const char *registrar);
|
|
|
|
|
|
|
|
int ast_context_remove_extension_callerid2(struct ast_context *con, const char *extension,
|
|
|
|
int priority, const char *callerid, int matchcid, const char *registrar,
|
|
|
|
int already_locked);
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @} */
|
2008-07-04 16:06:34 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Add an ignorepat
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param context which context to add the ignorpattern to
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param ignorepat ignorepattern to set up for the extension
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param registrar registrar of the ignore pattern
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* Adds an ignore pattern to a particular context.
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_context_add_ignorepat(const char *context, const char *ignorepat, const char *registrar);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_context_add_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Remove an ignorepat
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param context context from which to remove the pattern
|
|
|
|
* \param ignorepat the pattern to remove
|
|
|
|
* \param registrar the registrar of the ignore pattern
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* This removes the given ignorepattern
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_context_remove_ignorepat(const char *context, const char *ignorepat, const char *registrar);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_context_remove_ignorepat2(struct ast_context *con, const char *ignorepat, const char *registrar);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Checks to see if a number should be ignored
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param context context to search within
|
2005-10-26 23:11:36 +00:00
|
|
|
* \param pattern to check whether it should be ignored or not
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* Check if a number should be ignored with respect to dialtone cancellation.
|
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 if the pattern should not be ignored
|
|
|
|
* \retval non-zero if the pattern should be ignored
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_ignore_pattern(const char *context, const char *pattern);
|
2001-09-19 14:40:16 +00:00
|
|
|
|
|
|
|
/* Locking functions for outer modules, especially for completion functions */
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2007-02-28 20:46:01 +00:00
|
|
|
* \brief Write locks the context list
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on error
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2007-02-28 20:46:01 +00:00
|
|
|
int ast_wrlock_contexts(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Read locks the context list
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on error
|
|
|
|
*/
|
|
|
|
int ast_rdlock_contexts(void);
|
2001-11-06 17:34:13 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Unlocks contexts
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2001-09-19 14:40:16 +00:00
|
|
|
int ast_unlock_contexts(void);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2007-02-28 20:46:01 +00:00
|
|
|
* \brief Write locks a given context
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param con context to lock
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2007-02-28 20:46:01 +00:00
|
|
|
int ast_wrlock_context(struct ast_context *con);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Read locks a given context
|
|
|
|
*
|
|
|
|
* \param con context to lock
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
|
|
|
*/
|
|
|
|
int ast_rdlock_context(struct ast_context *con);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval Unlocks the given context
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
2001-11-06 17:34:13 +00:00
|
|
|
* \param con context to unlock
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2009-10-13 17:11:46 +00:00
|
|
|
* \retval 0 on success
|
2006-03-18 17:38:51 +00:00
|
|
|
* \retval -1 on failure
|
2001-11-06 17:34:13 +00:00
|
|
|
*/
|
2001-09-19 14:40:16 +00:00
|
|
|
int ast_unlock_context(struct ast_context *con);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2017-12-20 12:14:54 -05:00
|
|
|
* \brief locks the macrolock in the given context
|
2006-08-14 03:24:06 +00:00
|
|
|
*
|
|
|
|
* \param macrocontext name of the macro-context to lock
|
|
|
|
*
|
|
|
|
* Locks the given macro-context to ensure only one thread (call) can execute it at a time
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
|
|
|
*/
|
|
|
|
int ast_context_lockmacro(const char *macrocontext);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Unlocks the macrolock in the given context
|
|
|
|
*
|
|
|
|
* \param macrocontext name of the macro-context to unlock
|
|
|
|
*
|
|
|
|
* Unlocks the given macro-context so that another thread (call) can execute it
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
|
|
|
*/
|
|
|
|
int ast_context_unlockmacro(const char *macrocontext);
|
2002-09-09 15:05:28 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set the channel to next execute the specified dialplan location.
|
2009-04-01 20:13:28 +00:00
|
|
|
* \see ast_async_parseable_goto, ast_async_goto_if_exists
|
2011-06-21 20:15:41 +00:00
|
|
|
*
|
|
|
|
* \note Do _NOT_ hold any channel locks when calling this function.
|
2009-04-01 20:13:28 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
2002-09-09 15:05:28 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Set the channel to next execute the specified dialplan location.
|
2009-04-01 20:13:28 +00:00
|
|
|
*/
|
2004-10-03 04:19:59 +00:00
|
|
|
int ast_async_goto_by_name(const char *chan, const char *context, const char *exten, int priority);
|
2002-09-09 15:05:28 +00:00
|
|
|
|
2017-02-09 11:01:22 -05:00
|
|
|
enum ast_pbx_outgoing_sync {
|
|
|
|
AST_OUTGOING_NO_WAIT = 0, /*!< Don't wait for originated call to answer */
|
|
|
|
AST_OUTGOING_WAIT = 1, /*!< Wait for originated call to answer */
|
|
|
|
AST_OUTGOING_WAIT_COMPLETE = 2, /*!< Wait for originated call to answer and hangup */
|
|
|
|
};
|
|
|
|
|
2014-04-18 16:44:48 +00:00
|
|
|
/*!
|
|
|
|
* \brief Synchronously or asynchronously make an outbound call and send it to a
|
2013-07-01 21:24:20 +00:00
|
|
|
* particular extension
|
|
|
|
*
|
|
|
|
* \param type The channel technology to create
|
|
|
|
* \param cap The format capabilities for the channel
|
|
|
|
* \param addr Address data to pass to the channel technology driver
|
|
|
|
* \param timeout How long we should attempt to dial the outbound channel
|
|
|
|
* \param context The destination context for the outbound channel
|
|
|
|
* \param exten The destination extension for the outbound channel
|
|
|
|
* \param priority The destination priority for the outbound channel
|
2014-04-18 16:44:48 +00:00
|
|
|
* \param reason Optional. If provided, the dialed status of the outgoing channel.
|
|
|
|
* Codes are AST_CONTROL_xxx values. Valid only if synchronous is non-zero.
|
2017-02-09 11:01:22 -05:00
|
|
|
* \param synchronous defined by the ast_pbx_outgoing_sync enum.
|
|
|
|
* If \c AST_OUTGOING_NO_WAIT then don't wait for anything.
|
|
|
|
* If \c AST_OUTGOING_WAIT then block until the outbound channel answers or
|
|
|
|
* the call fails.
|
|
|
|
* If \c AST_OUTGOING_WAIT_COMPLETE then wait for the call to complete or
|
|
|
|
* fail.
|
|
|
|
* If \c AST_OUTGOING_WAIT or \c AST_OUTGOING_WAIT_COMPLETE is specified,
|
|
|
|
* the call doesn't answer, and \c failed@context exists then run a channel
|
|
|
|
* named \c OutgoingSpoolFailed at \c failed@context.
|
2013-07-01 21:24:20 +00:00
|
|
|
* \param cid_num The caller ID number to set on the outbound channel
|
|
|
|
* \param cid_name The caller ID name to set on the outbound channel
|
|
|
|
* \param vars Variables to set on the outbound channel
|
|
|
|
* \param account The accountcode for the outbound channel
|
2014-04-18 16:44:48 +00:00
|
|
|
* \param locked_channel Optional. The outbound channel that was created if success
|
|
|
|
* is returned. Otherwise it is set to NULL. This is returned both locked
|
|
|
|
* and reference bumped.
|
|
|
|
* \param early_media If non-zero the channel "answers" when progress is indicated.
|
|
|
|
* \param assignedids Optional. The uniqueid(s) to assign the channel(s) that are created.
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
2013-07-01 21:24:20 +00:00
|
|
|
*/
|
|
|
|
int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr,
|
2014-04-18 16:44:48 +00:00
|
|
|
int timeout, const char *context, const char *exten, int priority, int *reason,
|
|
|
|
int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars,
|
|
|
|
const char *account, struct ast_channel **locked_channel, int early_media,
|
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
|
|
|
const struct ast_assigned_ids *assignedids);
|
2013-07-01 21:24:20 +00:00
|
|
|
|
2016-11-21 16:43:47 -05:00
|
|
|
int ast_pbx_outgoing_exten_predial(const char *type, struct ast_format_cap *cap, const char *addr,
|
|
|
|
int timeout, const char *context, const char *exten, int priority, int *reason,
|
|
|
|
int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars,
|
|
|
|
const char *account, struct ast_channel **locked_channel, int early_media,
|
|
|
|
const struct ast_assigned_ids *assignedids, const char *predial_callee);
|
|
|
|
|
2014-04-18 16:44:48 +00:00
|
|
|
/*!
|
|
|
|
* \brief Synchronously or asynchronously make an outbound call and execute an
|
2013-07-01 21:24:20 +00:00
|
|
|
* application on the channel.
|
|
|
|
*
|
|
|
|
* Note that when the application stops executing, the channel is hungup.
|
|
|
|
*
|
|
|
|
* \param type The channel technology to create
|
|
|
|
* \param cap The format capabilities for the channel
|
|
|
|
* \param addr Address data to pass to the channel technology driver
|
|
|
|
* \param timeout How long we should attempt to dial the outbound channel
|
|
|
|
* \param app The name of the application to execute
|
|
|
|
* \param appdata Data to pass to the application
|
2014-04-18 16:44:48 +00:00
|
|
|
* \param reason Optional. If provided, the dialed status of the outgoing channel.
|
|
|
|
* Codes are AST_CONTROL_xxx values. Valid only if synchronous is non-zero.
|
2017-02-09 11:01:22 -05:00
|
|
|
* \param synchronous defined by the ast_pbx_outgoing_sync enum.
|
|
|
|
* If \c AST_OUTGOING_NO_WAIT then don't wait for anything.
|
|
|
|
* If \c AST_OUTGOING_WAIT then block until the outbound channel answers or
|
|
|
|
* the call fails.
|
|
|
|
* If \c AST_OUTGOING_WAIT_COMPLETE then wait for the call to complete or
|
|
|
|
* fail.
|
2013-07-01 21:24:20 +00:00
|
|
|
* \param cid_num The caller ID number to set on the outbound channel
|
|
|
|
* \param cid_name The caller ID name to set on the outbound channel
|
|
|
|
* \param vars Variables to set on the outbound channel
|
|
|
|
* \param account The accountcode for the outbound channel
|
2014-04-18 16:44:48 +00:00
|
|
|
* \param locked_channel Optional. The outbound channel that was created if success
|
|
|
|
* is returned. Otherwise it is set to NULL. This is returned both locked
|
|
|
|
* and reference bumped.
|
|
|
|
* \param assignedids Optional. The uniqueid(s) to assign the channel(s) that are created.
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
2013-07-01 21:24:20 +00:00
|
|
|
*/
|
|
|
|
int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr,
|
2014-04-18 16:44:48 +00:00
|
|
|
int timeout, const char *app, const char *appdata, int *reason, int synchronous,
|
|
|
|
const char *cid_num, const char *cid_name, struct ast_variable *vars,
|
|
|
|
const char *account, struct ast_channel **locked_channel,
|
uniqueid: channel linkedid, ami, ari object creation with id's
Much needed was a way to assign id to objects on creation, and
much change was necessary to accomplish it. Channel uniqueids
and linkedids are split into separate string and creation time
components without breaking linkedid propgation. This allowed
the uniqueid to be specified by the user interface - and those
values are now carried through to channel creation, adding the
assignedids value to every function in the chain including the
channel drivers. For local channels, the second channel can be
specified or left to default to a ;2 suffix of first. In ARI,
bridge, playback, and snoop objects can also be created with a
specified uniqueid.
Along the way, the args order to allocating channels was fixed
in chan_mgcp and chan_gtalk, and linkedid is no longer lost as
masquerade occurs.
(closes issue ASTERISK-23120)
Review: https://reviewboard.asterisk.org/r/3191/
........
Merged revisions 410157 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-07 15:47:55 +00:00
|
|
|
const struct ast_assigned_ids *assignedids);
|
2002-09-09 15:05:28 +00:00
|
|
|
|
2016-11-21 16:43:47 -05:00
|
|
|
int ast_pbx_outgoing_app_predial(const char *type, struct ast_format_cap *cap, const char *addr,
|
|
|
|
int timeout, const char *app, const char *appdata, int *reason, int synchronous,
|
|
|
|
const char *cid_num, const char *cid_name, struct ast_variable *vars,
|
|
|
|
const char *account, struct ast_channel **locked_channel,
|
|
|
|
const struct ast_assigned_ids *assignedids, const char *predial_callee);
|
|
|
|
|
2006-05-08 10:08:20 +00:00
|
|
|
/*!
|
|
|
|
* \brief Evaluate a condition
|
|
|
|
*
|
|
|
|
* \retval 0 if the condition is NULL or of zero length
|
|
|
|
* \retval int If the string is an integer, the integer representation of
|
|
|
|
* the integer is returned
|
|
|
|
* \retval 1 Any other non-empty string
|
|
|
|
*/
|
2006-05-05 16:36:43 +00:00
|
|
|
int pbx_checkcondition(const char *condition);
|
2006-03-29 19:30:57 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*! @name
|
2006-11-30 20:34:23 +00:00
|
|
|
* Functions for returning values from structures */
|
|
|
|
/*! @{ */
|
2004-10-03 04:19:59 +00:00
|
|
|
const char *ast_get_context_name(struct ast_context *con);
|
|
|
|
const char *ast_get_extension_name(struct ast_exten *exten);
|
2006-03-28 22:09:38 +00:00
|
|
|
struct ast_context *ast_get_extension_context(struct ast_exten *exten);
|
2016-07-14 14:51:42 -04:00
|
|
|
const char *ast_get_include_name(const struct ast_include *include);
|
2016-07-15 03:59:48 -04:00
|
|
|
const char *ast_get_ignorepat_name(const struct ast_ignorepat *ip);
|
2016-07-15 20:28:16 -04:00
|
|
|
const char *ast_get_switch_name(const struct ast_sw *sw);
|
|
|
|
const char *ast_get_switch_data(const struct ast_sw *sw);
|
|
|
|
int ast_get_switch_eval(const struct ast_sw *sw);
|
2009-10-13 17:11:46 +00:00
|
|
|
|
2006-11-30 20:34:23 +00:00
|
|
|
/*! @} */
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2006-11-30 20:34:23 +00:00
|
|
|
/*! @name Other Extension stuff */
|
|
|
|
/*! @{ */
|
2001-09-19 14:40:16 +00:00
|
|
|
int ast_get_extension_priority(struct ast_exten *exten);
|
2004-08-21 18:55:39 +00:00
|
|
|
int ast_get_extension_matchcid(struct ast_exten *e);
|
2004-10-03 04:19:59 +00:00
|
|
|
const char *ast_get_extension_cidmatch(struct ast_exten *e);
|
|
|
|
const char *ast_get_extension_app(struct ast_exten *e);
|
|
|
|
const char *ast_get_extension_label(struct ast_exten *e);
|
2001-09-19 14:40:16 +00:00
|
|
|
void *ast_get_extension_app_data(struct ast_exten *e);
|
2006-11-30 20:34:23 +00:00
|
|
|
/*! @} */
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2006-11-30 20:34:23 +00:00
|
|
|
/*! @name Registrar info functions ... */
|
|
|
|
/*! @{ */
|
2004-10-03 04:19:59 +00:00
|
|
|
const char *ast_get_context_registrar(struct ast_context *c);
|
|
|
|
const char *ast_get_extension_registrar(struct ast_exten *e);
|
2016-07-14 14:51:42 -04:00
|
|
|
const char *ast_get_include_registrar(const struct ast_include *i);
|
2016-07-15 03:59:48 -04:00
|
|
|
const char *ast_get_ignorepat_registrar(const struct ast_ignorepat *ip);
|
2016-07-15 20:28:16 -04:00
|
|
|
const char *ast_get_switch_registrar(const struct ast_sw *sw);
|
2006-11-30 20:34:23 +00:00
|
|
|
/*! @} */
|
2001-09-19 14:40:16 +00:00
|
|
|
|
2016-12-19 15:03:52 -06:00
|
|
|
/*!
|
|
|
|
* \brief Get name of configuration file used by registrar to register this extension
|
|
|
|
*
|
|
|
|
* \retval NULL if registrar did not indicate config file when registering the extension
|
|
|
|
* \retval name of the file used to register the extension
|
|
|
|
*/
|
|
|
|
const char *ast_get_extension_registrar_file(struct ast_exten *e);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get line number of configuration file used by registrar to register this extension
|
|
|
|
*
|
|
|
|
* \retval 0 if the line wasn't indicated when the extension was registered
|
|
|
|
* \retval positive integer indicating what line in the config file was responsible for
|
|
|
|
* registering the extension.
|
|
|
|
*/
|
|
|
|
int ast_get_extension_registrar_line(struct ast_exten *e);
|
|
|
|
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @name Walking functions ... */
|
|
|
|
/*! @{ */
|
2001-09-19 14:40:16 +00:00
|
|
|
struct ast_context *ast_walk_contexts(struct ast_context *con);
|
|
|
|
struct ast_exten *ast_walk_context_extensions(struct ast_context *con,
|
|
|
|
struct ast_exten *priority);
|
|
|
|
struct ast_exten *ast_walk_extension_priorities(struct ast_exten *exten,
|
|
|
|
struct ast_exten *priority);
|
2016-07-14 14:51:42 -04:00
|
|
|
const struct ast_include *ast_walk_context_includes(const struct ast_context *con,
|
|
|
|
const struct ast_include *inc);
|
2016-07-15 03:59:48 -04:00
|
|
|
const struct ast_ignorepat *ast_walk_context_ignorepats(const struct ast_context *con,
|
|
|
|
const struct ast_ignorepat *ip);
|
2016-07-15 20:28:16 -04:00
|
|
|
const struct ast_sw *ast_walk_context_switches(const struct ast_context *con,
|
|
|
|
const struct ast_sw *sw);
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @} */
|
2002-11-10 03:20:35 +00:00
|
|
|
|
2016-07-14 14:51:42 -04:00
|
|
|
/*! @name Iterator functions ... */
|
|
|
|
/*! @{ */
|
|
|
|
int ast_context_includes_count(const struct ast_context *con);
|
|
|
|
const struct ast_include *ast_context_includes_get(const struct ast_context *con, int idx);
|
2016-07-15 03:59:48 -04:00
|
|
|
int ast_context_ignorepats_count(const struct ast_context *con);
|
|
|
|
const struct ast_ignorepat *ast_context_ignorepats_get(const struct ast_context *con, int idx);
|
2016-07-15 20:28:16 -04:00
|
|
|
int ast_context_switches_count(const struct ast_context *con);
|
|
|
|
const struct ast_sw *ast_context_switches_get(const struct ast_context *con, int idx);
|
2016-07-14 14:51:42 -04:00
|
|
|
/*! @} */
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Create a human-readable string, specifying all variables and their corresponding values.
|
2009-04-01 20:13:28 +00:00
|
|
|
* \param chan Channel from which to read variables
|
2009-10-13 17:11:46 +00:00
|
|
|
* \param buf Dynamic string in which to place the result (should be allocated with ast_str_create).
|
|
|
|
* \see ast_str_create
|
2007-11-06 14:08:54 +00:00
|
|
|
* \note Will lock the channel.
|
|
|
|
*/
|
2006-12-18 15:38:50 +00:00
|
|
|
int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **buf);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Return a pointer to the value of the corresponding channel variable.
|
2007-11-06 14:08:54 +00:00
|
|
|
* \note Will lock the channel.
|
2008-03-28 22:50:46 +00:00
|
|
|
*
|
|
|
|
* \note This function will return a pointer to the buffer inside the channel
|
|
|
|
* variable. This value should only be accessed with the channel locked. If
|
|
|
|
* the value needs to be kept around, it should be done by using the following
|
|
|
|
* thread-safe code:
|
|
|
|
* \code
|
|
|
|
* const char *var;
|
|
|
|
*
|
|
|
|
* ast_channel_lock(chan);
|
|
|
|
* if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
|
|
|
|
* var = ast_strdupa(var);
|
|
|
|
* }
|
|
|
|
* ast_channel_unlock(chan);
|
|
|
|
* \endcode
|
2007-11-06 14:08:54 +00:00
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Add a variable to the channel variable stack, without removing any previously set value.
|
2007-11-06 14:08:54 +00:00
|
|
|
* \note Will lock the channel.
|
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, const char *value);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Add a variable to the channel variable stack, removing the most recently set value for the same name.
|
2009-04-01 20:13:28 +00:00
|
|
|
* \note Will lock the channel. May also be used to set a channel dialplan function to a particular value.
|
|
|
|
* \see ast_func_write
|
2010-01-25 21:13:20 +00:00
|
|
|
* \return -1 if the dialplan function fails to be set
|
|
|
|
* \version 1.8 changed the function to return an error code
|
2007-11-06 14:08:54 +00:00
|
|
|
*/
|
2010-01-25 21:13:20 +00:00
|
|
|
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Retrieve the value of a builtin variable or variable from the channel variable stack.
|
2007-11-06 14:08:54 +00:00
|
|
|
* \note Will lock the channel.
|
|
|
|
*/
|
2006-03-18 17:38:51 +00:00
|
|
|
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp);
|
|
|
|
void pbx_builtin_clear_globals(void);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Parse and set a single channel variable, where the name and value are separated with an '=' character.
|
2007-11-06 14:08:54 +00:00
|
|
|
* \note Will lock the channel.
|
|
|
|
*/
|
2009-05-21 21:13:09 +00:00
|
|
|
int pbx_builtin_setvar(struct ast_channel *chan, const char *data);
|
2009-04-01 20:13:28 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
|
|
|
* \brief Parse and set multiple channel variables, where the pairs are separated by the ',' character, and name and value are separated with an '=' character.
|
2009-04-01 20:13:28 +00:00
|
|
|
* \note Will lock the channel.
|
|
|
|
*/
|
2009-05-21 21:13:09 +00:00
|
|
|
int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *data);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-05-21 21:13:09 +00:00
|
|
|
int pbx_builtin_raise_exception(struct ast_channel *chan, const char *data);
|
2007-11-06 14:08:54 +00:00
|
|
|
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @name Substitution routines, using static string buffers
|
|
|
|
* @{ */
|
|
|
|
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count);
|
2006-03-18 17:38:51 +00:00
|
|
|
void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count);
|
2008-12-13 08:36:35 +00:00
|
|
|
void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int cp2_size, size_t *used);
|
2009-04-29 18:53:01 +00:00
|
|
|
/*! @} */
|
|
|
|
/*! @} */
|
|
|
|
|
|
|
|
/*! @name Substitution routines, using dynamic string buffers */
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \param buf Result will be placed in this buffer.
|
|
|
|
* \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
|
|
|
|
* \param chan Channel variables from which to extract values, and channel to pass to any dialplan functions.
|
|
|
|
* \param headp If no channel is specified, a channel list from which to extract variable values
|
|
|
|
* \param var Variable name to retrieve.
|
|
|
|
*/
|
|
|
|
const char *ast_str_retrieve_variable(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, struct varshead *headp, const char *var);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \param buf Result will be placed in this buffer.
|
|
|
|
* \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
|
|
|
|
* \param chan Channel variables from which to extract values, and channel to pass to any dialplan functions.
|
|
|
|
* \param templ Variable template to expand.
|
|
|
|
*/
|
|
|
|
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \param buf Result will be placed in this buffer.
|
|
|
|
* \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
|
|
|
|
* \param headp If no channel is specified, a channel list from which to extract variable values
|
|
|
|
* \param templ Variable template to expand.
|
|
|
|
*/
|
|
|
|
void ast_str_substitute_variables_varshead(struct ast_str **buf, ssize_t maxlen, struct varshead *headp, const char *templ);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \param buf Result will be placed in this buffer.
|
|
|
|
* \param maxlen -1 if the buffer should not grow, 0 if the buffer may grow to any size, and >0 if the buffer should grow only to that number of bytes.
|
|
|
|
* \param c Channel variables from which to extract values, and channel to pass to any dialplan functions.
|
|
|
|
* \param headp If no channel is specified, a channel list from which to extract variable values
|
|
|
|
* \param templ Variable template to expand.
|
2018-01-18 20:19:00 -06:00
|
|
|
* \param used Number of bytes read from the template. (May be NULL)
|
2009-04-29 18:53:01 +00:00
|
|
|
*/
|
|
|
|
void ast_str_substitute_variables_full(struct ast_str **buf, ssize_t maxlen, struct ast_channel *c, struct varshead *headp, const char *templ, size_t *used);
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @} */
|
2003-02-12 13:59:15 +00:00
|
|
|
|
2003-09-13 20:51:48 +00:00
|
|
|
int ast_extension_patmatch(const char *pattern, const char *data);
|
|
|
|
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! Set "autofallthrough" flag, if newval is <0, does not actually set. If
|
2004-10-16 19:46:02 +00:00
|
|
|
set to 1, sets to auto fall through. If newval set to 0, sets to no auto
|
|
|
|
fall through (reads extension instead). Returns previous value. */
|
2006-03-18 17:38:51 +00:00
|
|
|
int pbx_set_autofallthrough(int newval);
|
closes issue #11363; where the pattern _20x. buried in an included context, didn't match 2012; There were a small set of problems to fix: 1. I needed NOT to score patterns unless you are at the end of the data string. 2. Capital N,X,Z and small n,x,z are OK in patterns. I canonicalize the patterns in the trie to caps. 3. When a pattern ends with dot or exclamation, CANMATCH/MATCHMORE should always report this pattern, no matter the length. With this commit, I also supplied the wish of Luigi, where the user can select which pattern matching algorithm to use, the old (legacy) pattern matcher, or the new, trie based matcher. The OLD matcher is the default. A new [general] section variable, extenpatternmatchnew, is added to the extensions.conf, and the example config has it set to false. If true, the new matcher is used. In all other respects, the context/exten structs are the same; the tries and hashtabs are formed, but in the new mode the tries are not used. A new CLI command 'dialplan set extenpatternmatch true/false' is provided to allow switching at run time. I beg users that are forced to return to the old matcher to please report the reason in the bug tracker. Measured the speed benefit of the new matcher against an impossibly large context with 10,000 extensions: the new matcher is 374 times faster.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-24 21:00:26 +00:00
|
|
|
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! Set "extenpatternmatchnew" flag, if newval is <0, does not actually set. If
|
closes issue #11363; where the pattern _20x. buried in an included context, didn't match 2012; There were a small set of problems to fix: 1. I needed NOT to score patterns unless you are at the end of the data string. 2. Capital N,X,Z and small n,x,z are OK in patterns. I canonicalize the patterns in the trie to caps. 3. When a pattern ends with dot or exclamation, CANMATCH/MATCHMORE should always report this pattern, no matter the length. With this commit, I also supplied the wish of Luigi, where the user can select which pattern matching algorithm to use, the old (legacy) pattern matcher, or the new, trie based matcher. The OLD matcher is the default. A new [general] section variable, extenpatternmatchnew, is added to the extensions.conf, and the example config has it set to false. If true, the new matcher is used. In all other respects, the context/exten structs are the same; the tries and hashtabs are formed, but in the new mode the tries are not used. A new CLI command 'dialplan set extenpatternmatch true/false' is provided to allow switching at run time. I beg users that are forced to return to the old matcher to please report the reason in the bug tracker. Measured the speed benefit of the new matcher against an impossibly large context with 10,000 extensions: the new matcher is 374 times faster.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-24 21:00:26 +00:00
|
|
|
set to 1, sets to use the new Trie-based pattern matcher. If newval set to 0, sets to use
|
|
|
|
the old linear-search algorithm. Returns previous value. */
|
|
|
|
int pbx_set_extenpatternmatchnew(int newval);
|
2007-11-28 00:24:19 +00:00
|
|
|
|
2008-03-10 21:48:20 +00:00
|
|
|
/*! Set "overrideswitch" field. If set and of nonzero length, all contexts
|
|
|
|
* will be tried directly through the named switch prior to any other
|
2009-03-09 20:58:17 +00:00
|
|
|
* matching within that context.
|
|
|
|
* \since 1.6.1
|
2009-10-13 17:11:46 +00:00
|
|
|
*/
|
2008-03-10 21:48:20 +00:00
|
|
|
void pbx_set_overrideswitch(const char *newval);
|
|
|
|
|
2007-11-28 00:24:19 +00:00
|
|
|
/*!
|
|
|
|
* \note This function will handle locking the channel as needed.
|
|
|
|
*/
|
2005-12-03 19:25:33 +00:00
|
|
|
int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
2007-11-28 00:24:19 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \note This function will handle locking the channel as needed.
|
|
|
|
*/
|
2004-11-22 22:11:10 +00:00
|
|
|
int ast_parseable_goto(struct ast_channel *chan, const char *goto_string);
|
2007-11-28 00:24:19 +00:00
|
|
|
|
2008-02-18 15:47:00 +00:00
|
|
|
/*!
|
|
|
|
* \note This function will handle locking the channel as needed.
|
|
|
|
*/
|
|
|
|
int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string);
|
|
|
|
|
2007-11-28 00:24:19 +00:00
|
|
|
/*!
|
|
|
|
* \note This function will handle locking the channel as needed.
|
|
|
|
*/
|
2004-11-23 20:25:02 +00:00
|
|
|
int ast_explicit_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
2007-11-28 00:24:19 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \note This function will handle locking the channel as needed.
|
|
|
|
*/
|
2005-12-03 19:25:33 +00:00
|
|
|
int ast_async_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority);
|
2005-05-05 05:39:33 +00:00
|
|
|
|
2005-12-24 06:23:36 +00:00
|
|
|
struct ast_custom_function* ast_custom_function_find(const char *name);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Unregister a custom function
|
|
|
|
*/
|
2005-05-05 05:39:33 +00:00
|
|
|
int ast_custom_function_unregister(struct ast_custom_function *acf);
|
2006-03-18 17:38:51 +00:00
|
|
|
|
2013-12-16 19:11:51 +00:00
|
|
|
/*!
|
|
|
|
* \brief Description of the ways in which a function may escalate privileges.
|
|
|
|
*/
|
|
|
|
enum ast_custom_function_escalation {
|
|
|
|
AST_CFE_NONE,
|
|
|
|
AST_CFE_READ,
|
|
|
|
AST_CFE_WRITE,
|
|
|
|
AST_CFE_BOTH,
|
|
|
|
};
|
|
|
|
|
2006-03-18 17:38:51 +00:00
|
|
|
/*!
|
2007-07-16 18:24:29 +00:00
|
|
|
* \brief Register a custom function
|
2006-03-18 17:38:51 +00:00
|
|
|
*/
|
2015-05-04 15:26:37 -04:00
|
|
|
#define ast_custom_function_register(acf) __ast_custom_function_register(acf, AST_MODULE_SELF)
|
2007-07-16 18:24:29 +00:00
|
|
|
|
2013-12-16 19:11:51 +00:00
|
|
|
/*!
|
|
|
|
* \brief Register a custom function which requires escalated privileges.
|
|
|
|
*
|
|
|
|
* Examples would be SHELL() (for which a read needs permission to execute
|
|
|
|
* arbitrary code) or FILE() (for which write needs permission to change files
|
|
|
|
* on the filesystem).
|
|
|
|
*/
|
2015-05-04 15:26:37 -04:00
|
|
|
#define ast_custom_function_register_escalating(acf, escalation) __ast_custom_function_register_escalating(acf, escalation, AST_MODULE_SELF)
|
2013-12-16 19:11:51 +00:00
|
|
|
|
2007-07-16 18:24:29 +00:00
|
|
|
/*!
|
|
|
|
* \brief Register a custom function
|
|
|
|
*/
|
2007-07-16 18:38:28 +00:00
|
|
|
int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod);
|
2005-05-18 01:49:13 +00:00
|
|
|
|
2013-12-16 19:11:51 +00:00
|
|
|
/*!
|
|
|
|
* \brief Register a custom function which requires escalated privileges.
|
|
|
|
*
|
|
|
|
* Examples would be SHELL() (for which a read needs permission to execute
|
|
|
|
* arbitrary code) or FILE() (for which write needs permission to change files
|
|
|
|
* on the filesystem).
|
|
|
|
*/
|
|
|
|
int __ast_custom_function_register_escalating(struct ast_custom_function *acf, enum ast_custom_function_escalation escalation, struct ast_module *mod);
|
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief Retrieve the number of active calls
|
|
|
|
*/
|
2005-05-18 01:49:13 +00:00
|
|
|
int ast_active_calls(void);
|
2007-12-07 16:11:05 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*!
|
2007-12-07 16:11:05 +00:00
|
|
|
* \brief Retrieve the total number of calls processed through the PBX since last restart
|
|
|
|
*/
|
|
|
|
int ast_processed_calls(void);
|
2009-10-13 17:11:46 +00:00
|
|
|
|
2005-05-05 15:07:49 +00:00
|
|
|
/*!
|
2009-10-13 17:11:46 +00:00
|
|
|
* \brief executes a read operation on a function
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
2005-05-05 15:07:49 +00:00
|
|
|
* \param chan Channel to execute on
|
2006-02-12 04:28:58 +00:00
|
|
|
* \param function Data containing the function call string (will be modified)
|
2009-10-13 17:11:46 +00:00
|
|
|
* \param workspace A pointer to safe memory to use for a return value
|
2005-05-05 15:07:49 +00:00
|
|
|
* \param len the number of bytes in workspace
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* This application executes a function in read mode on a given channel.
|
|
|
|
*
|
2009-04-01 20:13:28 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval non-zero failure
|
2006-03-18 17:38:51 +00:00
|
|
|
*/
|
2007-01-05 23:32:42 +00:00
|
|
|
int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len);
|
2005-05-05 15:07:49 +00:00
|
|
|
|
2009-04-29 18:53:01 +00:00
|
|
|
/*!
|
2009-10-13 17:11:46 +00:00
|
|
|
* \brief executes a read operation on a function
|
2009-04-29 18:53:01 +00:00
|
|
|
*
|
|
|
|
* \param chan Channel to execute on
|
|
|
|
* \param function Data containing the function call string (will be modified)
|
|
|
|
* \param str A dynamic string buffer into which to place the result.
|
|
|
|
* \param maxlen <0 if the dynamic buffer should not grow; >0 if the dynamic buffer should be limited to that number of bytes; 0 if the dynamic buffer has no upper limit
|
|
|
|
*
|
|
|
|
* This application executes a function in read mode on a given channel.
|
|
|
|
*
|
|
|
|
* \retval 0 success
|
|
|
|
* \retval non-zero failure
|
|
|
|
*/
|
|
|
|
int ast_func_read2(struct ast_channel *chan, const char *function, struct ast_str **str, ssize_t maxlen);
|
|
|
|
|
2005-05-05 15:07:49 +00:00
|
|
|
/*!
|
2006-03-18 17:38:51 +00:00
|
|
|
* \brief executes a write operation on a function
|
|
|
|
*
|
2005-05-05 15:07:49 +00:00
|
|
|
* \param chan Channel to execute on
|
2006-02-12 04:28:58 +00:00
|
|
|
* \param function Data containing the function call string (will be modified)
|
2005-05-05 15:07:49 +00:00
|
|
|
* \param value A value parameter to pass for writing
|
2006-03-18 17:38:51 +00:00
|
|
|
*
|
|
|
|
* This application executes a function in write mode on a given channel.
|
|
|
|
*
|
2009-04-01 20:13:28 +00:00
|
|
|
* \retval 0 success
|
|
|
|
* \retval non-zero failure
|
2005-05-05 15:07:49 +00:00
|
|
|
*/
|
2007-01-05 23:32:42 +00:00
|
|
|
int ast_func_write(struct ast_channel *chan, const char *function, const char *value);
|
2005-03-04 06:36:18 +00:00
|
|
|
|
2007-08-15 19:21:27 +00:00
|
|
|
/*!
|
2009-10-13 17:11:46 +00:00
|
|
|
* \details
|
2007-08-15 19:21:27 +00:00
|
|
|
* When looking up extensions, we can have different requests
|
|
|
|
* identified by the 'action' argument, as follows.
|
2009-10-13 17:11:46 +00:00
|
|
|
*
|
|
|
|
* \note that the coding is such that the low 4 bits are the
|
2007-08-15 19:21:27 +00:00
|
|
|
* third argument to extension_match_core.
|
|
|
|
*/
|
|
|
|
enum ext_match_t {
|
|
|
|
E_MATCHMORE = 0x00, /* extension can match but only with more 'digits' */
|
|
|
|
E_CANMATCH = 0x01, /* extension can match with or without more 'digits' */
|
|
|
|
E_MATCH = 0x02, /* extension is an exact match */
|
|
|
|
E_MATCH_MASK = 0x03, /* mask for the argument to extension_match_core() */
|
|
|
|
E_SPAWN = 0x12, /* want to spawn an extension. Requires exact match */
|
|
|
|
E_FINDLABEL = 0x22 /* returns the priority for a given label. Requires exact match */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define STATUS_NO_CONTEXT 1
|
|
|
|
#define STATUS_NO_EXTENSION 2
|
|
|
|
#define STATUS_NO_PRIORITY 3
|
|
|
|
#define STATUS_NO_LABEL 4
|
2009-10-13 17:11:46 +00:00
|
|
|
#define STATUS_SUCCESS 5
|
2019-02-20 11:48:25 -07:00
|
|
|
|
|
|
|
#ifdef LOW_MEMORY
|
2007-08-15 19:21:27 +00:00
|
|
|
#define AST_PBX_MAX_STACK 128
|
2019-02-20 11:48:25 -07:00
|
|
|
#else
|
|
|
|
#define AST_PBX_MAX_STACK 512
|
|
|
|
#endif
|
2007-08-15 19:21:27 +00:00
|
|
|
|
|
|
|
/* request and result for pbx_find_extension */
|
|
|
|
struct pbx_find_info {
|
|
|
|
#if 0
|
|
|
|
const char *context;
|
|
|
|
const char *exten;
|
|
|
|
int priority;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
char *incstack[AST_PBX_MAX_STACK]; /* filled during the search */
|
|
|
|
int stacklen; /* modified during the search */
|
|
|
|
int status; /* set on return */
|
|
|
|
struct ast_switch *swo; /* set on return */
|
|
|
|
const char *data; /* set on return */
|
|
|
|
const char *foundcontext; /* set on return */
|
|
|
|
};
|
2009-10-13 17:11:46 +00:00
|
|
|
|
2007-08-15 19:21:27 +00:00
|
|
|
struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
|
|
|
struct ast_context *bypass, struct pbx_find_info *q,
|
|
|
|
const char *context, const char *exten, int priority,
|
|
|
|
const char *label, const char *callerid, enum ext_match_t action);
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
|
2009-10-13 17:11:46 +00:00
|
|
|
/*! \brief hashtable functions for contexts */
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @{ */
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
|
|
|
|
unsigned int ast_hashtab_hash_contexts(const void *obj);
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! @} */
|
2007-08-15 19:21:27 +00:00
|
|
|
|
2009-05-26 14:36:11 +00:00
|
|
|
/*!
|
|
|
|
* \brief Command completion for the list of installed applications.
|
|
|
|
*
|
|
|
|
* This can be called from a CLI command completion function that wants to
|
|
|
|
* complete from the list of available applications.
|
|
|
|
*/
|
|
|
|
char *ast_complete_applications(const char *line, const char *word, int state);
|
|
|
|
|
2013-12-16 19:11:51 +00:00
|
|
|
/*!
|
|
|
|
* \brief Enable/disable the execution of 'dangerous' functions from external
|
|
|
|
* protocols (AMI, etc.).
|
|
|
|
*
|
|
|
|
* These dialplan functions (such as \c SHELL) provide an opportunity for
|
|
|
|
* privilege escalation. They are okay to invoke from the dialplan, but external
|
|
|
|
* protocols with permission controls should not normally invoke them.
|
|
|
|
*
|
|
|
|
* This function can globally enable/disable the execution of dangerous
|
|
|
|
* functions from external protocols.
|
|
|
|
*
|
|
|
|
* \param new_live_dangerously If true, enable the execution of escalating
|
|
|
|
* functions from external protocols.
|
|
|
|
*/
|
|
|
|
void pbx_live_dangerously(int new_live_dangerously);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Inhibit (in the current thread) the execution of dialplan functions
|
|
|
|
* which cause privilege escalations. If pbx_live_dangerously() has been
|
|
|
|
* called, this function has no effect.
|
|
|
|
*
|
|
|
|
* \return 0 if successfuly marked current thread.
|
|
|
|
* \return Non-zero if marking current thread failed.
|
|
|
|
*/
|
|
|
|
int ast_thread_inhibit_escalations(void);
|
|
|
|
|
2016-07-27 17:17:53 -05:00
|
|
|
/*!
|
|
|
|
* \brief Swap the current thread escalation inhibit setting.
|
|
|
|
* \since 11.24.0
|
|
|
|
*
|
|
|
|
* \param inhibit New setting. Non-zero to inhibit.
|
|
|
|
*
|
|
|
|
* \retval 1 if dangerous function execution was inhibited.
|
|
|
|
* \retval 0 if dangerous function execution was allowed.
|
|
|
|
* \retval -1 on error.
|
|
|
|
*/
|
|
|
|
int ast_thread_inhibit_escalations_swap(int inhibit);
|
|
|
|
|
1999-10-27 00:56:38 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-08-30 18:32:10 +00:00
|
|
|
#endif /* _ASTERISK_PBX_H */
|