Package 

Class SIPProvider

    • Method Detail

      • setDialerConfiguration

         void setDialerConfiguration(DialerConfiguration configuration)

        Sets the dialer configuration for the SIP provider.

        WARNING: This method is intended for internal use and advanced customization only.Modifying the dialer configuration improperly can lead to unexpected behavior andpotentially break the functionality of the SIP stack.

        Only call this method if you absolutely understand the implications and have aspecific reason to override the default dialer configuration.

        Parameters:
        configuration - The new dialer configuration to apply.
      • getSipProvider

         static SIPProvider getSipProvider(Context context, DialerConfiguration dialerConfiguration)

        Gets the SIP provider instance.

        This method provides a singleton instance of the SIPProvider. If the instancedoes not exist, it creates a new one using the provided context and dialer configuration.It also sets the debug mode for the SIPProvider based on the dialer configuration.

        Parameters:
        context - The application context.
        dialerConfiguration - The dialer configuration object.
      • getSipProvider

         static SIPProvider getSipProvider(Context context, DialerConfiguration dialerConfiguration)

        Gets the SIP provider instance.

        This method provides a singleton instance of the SIPProvider. If the instancedoes not exist, it creates a new one using the provided context and dialer configuration.It also sets the debug mode for the SIPProvider based on the dialer configuration.

        Parameters:
        context - The application context.
        dialerConfiguration - The dialer configuration object.
      • getDeviceId

         static String getDeviceId(Context context)

        Retrieves the device ID.

        This method delegates the retrieval of the device ID to the `SipToolbox.getDeviceId` method.

        Parameters:
        context - The application context.
      • setContext

         void setContext(Context context)

        Sets the Android application context for this object.

        **Warning:** This method is intended for internal use and should not be called directlyunless absolutely necessary. Improper use can lead to unexpected behavior and memory leaks.

        This method is typically used for initialization purposes and should only be invokedwhen setting up the object. In most cases, the context is provided automaticallyduring construction or through other setup methods.

        Parameters:
        context - The Android application context.
      • getVersion

         static native String getVersion()

        Retrieves the version information of the underlying native library or system.

        This method calls a native function to obtain the version string.

      • isValidSigning

         native int isValidSigning(Context context)

        Checks if the current signing configuration of the application is valid.

        This method verifies the application's signing certificate againstpredefined criteria or a trusted source. It might involve checkingfor a specific signature, a known developer key, or other securitymeasures.

        Parameters:
        context - The application context.
      • isValidSigning

         int isValidSigning()

        Checks if the current context is valid for signing.

        This method delegates to isValidSigning using the current contextheld by this instance.

      • getDNSPort

         static native int getDNSPort()

        Retrieves the port number used for DNS queries.

        This method returns the port number that is used for communication with DNS servers.The default DNS port is 53. However, this method allows retrieving the actual portthat is currently configured, which might be different in certain environmentsor due to custom configurations.

      • getProvisioningDomain

         static native String getProvisioningDomain(int index)

        Retrieves the provisioning domain associated with the specified index.

        Provisioning domains are used to group devices and manage their configurations.This method allows you to retrieve the domain name for a specific index.

        Parameters:
        index - The index of the provisioning domain to retrieve.This index should be a non-negative integer.
      • getProvisioningDomainSize

         static native int getProvisioningDomainSize()

        Retrieves the size of the provisioning domain.

        This method returns the size of the provisioning domain, which isthe area reserved for storing provisioning information.The size is typically expressed in bytes or a similar unit.

      • getDNSIP

         static String getDNSIP()

        Retrieves the IP address of the DNS server at the specified index.This method calls the overloaded `getDNSIP` method with an index of 0,effectively returning the primary DNS server's IP address.

      • checkForRoot

         static void checkForRoot()

        Checks if the device has root access.

        This method utilizes multiple techniques to determine if the device is rooted:

        • Checks if a known root management app is installed.
        • Attempts to execute commands requiring root privileges.

        The result is stored in the `isRootEnabled` static variable.

      • isDeviceRooted

         static boolean isDeviceRooted()

        Checks if the device is rooted.

        This method relies on a previously determined value stored in the `isRootEnabled` variable.It does not perform any runtime checks for root access.

      • getProvisioningInfo

         static synchronized ProvisioningInfo getProvisioningInfo()

        Retrieves the provisioning information.

        This method retrieves the provisioning information from the `ProvisioningProvider`.The method is synchronized to ensure thread safety.

      • isVideoCall

         static boolean isVideoCall(String callID)

        Checks if a call with the given call ID is a video call.

        Parameters:
        callID - The ID of the call to check.
      • getPushUrl

        @NonNull() String getPushUrl()

        Constructs the push notification URL used for sending push notifications to the device.

        The URL is built based on the device's push notification configuration,retrieved from getConfiguaration. It includes information aboutthe device OS (Android or Huawei) and the push notification registration ID.

        The URL format is as follows:`FT;[deviceOS];[pushNotificationURI]`

        Where:- `FT` is a constant prefix.- `deviceOS` is either `ANDRD` for standard Android devices or `ANDRD_HW` for Huawei devices.- `pushNotificationURI` is the device's registration ID for receiving push notifications.

        If the push type is not specified in the configuration, it defaults to "GMS" (Google Mobile Services),indicating a standard Android device.

      • playRBTData

         boolean playRBTData()

        Plays RBT (Ring Back Tone) data.

        This method is part of the `ServerMessageProcessor` interface but is notrelevant for this particular implementation, which focuses on non-mediafunctionalities. As a result, it always returns `false`, indicatingthat RBT data playback is not supported.

      • processReceivedMessage

         void processReceivedMessage(ByteArray receivedMessage, String extension)

        Processes a received message from the signaling server based on the transport protocol used.

        This method handles incoming messages and prepares them for further processing.It removes any transport-specific headers or encoding and then passes the messageto the SIP response processor.

        Parameters:
        receivedMessage - The received message as a ByteArray.- For TCP, the ByteArray contains: header + header + data.- For UDP, the ByteArray contains: header + data.
        extension - The signaling protocol extension used (e.g., SDNS, SSL, TCP).
      • attachSIPInterface

         void attachSIPInterface(BaseSipInterface sipInterface)

        Attaches a SIP interface to the SipManager.

        This method allows you to register different types of listeners to receive events and updatesfrom the SIP stack. The provided `sipInterface` should implement one or more of the followinglistener interfaces:

        - CallEventListener: To receive events related to calls (e.g., incoming calls, call state changes).- GUIActionListener: To receive actions triggered by the GUI (e.g., dial, hangup).- BalanceEventListener: To receive updates about the user's balance.- LoginStateListener: To receive notifications about login state changes.- DialerEventListener: To receive events related to the dialer (e.g., DTMF input).- SignUpActionListener: To receive actions related to sign-up process.- CallForwardActionListener: To receive actions related to call forwarding.- ChatEventListener: To receive events related to chat messages.- ProvisioningInfoListener: To receive provisioning information.- MessageProcessorEventListener: To receive events from the message processor.- MediaListener: To receive events related to media streams.

        When a new interface is attached for a specific listener type, it replaces any previouslyattached interfaces of the same type. This ensures that only one listener of each typeis active at any given time.

        Parameters:
        sipInterface - The SIP interface to attach.
      • resetInvalidLoginReceived

         void resetInvalidLoginReceived()

        Resets the flag indicating whether an invalid login attempt has been received.

        This method sets the `invalidLoginReceived` flag to `false`, effectivelyclearing the indication of a previous invalid login attempt.

      • getGUIContext

         Context getGUIContext()

        Returns the Android Context associated with the GUI.

        This context can be used to access Android system resources and services,such as laying out UI elements, accessing shared preferences, or starting activities.

      • sendBalanceMessage

         void sendBalanceMessage()

        Sends a balance message to the server. This method is responsible for constructingand transmitting a balance request message composed of various data fields, such asoperator code, username, and password. It determines whether the balance serverport is properly configured and either sends the message via signal transmission ortriggers HTTP requests through registered event listeners.The balance message is constructed using a predefined message format that includes:- A balance request identifier.- Operator code obtained from the internal configuration.- Username fetched dynamically or set to a default value.- Password associated with the operation.If the balance server port is not configured (set to 0), it uses registered balanceevent listeners to send an HTTP request to fetch the balance. Otherwise, it buildsa binary message buffer containing the required fields, sets the length, and sendsit to the balance server address using the `sendSignal` method.The message buffer is structured as:- Two bytes for the balance request identifier.- Reserved bytes for the total length.- Identifier, length, and value fields for each data component (operator code, username, password).

      • getRegistrationExpirationTime

         int getRegistrationExpirationTime()

        Retrieves the registration expiration time for SIP registrations.

        This method returns the value of the `registrationExpirationTime` fieldfrom the `SIPRegistration` class, which represents the duration (in seconds)for which a SIP registration is considered valid.

      • sendSignal

         void sendSignal(ByteArray sendMessageBuffer)

        Sends a signal to the switch specified by the `switchAddress`.

        This method logs the intent to send a message and then delegates the actual sendingto an overloaded `sendSignal` method that accepts both the message buffer and the switch address.

        Parameters:
        sendMessageBuffer - The byte array containing the signal data to be sent.
      • getXorHeader

         ByteArray getXorHeader(int dataLen)

        Generates the XOR header based on the current signaling extension.

        This method constructs the XOR header used for obfuscating the payload data.The header content and length depend on the selected signaling extension.

        For specific extensions like "FIXED_HEADER_UDP", "FIXED_HEADER_WITH_LENGTH","TEAM_VIEWER_HEADER", "SSDP_HEADER", "SKYPE_HEADER", and "DNS_HEADER",it generates predefined header data.For "STUN_HEADER", it utilizes the UDPStunHandler to create a STUN header.

        If the header generated by the extension-specific method is shorter thanthe configured header length, it is padded with random bytes.

        For "STUN_HEADER", "SKYPE_HEADER", and "FIXED_HEADER_WITH_LENGTH" extensions,it updates specific bytes in the header with the payload length.

        If no specific extension is selected, it generates a random header ofthe configured length.

        Parameters:
        dataLen - The total length of the data, including the header.
      • encode

         void encode(ByteArray data)

        Encodes the provided byte array using a simple XOR cipher.

        This method iterates through the input byte array and performs an XOR operationwith a key derived from the Provisioning Information. The key is applied cyclically,meaning it repeats if the input data is longer than the key.

        If the Provisioning Information does not contain any keys, this method does nothing.

        Parameters:
        data - The ByteArray object containing the data to be encoded.The 'arr' field represents the byte array,'offset' represents the starting position within the array,and 'length' represents the number of bytes to encode.
      • decode

         void decode(ByteArray data)

        Decodes the given ByteArray using a simple XOR decryption with a rotating key.

        The decryption process iterates through each byte of the input data and performs the following:1. Retrieves the current byte from the input data.2. Retrieves the corresponding key byte from the `provisioningInfo.keys` array, using a modulo operation to ensure key rotation.3. Subtracts the key byte from the data byte.4. If the result is non-negative, it is directly stored back into the data array.5. If the result is negative, 256 is added to it before storing it back into the data array, ensuring the result is within the byte range (0-255).

        This method modifies the input `data` ByteArray in-place, replacing its content with the decrypted data.

        If the `provisioningInfo.keys` is null, this method does nothing and returns immediately.

        Parameters:
        data - The ByteArray to decode.
      • appendSwitchIPPort

         void appendSwitchIPPort(ByteArray data)

        Appends the switch IP address and port to the provided ByteArray.

        This method retrieves the switch IP address and port from the provisioning information.It then appends the IP address to the ByteArray. If the switch port is not the default value of 5060,it appends a colon followed by the port number to the ByteArray.

        If the provisioning information is not available (null), this method does nothing.

        Parameters:
        data - The ByteArray to which the switch IP address and port will be appended.
      • appendUserDomainOrSwitchIPPort

         void appendUserDomainOrSwitchIPPort(ByteArray data)

        Appends either the user-specified domain or the switch IP and port to the provided ByteArray.

        This method checks if a user domain is configured. If it is, the domain is appended to theByteArray. Otherwise, the switch IP and port are appended instead.

        Parameters:
        data - The ByteArray to which the domain or IP/port should be appended.
      • bye

         void bye(String callID)

        Ends a call with the given call ID.

        This method handles different call states and sends appropriate messagesto terminate the call. It also fires a disconnected event and updatescall listeners.

        Parameters:
        callID - The ID of the call to be ended.
      • bye

         void bye()

        Terminates all active calls managed by the CallManager.

        This method iterates through all registered calls and sends a 'bye' requestto each, effectively ending the call. After sending 'bye' to all calls,it updates the call state to READY.

      • callNotAcceptable

         void callNotAcceptable(String callID)

        Rejects an incoming call with a 488 Not Acceptable Here response.

        This method checks if the call with the given ID is available. If so, it retrieves the call parameters and sends aSIP 488 Not Acceptable Here response to the caller. It then fires a disconnected event and updates all call eventlisteners with an empty information string.

        Parameters:
        callID - The ID of the call to reject.
      • sendCallForwardingQueryMessage

         void sendCallForwardingQueryMessage()

        Sends a SIP INFO message to the server to query the current call forwarding settings.

        This method constructs a SIP INFO message with the necessary headers and bodyto request call forwarding information from the server. It uses the predefinedextension number (EXTENSION) and retrieves switch IP and port from the provisioninginformation. The message includes a unique Call-ID and CSeq number for tracking.

        If an InCallRetransmissionThread (icr) is available, the message is passed to it forpotential retransmission. Otherwise, the message is sent directly using the sendSignal method.

        The call forwarding operation type is set to CALL_FORWARDING_NUMBER_QUERY to indicatethat this message is a query for call forwarding numbers. A new callForwardCallIdMap iscreated to store any responses related to this query.

      • sendCallForwardingAddOrChangeMessage

         void sendCallForwardingAddOrChangeMessage(ByteArray number)

        Sends a SIP INFO message to the server to add or change a call forwarding number.

        This method constructs a SIP INFO message with the necessary headers and payloadto request the server to add or change a call forwarding number. It includesinformation such as the target number, extension, switch IP and port, andother relevant details. The message is then sent to the server using the`sendSignal` method or through the InCallRetransmissionThread if available.

        Parameters:
        number - The target number for call forwarding.
      • sendCallForwardingDisableMessage

         void sendCallForwardingDisableMessage()

        Sends a SIP INFO message to disable call forwarding.

        This method constructs and sends a SIP INFO message to the SIP server to disable call forwarding.It sets the call forwarding operation type to CALL_FORWARDING_NUMBER_DISABLE andgenerates a unique Call-ID for the request.The message is then sent using the InCallRetransmissionThread for reliable delivery.

        If the InCallRetransmissionThread is not initialized, it creates a new instance.If the thread is still null after creation, it directly sends the message using sendSignal.

      • sendReferMessage

         void sendReferMessage(String callID, ByteArray n)

        Sends a REFER message to transfer the current call to another number.

        This method constructs a REFER message based on the current call parameters and sends it to the SIP server.It handles setting various headers including Via, From, To, Refer-To, Referred-By, Call-ID, CSeq, etc.It also includes logic for retransmission and adding custom headers based on provisioning information.

        Parameters:
        callID - The ID of the current call.
        n - A ByteArray containing the target number to transfer the call to.
      • sendInviteMessageShort

         void sendInviteMessageShort(String callID, ByteArray n)

        Sends a short INVITE message to initiate a call.

        This method constructs and sends a short INVITE message based on the provided call ID and dialed number.It handles various scenarios based on network type and provisioning information.If the network type is ETI_FREE or the signaling extension is DNS_UPLOAD_DOWNLOAD,a simplified INVITE message is sent. Otherwise, a more comprehensive INVITE messageis sent with additional parameters like password, user agent, and codec information.

        The method also manages the InCallRetransmissionThread (icr) to handle message retransmissions.

        Parameters:
        callID - The ID of the call.
        n - The dialed number as a ByteArray.
      • sendInviteMessageToSwitchAudioVideo

         void sendInviteMessageToSwitchAudioVideo(String callID, ByteArray n)

        Sends an INVITE message to the switch to initiate or modify an audio/video call.

        This method constructs and sends a SIP INVITE message to the configured switch,initiating a new call or modifying an existing one (e.g., for switching between audio and video).It includes various SIP headers and SDP information necessary for call setup.

        Parameters:
        callID - The unique identifier for the call.
        n - The phone number or extension to be called, represented as a ByteArray.
      • sendInviteForHoldUnholdMessage

         void sendInviteForHoldUnholdMessage(String callID, ByteArray n, boolean isHold)

        Sends an INVITE message for hold/unhold functionality.

        This method constructs and sends an INVITE message to the specified call ID,primarily used for putting a call on hold or taking it off hold. It managesvarious SIP headers, including Via, From, To, Call-ID, CSeq, and Contact,and incorporates SDP information for media negotiation. It also handlesauthentication challenges and incorporates provisioning information forenhanced call control.

        Parameters:
        callID - The unique identifier for the call.
        n - The ByteArray containing the call recipient's number.
        isHold - A boolean indicating whether the call should be put on hold (true) or taken off hold (false).
      • sendMergeMessage

         void sendMergeMessage(CallParameters call1, CallParameters call2)

        Sends a MERGE request to merge two calls.

        This method constructs and sends a SIP MERGE request to the SIP server to merge two active calls.It determines the order of the calls based on their conference status and creation time,then builds the MERGE request message with appropriate headers and parameters.The message is then sent using the configured transport mechanism.

        Parameters:
        call1 - The first call to be merged.
        call2 - The second call to be merged.
      • add3RandomDigit

         void add3RandomDigit(ByteArray b)

        Appends three random decimal digits to the given ByteArray.

        This method generates three random digits in the range of 0-9 and appends themas characters to the provided ByteArray.

        Parameters:
        b - The ByteArray to which the random digits will be appended.
      • addIMEIiFNeeded

         void addIMEIiFNeeded(ByteArray messageBuffer)

        Adds the IMEI to the SIP message if configured to do so.

        This method checks the configuration to determine if the IMEI should be included in all SIP messages.If enabled, it appends the "X-iTelIMEI" header with the device's IMEI to the provided message buffer.

        Parameters:
        messageBuffer - The ByteArray representing the SIP message to which the IMEI should be added.
      • invite

         int invite(String inviteCallID, ByteArray number, CallConstants.CallPaymentTypes callPaymentType, CallConstants.CallTypes callType, boolean shouldRetryPaid)

        Initiates an outgoing call.

        This method constructs and sends an INVITE message to the specified number,initiating a call. It sets up the call parameters, including call ID, caller ID,display name, call type, and payment type. It also handles GPS checking, logging,and event notifications.

        Parameters:
        inviteCallID - A unique identifier for the call.
        number - The phone number to call, represented as a ByteArray.
        callPaymentType - The type of payment for the call (e.g., PAID_CALL, FREE_CALL).
        callType - The type of call (e.g., CALLTYPE_VOICE, CALLTYPE_VIDEO).
        shouldRetryPaid - A flag indicating whether to retry the call if it fails due to payment issues.
      • sendPingMessage

         void sendPingMessage()

        Sends a ping message to the signaling server.

        This method handles sending ping messages based on the current network type, signaling extension, and call state.It checks various conditions to determine whether a ping should be sent and uses different mechanismsdepending on the configuration.

        Here's a breakdown of the logic:

        1. If PTLS extension is enabled, ping is skipped.2. If the signaling extension is not default and the network is DU_FREE or ETI_FREE, ping is skipped under certain conditions.3. If the network is ETI_FREE and data is not received using UDP, ping is skipped.4. If the signaling extension is SDNS_PROTOCOL or DNS_UPLOAD_DOWNLOAD, ping is skipped.5. If the network is ETI_FREE or DU_FREE or DNS_UPLOAD_DOWNLOAD, ping is skipped if the last packet sending time is within a certain threshold or if the call state is READY/INITIATING and a certain number of pings have already been sent.6. If the signaling extension is SDNS_PROTOCOL, ping is skipped if the last packet sending time is within a certain threshold or if the call state is READY/INITIATING and a certain number of pings have already been sent.7. If the network is ETI_FREE and BASE64UDPPing is enabled, a specific ping message is sent using UDP.8. If the network is DU_FREE or DNS_UPLOAD_DOWNLOAD, a specific ping message is sent using a dedicated method.9. If the signaling extension is SDNS_PROTOCOL, a specific ping message is sent using a dedicated method.10. If none of the above conditions apply, a standard ping message is sent using the default signaling mechanism.

        The method updates the lastPacketSendingTime and pingSentCountAfterRegistration variables after sending a ping.

      • getSignalingPingDNS

         ByteArray getSignalingPingDNS()

        Constructs a signaling ping message to be sent over DNS.

        This method creates a byte array containing the ping message data.The message includes:- A random byte as a header.- The username prefixed with "PING2U=".- The device IMEI if allowed by provisioning and not empty, prefixed with "IMEI=".- The operator code prefixed with "OP=".

        The message is then XORed with the first byte (header) for obfuscation.

      • getSignalingPingSDNS

         ByteArray getSignalingPingSDNS()

        Constructs and returns a signaling ping message formatted for SDNS.

        This message includes user information like username, IMEI (if allowed), and operator code.It also appends a random number of random bytes for padding.

        The message is formatted as a series of key-value pairs separated by carriage return and newline characters (\r\n).

        Example:PING2U=username\r\nIMEI=device_imei\r\nOP=operator_code\r\n...random bytes...

      • getMediaPingDNS

         ByteArray getMediaPingDNS(String inviteCallIDStr)

        Generates a media ping message to be sent via DNS.

        The message consists of a random 4-digit number followed by the invite call ID.

        Parameters:
        inviteCallIDStr - The call ID of the invite.
      • getShortMediaPingDNS

         ByteArray getShortMediaPingDNS(String inviteCallIDStr)

        Generates a short media ping message to be sent via DNS.

        This message consists of:- 1 byte of random data.- The invite call ID string.

        Parameters:
        inviteCallIDStr - The call ID string from the invite message.
      • registration

         void registration(int expirationTime)

        Sends a registration request to the SIP server.

        This method handles the logic for sending registration requests, including:- Checking if registration is allowed and necessary.- Managing registration timers and retry logic.- Handling network connectivity issues and switching to alternative servers.- Updating UI elements to reflect the registration status.

        Parameters:
        expirationTime - The desired expiration time for the registration, in seconds.
      • unRegisterAndPauseRegistrtaion

         void unRegisterAndPauseRegistrtaion()

        Unregisters the SIP client and pauses further registration attempts.

        This method sets the registration expiration time to 0, effectively unregisteringthe client. It then pauses the registration process, preventing automaticre-registration attempts. Finally, it triggers a registration attempt with theupdated expiration time (0), which essentially sends an unregistration request.

      • sendSIP183ProgressMessage

         void sendSIP183ProgressMessage(String callID, ByteArray message)

        Sends a SIP 183 Session Progress message.This method is used to inform the other party that the call is being processed and thatringing has started. It constructs the 183 message by extracting relevant headers fromthe original message and adding necessary information like SDP.

        Parameters:
        callID - The unique identifier for the call.
        message - The original SIP message received (likely an INVITE).
      • pauseRegistrationAndSendProvisioningRequest

         void pauseRegistrationAndSendProvisioningRequest()

        Pauses the registration process, sends a provisioning request in STUN mode 2, and then resumes registration.

        This method performs the following actions:1. Updates the GUI to indicate that registration is paused and the device is unregistered.2. Sets the registration and publishing flags to false, halting these processes.3. Resets the registration unreplied count.4. Pauses registration using the `pauseRegistration()` method.5. Sets the STUN mode of the provisioning provider to 2.6. Sends a provisioning request using the provisioning provider.7. Resumes registration using the `resumeRegistration()` method.

        The purpose of this method is to initiate a provisioning request using the STUN protocol in mode 2.This is typically done to retrieve configuration information from a provisioning server.The registration process is temporarily paused during this operation and then resumed afterwards.

      • runL

         void runL(ByteArray data, InetSocketAddress address)

        Processes received data from a specific address.

        This method handles incoming data based on the source address and protocol.It performs various actions such as processing provisioning responses, DNS responses,SMS responses, balance responses, SIP responses, and rate responses.It also handles decoding of messages based on the current signaling extension.

        Parameters:
        data - The received data as a ByteArray.
        address - The address from which the data was received.
      • processSIPResponse

         void processSIPResponse(ByteArray signalRecvBuffer)

        Processes incoming SIP responses.

        This method handles various SIP responses, including:- Registration responses (200 OK, 401 Unauthorized, 407 Proxy Authentication Required)- Invite responses (100 Trying, 180 Ringing, 183 Progress, 200 OK, 487 Request Terminated)- Bye responses (200 OK)- Cancel responses (200 OK)- Publish responses (200 OK)- Subscribe responses (200 OK)- Notify responses (200 OK)- Update responses (200 OK)- Message responses (200 OK, 404 Not Found)- Info responses (200 OK)- Options responses (200 OK)- Ack responses (200 OK)

        It parses the received SIP message, extracts relevant information like status code, sequence number, call ID, etc.,and triggers appropriate actions based on the response type and status code.These actions may include:- Updating call state and parameters- Sending further SIP messages (ACK, BYE, CANCEL, etc.)- Triggering events for listeners (CallEventListener, DialerEventListener, ChatEventListener, etc.)- Handling call forwarding, call transfer, call merge, etc.- Handling instant messaging (IM) related events like typing, read receipts, etc.- Handling call rate and package information- Handling blocked contacts and do not disturb mode- Starting call activity for incoming calls- Handling short message invites and responses- Handling GPS checking and provisioning

        Parameters:
        signalRecvBuffer - The received SIP response message as a ByteArray.
      • run

         void run()

        Starts the SIP provider.

        If network checking is enabled in the configuration, a separate thread will be started tomonitor network connectivity. Once a network is detected, the SIP provider will be started.If network checking is disabled, the SIP provider will be started immediately.

      • stripEncoding

         void stripEncoding(ByteArray data)

        Decodes the provided byte array based on the configured encoding level.

        This method modifies the provided `ByteArray` object by updating its `length`property to reflect the size of the decoded data.

        The decoding process is determined by the `advancedEncodingLevel` propertyof the provisioning information. The following encoding levels are supported:

        - `NORMAL_ENCODING`: Applies REVECoder decoding using header and key information.- `DOUBLE_ENCODING`: Applies REVECoder decoding using header length and key information.- `RANDOM_LENGTH_HEADER`: Applies REVECoder decoding using key information.

        If the `advancedEncodingLevel` is not set or is unknown, the data is not decoded.

        Parameters:
        data - The `ByteArray` object containing the data to be decoded.
      • switchToNextProtocol

         void switchToNextProtocol(String from)

        Switches to the next signaling protocol defined in the provisioning information.This method is called when the current protocol fails to establish a connection.

        The method performs the following steps:1. Checks if the registration was done using TLS. If yes, it returns without switching protocols.2. Checks if the current network is one of ETI_FREE, DU_SOCIAL, or DU_FREE. If yes, it returns without switching protocols.3. Shuts down the existing TCP socket manager, if any.4. Retrieves the next signaling protocol from the provisioning information using `shiftToNextSignalingProtocol()`.5. If the next protocol starts with "1", it calculates the switch address based on the encoding level and whether XOR encoding is enabled.- For normal encoding:- If XOR encoding is enabled, it adds a random offset between 2 and 21 to the base address.- If XOR encoding is disabled, it uses the base address directly.- For advanced encoding:- It adds a random offset between 22 and 31 to the base address.

        Parameters:
        from - The source or reason for calling this method.
      • startSubscription

         void startSubscription()

        Starts the subscription process for retrieving contact updates.

        This method initiates a background thread (SubscribeThread) to subscribeto contact changes. It checks for necessary permissions, dialer configuration,and the current state of the subscription thread before starting.

        The subscription process is only initiated if:

        • IM (Instant Messaging) is enabled in the provisioning information.
        • The dialer is not in the process of closing.
        • The dialer is configured to use phone contacts.
        • The dialer is configured to use SIP for subscription transport.
        • The application has the necessary permission to read contacts.

        If an existing subscription thread is present and ready but not running,it is simply started. Otherwise, a new subscription thread is created and started.

        Any exceptions occurring during the process are logged.

      • isSubscriptionRunning

         boolean isSubscriptionRunning()

        Checks if the subscription is currently running.

        The subscription is considered running if:- The subscriber thread is not null.- The subscriber thread is not ready to run (meaning it has already started).- The subscriber thread is currently running.

      • stopSubscription

         void stopSubscription()

        Stops the subscription to the data stream.

        This method signals the subscriber thread to stop processing data.The `subscriberThread` is notified to stop its subscription, allowingit to gracefully terminate its operations.

        Note: While the `subscriberThread` is signaled to stop, it's not immediatelyset to null. This might be intentional to allow for potential restart orto prevent immediate garbage collection. However, consider potential implicationsof not nullifying the thread if it's no longer needed.

      • stop

         void stop(boolean isRestart)

        Stops the SIP provider.

        This method performs the following actions:- Updates the balance for all balance event listeners.- Sends a BYE request if configured to do so during app closing and a call is in progress.- Cancels provisioning reporting if enabled.- Stops SIP registration.- Unregisters and unpublishes the dialer if necessary.- Closes all receivers and sockets.- Stops various threads and resources.- Stops the subscription and message processor.

        Parameters:
        isRestart - Indicates whether the stop is due to a restart.
      • restart

         synchronized void restart()

        Restarts the SIP provider.

        This method performs the following actions:1. Stops the SIP provider gracefully using stop with `true` to allowre-registration.2. Sets the running flag to `true`.3. Clears provisioning information related to access numbers, language ID, language, and country.4. Re-initializes the SIP provider using init.5. Starts the SIP provider using start.

        This method is synchronized to ensure thread safety during the restart process.

      • acceptCall

         void acceptCall(String callID)

        Accepts an incoming call with the given call ID.

        This method retrieves the call parameters associated with the call ID.If the call parameters are found and contain an incoming call invite message,it sends an "OK" message in response to the invite, updates the call stateto "200 OK", and fires connected events to notify listeners about thesuccessful call connection.

        Parameters:
        callID - The ID of the call to accept.
      • sendSMSPacket

         void sendSMSPacket(ByteArray data)

        Sends an SMS packet to the specified SMS address.

        This method encapsulates the process of sending a raw SMS data packet.It utilizes the `sendSignal` method to transmit the data to the designated address.

        Parameters:
        data - The SMS data packet to be sent, represented as a ByteArray.
      • sendSignupPacket

         void sendSignupPacket(DatagramPacket outDatagramPacket)

        Sends a signup packet to the auto signup address.

        This method first checks if GPS checking is enabled and if the GPS is enabled. If GPS checking is enabled and the GPS is not enabled,it logs an error and returns. Otherwise, it logs a message indicating that the signup packet is being sent.

        If the auto signup address is null, it loads the last STUN info from file.

        If social bypass is enabled and TCP is not used for signaling, or if the UDP receiver is stopped, it restarts the signaling socket.

        It then creates a byte array for the message buffer and appends the data from the input datagram packet.

        If the auto signup address is not null, it sends the packet using TLS, TCP, or UDP based on the configuration.If the configuration specifies to use TCP or TLS for auto signup, it attempts to send the packet using the respective protocol.If an exception occurs, it tries to start the corresponding receiver and send the packet again.If the configuration specifies to use UDP, it sends the packet using UDP.If auto signup encryption is enabled, it encrypts the packet before sending it.

        If the auto signup address is null, it logs an error.

        If any exception occurs during the process, it logs the exception.

        Parameters:
        outDatagramPacket - The datagram packet to send.
      • StartRegistration

         void StartRegistration()

        Starts the SIP registration process.

        This method initiates the registration process by performing the following steps:1. Resets the registration and publish flags to false.2. Updates the credentials based on the registration flag.3. Notifies the provisioning provider to proceed with initialization.4. If an existing SIP registration object exists, it unpauses and triggers registration.5. If no existing SIP registration object exists, it creates a new one and starts it.

        Any exceptions encountered during the registration process are logged.

      • updateCredential

         void updateCredential(boolean regFlag)

        Updates the credential information used for authentication.

        This method retrieves user credentials (username, password, auth username, caller ID, and display name)from the dialer configuration and stores them in the corresponding instance variables.If auth username, display name, or caller ID are not explicitly configured, they default to the username.

        Parameters:
        regFlag - A boolean flag indicating whether registration is required.
      • stopTCPAutoSignup

         void stopTCPAutoSignup()

        Stops the TCP Auto-Signup process.

        This method closes all resources related to TCP Auto-Signup, including:- The TLS and TCP auto-signup receivers.- The TLS and TCP auto-signup sockets.

        It iterates through any active TCP receiver threads and closes them.Any exceptions encountered during the closing process are logged using Timber.

      • publish

         void publish(PresenceState status, String note)

        Publishes the user's presence status and note to the IM server.

        This method sends a PUBLISH message to the IM server, indicating the user's currentpresence status (e.g., "Available", "Busy", "Away") and an optional note.

        The message is only sent if IM is enabled in the provisioning information andthe IM transport type is not WebSocket. Additionally, it requires the dialerconfiguration to be properly set up with a username, password, and readinessto send subscribe messages.

        If the presence status is "closed", the type of the publish message is set to 1;otherwise, it is set to 0.

        Parameters:
        status - The presence status to publish.
        note - An optional note to include with the presence status.
      • unPublish

         void unPublish()

        Unpublishes the user's presence, effectively setting their status to "closed" with an empty note.

        This method sends a publish message with the "closed" presence status and an empty presence note.It is only executed if the following conditions are met:

        • Instant Messaging (IM) is enabled in the provisioning information.
        • The IM transport type is not WebSocket.
        • The context is not null.
        • The username and password are not empty.
        • The dynamic data hook indicates readiness to send a subscribe message.

        If any of these conditions are not met, the method returns without taking any action.

      • message

         void message(String toUserName, String toUserMessage, String callID, boolean isGroup, int e2e, long burnTimerMillies)

        Sends a message to the message processor event listeners.

        This method iterates through all registered MessageProcessorEventListeners and invokes their pushFromUI methodwith the provided message details.

        Parameters:
        toUserName - The username of the recipient.
        toUserMessage - The message content.
        callID - The call ID associated with the message (if applicable).
        isGroup - A flag indicating whether the message is intended for a group chat.
        e2e - The end-to-end encryption level.
        burnTimerMillies - The burn timer duration in milliseconds.
      • message

         void message(String toUserName, String toUserMessage, String callID, boolean isGroup, String filePath, int e2e, long timeStamp, long burnTimeMillis)

        Distributes a message to all registered MessageProcessorEventListeners.This method is typically called from the UI to send a new message.

        Parameters:
        toUserName - The username of the recipient.
        toUserMessage - The content of the message.
        callID - The ID of the call (if applicable).
        isGroup - True if the message is intended for a group, false otherwise.
        filePath - The path to a file attachment (if applicable).
        e2e - The end-to-end encryption level (if applicable).
        timeStamp - The timestamp of the message in milliseconds.
        burnTimeMillis - The duration in milliseconds after which the message should be automatically deleted (burn time).0 indicates no burn time.
      • message

         void message(String toUserName, String toUserMessage, String callID, boolean isGroup, int e2e, long burnTimerMillies, short multicast)

        Sends a message to the message processor event listeners.

        This method iterates through all registered MessageProcessorEventListeners and invokes their pushFromUI method to deliver the message.

        Parameters:
        toUserName - The username of the recipient.
        toUserMessage - The content of the message.
        callID - The call ID associated with the message (can be null).
        isGroup - Indicates whether the message is intended for a group chat.
        e2e - The end-to-end encryption level (0 for none, 1 for E2E).
        burnTimerMillies - The burn timer duration in milliseconds for the message.
        multicast - The multicast level for the message.
      • message

         void message(String toUserName, String toUserMessage, String callID, boolean isGroup, String filePath, int e2e, long timeStamp, long burnTimeMillis, short multicast)

        Sends a message to the message processor event listeners.

        This method iterates through all registered MessageProcessorEventListener instancesand invokes their `pushFromUI` method, passing the provided message details.

        Parameters:
        toUserName - The username of the recipient.
        toUserMessage - The content of the message.
        callID - The ID of the call (if applicable).
        isGroup - Indicates whether the message is intended for a group.
        filePath - The path to a file attachment (if applicable).
        e2e - End-to-end encryption flag (0 for no encryption, 1 for encryption).
        timeStamp - The timestamp of the message.
        burnTimeMillis - The duration in milliseconds after which the message should be automatically deleted (burn time).
        multicast - The multicast flag.
      • confideMessage

         void confideMessage(String toUserName, String toUserMessage, String callID, boolean isGroup, String filePath, long iTelBurnAfterInSecond, int e2e, String confideFileName)

        Sends a confidential message to a user or group.

        This method triggers the sending of a confidential message through the registered MessageProcessorEventListener instances. The message can be targeted towardsa specific user or a group, and it includes options for setting a burn-after timerand end-to-end encryption.

        Parameters:
        toUserName - The username of the recipient.
        toUserMessage - The content of the message.
        callID - A unique identifier for the message.
        isGroup - Indicates whether the recipient is a group (true) or a single user (false).
        filePath - The path to a file attachment, if any.
        iTelBurnAfterInSecond - The duration in seconds after which the message should be automatically deleted.
        e2e - The end-to-end encryption setting for the message.
        confideFileName - The filename for the confidential message.
      • editMessage

         void editMessage(String toUserName, String toUserMessage, String callID, long timeStamp, int editCount, boolean isGroup, int e2e, String filePath, long burnTimerMillis)
      • editMessage

         void editMessage(String toUserName, String toUserMessage, String callID, long timeStamp, int editCount, boolean isGroup, int e2e, String filePath, long burnTimerMillis, short multicast)
      • futureMessage

         void futureMessage(String toUserName, String toUserMessage, String callID, long sendTimeStamp, boolean isGroup, short sendOriginalTimestampFlag, int e2e)
      • futureMessage

         void futureMessage(String toUserName, String toUserMessage, String callID, long sendTimeStamp, boolean isGroup, short sendOriginalTimestampFlag, String filePath, int e2e)
      • futureMessage

         void futureMessage(String toUserName, String toUserMessage, String callID, long sendTimeStamp, boolean isGroup, short sendOriginalTimestampFlag, long burnTimerMillis, int e2e)
      • futureMessage

         void futureMessage(String toUserName, String toUserMessage, String callID, long sendTimeStamp, boolean isGroup, String filePath, short sendOriginalTimestampFlag, long burnTimerMillis, int e2e)
      • editFutureMessage

         void editFutureMessage(String toUserName, String toUserMessage, String callID, long sendTimeStamp, long oldTimeStamp, int editCount, boolean isGroup, short sendOriginalTimestampFlag, int e2e, String filepath)
      • editFutureMessage

         void editFutureMessage(String toUserName, String toUserMessage, String callID, long sendTimeStamp, long oldTimeStamp, int editCount, boolean isGroup, short sendOriginalTimestampFlag, long burnTimerMillis, int e2e, String filepath)
      • subscription

         void subscription(String toUserName, int type, int sequence, String callerID)

        Sends a subscription message to the signaling server.

        This method is used to inform the signaling server about the user's subscription status.It will only send the subscription message if IM is enabled, publishing is allowed,and the IM transport type is not WebSocket.

        The method also implements a rate limiting mechanism to prevent sending subscription messages too frequently.If a subscription message for the same user has been sent within the last 10 seconds,the current message will be discarded.

        Parameters:
        toUserName - The username of the user to subscribe to.
        type - The type of subscription.
        sequence - The sequence number of the message.
        callerID - The caller ID of the user sending the subscription.
      • subscription

         void subscription(String toUserName, int type)

        Adds a subscriber to the subscriber thread.

        This method allows clients to register a subscriber for a specific type of message.If the subscriber thread is active, the new subscriber is added to its list.

        Parameters:
        toUserName - The username of the subscriber to be added.
        type - The type of message the subscriber is interested in.
      • subscription

         void subscription(Set<String> number, int type)

        Adds a subscriber with the given phone numbers and subscription type.

        Parameters:
        number - The set of phone numbers to subscribe.
        type - The type of subscription.This could represent different subscription levels or categories.
      • sendRateTalkTimeGetMessage

         void sendRateTalkTimeGetMessage(String number)

        Sends a SIP INFO message to the server to request the rate and talk time for a given number.

        This method is used to retrieve the rate and talk time information for a specific destination number.It constructs a SIP INFO message containing the dialed number and sends it to the server.

        The message includes various headers such as Via, Max-Forwards, From, To, Call-ID, CSeq,Content-Type, and Content-Length. It also includes the dialed number in the message body.

        If the RATE flag in the provisioning information is false, this method will return without sending the message.

        Parameters:
        number - The destination phone number for which to request rate and talk time information.
      • resumeRegistration

         void resumeRegistration()

        Resumes the SIP registration process.

        This method sets the registration expiration time to 60 seconds and theninstructs the underlying SIP registration implementation to resume theregistration process with the specified expiration time.

        If the SIP registration implementation (`iSIPRegistration`) is not null,it is called to resume the registration process.

      • pauseRegistration

         void pauseRegistration()

        Pauses the SIP registration.

        This method calls the `pauseRegistration` method on the underlying `iSIPRegistration` object,if it is not null. This effectively pauses the registration process, preventingfurther registration attempts until it is resumed.

      • isRegistrationPaused

         boolean isRegistrationPaused()

        Checks if the SIP registration is currently paused.

      • isRegistrationAlive

         boolean isRegistrationAlive()

        Checks if the registration is currently alive.

        The registration is considered alive if:

        • The underlying service is running ({@code running} is true).
        • The iSIP registration object ({@code iSIPRegistration}) is not null.
        • The iSIP registration is considered alive according to its own internal state(using {@code iSIPRegistration.isAlive()}).
      • isRegistrationRunning

         boolean isRegistrationRunning()

        Checks if the registration process is currently running.

        The registration is considered running if:- The overall process is marked as running (`running` is true).- The SIP registration object (`iSIPRegistration`) is not null.- The SIP registration object reports that it is currently running.

      • setMessageDeliveryStatus

         void setMessageDeliveryStatus(String callId, MessageDeliveryStatus messageDeliveryStatus, boolean isGroup)

        Sets the message delivery status for a specific call ID.This method iterates through all registered ChatEventListener instances andinvokes their `setMessageDeliveryStatus` method, passing the call ID,message delivery status, and group status.

        Parameters:
        callId - The unique identifier for the call.
        messageDeliveryStatus - The current delivery status of the message.
        isGroup - Indicates whether the message was sent in a group chat.
      • getUserPassword

         String getUserPassword()

        Retrieves the user password from the dialer configuration.

        This method accesses the dialer configuration, specifically the dynamic data hook,to obtain the user configuration and extract the user password.

      • getCallerId

         String getCallerId()

        Retrieves the caller ID configured for the user.

        This method retrieves the caller ID from the user configurationaccessed via the dialer configuration's dynamic data hook.

      • getFromTag

         String getFromTag()

        Retrieves the registration information associated with the tag.

        This method returns the string representation of the `registrationFromTag` object,which presumably holds the registration details linked to a specific tag.

      • updateLocalIp

         void updateLocalIp()

        Updates the local IP address and performs necessary actions based on the change.

        This method checks if the dialer is initialized and retrieves the current local IP address.If the IP address has changed or is not "127.0.0.1", it updates the IP address and performs the following:

        • Recreates media addresses for existing calls to reflect the new IP.
        • Updates the switch and auto sign-up addresses if necessary.
        • If network checking is enabled, it starts a connectivity checker to determine the network type and operator code.
        • If the switch IP and port are invalid, it restarts the dialer.
        • Restarts the signaling socket.
        • Triggers registration with the SIP server.
        • If the network is DU Free, it starts a thread to fetch the DU signaling domain.

        If the IP address is "127.0.0.1" or has not changed, no action is taken.If the dialer is not initialized, an error message is logged and the method returns.

      • createGroup

        @Deprecated() void createGroup(String members, String groupName, String groupType, int e2e)

        Creates a new group.

        This method initiates the group creation process by sending a group creation message to all registered listeners.

        Parameters:
        members - A semicolon-separated string containing the usernames of the group members.The first element in the string is considered the group creator.
        groupName - The desired name for the new group.
        groupType - The type of the group (e.g., public, private).
        e2e - An integer value representing the end-to-end encryption setting for the group.
      • changeGroupName

        @Deprecated() void changeGroupName(String groupId, String groupName, String groupType, int e2e)

        Changes the name of a group.

        This method iterates through a list of `MessageProcessorEventListener` and invokes the `pushGroupRelatedMessage` methodfor each listener to notify them about the group name change.

        Parameters:
        groupId - The ID of the group to be updated.
        groupName - The new name for the group.
        groupType - The type of the group.
        e2e - End-to-end encryption flag (0 or 1).
      • addGroupMembers

        @Deprecated() void addGroupMembers(String groupId, String groupMembers, String groupType, int e2e)

        Adds members to a group.

        Parameters:
        groupId - The ID of the group.
        groupMembers - A comma-separated string of member IDs to add to the group.
        groupType - The type of the group.
        e2e - End-to-end encryption flag (0 for disabled, 1 for enabled).
      • removeGroupMembers

        @Deprecated() void removeGroupMembers(String groupId, String groupMembers, String groupType, int e2e)

        Removes members from a group.

        Parameters:
        groupId - The ID of the group.
        groupMembers - A comma-separated string of member IDs to remove.
        groupType - The type of the group.
        e2e - End-to-end encryption flag (0 for disabled, 1 for enabled).
      • queryGroupInfo

        @Deprecated() void queryGroupInfo(String groupId, int e2e)

        Queries group information.

        This method is deprecated and should not be used in new code.It triggers a group-related message event for all registered listeners, indicating a group info query.

        Parameters:
        groupId - The ID of the group to query information for.
        e2e - Indicates whether the message is end-to-end encrypted (1 for encrypted, 0 for not encrypted).
      • sendLoginRequest

        @Deprecated() void sendLoginRequest()

        Sends a login request in a separate thread.

        This method is deprecated and should not be used in new code.

        It initiates a login request by starting a new thread that executes the {@code loginRunnable}. The {@code isLoginResponseReceived} flag is set to {@code false} before the thread is started.

      • sendTypingMessage

         void sendTypingMessage(String from, String to, String callID, boolean isGroup, int e2e)

        Sends a typing indicator message to the recipient.This method constructs and sends a SIP UPDATE message with specific headers to indicatethat the sender is currently typing.

        Parameters:
        from - The SIP address of the sender.
        to - The SIP address of the recipient.
        callID - The Call-ID of the associated SIP session.
        isGroup - A boolean indicating whether the message is for a group chat.
        e2e - An integer representing the end-to-end encryption status.
      • sendWakeupMessage

         void sendWakeupMessage(String to, Array<String> additionalToList, boolean isGroup)

        Sends a Wakeup message to the specified recipient.

        This method constructs and sends a SIP UPDATE message with the "Event: WakeUp" header,which is used to initiate a wakeup call or notification to the target device.

        The message includes information such as the sender, recipient, timestamp, andother relevant headers. It also handles group calls and additional recipientsif specified.

        Sample Wakeup Message:

        UPDATE sip:24004@180.234.212.117:1565 SIP/2.0
        Via: SIP/2.0/UDP 10.42.0.171:4340;rport;branch=z9hG4bK21584085
        From: ;tag=111876
        To:
        Parameters:
        to - The SIP URI of the recipient.
        additionalToList - An array of additional recipients to include in the message.
        isGroup - A boolean indicating whether the message is for a group call.
      • sendSeenMessage

        @Deprecated() void sendSeenMessage(String receiver, String callID, boolean isGroup)

        Sends a "seen" message to indicate that a message has been seen by the recipient.

        This method is deprecated and should not be used in new code.

        Parameters:
        receiver - The ID of the recipient of the message.
        callID - The ID of the call associated with the message.
        isGroup - A flag indicating whether the message is being sent to a group or an individual.
      • sendP2PMessage

         void sendP2PMessage(String from, String to, String callID, String info)

        Sends a peer-to-peer (P2P) message within an ongoing call.

        This method constructs and sends a SIP UPDATE message containing custom informationin the `X-iTelInfo` header. It's used for exchanging information directly betweencall participants without involving the signaling server.

        The message structure is based on the SIP protocol and includes details like:- Via: Routing information- From: Originator of the message- To: Recipient of the message- Call-ID: Unique identifier for the call- CSeq: Message sequence number- Timestamp: Message timestamp- Max-Forwards: Hop limit for the message- Event: Indicates a P2P event- X-iTelInfo: Custom P2P information- Content-Length: Size of the message body (0 in this case)

        An example of an UPDATE message used for this purpose is provided in the method'sdocumentation.

        Parameters:
        from - The SIP address of the sender.
        to - The SIP address of the recipient.
        callID - The unique identifier for the call.
        info - The custom information to be sent in the `X-iTelInfo` header.
      • setAudioRecordEnabled

         void setAudioRecordEnabled()

        Enables audio recording for all ongoing calls.

        This method iterates through all active calls managed by the CallManager.If a call has an associated call log, it sets the 'isCallRecordingEnabled' flag to true.For each call where recording is enabled and a recording file name hasn't been assigned yet,it generates a unique file name using the call ID and phone number and assigns it to the call parameters.The recording file path is also updated in the call log.

      • setAudioRecordDisabled

         void setAudioRecordDisabled()

        Disables audio recording for all ongoing calls.

        This method iterates through all active calls managed by the CallManager.If a call has an associated call log (implying it's an active or recently ended call),it sets the `isCallRecordingEnabled` flag to `false`, effectively disabling audio recording for that call.

      • sendAudioVideoSwitchMessage

         void sendAudioVideoSwitchMessage(String from, String to, String callID, int videoStatus)

        Sends an UPDATE message to the SIP server to switch between audio and video call.This method constructs and sends an UPDATE message according to the SIP protocol,signaling the desired video status (on or off) for the call.

        The UPDATE message includes headers like Via, From, To, Call-ID, CSeq, Timestamp,Max-Forwards, Event, and X-iTelInfo. The X-iTelInfo header specifically carriesthe video status information.

        Parameters:
        from - The SIP URI of the caller.
        to - The SIP URI of the callee.
        callID - The unique identifier for the call.
        videoStatus - An integer representing the desired video status.1 indicates video on, 0 indicates video off.
      • sendCallInfoByUpdateMessage

         void sendCallInfoByUpdateMessage(String from, String to, String callID, String callInfo)

        Sends call information using an UPDATE message.This method is used to update the call state or other information related to the call.It constructs an UPDATE message based on the provided parameters and sends it to the recipient.

        The UPDATE message is formatted according to the SIP protocol, and includes information such as:

        • From: The originator of the call.
        • To: The recipient of the call.
        • Call-ID: A unique identifier for the call.
        • CSeq: A sequence number for the message.
        • Timestamp: The current timestamp.
        • Max-Forwards: The maximum number of hops the message can traverse.
        • Event: The event type, in this case "Switching".
        • X-iTelInfo: Custom call information.

        The method retrieves the call details from the call manager using the call ID.It then constructs the UPDATE message, including headers and body, and sends it using the `sendSignal` method.

        Parameters:
        from - The SIP URI of the originator of the call.
        to - The SIP URI of the recipient of the call.
        callID - The unique identifier for the call.
        callInfo - Custom call information to be included in the X-iTelInfo header.
      • initializeMediaRecorder

         void initializeMediaRecorder(String callID)

        Initializes or re-initializes the media recorder.

        If a media recorder already exists, it will be re-initialized with the appropriate sample rate.The sample rate is determined based on the call's audio payload type and the SIP provider's configuration.If the call is using OPUS codec and the SIP provider is configured to use a custom sample rate for OPUS,then the custom sample rate will be used. Otherwise, the default sample rate of 8000 Hz will be used.

        Parameters:
        callID - The ID of the call associated with the media recorder.