i have question regarding implementing sip libraray , i have used it in test client as a service module , i have coded the the sip code from example was published previously in the forum , the code is as follows this is my Service Module :
Dim Sip As Sip
Dim CurrentCall As SipAudioCall
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
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", "[email protected]","xxxx")
' Sip.Initialize("SIP","xxxx","xxxx.onsip.com","xxxx")
Sip.register
If Sip.IsInitialized = True Then
ToastMessageShow("SIP Intialized.", True)
End If
End If
End If
End Sub
Sub Service_Destroy
End Sub
Sub SIP_Registering
Log("Registering")
ToastMessageShow("Registering", True)
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)
' Main.Connect_peer.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
CurrentCall.StartAudio 'Start the audio
CurrentCall.SpeakerMode = True
ToastMessageShow("Call established", True)
End Sub
'Incoming call
Sub SIP_CallRinging (IncomingCall As SipAudioCall)
Log("CallRinging")
ToastMessageShow("Ringing from: " & IncomingCall.PeerUri, True)
CurrentCall = IncomingCall
End Sub
but i keep getting this error in the log :
Failed, ErrorCode=-9, Message=0
when ever the app is trying to register , i have made some efforts to debug it o see weather it actually sent the request to the server , i have changed the host uri and made it wrong as "xxxx.onsip.comxxx" just to see weather it wold give me network error or not but still get the same error as errorcode= -9 .
i have also installed "Csipsimple" client fom Google play market , and then used the same uri "xxxx.onsip.com" and username and password , and csipsimple client connected successfully , which meant that the registration process should be successful also with the b4a code , but i think as of my debugging that my code above does not even connect to the sip server the problem is in the Register process, i don't get "registering" at all, i get "SIP Intialized." but after that i always get error code = -9 , i am using the same phone "samsung galaxy 3 mini"
I also have included this line in the manifest file :
AddPermission (android.permission.USE_SIP)
my question Why do i keep getting
Failed, ErrorCode=-9, Message=0
always
I will appreciate any help
Thanks
Dim Sip As Sip
Dim CurrentCall As SipAudioCall
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
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", "[email protected]","xxxx")
' Sip.Initialize("SIP","xxxx","xxxx.onsip.com","xxxx")
Sip.register
If Sip.IsInitialized = True Then
ToastMessageShow("SIP Intialized.", True)
End If
End If
End If
End Sub
Sub Service_Destroy
End Sub
Sub SIP_Registering
Log("Registering")
ToastMessageShow("Registering", True)
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)
' Main.Connect_peer.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
CurrentCall.StartAudio 'Start the audio
CurrentCall.SpeakerMode = True
ToastMessageShow("Call established", True)
End Sub
'Incoming call
Sub SIP_CallRinging (IncomingCall As SipAudioCall)
Log("CallRinging")
ToastMessageShow("Ringing from: " & IncomingCall.PeerUri, True)
CurrentCall = IncomingCall
End Sub
but i keep getting this error in the log :
Failed, ErrorCode=-9, Message=0
when ever the app is trying to register , i have made some efforts to debug it o see weather it actually sent the request to the server , i have changed the host uri and made it wrong as "xxxx.onsip.comxxx" just to see weather it wold give me network error or not but still get the same error as errorcode= -9 .
i have also installed "Csipsimple" client fom Google play market , and then used the same uri "xxxx.onsip.com" and username and password , and csipsimple client connected successfully , which meant that the registration process should be successful also with the b4a code , but i think as of my debugging that my code above does not even connect to the sip server the problem is in the Register process, i don't get "registering" at all, i get "SIP Intialized." but after that i always get error code = -9 , i am using the same phone "samsung galaxy 3 mini"
I also have included this line in the manifest file :
AddPermission (android.permission.USE_SIP)
my question Why do i keep getting
Failed, ErrorCode=-9, Message=0
always
I will appreciate any help
Thanks