2

我搜索了谷歌,尝试阅读 adhearsion 文档并理解示例。我了解其中的一部分,但无法将其组合在一起。我可以编辑 extensions.conf 并执行 agi(agi://localhost) 并处理 dialplan.rb 中的来电。我用这种方式编写了一个 ivr,它在现实世界中使用。

我已经编辑了 manager.conf 和 config/setup.rb 当我做 ahn - 我明白了

 INFO ami: Successful AMI actions-only connection into ...@127.0.0.1
 INFO ami: Successful AMI events-only connection into ...@127.0.0.1

现在我想知道的非常具体如下:

  1. 我在哪里以及如何编写在 adhearsion 应用程序启动时执行的代码。即没有任何事件或 agi 呼叫。
  2. 我到底要写什么来拨出。

请不要给我部分答复,例如

methods_for :dialplan
  sub foo
    # stuff here
  end

请不要给我模糊的回答,例如“创建组件并将其分叉到左侧”,或者其他什么......我一直在阅读类似的东西,但我无法得到它。请告诉我具体步骤。

4

2 回答 2

3

你的 google foo 显然低于标准杆

使用 'after_initialized' 事件命名空间 1

您想什么时候拨出?您需要查看拨号方案中的“拨号”,或其他地方的“起源”。

于 2010-09-22T08:13:19.063 回答
1

extensions.conf

[context]

exten => extension_number,1,Noop()

exten => extension_number,n,AGI(agi://localhost)


in adhearsion project directory.

dialplan.rb 

context {
#your code goes here.
dial "SIP/xxxxx"
dial "SIP/xxxxx"
}


for methods:

 your_ahn_directory/components/component_name/lib/component_name.rb


  methods_for :dialplan do

    def sum(n1,n2)

    n1+n2

   end

end
于 2011-05-20T08:46:08.457 回答