简体   繁体   English

星号AMI发起呼叫

[英]Asterisk AMI originate call

I have configured the analog local phone with cisco adapter, so I can make any outbound call from SIP phone. 我已经使用cisco适配器配置了模拟本地电话,因此可以从SIP电话发出任何出站呼叫。 But I can't achieve this by AMI which calls to outbound channel through trunk then plays prompt. 但是我无法通过AMI实现此功能,AMI通过中继线呼叫出站通道,然后播放提示。
manager.conf : 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 : extensions.conf

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

source code : 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();
    }
}  

Where 405 is the UserID of CISCO adapter for outgoing calls, 7000000 is a sample cell phone number. 其中405是用于拨出呼叫的CISCO适配器的UserID,而7000000是样本手机号码。

Here is the logs: 这是日志:

== 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'  

I think SIP/405 is answering, executing Playback then hangs up, not redirecting to sample number. 我认为SIP/405正在应答,执行Playback然后挂断,而不是重定向到样本号。
Any suggestions? 有什么建议么?

EDIT: How can I configure my cisco adapter in order to redirect outgoing calls, not to answer and make the bridge? 编辑:如何配置我的cisco适配器以重定向传出呼叫,而不是接听并建立网桥?

You have configure ring, answer and busy recognition on your ATA. 您已经在ATA上配置了振铃,应答和忙碌识别。

Asterisk work as you requested as far as i can see from your trace. 根据您的要求,我可以从星号中看到星号。

If adapter not calling, you have check with your adapater settings. 如果适配器未通话,则需要检查您的适配器设置。 For example it can be calling in tone, why you line expect it is pulse. 例如,它可能正在发出声音,为什么您认为这是脉冲。

Also can be incorrect adapter type for your task. 也可能是您的任务的适配器类型不正确。 For calling out via PSTN line you need FXO adapter,not FXS. 要通过PSTN线路呼出,您需要FXO适配器,而不是FXS。

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

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