0

I'm trying to run the Jain-SIP example application in Android, found here: https://github.com/usnistgov/jsip/blob/master/src/examples/android/simplecallsetup/Shootist.java

The code returns an error when it tries to create a listening point at the following line

udpListeningPoint = sipStack.createListeningPoint("127.0.0.1", 5060, transport);

The code can be found on the github page linked above.

Do you know what might be causing the error?

The example given on the github for java works fine in IntelliJ. I'm using the following dependency for Jain-SIP:

compile group: 'javax.sip', name: 'android-jain-sip-ri', version: '1.3.0-91'

I'm using Android Studio with Ubuntu 18.04.2 LTS.

My MainActivity class is as follows

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new Shootist().init();
    }
}

The entire error output is below


07/23 15:30:37: Launching app
$ adb shell am start -n "com.example.jainsiptestapplication/com.example.jainsiptestapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Waiting for process to come online
Connected to process 23998 on device Pixel_2_API_29 [emulator-5554]
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/testapplicatio: JIT profile information will not be recorded: profile file does not exits.
I/chatty: uid=10154(com.example.jainsiptestapplication) identical 10 lines
W/testapplicatio: JIT profile information will not be recorded: profile file does not exits.
I/InstantRun: starting instant run server: is main process
W/testapplicatio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/testapplicatio: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
W/System.err: log4j:WARN No appenders could be found for logger (shootist).
    log4j:WARN Please initialize the log4j system properly.
I/System.out: createSipStack android.gov.nist.javax.sip.SipStackImpl@226a293
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/System.out: java.net.SocketException: socket failed: EPERM (Operation not permitted)
W/System.err: android.javax.sip.InvalidArgumentException: java.net.SocketException: socket failed: EPERM (Operation not permitted)
        at android.gov.nist.javax.sip.SipStackImpl.createListeningPoint(SipStackImpl.java:1677)
        at com.example.jainsiptestapplication.Shootist.init(Shootist.java:280)
        at com.example.jainsiptestapplication.MainActivity.onCreate(MainActivity.java:13)
        at android.app.Activity.performCreate(Activity.java:7783)
        at android.app.Activity.performCreate(Activity.java:7772)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7319)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)
    Caused by: java.io.IOException: java.net.SocketException: socket failed: EPERM (Operation not permitted)
        at android.gov.nist.javax.sip.stack.UDPMessageProcessor.<init>(UDPMessageProcessor.java:169)
        at android.gov.nist.javax.sip.stack.OIOMessageProcessorFactory.createMessageProcessor(OIOMessageProcessorFactory.java:46)
        at android.gov.nist.javax.sip.stack.SIPTransactionStack.createMessageProcessor(SIPTransactionStack.java:2509)
        at android.gov.nist.javax.sip.SipStackImpl.createListeningPoint(SipStackImpl.java:1657)
        ... 17 more
    Caused by: java.net.SocketException: socket failed: EPERM (Operation not permitted)
        at libcore.io.IoBridge.socket(IoBridge.java:662)
        at java.net.PlainDatagramSocketImpl.datagramSocketCreate(PlainDatagramSocketImpl.java:197)
        at java.net.AbstractPlainDatagramSocketImpl.create(AbstractPlainDatagramSocketImpl.java:93)
        at java.net.DatagramSocket.createImpl(DatagramSocket.java:357)
        at java.net.DatagramSocket.<init>(DatagramSocket.java:259)
        at java.net.DatagramSocket.<init>(DatagramSocket.java:319)
W/System.err:     at android.gov.nist.core.net.DefaultNetworkLayer.createDatagramSocket(DefaultNetworkLayer.java:98)
        at android.gov.nist.javax.sip.stack.UDPMessageProcessor.<init>(UDPMessageProcessor.java:144)
        ... 20 more
    Caused by: android.system.ErrnoException: socket failed: EPERM (Operation not permitted)
        at libcore.io.Linux.socket(Native Method)
        at libcore.io.ForwardingOs.socket(ForwardingOs.java:217)
        at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:370)
        at libcore.io.ForwardingOs.socket(ForwardingOs.java:217)
        at libcore.io.IoBridge.socket(IoBridge.java:658)
        ... 27 more
I/System.out: java examples.shootist.Shootist 
    >>>> is your class path set to the root?
I/testapplicatio: System.exit called, status: 0
I/AndroidRuntime: VM exiting with result code 0, cleanup skipped.
Application terminated.
  • It appears to be working fine now. I believe what solved it was uninstalling and reinstalling the app on the emulator. –  Jul 23 '19 at 13:00
  • possible duplicate - https://stackoverflow.com/questions/56582336/permission-for-sockets-android-manifest?noredirect=1&lq=1 – second Jul 23 '19 at 13:04

0 Answers0