ARI ari4java:分配失败

时间:2018-03-28 15:40:28

标签: java rest asterisk

我尝试使用ARI创建出站呼叫。

我这样设置:

@Autowired
    private Environment env;

    private ARI ari;

    private String context;
    private String extention;
    private String protocol;

    @PostConstruct
    public void init() throws ARIException, URISyntaxException {
        String url = env.getProperty("ari_url");
        String login = env.getProperty("ari_login");
        String password = env.getProperty("ari_password");

        context = env.getProperty("channel_context");
        extention = env.getProperty("channel_extention");
        protocol = env.getProperty("channel_protocol");

        ari = AriFactory.nettyHttp(url, login, password, AriVersion.ARI_3_0_0);
    }

    @Override
    public void sendNotification(String number) {

        String endpoint = protocol + number;
        long priority = 0L;
        String label = null;
        String app = "";
        String appArgs = "";
        String callerId = "BAKAPP";
        int timeout = 60;
        Map<String, String> variables = new HashMap<>();
        String channelId = "";
        String otherChannelId = "";
        String originator = null;
        String formats = null;

        try {
            ari.channels().originate(endpoint, extention, context, priority, label, app, appArgs, callerId,
                    timeout, variables, channelId, otherChannelId, originator, formats);
        } catch (RestException e) {
            e.printStackTrace();
        }
    }

正如我们所见,我初始化了延伸。但我得到RestException:

ch.loway.oss.ari4java.tools.RestException: {"error":"Allocation failed"}
    ...
    at ch.loway.oss.ari4java.tools.http.NettyHttpClient.makeException(NettyHttpClient.java:200)
    at ch.loway.oss.ari4java.tools.http.NettyHttpClient.httpActionSync(NettyHttpClient.java:218)
    at ch.loway.oss.ari4java.tools.BaseAriAction.httpActionSync(BaseAriAction.java:69)
    at ch.loway.oss.ari4java.generated.ari_3_0_0.actions.ActionChannels_impl_ari_3_0_0.originate(ActionChannels_impl_ari_3_0_0.java:85)
    ...

我不知道为什么它不起作用。我已经读过我需要设置扩展程序或应用程序,我设置扩展程序。

请帮我解决这个问题。

0 个答案:

没有答案