I have added the answer_url to Conference XML with unique Id. But my 2nd call to the makecall API recieved a IllegalState Exception. I am not sure what i am doing wrong?

Code:

LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
params.put("from", "ZZZZZZZZZZZ");
params.put("answer_url",
        "https://dl.dropboxusercontent.com/s/cho3u1633pz43lx/conference.xml");
params.put("callback_method", "GET");

Call response;

String[] conference_numbers = { moderator, participant1 };

try {

    for (int i = 0; i < conference_numbers.length; i++) {
        params.put("to", conference_numbers[i]);
        System.out.println("Number at index " + i + " "
                + conference_numbers[i]);
        response = restAPI.makeCall(params);
        System.out.println(response.apiId);
    }

} catch (PlivoException e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
}

Console:

======= CONSOLE =========================
Moderator Number 1 : XXXXX
Participants Number 1 : YYYYYY
Database connection terminated...!!!
Number at index 0 XXXXX
5304db62-cfa6-11e3-9c37-22000ac7849b
Number at index 1 YYYYYY
Connection manager has been shut down
com.plivo.helper.exception.PlivoException: Connection manager has been shut down
    at com.plivo.helper.api.client.RestAPI.request(RestAPI.java:127)
    at com.plivo.helper.api.client.RestAPI.makeCall(RestAPI.java:238)
    at PlivoConference.main(PlivoConference.java:136)
有帮助吗?

解决方案

Call to restAPI.makeCall shuts down connection manager and restAPI instance becomes unusable. To fix your error create brand new instance of RestAPI before each call.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top