获取其他频道的状态

时间:2014-05-31 09:07:52

标签: asterisk

是否有可能获得另一个频道的状态。例如:在我的拨号方案中,我想知道频道的状态:SIP / provider / 0612345678,它应该返回,邀请或回答等等

这可能吗?

1 个答案:

答案 0 :(得分:0)

是的,您可以使用SHARED功能。

core show function SHARED 

  -= Info about function 'SHARED' =- 

[Synopsis]
Gets or sets the shared variable specified. 

[Description]
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, fiddling 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).

[Syntax]
SHARED(varname[,channel])

[Arguments]
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'.

如果您已接听,则检查变量DIALSTATUS