VoiSmart / pjsip-android

SIP Service for Android based on PJSIP
http://www.pjsip.org/
Apache License 2.0
290 stars 140 forks source link

PJSIP Android

NOTICE! This project is experimental, so don't use it in production! No support is provided and only bug fixes and pull requests can be accepted.

What you need to work with this library:

Architecture

Architecture

This project wraps the standard PJSUA2 bindings in a background service and completely hides SIP from the rest of the application, to be able to have VoIP capabilities at a high level of abstraction. You can talk to the service using static methods and you will receive broadcast intents as a response. To talk to the service, refer to SipServiceCommand static methods. To receive events from the service, extend BroadcastEventReceiver. To see which events are emitted by the service, refer to BroadcastEventEmitter. All the commands that you will send to the service will get executed in the background and without blocking your main thread. Once the service has done the requested job or operation, it will notify you with a broadcast intent. So, you don't risk blocking your UI thread in any way.

Native PJSIP library for Android is compiled using PJSIP Android Builder

State of the art

What is tested and working

What is missing (contributions are welcome)

Used Libraries versions

Logging

This library ships with a default logger which logs with the default Android Log class and a default DEBUG loglevel. You can customize such behaviour by either:

  1. Setting a specific loglevel (see Logger#setLogLevel)
  2. Setting your own LoggerDelegate. E.g.:

    class SipServiceLogger extends Logger.LoggerDelegate {
        @Override
        public void error(String tag, String message) {
            Timber.tag(tag).e(message);
        }
    
        @Override
        public void error(String tag, String message, Throwable exception) {
            Timber.tag(tag).e(exception, message);
        }
    
        @Override
        public void debug(String tag, String message) {
            Timber.tag(tag).d(message);
        }
    
        @Override
        public void info(String tag, String message) {
            Timber.tag(tag).i(message);
        }
    }

    Timber can be configured as you wish, to log everything or just in debug mode, or log to anywhere.

SIP Logging

To allow see PjSip logs you need to set SipServiceUtils.ENABLE_SIP_LOGGING to true which will log all pjsip logs while in debug mode.

Recompile native libraries

Refer to PJSIP Android Builder