简体   繁体   中英

Sip Calling in Android

I am using native sip android when I am calling from my Android application to application I have found errors SipAudioCall﹕ sip session error: TRANSACTION_TERMINTED: transaction terminated SipAudioCall﹕ onCallEstablished(): java.lang.NullPointerException but call is established but on end call it does not giving call back

public void initiateCall(final String sipAddress,final IResponse m_listener) {
    this.m_listener = m_listener;

    //m_listener.connectionStatus(sipAddress);

    try {
        SipAudioCall.Listener listener = new SipAudioCall.Listener() {
            @Override
            public void onCallEstablished(SipAudioCall call) {
                //super.onCallEstablished(call);




                call.startAudio();
                call.setSpeakerMode(false);

                if (call.isMuted()) {
                    call.toggleMute();
                }
                //call.toggleMute();
                m_listener.callIsEtsablished(true);

                String useName = call.getPeerProfile().getDisplayName();

                if(useName == null) {
                    Log.d("hamid","useName is null");
                    useName = call.getPeerProfile().getUserName();
                }






            }

            // Much of the client's interaction with the SIP Stack will
            // happen via listeners.  Even making an outgoing m_audioCall, don't
            // forget to set up a listener to set things up once the m_audioCall is established.
           /* @Override
            public void onCallEstablished(SipAudioCall call) {
                //super.onCallEstablished(call);


            }*/
            @Override
            public void onCallEnded(SipAudioCall call) {
                //rejectIncomingCall();
                //m_listener.onCallEndedStatus("Call Ended");
                //m_listener.connectionStatus("Call Ended");
                m_listener.connectionStatus("Ready.");
                m_listener.callIsEtsablished(false);

            }


        };

        m_audioCall = m_manager.makeAudioCall(m_profile.getUriString(), sipAddress, listener, 30);

    }
    catch (Exception e) {
        Log.d("hamid", "Calling exception: "+e);

        Log.i("DialCallActivity/InitiateCall", "Error when trying to close manager.", e);

        if (m_profile != null) {

            try {
                m_manager.close(m_profile.getUriString());

            } catch (Exception ee) {
                Log.i("DialCallActivity/InitiateCall",
                        "Error when trying to close manager.", ee);
                ee.printStackTrace();
            }
        }
        if (m_audioCall != null) {
            m_audioCall.close();
        }
    }
}

Can you try to add

call.answerCall(-1); 

in front of start audio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM