使用adhearsion发起呼叫

时间:2010-06-09 09:38:03

标签: asterisk asteriskami

我搜索了谷歌,试图阅读adhearsion文档并理解这些示例。我理解它的一部分,但我不能把它放在一起。我可以编辑extensions.conf并执行agi(agi:// localhost)并处理dialplan.rb中的传入呼叫。我写了一个在现实世界中使用的方法。

我编辑了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. 我究竟写了什么来拨出。
  3. 请不要给我部分回复,如

    methods_for :dialplan
      sub foo
        # stuff here
      end
    

    请不要给我模糊的回答,比如“创建组件并将其分叉到左侧”,或者某些东西......我一直在阅读这样的东西,而我却无法得到它。请告诉我具体的步骤。

2 个答案:

答案 0 :(得分:3)

你的google foo显然是sub par

对1

使用'after_initialized'事件名称空间

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

答案 1 :(得分: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