Asterisk dialplan functions: Difference between revisions
(→IMPORT) |
No edit summary |
||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
Asterisk dialplan function 내용 정리 | Asterisk dialplan function 내용 정리 | ||
== IMPORT == | |||
Retrieve the value of a variable from another channel. | |||
<pre> | |||
IMPORT(channel,variable) | |||
</pre> | |||
* channel | |||
* variable | |||
=== Example === | |||
<pre> | |||
[TransferFromMVNO] | |||
exten => _[+*0-9a-zA-Z]!,2,NoOp(Transfer from MVNO) | |||
same => n,Set(__InternalNumber=${IMPORT(${SHARED(TransferChennel)},InternalNumber)}) | |||
... | |||
</pre> | |||
=== See also === | |||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_IMPORT | |||
== SHARED == | |||
Gets or sets the shared variable specified. | |||
Implements a shared variable area, in which you may share variables between channels. | |||
The variables used in this space are separate from the general namespace of the channel and thus SHARED(foo) and foo represent two completely different variables, despite sharing the same name. | |||
Finally, realize that there is an inherent race between channels operating at the same time, fiding with each others internal variables, which is why this special variable namespace exists; it is to remind you that variables in the SHARED namespace may change at any time, without warning. You should therefore take special care to ensure that when using the SHARED namespace, you retrieve the variable and store it in a regular channel variable before using it in a set of calculations(or you might be surprised by the result). | |||
<pre> | |||
SHARED(varname,channel) | |||
</pre> | |||
* varname : Variable name | |||
* channel : If not specified will default to current channel. It is the complete channel name: SIP/12-abcd1234 or the prefix only SIP/12. | |||
=== Example === | |||
<pre> | |||
[SetSharedVariables] | |||
exten => s,1,NoOp(Set shared variables) | |||
same => n,Set(SHARED(DirectNumber)=${DirectNumber}) | |||
same => n,Set(SHARED(InternalNumber)=${DirectNumber}) | |||
... | |||
</pre> | |||
=== See also === | |||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_SHARED | |||
== VALID_EXTEN == | == VALID_EXTEN == | ||
Line 29: | Line 75: | ||
=== See also === | === See also === | ||
* https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_VALID_EXTEN | * https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_VALID_EXTEN | ||
== See also == | == See also == |
Revision as of 09:29, 27 January 2017
Overview
Asterisk dialplan function 내용 정리
IMPORT
Retrieve the value of a variable from another channel.
IMPORT(channel,variable)
- channel
- variable
Example
[TransferFromMVNO] exten => _[+*0-9a-zA-Z]!,2,NoOp(Transfer from MVNO) same => n,Set(__InternalNumber=${IMPORT(${SHARED(TransferChennel)},InternalNumber)}) ...
See also
SHARED
Gets or sets the shared variable specified.
Implements a shared variable area, in which you may share variables between channels.
The variables used in this space are separate from the general namespace of the channel and thus SHARED(foo) and foo represent two completely different variables, despite sharing the same name.
Finally, realize that there is an inherent race between channels operating at the same time, fiding with each others internal variables, which is why this special variable namespace exists; it is to remind you that variables in the SHARED namespace may change at any time, without warning. You should therefore take special care to ensure that when using the SHARED namespace, you retrieve the variable and store it in a regular channel variable before using it in a set of calculations(or you might be surprised by the result).
SHARED(varname,channel)
- varname : Variable name
- channel : If not specified will default to current channel. It is the complete channel name: SIP/12-abcd1234 or the prefix only SIP/12.
Example
[SetSharedVariables] exten => s,1,NoOp(Set shared variables) same => n,Set(SHARED(DirectNumber)=${DirectNumber}) same => n,Set(SHARED(InternalNumber)=${DirectNumber}) ...
See also
VALID_EXTEN
입력된 Extension 이 지정된 Context 에 존재하는지 여부를 확인한다.
Determine whether an extension exists or not.
Returns a true value if the indicated context, extension, and priority exist.
- This function has been deprecated in favor of the DIALPLAN_EXISTS() function.
VALID_EXTEN(context,extension,priority)
- context : Defaults to the current context.
- extension
- priority : Priority defaults to 1
Example
[DialToInternal] include => Internal exten => s,1,Goto(${CallFlowID},1) exten => _[+0-9]!,1,GoSub(LoopDetection,s,1) same => n,ExecIf(${ISNULL(${UniqueID})}?Set(__UniqueID=${UNIQUEID})) same => n,Log(NOTICE,${UniqueID}-${CONTEXT}(${UNIQUEID}@${CHANNEL})) same => n,GotoIf(${VALID_EXTEN(Internal,${EXTEN},1)}?Internal,${EXTEN},1)
See also
See also
- https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Dialplan+Functions - Asterisk 14 Dialplan Functions