Interface CallClient


  • public interface CallClient
    CallClient provides the entry point to the calling functionality of the Sinch SDK. A CallClient can be acquired via the SinchClient.
     
    
     sinchClient.start();
    
     ...
    
     // Get the CallClient from the SinchClient
     CallClient callClient = sinchClient.getCallClient();
     // Make outgoing call
     Call call = callClient.call(<remote user id>);
    
     // Add the call listener that handles call state changes
     call.addCallListener(...);
    
     ...
    
     // Hang up the call
     call.hangUp();
    
     
     
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addCallClientListener​(CallClientListener callClientListener)
      The CallClientListener object will be notified of new incoming calls.
      Call callConference​(java.lang.String conferenceId)
      Calls the conference with the given id.
      Call callConference​(java.lang.String conferenceId, java.util.Map<java.lang.String,​java.lang.String> headers)
      Calls the conference with the given id and the given headers.
      Call callPhoneNumber​(java.lang.String phoneNumber)
      Calls a phone number and terminates the call to the PSTN-network (Publicly Switched Telephone Network).
      Call callPhoneNumber​(java.lang.String phoneNumber, java.util.Map<java.lang.String,​java.lang.String> headers)
      Calls a phone number and terminates the call to the PSTN-network (Publicly Switched Telephone Network).
      Call callSip​(java.lang.String sipIdentity)
      Makes a SIP call to the user with the given identity.
      Call callSip​(java.lang.String sipIdentity, java.util.Map<java.lang.String,​java.lang.String> headers)
      Makes a SIP call to the user with the given identity and adding the given headers.
      Call callUser​(java.lang.String toUserId)
      Makes a call to the user with the given id.
      Call callUser​(java.lang.String toUserId, java.util.Map<java.lang.String,​java.lang.String> headers)
      Makes a call to the user with the given id and adding the given headers.
      Call callUserVideo​(java.lang.String toUserId)
      Makes a video call to the user with the given id.
      Call callUserVideo​(java.lang.String toUserId, java.util.Map<java.lang.String,​java.lang.String> headers)
      Makes a video call to the user with the given id and adding the given headers.
      Call getCall​(java.lang.String callId)
      Returns the Call object with the identifier callId.
      void removeCallClientListener​(CallClientListener callClientListener)
      Remove listener for incoming call events.
      void setRespectNativeCalls​(boolean respectNativeCalls)
      Set whether or not the client should respect native calls.
    • Method Detail

      • removeCallClientListener

        void removeCallClientListener​(CallClientListener callClientListener)
        Remove listener for incoming call events.
        Parameters:
        callClientListener - a CallClientListener
      • callUser

        Call callUser​(java.lang.String toUserId)
        Makes a call to the user with the given id.
        Parameters:
        toUserId - The app specific id of the user to call. May not be null or empty.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        MissingPermissionException - If missing a permission required to place a call
      • callUser

        Call callUser​(java.lang.String toUserId,
                      java.util.Map<java.lang.String,​java.lang.String> headers)
        Makes a call to the user with the given id and adding the given headers.
        Parameters:
        toUserId - The app specific id of the user to call. May not be null or empty.
        headers - Headers to pass with the call.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.
        MissingPermissionException - If missing a permission required to place a call
      • callUserVideo

        Call callUserVideo​(java.lang.String toUserId)
        Makes a video call to the user with the given id.
        Parameters:
        toUserId - The app specific id of the user to call. May not be null or empty.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        MissingPermissionException - If missing a permission required to place a call
      • callUserVideo

        Call callUserVideo​(java.lang.String toUserId,
                           java.util.Map<java.lang.String,​java.lang.String> headers)
        Makes a video call to the user with the given id and adding the given headers.
        Parameters:
        toUserId - The app specific id of the user to call. May not be null or empty.
        headers - Headers to pass with the call.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.
        MissingPermissionException - If missing a permission required to place a call
      • callPhoneNumber

        Call callPhoneNumber​(java.lang.String phoneNumber)
        Calls a phone number and terminates the call to the PSTN-network (Publicly Switched Telephone Network).
        Parameters:
        phoneNumber - The phone number to call. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164) and should be prefixed with a '+'. E.g. to call the US phone number 415 555 0101, it should be specified as "+14155550101", where the '+' is the required prefix and the US country code '1' added before the local subscriber number.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        MissingPermissionException - If missing a permission required to place a call
      • callPhoneNumber

        Call callPhoneNumber​(java.lang.String phoneNumber,
                             java.util.Map<java.lang.String,​java.lang.String> headers)
        Calls a phone number and terminates the call to the PSTN-network (Publicly Switched Telephone Network).
        Parameters:
        phoneNumber - The phone number to call. The phone number should be given according to E.164 number formatting (http://en.wikipedia.org/wiki/E.164) and should be prefixed with a '+'. E.g. to call the US phone number 415 555 0101, it should be specified as "+14155550101", where the '+' is the required prefix and the US country code '1' added before the local subscriber number.
        headers - Headers to pass with the call.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.
        MissingPermissionException - If missing a permission required to place a call
      • callConference

        Call callConference​(java.lang.String conferenceId)
        Calls the conference with the given id.
        Parameters:
        conferenceId - Conference ID to dial in to.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if conferenceId exceeds 64 characters
        MissingPermissionException - If missing a permission required to place a call
      • callConference

        Call callConference​(java.lang.String conferenceId,
                            java.util.Map<java.lang.String,​java.lang.String> headers)
        Calls the conference with the given id and the given headers.
        Parameters:
        conferenceId - Conference ID to dial in to.
        headers - Headers to pass with the call.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if conferenceId exceeds 64 characters
        java.lang.IllegalArgumentException - if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.
        MissingPermissionException - If missing a permission required to place a call
      • callSip

        Call callSip​(java.lang.String sipIdentity)
        Makes a SIP call to the user with the given identity. The identity should be in the form "user@server".
        Parameters:
        sipIdentity - SIP identity to dial in to.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if sipIdentity exceeds 64 characters
        MissingPermissionException - If missing a permission required to place a call
      • callSip

        Call callSip​(java.lang.String sipIdentity,
                     java.util.Map<java.lang.String,​java.lang.String> headers)
        Makes a SIP call to the user with the given identity and adding the given headers. The identity should be in the form "user@server".
        Parameters:
        sipIdentity - SIP identity to dial in to.
        headers - Headers to pass with the call.
        Returns:
        A Call instance.
        Throws:
        java.lang.IllegalStateException - if SinchClient is not started
        java.lang.IllegalArgumentException - if sipIdentity exceeds 64 characters
        java.lang.IllegalArgumentException - if the size of all header strings exceeds 1024 bytes when encoded as UTF-8.
        MissingPermissionException - If missing a permission required to place a call
      • setRespectNativeCalls

        void setRespectNativeCalls​(boolean respectNativeCalls)
        Set whether or not the client should respect native calls. If this is set to true, answering native calls will hangup any ongoing Sinch calls. Also, if in a native calls, incoming Sinch calls will be denied automatically. If set to true, the app requires permissions android.permission.READ_PHONE_STATE. Defaults to true.
        Parameters:
        respectNativeCalls - whether or not the client should respect native calls.
      • getCall

        Call getCall​(java.lang.String callId)
        Returns the Call object with the identifier callId.
        Parameters:
        callId - The call identifier string.
        Returns:
        A Call instance if one matches, otherwise null.