Android Question Error with SIP library example

Semendey

Member
I'm trying to run an example from the SIP library on a device with Android 13
I made edits to the example manifest:
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30"/>
And also changed the connection string to my data.
When I run it, I get an error:


--------- beginning of main
** Activity (main) Create (first time) **
main_activity_create (java line: 364)
android.net.sip.SipException: SipService is dead and is restarting...
at android.net.sip.SipManager.checkSipServiceConnection(SipManager.java:205)
at android.net.sip.SipManager.open(SipManager.java:266)
at anywheresoftware.b4a.objects.SIP.Register(SIP.java:169)
at anywheresoftware.b4a.samples.sip.main._activity_create(main.java:364)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.samples.sip.main.afterFirstLayout(main.java:105)
at anywheresoftware.b4a.samples.sip.main.access$000(main.java:17)
at anywheresoftware.b4a.samples.sip.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8410)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.Exception
... 17 more
android.net.sip.SipException: SipService is dead and is restarting...
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **



Can you tell me what this means and how to fix it?
 

Semendey

Member
Good afternoon, below is the code and log

kod:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
    #ApplicationLabel: Sip
    #VersionCode: 2
    #VersionName: 1.01
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

Sub Process_Globals
    Dim Sip As Sip
    Dim CurrentCall As SipAudioCall
End Sub
Sub Globals
    Dim mute As ToggleButton
    Dim btnAnswer As Button
    Dim btnMakeCall As Button
    Dim btnEndCall As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
    If Sip.IsInitialized = False Then
        'Check if SIP and VOIP are supported.
        If Sip.IsSipSupported = False Or Sip.IsVoipSupported = False Then
            Log("Not supported.")
            ToastMessageShow("SIP not supported.", True)
        Else
            'Register with the VOIP service
            Sip.Initialize2("SIP", "sip:semendey@iptel.org", "Semendey1!")
            Log("Sip.Register")
            Sip.AutoRegistration = True
            
            Sip.Register
            
        End If
    End If
    Activity.LoadLayout("1")
End Sub

Sub SIP_Registering
    Log("Registering")
End Sub

Sub SIP_RegistrationFailed (ErrorCode As Int, ErrorMessage As String)
    Log("Failed, ErrorCode=" & ErrorCode & ", Message=" & ErrorMessage)
    ToastMessageShow("Registration failed.", True)
End Sub

Sub SIP_RegistrationDone (ExpiryTime As Long)
    Log("RegistrationDone, ExpiryTime=" & ExpiryTime)
    ToastMessageShow("SIP registered sucessfully", True)
    btnMakeCall.Enabled = True
End Sub
Sub SIP_CallEstablished
    'Check that we are not already in a call.
    'Seems like this event can be raised by the SIP service multiple times.
    If CurrentCall.IsInCall Then Return
    Log("CallEstablished")
    CurrentCall.StartAudio 'Start the audio
    CurrentCall.SpeakerMode = True
    ToastMessageShow("Call established", True)
End Sub

Sub SIP_Calling
    Log("Calling")
End Sub
Sub SIP_CallEnded
    Log("CallEnded")
    If CurrentCall.IsInitialized Then CurrentCall.EndCall
End Sub
'Incoming call
Sub SIP_CallRinging (IncomingCall As SipAudioCall)
    Log("CallRinging")
    ToastMessageShow("Ringing from: " & IncomingCall.PeerUri, True)
    CurrentCall = IncomingCall
End Sub

'Answers an incoming call
Sub btnAnswer_Click
    If CurrentCall.IsInitialized And CurrentCall.IsInCall = False Then CurrentCall.AnswerCall(30)
End Sub

Sub SIP_CallError (ErrorCode As Int, ErrorMessage As String)
    Log("CallError, ErrorCode=" & ErrorCode & ", ErrorMessage=" & ErrorMessage)
End Sub
Sub Activity_Pause(UserClosed As Boolean)
    If UserClosed Then
        Sip.Close
    End If
End Sub
Sub Activity_Resume

End Sub

Sub mute_CheckedChange(Checked As Boolean)
    If CurrentCall.IsInitialized Then
        Log(CurrentCall.IsMuted)
        If CurrentCall.IsMuted <> Checked Then CurrentCall.ToggleMute
    End If
End Sub
Sub btnMakeCall_Click
    'Makes a call.
    'The audio will start after the CallEstablished event is raised.
    CurrentCall = Sip.MakeCall("sip:8355@ideasip.com", 30)
End Sub


Sub btnEndCall_Click
    If CurrentCall.IsInitialized Then CurrentCall.EndCall
End Sub





log:
--------- beginning of main
Copying updated assets files (1)
** Activity (main) Create (first time) **
Sip.Register
Error occurred on line: 33 (Main)
android.net.sip.SipException: SipService is dead and is restarting...
    at android.net.sip.SipManager.checkSipServiceConnection(SipManager.java:205)
    at android.net.sip.SipManager.open(SipManager.java:266)
    at anywheresoftware.b4a.objects.SIP.Register(SIP.java:169)
    at anywheresoftware.b4a.samples.sip.main._activity_create(main.java:415)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.samples.sip.main.afterFirstLayout(main.java:105)
    at anywheresoftware.b4a.samples.sip.main.access$000(main.java:17)
    at anywheresoftware.b4a.samples.sip.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:211)
    at android.os.Looper.loop(Looper.java:300)
    at android.app.ActivityThread.main(ActivityThread.java:8410)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.Exception
    ... 21 more
** Activity (main) Resume **
 
Upvote 0

Semendey

Member
Good day
Unfortunately, it is impossible to develop a full-fledged application on this library, because there are several problems
1. EndCall - breaks only the established connection, but does not work when breaking an unaccepted call (rejection on the initiative of the caller or rejection on the receiving side)
2. ToggleMute - changes the IsMuted parameter, but does not turn off the microphone
3. SpeakerMode = False - does not turn off the microphone

Unfortunately, I need to look for other options

I found these library options, but my knowledge is not enough to test them in B4A

 
Upvote 0
Top