Asterisk AMI发起呼叫

时间:2015-01-26 11:26:25

标签: java asterisk cisco asteriskami

我已经使用cisco适配器配置了模拟本地电话,因此我可以通过SIP电话拨打任何外拨电话。但我无法通过AMI实现此目的,通过中继呼叫出站通道然后播放提示 manager.conf

[asteriskjava]
secret = asteriskjava  
deny = 0.0.0.0/0.0.0.0  
permit = 127.0.0.1/255.255.255.0  
read = all  
write = all  

extensions.conf

[bulk]
exten => 8,1,Playback(thank-you-cooperation)
exten => h,1,Hangup  

source code

public class HelloManager
 {
    private ManagerConnection managerConnection;

    public HelloManager() throws IOException
    {
      ManagerConnectionFactory factory = new ManagerConnectionFactory(
            "localhost", "asteriskjava", "asteriskjava");

      this.managerConnection = factory.createManagerConnection();
    }

    public void run() throws IOException, AuthenticationFailedException,
        TimeoutException
    {
      OriginateAction originateAction;
      ManagerResponse originateResponse;

      originateAction = new OriginateAction();
      originateAction.setChannel("SIP/405/7000000");
      originateAction.setContext("bulk");
      originateAction.setExten("8");
      originateAction.setPriority(new Integer(1));
      originateAction.setAsync(true);

      // connect to Asterisk and log in
      managerConnection.login();

      // send the originate action and wait for a maximum of 30 seconds for Asterisk
      // to send a reply
      originateResponse = managerConnection.sendAction(originateAction, 30000);

      // print out whether the originate succeeded or not
      System.out.println("---" + originateResponse.getResponse());

      // and finally log off and disconnect
      managerConnection.logoff();
    }
}  

405是拨打电话的CISCO适配器的用户ID,7000000是一个示例手机号码。

这是日志:

== Manager 'asteriskjava' logged on from 127.0.0.1
    == Manager 'asteriskjava' logged off from 127.0.0.1
    == Using SIP RTP CoS mark 5
         > Channel SIP/405-0000000c was answered.
      -- Executing [8@bulk:1] Playback("SIP/405-0000000c", "thank-you-cooperation") in new stack
      -- <SIP/405-0000000c> Playing 'thank-you-cooperation.gsm' (language 'en')
      -- Auto fallthrough, channel 'SIP/405-0000000c' status is 'UNKNOWN'
      -- Executing [h@bulk:1] Hangup("SIP/405-0000000c", "") in new stack
    == Spawn extension (bulk, h, 1) exited non-zero on 'SIP/405-0000000c'  

我认为SIP/405正在回答,执行Playback然后挂机,而不是重定向到示例号。
有什么建议?

编辑:我如何配置我的cisco适配器以重定向拨出电话,而不是回答并建立桥接?

1 个答案:

答案 0 :(得分:0)

您已在ATA上配置响铃,接听和忙碌识别。

从我的踪迹中可以看到Asterisk正如您所要求的那样工作。

如果适配器没有呼叫,您可以检查适配器设置。例如,它可以调用音调,为什么你预期它是脉冲。

也可能是您的任务的错误适配器类型。要通过PSTN线路呼叫,您需要FXO适配器,而不是FXS。