Ari4java: Allocation failed


#1

When I try to create outbound call with ari4java, I see exception:

ch.loway.oss.ari4java.tools.RestException: {"error":"Allocation failed"}
15:02:13.794 [PhoneNotification.GetUsersByRole-0-C-1] DEBUG org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer - Received: 0 records
15:02:13.794 [PhoneNotification.GetUsersByRole-0-C-1] DEBUG org.apache.kafka.clients.consumer.internals.ConsumerCoordinator - [Consumer clientId=consumer-1, groupId=PhoneNotification.GetUsersByRole] Sending asynchronous auto-commit of offsets {phoneNotification.GetUsersByRole-0=OffsetAndMetadata{offset=21, metadata=''}}
	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)
	at ru.bakapp.phone.notification.services.PhoneNotificationSenderImpl.sendNotification(PhoneNotificationSenderImpl.java:61)
	at ru.bakapp.phone.notification.services.PhoneNotificationSenderTest.sendMessageTest(PhoneNotificationSenderTest.java:24)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
	at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:114)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:57)
	at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
	at com.sun.proxy.$Proxy1.processTestClass(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:146)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:128)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
	at java.lang.Thread.run(Thread.java:748)

there is setup:

@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();
        }
    }
ari_url=http://freepbx.example:8080/
ari_login=password
ari_password=password
channel_context=default
channel_extention=s
channel_protocol=SIP/

Please help me solve my problem. Need I setup app & where can I get it? I using ari4java:0.4.5


#2

Taking Out the Java issue, what are you trying to do?


#3

I trying to dial to my phone number.

I get info from connection:

Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@5c7253cd
Channel ID: []
Resource: dpma_endpoint
Technology: PJSIP
State: offline
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@15c44398
Channel ID: []
Resource: 101
Technology: SIP
State: unknown
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@2c401b9f
Channel ID: []
Resource: 102
Technology: SIP
State: unknown
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@6324172a
Channel ID: []
Resource: 103
Technology: SIP
State: unknown
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@2d86ccb8
Channel ID: []
Resource: 500
Technology: SIP
State: unknown
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@1ae99213
Channel ID: []
Resource: 600
Technology: SIP
State: unknown
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@3659fe32
Channel ID: []
Resource: 700
Technology: SIP
State: unknown
Endpoint: ch.loway.oss.ari4java.generated.ari_3_0_0.models.Endpoint_impl_ari_3_0_0@75873294
Channel ID: []
Resource: MangoTel
Technology: SIP
State: online

There are 0 active channels now.
System up since Fri Mar 30 09:53:07 MSK 2018
OS: Linux
Core: 3.10.0-693.5.2.el7.x86_64
Architecture: x86_64
Last reload: Fri Mar 30 09:53:07 MSK 2018
Asterisk version: 15.1.5