Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
The Extensions class is not included by any module. It is passed during Apply Config changes to the BMO function BMO Hooks#DialplanHooks or <moduleraw>_get_config if using functions.inc.php
Core Methods
add
Add a new entry to the extensions_additional file
/** Add an entry to the extensions file
* @param $section The section to be added to
* @param $extension The extension used
* @param $tag A tag to use (to reference with basetag), use false or '' if none
* @param $command The command to execute
* @param $basetag The tag to base this on. Only used in conjunction with $addpriority
* priority. Defaults to false.
* @param $addpriority Finds the priority of the tag called $basetag, and adds this
* value to it to use as the priority for this command.
* @return
*/
function add($section, $extension, $tag, $command, $basetag = false, $addpriority = false)
Example
PHP
$ext->add('vmx, '555', '', new ext_noop('Timeout: going to timeout dest'));
$ext->add('vmx, '555', '', new ext_noop('Foo: Bar'));
/**
* This function allows new priorities to be injected into already generated dialplan
* usage: $ext->splice($context, $exten, $priority_number, new ext_goto('1','s','ext-did'));
* if $priority is not numeric, it will interpret it as a tag and try to inject
* the command just prior to the first instruction it finds with the specified tag
* if it can't find the tag, it will inject it after the last instruction
* @method splice
* @param string $section The context to splice
* @param string $extension The extension to splice
* @param string $priority if $priority is not numeric, it will
* interpret it as a tag and try to inject
* the command just prior to the first instruction
* it finds with the specified tag if it
* can't find the tag, it will inject it after the last instruction
* @param object $command Object of Extension
* @param string $new_tag New Priority tag to insert
* @param integer $offset Offset of label
* @param boolean $fixmultiplelabels [description]
*/
function splice($section, $extension, $priority, $command, $new_tag="", $offset=0, $fixmultiplelabels=false) {
Example
PHP
$ext->splice('my-context', 's', "dialapp", new \ext_noop('This is inserted before priority dialapp'),'mypri');
extensions_additional
[my-context]
exten => s,n(mypri),Noop(This is inserted before priority dialapp)
exten => s,n(dialapp),Noop()
PHP
$ext->splice($context, 's', "nodial", new \ext_noop('This is inserted after priority nodial'),"mypri",1);
extensions_additional
[my-context]
exten => s,n(nodial),Noop()
exten => s,n(mypri),Noop(This is inserted after priority nodial)
replace
function replace($section, $extension, $priority, $command) {
remove
function remove($section, $extension, $priority) {
addSectionComment
function addSectionComment($section, $comment) {
addSectionNoCustom
function addSectionNoCustom($section, $setting) {
disableCustomContexts
function disableCustomContexts($setting) {
addHint
function addHint($section, $extension, $hintvalue) {
addGlobal
function addGlobal($globvar, $globval) {
addInclude
function addInclude($section, $incsection, $comment='') {
spliceInclude
function spliceInclude($section, $splicesection, $splicecomment, $incsection, $comment='') {
addSwitch
function addSwitch($section, $incsection) {
addExec
function addExec($section, $incsection) {
Dialplan Commands
gosub
Jump to label, saving return address.
Jumps to the label specified, saving the return address.
Send a text message. The body of the message that will be sent is what is currently set to MESSAGE(body). The technology chosen for sending the message is determined based on a prefix to the to parameter.
Conditionally jump to label, saving return address.
If the condition is true, then jump to labeliftrue. If false, jumps to labeliffalse, if specified. In either case, a jump saves the return point in the dialplan, to be returned to with a Return.
Jump to a particular priority, extension, or context.
This application will set the current context, extension, and priority in the channel structure. After it completes, the pbx engine will continue dialplan execution at the specified location. If no specific extension, or extension and context, are specified, then this application will just set the specified priority of the current extension.
At least a priority is required as an argument, or the goto will return a -1,and the channel and call will be terminated.
If the location that is put into the channel information is bogus, and asterisk cannot find that location in the dialplan, then the execution engine will try to find and execute the code in the i (invalid) extension in the current context. If that does not exist, it will try to execute the h extension. If neither the hnor i extensions have been defined, the channel is hung up, and the execution of instructions on the channel is terminated. What this means is that, for example, you specify a context that does not exist, then it will not be possible to find the h or i extensions, and the call will terminate!
This application will set the current context, extension, and priority in the channel structure based on the evaluation of the given condition. After this application completes, the pbx engine will continue dialplan execution at the specified location in the dialplan. The labels are specified with the same syntax as used within the Goto application. If the label chosen by the condition is omitted, no jump is performed, and the execution passes to the next instruction. If the target location is bogus, and does not exist, the execution engine will try to find and execute the code in the i (invalid) extension in the current context. If that does not exist, it will try to execute the h extension. If neither the h nor i extensions have been defined, the channel is hung up, and the execution of instructions on the channel is terminated. Remember that this command can set the current context, and if the context specified does not exist, then it will not be able to find any 'h' or 'i' extensions there, and the channel and call will both be terminated!.
This application will set the context, extension, and priority in the channel structure based on the evaluation of the given time specification. After this application completes, the pbx engine will continue dialplan execution at the specified location in the dialplan. If the current time is within the given time specification, the channel will continue at labeliftrue. Otherwise the channel will continue at labeliffalse. If the label chosen by the condition is omitted, no jump is performed, and execution passes to the next instruction. If the target jump location is bogus, the same actions would be taken as for Goto. Further information on the time specification can be found in examples illustrating how to do time-based context includes in the dialplan.