Android Question SIP / VOIP Android Client Help !

İlter Oktay

Member
Licensed User
Longtime User
Hi,

1. I'm using 3CX SIP Server and I would like to register with SIP Library. Is it possible?
2. Can I use Linphone Library in Basic4Android? If yes how?
3. Any suggestion for register to 3CX Server?

Thanks & Regards
 

İlter Oktay

Member
Licensed User
Longtime User

Attachments

  • SIPErr.png
    SIPErr.png
    219.9 KB · Views: 383
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
Try this:

B4X:
'Register with the VOIP service extension "example 101"

'works Sip.Initialize2("SIP", "[email protected]", "101ohbe") This works with asterisk systems

Sip.Initialize2("SIP", "[email protected]", "101ohbe")

it works for mine. :)

p.s Give me a Like if you find my help useful.
 
Upvote 0

İlter Oktay

Member
Licensed User
Longtime User
Try this:

B4X:
'Register with the VOIP service extension "example 101"

'works Sip.Initialize2("SIP", "[email protected]", "101ohbe") This works with asterisk systems

Sip.Initialize2("SIP", "[email protected]", "101ohbe")

it works for mine. :)

p.s Give me a Like if you find my help useful.

Thanks for you quick reply.
I'm using 3CX SIP server and getting
"Failed, ErrorCode=-5, Message=registration timed out"
 
Upvote 0

İlter Oktay

Member
Licensed User
Longtime User
My code

#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", "[email protected]", "101ohbe")
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:[email protected]", 30)
End Sub


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

giga

Well-Known Member
Licensed User
Longtime User
I don't see where you specified the Profile name for the device and also the Dialplan for that account/extension

example:
B4X:
'Register with the VOIP service
Sip.Initialize2("SIP", "[email protected]", "101ohbe")
Sip.Register
Sip.ProfileName = Samsung
Sip.OutboundProxy = DialPlan1

also verify the password in your 3CX is 101ohbe
 
Upvote 0

İlter Oktay

Member
Licensed User
Longtime User
I'm not using Profile Name and OutboundProxy. I'm working on local network.
When I wanna register with a another siphone like Linphone, I can make registration succesfully.
But When I'm trying to register with Basic4Android codes I'm getting "Failed, ErrorCode=-5, Message=registration timed out" message.
 
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
Sip.ProfileName = Samsung 'Tells the SIP server who is connecting by name in the PBX. It will show "Samsung" is connected
Sip.OutboundProxy = DialPlan1 'I have used this to assign the DialPlan rights to the user. Some users could be assigned different Dial Plans example DialPlan1 could be accounting dept or in a user certain call queue.

If you are in the LAN trying this with IP 192.168.2.22

I use this in my LAN and also over WAN when the cell provider allow SIP. I will further research this but these settings work with SIPDroid and our custom SIP program.
 
Upvote 0

İlter Oktay

Member
Licensed User
Longtime User
Many thanks for your effort.
Can you give me a suggestion about which SIP server (Windows based) I can make register with Basic4Android codes?
 
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
Are you getting any error message(s)? I would imagine in the WLAN it should work if in the same IP range/scheme. Can you ping the officesip server from a computer in the WLAN?

Or do you mean WAN, for this to work you need to forward ports snd configure the firewall on the router.
 
Upvote 0

bjfhs

Active Member
Licensed User
Longtime User
Are you getting any error message(s)? I would imagine in the WLAN it should work if in the same IP range/scheme. Can you ping the officesip server from a computer in the WLAN?

Or do you mean WAN, for this to work you need to forward ports snd configure the firewall on the router.
Thank you for your reply.
when I use officesip phone in my office ,and the officesip server in WAN(I can ping the server) ,I get error "Uccapi Error (2017/11/26 11:33): 80ee0067, KERBEROS + NTLM, Default Creditals, Fails to make a TCP connection."
When I close the firewall,I get the error too.
The next is my configure.
B4X:
<turnServers key1="/ftEipdl+5dxpskB5zekT04KPa5=" key2="wfzzcunCxlMNkP+ZoRXzIRNm5y0=">
        <add fqdn="172.117.69.46" tcpPort="443" />
    </turnServers>
    <portForwardings>
    
        <add protocol="Tcp" localEndpoint="172.117.69.46:5060" externalEndpoint="47.93.234.158:5060" />
        <add protocol="Udp" localEndpoint="172.117.69.46:5060" externalEndpoint="47.93.234.158:5060" />
    </portForwardings>
 
Last edited:
Upvote 0

giga

Well-Known Member
Licensed User
Longtime User
Unfortunately this looks like a bug in officesip. if you search the error in Google others are getting this same error related to uccapi.

I will look into this a little more but you may have to try a different sip server to see if you can get past this.
 
Upvote 0
Top