代码之家  ›  专栏  ›  技术社区  ›  Kinjal Dixit

使用Adhearsion发起呼叫

  •  2
  • Kinjal Dixit  · 技术社区  · 14 年前

    我搜索过Google,尝试过阅读Adhearsion文档并理解这些示例。我理解其中的某些部分,但无法将其组合起来。我可以编辑extensions.conf并执行agi(agi://localhost)并处理dialplan.rb中的传入呼叫。我已经用这种方式写了一个在现实世界中使用的IVR。

    我已经编辑了manager.conf和config/setup.rb,当我编辑时-我看到

     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. 在何处以及如何编写在应用程序启动时执行的代码。即没有任何事件或AGI呼叫。
    2. 我到底要写什么来拨出。

    请不要给我这样的部分答复

    methods_for :dialplan
      sub foo
        # stuff here
      end
    

    请不要给我一些含糊不清的回答,比如“创建组件并将其分叉到左边”,或者其他什么…我一直在读这样的东西,但我无法理解。请告诉我具体步骤。

    2 回复  |  直到 13 年前
        1
  •  3
  •   Ben Langfeld    14 年前

    你的google foo很明显 sub par

    为1使用“after\u initialized”事件命名空间

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

        2
  •  1
  •   Ortiga    13 年前

    扩展函数

    [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