unable to receive incoming call using SipDemo

  • Replies:0
Azhar Eqbal
  • Forum posts: 1

Jul 31, 2015, 11:59:36 AM via Website

I am working on a SIP based application , i have followed SIP-DEMO for reference, everything is working fine , i am able to make app to app calls, receive call but when i am trying to answer the call i get an error "Transaction Terminated" ,error code "-3". Can anybody help me to figure out the cause of problem and come up with a solution, any sort of help is highly appreciated.

Below is the class i have used to Receive Incoming Calls

public class IncomingCallActivity extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.incoming_call_reciever);

mIntent = Helper.getInstance().getCallIntent();
mManager = Helper.getInstance().getSipManager();

initListeners();

try {

    mCall = mManager.takeAudioCall(mIntent, listener);

} catch (SipException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

views();

setClickListenerOnReceiveCall();

setClickListenerOnEndCall();

}

private void initListeners() {
// TODO Auto-generated method stub
listener = new SipAudioCall.Listener(){
@Override
public void onRinging(SipAudioCall call, SipProfile caller) {
// TODO Auto-generated method stub
super.onRinging(call, caller);
Toast.makeText(context, "onRinging", Toast.LENGTH_SHORT).show();
}
@Override
public void onCallEstablished(SipAudioCall call) {
// TODO Auto-generated method stub
super.onCallEstablished(call);
Toast.makeText(context, "onCallEstablished", Toast.LENGTH_SHORT).show();
mCall.startAudio();
mCall.setSpeakerMode(true);
}
@Override
public void onCallEnded(SipAudioCall call) {
// TODO Auto-generated method stub
super.onCallEnded(call);
Toast.makeText(context, "onCallEnded", Toast.LENGTH_SHORT).show();
}

    @Override
    public void onError(SipAudioCall call, int errorCode, String errorMessage) {
        // TODO Auto-generated method stub
        super.onError(call, errorCode, errorMessage);
    }
};

}

private void views() {
// TODO Auto-generated method stub
mChronometer = (Chronometer)findViewById(R.id.chronometer1);
buttonEndCall = (Button)findViewById(R.id.buttonEndCall);
buttonRecieve = (Button)findViewById(R.id.buttonReceiveCall);
textViewCallerInfo = (TextView)findViewById(R.id.textViewCallerInfo);
textViewCallerInfo.setText(mCall.getPeerProfile().getDisplayName());
}

private void setClickListenerOnReceiveCall() {
// TODO Auto-generated method stub
buttonRecieve.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Toast.makeText(context, "Recieve", Toast.LENGTH_SHORT).show();

        try {

            mCall.answerCall(30);


        } catch (SipException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }


    }
});

}

private void setClickListenerOnEndCall() {
// TODO Auto-generated method stub
buttonEndCall.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Toast.makeText(context, "Reject", Toast.LENGTH_SHORT).show();
        try {
            mCall.endCall();
            mCall.close();
        } catch (SipException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
});

}
}

Reply