简体   繁体   English

获取功能内接听电话的分机号-星号

[英]Getting the extension number on which a call was received within a function - asterisk

I have an asterisk server set up as a telephone exchange. 我有一个星号服务器设置为电话交换机。 I have, on it, a 100 extensions, from 00 - 99. I am running specific functions on each of those extensions. 我有一个100的扩展名,从00-99。我在每个扩展名上都运行特定的功能。 Some of these functions may need the extension on which the call was received to be available. 其中某些功能可能需要接听电话的分机才可用。 How can I access the same? 我该如何访问? For example, 例如,

Say a call comes in on extension 55. 假设有电话打到分机55。
55 has a function associated with it. 55具有与其相关的功能。 That function must take in 55 as an input parameter. 该函数必须接受55作为输入参数。 How do I do this? 我该怎么做呢?

I have tried the following: 我尝试了以下方法:

exten => 0,n,Verbose(1, "Call on ${EXTEN}-${CHANNEL}")  

Output is : Call on 0-DAHDI/20-1 输出为: Call on 0-DAHDI/20-1

Thanks, 谢谢,
Sriram Shankar. Sriram Shankar。

The answer you are looking for is dependent upon the path that the call is taking through your system. 您要寻找的答案取决于呼叫通过系统所经过的路径。 The easiest way to determine the answer to your question is to place the call and then run the following commands from within the Asterisk CLI: 确定问题答案的最简单方法是发出呼叫,然后在Asterisk CLI中运行以下命令:

> core show channels

This will show you what channels are active. 这将向您显示哪些频道处于活动状态。 Find the channel name of your call. 查找您的呼叫的频道名称。

core show channel [channel-name]

This will output an array of channel details, including different variables that are set and their corresponding values. 这将输出一组通道详细信息,包括设置的不同变量及其对应的值。 Look for the extension number you are trying to grab in the value fields and then look to see what the corresponding variable name is. 在值字段中查找要尝试获取的扩展名,然后查看相应的变量名称是什么。 It could be ${CALLERID(num)}, ${CALLERID(dnid)}, something under the ${CDR} variable, or even elsewhere. 可能是$ {CALLERID(num)},$ {CALLERID(dnid)},$ {CDR}变量下的内容,甚至其他地方。

If you don't find it in the output produced by "core show channel [channel-name]", you may have to trace the dialplan path that the call is taking and try setting the variable early on when the DID information is still available. 如果在“ core show channel [channel-name]”产生的输出中找不到它,则可能必须跟踪该呼叫正在使用的拨号计划路径,并在DID信息仍然可用时尽早尝试设置该变量。 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM