SIP calls using Android SDK¶
Overview¶
SIP call on Android devices can be made both from a browser and using the Android SDK.
Operation flowchart¶
1. SIP server as a proxy server to transfer calls and RTP media¶
- The Android device begins a call
- WCS connects to the SIP server
- The SIP server connects to the SIP device that receives the call
- The Android device and the SIP device exchange audio and video streams
2. SIP server as a server to transfer calls only¶
- The Android device begins a call
- WCS connects to the SIP server
- The SIP server connects to the SIP device that receives the call
- The Android device and the SIP device exchange audio and video streams
Testing¶
Making an outgoing call from Android to a SIP device¶
- For the test we use:
- two SIP accounts;
- the Phone application to make a call;
-
a software phone to answer the call.
-
Install the Phone app to the Android device. Start the app, enter the URL of the WCS server to connect to it via Websocket and the data of the SIP account making a call:
-
Run the softphone, enter the data of the SIP account that receives the call:
-
Tap the
Connect
button in the app, a connection will be established to the server. Then enter the identifier of the SIP account that receives the call and click theCall
button:
-
Answer the call in the softphone by clicking the answer button:
-
To terminate the call, tap the
Hangup
button in the application, or click the end call button in the softphone.
Receving an incoming call from a SIP device to Android¶
- For the test we use:
- two SIP accounts;
- a softphone to make a call;
-
the Phone application to answer the call.
-
Install the Phone app to the Android device. Start the app, enter the URL of the WCS server to connect via Websocket and the data of the SIP account that receives the call:
Tap theConnect"
button in the app to establish a connection to the WCS server. -
Run the software phone and enter the data of the SIP account making the call:
-
In the softphone enter the identifier of the SIP account that receives the call and click the call button:
-
Answer the call in the application by tapping
Answer
:
-
In the softphone make sure the call has started:
-
To terminate the call, tap the Hangup button in the app, or click the end call button in the softphone.
Call flow¶
Below is the call flow when using the Phone-min example to create a call
-
Creating a call
Session.createCall()
,Call.call()
code
CallOptions callOptions = new CallOptions(mCalleeView.getText().toString()); AudioConstraints audioConstraints = callOptions.getConstraints().getAudioConstraints(); MediaConstraints mediaConstraints = audioConstraints.getMediaConstraints(); ... call = session.createCall(callOptions); call.on(callStatusEvent); /** * Make the outgoing call */ call.call(); Log.i(TAG, "Permission has been granted by user");
-
Sending
SIP INVITE
to the SIP server -
Sending
SIP INVITE
to the SIP device -
Receiving a confirmation from the SIP device
-
Receiving a confirmation from the SIP server
-
Receiving from the server an event confirming successful connection.
-
The caller and the callee exchange audio and video streams
-
Terminating the call
Call.hangup()
code
-
Sending
SIP BYE
to the SIP server -
Sending
SIP BYE
to the SIP device -
Receiving a confirmation from the SIP device
-
Receiving a confirmation from the SIP server
Known issues¶
1. It's impossible to make a SIP call if SIP Login
and SIP Authentification name
fields contain unappropriate characters¶
Symptoms
SIP call stucks in PENDING
state
Solution
According to RFC3261, SIP Login
and SIP Authentification name
should not contain any of unescaped spaces and special symbols and should not be enclosed in angle brackets <>
.
For example, this is not allowed by the specification
sipLogin='Ralf C12441@host.com'
sipAuthenticationName='Ralf C'
sipPassword='demo'
sipVisibleName='null'
and this is allowed