How to use cBarge (Barge) to create conference with JTApi
Asked Answered
G

1

7

We have 2 cisco phones: one for call manager and another for his superviser.

We need to create a conference when the manager answers and put the supervisor's phone on mute. We are trying to achieve it using JTApi: wait for event TermConnActiveEv, then trying to create conference.

Here is the code sample.

if (callEv instanceof TermConnActiveEv) {
CiscoCall thisCall = (CiscoCall) callEv.getCall();
TerminalConnection connection = ((TermConnActiveEv) callEv).getTerminalConnection();

if (thisCall.getState() != Call.ACTIVE)
{
    System.out.println("call is not active");
    return;
}
try {
    CiscoCall newCall = (CiscoCall) provider.createCall();
    newCall.consult(connection);
    newCall.conference(thisCall);

    ....

However, PreConditionException is thrown. What are we doing wrong?

Gonfalonier answered 6/8, 2015 at 14:38 Comment(0)
T
1

You don't need to use Barge to create a conference.

You can try to do something like that:

if (callEv instanceof TermConnActiveEv) {
    CiscoCall thisCall = (CiscoCall) callEv.getCall();
    TerminalConnection tc = thisCall.getConferenceController();
    Connection[] connections = thisCall.getConnections();

    TerminalConnection[] tcs = connections[0].getTerminalConnections();
    if (tcs.length > 0 && tc == null) {
        tc = tcs[0];
    }

    if (tc == null) {
        System.out.println("Conference controller is null.");
    } else {
        try {
            Call call = provider.createCall();
            call.connect(thisAddress.getTerminals()[0], thisAddress, superVisorAddress);
            thisCall.conference(call);
        } catch (Exception ex) {
            System.out.println("Exception " + ex);
            ex.printStackTrace();
        }
    }
}

To set mute you can use:

((CiscoTerminal)termConnections[i].getTerminal().sendData("<CiscoIPPhoneExecute><ExecuteItem Priority=\"0\"URL=\"Key:Mute\"/></CiscoIPPhoneExecute>");

Before the application can make use of this feature, it must add TerminalObserver on the terminal.

Thirst answered 18/8, 2015 at 12:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.