Search in sources :

Example 1 with CallRequest

use of com.fanap.podchat.call.request_model.CallRequest in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method requestP2PCallWithContactId.

private void requestP2PCallWithContactId(int contactId, int callType, String contactName) {
    List<Invitee> invitees = new ArrayList<>();
    Invitee invitee = new Invitee();
    invitee.setId(contactId);
    invitee.setIdType(InviteType.Constants.TO_BE_USER_CONTACT_ID);
    invitees.add(invitee);
    // request with invitee list
    CallRequest callRequest = new CallRequest.Builder(invitees, callType).setTitle(GROUP_CALL_NAME_PREFIX + contactName).setDescription("Generated at " + new Date().toString()).build();
    if (callRequest.getCallType() == CallType.Constants.VIDEO_CALL) {
        showVideoViews();
    } else {
        prepareAudioCallView();
    }
    String uniqueId = requestCallByServerType(callRequest);
    callUniqueIds.add(uniqueId);
    callImpUniqueIds.add(uniqueId);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) ArrayList(java.util.ArrayList) Date(java.util.Date)

Example 2 with CallRequest

use of com.fanap.podchat.call.request_model.CallRequest in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method requestGroupAudioCallByContactId.

@SuppressLint("MissingPermission")
@Override
public void requestGroupAudioCallByContactId(String callName, ArrayList<Long> selectContactIds) {
    view.hideContactsFragment();
    view.showFabContact();
    List<Invitee> invitees = new ArrayList<>();
    for (Long cId : selectContactIds) {
        invitees.add(new Invitee(cId, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    }
    CallRequest request = new CallRequest.Builder().setTitle(callName).setCallType(CallType.Constants.VIDEO_CALL).setInvitees(invitees).build();
    prepareAudioCallView();
    callImpUniqueIds.add(chat.requestGroupCall(request));
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint)

Example 3 with CallRequest

use of com.fanap.podchat.call.request_model.CallRequest in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method requestGroupVideoCallByContactId.

@SuppressLint("MissingPermission")
@Override
public void requestGroupVideoCallByContactId(String callName, ArrayList<Long> selectContactIds) {
    view.hideContactsFragment();
    view.showFabContact();
    List<Invitee> invitees = new ArrayList<>();
    for (Long cId : selectContactIds) {
        invitees.add(new Invitee(cId, InviteType.Constants.TO_BE_USER_CONTACT_ID));
    }
    CallRequest request = new CallRequest.Builder().setTitle(callName).setCallType(CallType.Constants.VIDEO_CALL).setInvitees(invitees).build();
    showVideoViews();
    callImpUniqueIds.add(chat.requestGroupCall(request));
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint)

Example 4 with CallRequest

use of com.fanap.podchat.call.request_model.CallRequest in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method requestMainOrSandboxCall.

@SuppressLint("MissingPermission")
@Override
public void requestMainOrSandboxCall(String query, boolean isGroupCall) {
    try {
        if (Util.isNotNullOrEmpty(query)) {
            showVideoViews();
            String uniqueId = "";
            if (query.contains("-")) {
                String[] ids = query.split("-");
                List<Invitee> invitees = new ArrayList<>();
                if (ids.length == 1) {
                    // P2P Call
                    Invitee invitee = new Invitee();
                    invitee.setId(ids[0]);
                    invitee.setIdType(InviteType.Constants.TO_BE_USER_ID);
                    invitees.add(invitee);
                    // request with invitee list
                    CallRequest callRequest = new CallRequest.Builder(invitees, BASE_CALL_TYPE).build();
                    uniqueId = chat.requestCall(callRequest);
                    view.updateStatus("Request p2p call with: " + ids[0]);
                } else if (ids.length <= 5) {
                    for (String id : ids) {
                        Invitee invitee = new Invitee();
                        invitee.setId(id);
                        invitee.setIdType(InviteType.Constants.TO_BE_USER_CONTACT_ID);
                        invitees.add(invitee);
                    }
                    CallRequest callRequest = new CallRequest.Builder(invitees, BASE_CALL_TYPE).setTitle(GROUP_CALL_NAME_PREFIX + ids).setDescription("Generated at " + new Date().toString()).build();
                    uniqueId = chat.requestGroupCall(callRequest);
                    view.updateStatus("Request group call invitees: " + Arrays.toString(ids));
                } else {
                    view.updateStatus("حداکثر اعضای تماس گروهی 5 نفر می باشد");
                }
            } else {
                // Group Call with subject id
                CallRequest callRequest = new CallRequest.Builder(Long.parseLong(query), BASE_CALL_TYPE).setTitle(GROUP_CALL_NAME_PREFIX + query).setDescription("Generated at " + new Date().toString()).build();
                if (isGroupCall) {
                    uniqueId = chat.requestGroupCall(callRequest);
                } else {
                    uniqueId = chat.requestCall(callRequest);
                }
            }
            if (Util.isNotNullOrEmpty(uniqueId)) {
                callUniqueIds.add(uniqueId);
                callImpUniqueIds.add(uniqueId);
            }
        }
    } catch (NumberFormatException e) {
        view.updateStatus("Wrong format");
    }
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) GsonBuilder(com.google.gson.GsonBuilder) ArrayList(java.util.ArrayList) Date(java.util.Date) SuppressLint(android.annotation.SuppressLint)

Example 5 with CallRequest

use of com.fanap.podchat.call.request_model.CallRequest in project pod-chat-android-sdk by FanapSoft.

the class CallPresenter method requestP2PCallWithUserId.

@SuppressLint("MissingPermission")
@Override
public void requestP2PCallWithUserId(int userId, int callType) {
    List<Invitee> invitees = new ArrayList<>();
    Invitee invitee = new Invitee();
    invitee.setId(userId);
    invitee.setIdType(InviteType.Constants.TO_BE_USER_ID);
    invitees.add(invitee);
    // request with invitee list
    CallRequest callRequest = new CallRequest.Builder(invitees, callType).build();
    if (callRequest.getCallType() == CallType.Constants.VIDEO_CALL) {
        showVideoViews();
    } else {
        prepareAudioCallView();
    }
    String uniqueId = chat.requestCall(callRequest);
    callUniqueIds.add(uniqueId);
    callImpUniqueIds.add(uniqueId);
}
Also used : Invitee(com.fanap.podchat.mainmodel.Invitee) AcceptCallRequest(com.fanap.podchat.call.request_model.AcceptCallRequest) EndCallRequest(com.fanap.podchat.call.request_model.EndCallRequest) RejectCallRequest(com.fanap.podchat.call.request_model.RejectCallRequest) TerminateCallRequest(com.fanap.podchat.call.request_model.TerminateCallRequest) CallRequest(com.fanap.podchat.call.request_model.CallRequest) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint)

Aggregations

AcceptCallRequest (com.fanap.podchat.call.request_model.AcceptCallRequest)8 CallRequest (com.fanap.podchat.call.request_model.CallRequest)8 EndCallRequest (com.fanap.podchat.call.request_model.EndCallRequest)8 RejectCallRequest (com.fanap.podchat.call.request_model.RejectCallRequest)8 TerminateCallRequest (com.fanap.podchat.call.request_model.TerminateCallRequest)8 SuppressLint (android.annotation.SuppressLint)7 Invitee (com.fanap.podchat.mainmodel.Invitee)6 ArrayList (java.util.ArrayList)6 Date (java.util.Date)4 GsonBuilder (com.google.gson.GsonBuilder)3