Packages 
Package Description
com.zingaya.voximplant  

Package com.zingaya.voximplant

com.zingaya.voximplant

Class VoxImplantClient

  • java.lang.Object
    • com.zingaya.voximplant.VoxImplantClient


  • public class VoxImplantClient
    extends java.lang.Object
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void answerCall(java.lang.String callId)
      Answer incoming call
      void answerCall(java.lang.String callId, java.util.Map<java.lang.String,java.lang.String> headers)
      Answer incoming call
      void closeConnection()
      Closes connection with media server
      void connect()
      Connect to VoxImplant cloud
      void connect(boolean connectivityCheck, java.lang.String serverName)
      Connect to VoxImplant cloud
      java.lang.String createCall(java.lang.String to, boolean video, java.lang.String customData)
      Create new call instance.
      void declineCall(java.lang.String callId)
      Reject incoming alerting call
      void declineCall(java.lang.String callId, java.util.Map<java.lang.String,java.lang.String> headers)
      Reject incoming alerting call
      void disconnectCall(java.lang.String callId)
      Terminate specified call.
      void disconnectCall(java.lang.String callId, java.util.Map<java.lang.String,java.lang.String> headers)
      Terminate specified call.
      static java.util.List<java.lang.String> getMissingPermissions(Context context, boolean videoSupportEnabled)
      Returns the list of permissions that have not been granted by user yet
      void handlePushNotification(java.util.Map<java.lang.String,java.lang.String> notification)
      Handle incoming push notification
      static VoxImplantClient instance() 
      void login(java.lang.String username, java.lang.String password)
      Login to specified VoxImplant application
      void loginUsingAccessToken(java.lang.String user, java.lang.String accessToken)
      Perform login using specified username and access token that was obtained in onLoginSuccessful callback before
      void loginUsingOneTimeKey(java.lang.String user, java.lang.String hash)
      Perform login using one time key that was generated before
      void refreshToken(java.lang.String user, java.lang.String refreshToken)
      Perform refresh of login tokens required for login using access token
      void registerForPushNotifications(java.lang.String pushRegistrationToken)
      Register for push notifications.
      void requestOneTimeKey(java.lang.String user)
      Generates one time login key to be used for automated login process.
      void sendDTMF(java.lang.String callId, int digit)
      Sends DTMF digit in specified call.
      void sendInfo(java.lang.String callId, java.lang.String mimeType, java.lang.String content)
      Sends info within established call
      void sendInfo(java.lang.String callId, java.lang.String mimeType, java.lang.String content, java.util.Map<java.lang.String,java.lang.String> headers)
      Sends info within established call
      void sendMessage(java.lang.String callId, java.lang.String text)
      Sends instant message within established call
      void sendVideo(boolean doSendVideo)
      Start/stop sending video from local camera
      void setAndroidContext(Context context)
      Set Android context
      void setAndroidContext(Context context, VoxImplantClient.VoxImplantClientConfig clientConfig)
      Set Android context and VoxImplantClient config
      void setCallback(VoxImplantCallback cb)
      Sets handler for VoxImplant events
      void setCamera(int cam)
      Select camera
      void setCameraResolution(int width, int height)
      Set local camera resolution
      void setLocalPreview(VideoRenderer.Callbacks videoView)
      Set view for local stream
      void setMute(boolean doMute)
      Mute or unmute microphone.
      void setRemoteView(java.lang.String callId, VideoRenderer.Callbacks videoView)
      Set view for remote stream for call
      void setRemoteView(VideoRenderer.Callbacks videoView)
      Set view for remote stream
      boolean setUseLoudspeaker(boolean useLoudSpeaker)
      Enable/disable loudspeaker
      boolean startCall(java.lang.String callId)
      Send start call request If call with specified id is not found - returns false
      boolean startCall(java.lang.String callId, java.util.Map<java.lang.String,java.lang.String> headers)
      Send start call request If call with specified id is not found - returns false
      void unregisterFromPushNotifications(java.lang.String pushRegistrationToken)
      Unregister from push notifications.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • instance

        public static VoxImplantClient instance()
        Returns:
        VoxImplantClient shared instance
      • setAndroidContext

        public void setAndroidContext(Context context)
                               throws java.security.AccessControlException
        Set Android context
        Parameters:
        context - Android context
        Throws:
        java.security.AccessControlException
      • setAndroidContext

        public void setAndroidContext(Context context,
                             VoxImplantClient.VoxImplantClientConfig clientConfig)
                               throws java.security.AccessControlException
        Set Android context and VoxImplantClient config
        Parameters:
        context - Android context
        clientConfig - VoxImplantClientConfig instance with configuration for Android SDK
        Throws:
        java.security.AccessControlException
        See Also:
        VoxImplantClient.VoxImplantClientConfig
      • setCallback

        public void setCallback(VoxImplantCallback cb)
        Sets handler for VoxImplant events
        Parameters:
        cb - Callback object
      • connect

        public void connect()
        Connect to VoxImplant cloud
      • connect

        public void connect(boolean connectivityCheck,
                   java.lang.String serverName)
        Connect to VoxImplant cloud
        Parameters:
        connectivityCheck - Checks whether UDP traffic will flow correctly between device and VoxImplant cloud. This check reduces connection speed.
        serverName - Server name of particular media gateway for connection
      • closeConnection

        public void closeConnection()
        Closes connection with media server
      • login

        public void login(java.lang.String username,
                 java.lang.String password)
        Login to specified VoxImplant application
        Parameters:
        username - Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
        password - User password
      • loginUsingOneTimeKey

        public void loginUsingOneTimeKey(java.lang.String user,
                                java.lang.String hash)
        Perform login using one time key that was generated before
        Parameters:
        user - Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
        hash - Hash that was generated using following formula: MD5(oneTimeKey+"|"+MD5(user+":voximplant.com:"+password)). Please note that here user is just a user name, without app name, account name or anything else after "@". So if you pass myuser@myapp.myacc.voximplant.com as a username, you should only use myuser while computing this hash.
      • refreshToken

        public void refreshToken(java.lang.String user,
                        java.lang.String refreshToken)
        Perform refresh of login tokens required for login using access token
        Parameters:
        user - Full user name, including app and account name, like someuser@someapp.youraccount.voximplant.com
        refreshToken - refresh token that was obtained in onLoginSuccessful callback
        See Also:
        loginUsingAccessToken(String, String), VoxImplantCallback.LoginTokens.getRefreshToken()
      • createCall

        public java.lang.String createCall(java.lang.String to,
                                  boolean video,
                                  java.lang.String customData)
        Create new call instance. Call must be then started using startCall
        Parameters:
        to - SIP URI, username or phone number to make call to. Actual routing is then performed by VoxEngine scenario
        video - Enable video support in call
        customData - Optional custom data passed with call. Will be available in VoxEngine scenario
        Returns:
        Call id of newly created call, null if the call was not created. Created call id should be used to perform any subsequent call operations
      • startCall

        public boolean startCall(java.lang.String callId,
                        java.util.Map<java.lang.String,java.lang.String> headers)
        Send start call request If call with specified id is not found - returns false
        Parameters:
        callId - id of previously created call
        headers - Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK
        Returns:
        true on success, false if operation has failed
      • startCall

        public boolean startCall(java.lang.String callId)
        Send start call request If call with specified id is not found - returns false
        Parameters:
        callId - id of previously created call
        Returns:
        true on success, false if operation has failed
      • sendDTMF

        public void sendDTMF(java.lang.String callId,
                    int digit)
        Sends DTMF digit in specified call.
        Parameters:
        callId - id of previously created call
        digit - Digit can be 0-9 for 0-9, 10 for * and 11 for #
      • disconnectCall

        public void disconnectCall(java.lang.String callId,
                          java.util.Map<java.lang.String,java.lang.String> headers)
        Terminate specified call. Call must be either established, or outgoing progressing
        Parameters:
        callId - id of previously created call
        headers - Optional set of headers to be sent with message. Names must begin with "X-" to be processed by Voximplant
      • disconnectCall

        public void disconnectCall(java.lang.String callId)
        Terminate specified call. Call must be either established, or outgoing progressing
        Parameters:
        callId - id of previously created call
      • declineCall

        public void declineCall(java.lang.String callId,
                       java.util.Map<java.lang.String,java.lang.String> headers)
        Reject incoming alerting call
        Parameters:
        callId - id of previously created call
        headers - Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK
      • declineCall

        public void declineCall(java.lang.String callId)
        Reject incoming alerting call
        Parameters:
        callId - id of previously created call
      • answerCall

        public void answerCall(java.lang.String callId,
                      java.util.Map<java.lang.String,java.lang.String> headers)
        Answer incoming call
        Parameters:
        callId - id of previously created call
        headers - Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK
      • answerCall

        public void answerCall(java.lang.String callId)
        Answer incoming call
        Parameters:
        callId - id of previously created call
      • sendMessage

        public void sendMessage(java.lang.String callId,
                       java.lang.String text)
        Sends instant message within established call
        Parameters:
        callId - id of previously created call
        text - Message text
      • sendInfo

        public void sendInfo(java.lang.String callId,
                    java.lang.String mimeType,
                    java.lang.String content,
                    java.util.Map<java.lang.String,java.lang.String> headers)
        Sends info within established call
        Parameters:
        callId - id of previously created call
        mimeType - MIME type of info
        content - Custom string data
        headers - Optional set of headers to be sent with message. Names must begin with "X-" to be processed by SDK
      • sendInfo

        public void sendInfo(java.lang.String callId,
                    java.lang.String mimeType,
                    java.lang.String content)
        Sends info within established call
        Parameters:
        callId - id of previously created call
        mimeType - MIME type of info
        content - Custom string data
      • setLocalPreview

        public void setLocalPreview(VideoRenderer.Callbacks videoView)
        Set view for local stream
        Parameters:
        videoView - org.webrtc.SurfaceViewRenderer or custom implementation of org.webrtc.VideoRenderer.Callbacks
        It is recommended to use SurfaceViewRenderer for the most of cases.
        In case of custom implementation of VideoRenderer.Callback class:
        • 1. VideoRenderer.renderFrameDone(i420Frame) must be called after every VideoRenderer.renderFrame()
        • 2. See VoxImplamtClientConfig parameters to set up video frame format
      • setRemoteView

        public void setRemoteView(VideoRenderer.Callbacks videoView)
        Set view for remote stream
        Parameters:
        videoView - org.webrtc.SurfaceViewRenderer or custom implementation of org.webrtc.VideoRenderer.Callbacks
        It is recommended to use SurfaceViewRenderer for the most of cases.
        In case of custom implementation of VideoRenderer.Callback class:
        • 1. VideoRenderer.renderFrameDone(i420Frame) must be called after every VideoRenderer.renderFrame()
        • 2. See VoxImplamtClientConfig parameters to set up video frame format
      • setRemoteView

        public void setRemoteView(java.lang.String callId,
                         VideoRenderer.Callbacks videoView)
        Set view for remote stream for call
        Parameters:
        videoView - org.webrtc.SurfaceViewRenderer or custom implementation of org.webrtc.VideoRenderer.Callbacks
        It is recommended to use SurfaceViewRenderer for the most of cases.
        In case of custom implementation of VideoRenderer.Callback class:
        • 1. VideoRenderer.renderFrameDone(i420Frame) must be called after every VideoRenderer.renderFrame()
        • 2. See VoxImplamtClientConfig parameters to set up video frame format
        callId - id of the call
      • setCameraResolution

        public void setCameraResolution(int width,
                               int height)
        Set local camera resolution
        Parameters:
        width - camera resolution width
        height - camera resolution height
      • setCamera

        public void setCamera(int cam)
        Select camera
        Parameters:
        cam - Must be Camera.CameraInfo.CAMERA_FACING_FRONT or Camera.CameraInfo.CAMERA_FACING_BACK
      • sendVideo

        public void sendVideo(boolean doSendVideo)
        Start/stop sending video from local camera
        Parameters:
        doSendVideo - Specify if video should be sent
      • setMute

        public void setMute(boolean doMute)
        Mute or unmute microphone. This is reset after audio interruption
        Parameters:
        doMute - Enable/disable flag
      • setUseLoudspeaker

        public boolean setUseLoudspeaker(boolean useLoudSpeaker)
        Enable/disable loudspeaker
        Parameters:
        useLoudSpeaker - Enable/disable loudspeaker
      • getMissingPermissions

        public static java.util.List<java.lang.String> getMissingPermissions(Context context,
                                                             boolean videoSupportEnabled)
        Returns the list of permissions that have not been granted by user yet
        Parameters:
        context - Android context
        videoSupportEnabled - Specify if permissions for video calls are required.
        Returns:
        List of disallowed permissions
      • handlePushNotification

        public void handlePushNotification(java.util.Map<java.lang.String,java.lang.String> notification)
        Handle incoming push notification
        Parameters:
        notification - Incoming push notification that comes from FirebaseMessagingService.onMessageReceived(RemoteMessage remoteMessage)
      • registerForPushNotifications

        public void registerForPushNotifications(java.lang.String pushRegistrationToken)
        Register for push notifications. Application will receive push notifications from VoxImplant Server after first log in.
        Parameters:
        pushRegistrationToken - FCM registration token that can be retrieved by calling FirebaseInstanceID.getToken()
      • unregisterFromPushNotifications

        public void unregisterFromPushNotifications(java.lang.String pushRegistrationToken)
        Unregister from push notifications. Application will no longer receive push notifications from VoxImplant server
        Parameters:
        pushRegistrationToken - FCM registration token that was used to register for push notifications
        See Also:
        registerForPushNotifications(String)