Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7998181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:08:58+00:00 2026-06-04T15:08:58+00:00

When using the SIP API, how can I answer a call I’m receiving. Im

  • 0

When using the SIP API, how can I answer a call I’m receiving. Im using the incomingcallreceiver class from sipdemo for testing and I added a pickup button in the WalkieTalkieActivity class that should be enabled when a call comes in but I cant figure out how to pickup an inbound call. Any help or examples would be appreciated.

To be more specific, here is the sample code from IncomingCallReceiver class:

public class IncomingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SipAudioCall incomingCall = null;
try {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onRinging(SipAudioCall call, SipProfile caller) {
try {
call.answerCall(30);
}
catch (Exception e) {
e.printStackTrace();
}}};
WalkieTalkieActivity wtActivity = (WalkieTalkieActivity) context;
incomingCall = wtActivity.manager.takeAudioCall(intent, listener);
incomingCall.answerCall(30);
incomingCall.startAudio();
incomingCall.setSpeakerMode(true);
if(incomingCall.isMuted()) {
incomingCall.toggleMute();
}
wtActivity.call = incomingCall;
wtActivity.updateStatus(incomingCall);
}
catch (Exception e) {
if (incomingCall != null) {
incomingCall.close();
}}}}

The WalkieTalkieActivity class uses the following for receiving a call:
within onCreate

IntentFilter filter = new IntentFilter();
filter.addAction("android.SipDemo.INCOMING_CALL");
callReceiver = new IncomingCallReceiver();
this.registerReceiver(callReceiver, filter);

and where the profile is created

Intent i = new Intent();
i.setAction("android.SipDemo.INCOMING_CALL");
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, Intent.FILL_IN_DATA);
manager.open(me, pi, null);

According to the developer SIP guide:

When the SIP service receives a new call, it sends out an intent with the action string provided by the application. In SipDemo, this action string is android.SipDemo.INCOMING_CALL.

This code excerpt from SipDemo shows how the SipProfile object gets created with a pending intent based on the action string android.SipDemo.INCOMING_CALL. The PendingIntent object will perform a broadcast when the SipProfile receives a call:
(This referred to the code above where the profile is created)
The guide then goes on to say:
The broadcast will be intercepted by the intent filter, which will then fire the receiver (IncomingCallReceiver). You can specify an intent filter in your application’s manifest file, or do it in code as in the SipDemo sample application’s onCreate() method of the application’s Activity:

Im looking to add a pickup button to the WalkieTalkieActivity class that is enabled onRinging and will answer an incoming call when clicked.

I have been successful with handling all other general calling issues such as hold, mute, speaker, making calls, and ending calls but I cannot figure this out.

Edit – Could this work?:

public class IncomingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SipAudioCall incomingCall = null;
try {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onRinging(SipAudioCall call, SipProfile caller) {
try {
call.answerCall(30);
}
catch (Exception e) {
e.printStackTrace();
}}};
WalkieTalkieActivity wtActivity = (WalkieTalkieActivity) context;
wtActivity.inbound = incomingCall;
wtActivity.updateStatus(incomingCall);
}
catch (Exception e) {
if (incomingCall != null) {
incomingCall.close();
}}}}

and then set up a new SipAudioCall within the walkietalkieactivity Class and a listener for onRinging with the onclicklistener inside of it followed by normal call handling like:

inbound.answerCall(30);
inbound.startAudio();
inbound.setSpeakerMode(true);
if(inbound.isMuted()) {
inbound.toggleMute();
}

–Thanks
Daniel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:08:59+00:00Added an answer on June 4, 2026 at 3:08 pm

    I was able to get this working after several different attempts. I was unable to handle any call objects outside of the incoming call Activity. I had to call a method within the incoming call activity from my button in my main ui class. Referencing IncomingCallReceiver.incomingCall.answercall would change the state to answering but would not fail and not actually answer and startaudio would send RTP even though the call was not established. I tried moving this inside a listener for oncallestablished but it wasnt happening so it did not matter. Im still very new at this so I apologize if my terminology is off.

    Thanks,
    Daniel

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've managed to set up a SIP call using the JAIN-SIP API for Java.
I could build a sip profile using SipProfile.Builder class. I used following snippet of
I'm using demo http://developer.android.com/resources/samples/SipDemo/index.html and trying to make a call via SiP, I have
I'm trying to write a voip app for Android, using the Android SIP API
I'm using the SIP stack in Android 2.3.x+ (actually testing on Motorola Xoom though)
Im trying to run a VOIP call using built in SIP on android 3.1.
I looking for a way to programmatically start a VOIP call using the SIP
i got a strange Problem using Jain Sip (dowload today Version Jain-sip-ri-1.2.2014.jar). I'm connecting
I'm trying to build a Sip client for android using pjsip such as CSipSimple
Which is the better way to start the SIP client for android using any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.