"INVITE SESSION ALREADY TERMINATED ERROR" 尝试通过 pjsip(PJSUA2) 处理来电时

"INVITE SESSION ALREADY TERMINATED ERROR" while trying to handle incoming call via pjsip(PJSUA2)

我已成功通过 PJSIP 拨出电话。现在在尝试处理来电时遇到问题。

Thread isanycall=new Thread(new Runnable() {
        @Override
        public void run() {
            while(true)
            {
                if(Global.isanycall==1)
                {

                    sipOperationIncoming(username, pwd, ip, number.getText().toString());

                    Global.isanycall=0;
                }
            }
        }
    });
    isanycall.start();

此代码正在检查是否有任何来电。

System.out.println("Incoming call handler");

    //sip operation started
    registration=SipRegistration.getSipRegistration(uname,pwd,ip);
    registration.answerCall(da);
    //sip operation ended

这段代码块只负责调用一个函数answerCall,如下

public void answerCall(DialerActivity activity){

    call=new MyCall(myacc,1,this.ep,activity);

    CallOpParam prm = new CallOpParam();

    prm.setStatusCode(pjsip_status_code.PJSIP_SC_RINGING);

    try {
        call.answer(prm);

    }catch(Exception e){
        e.printStackTrace();
    }
}

现在我得到的异常是

java.lang.Exception: Title:       pjsua_call_answer2(id, param.p_opt, prm.statusCode, param.p_reason, param.p_msg_data)
10-27 12:11:19.839 10090-10384/com.skyteloutsourcing.callnxt W/System.err: Code:        171140
10-27 12:11:19.839 10090-10384/com.skyteloutsourcing.callnxt W/System.err: Description: INVITE session already terminated (PJSIP_ESESSIONTERMINATED)

可能是什么原因?

已解决,我用不同的呼叫 ID 进行响应,而不是来电的呼叫 ID。 :)

我没有检查这个控件时遇到了这个错误

if(ci.state==pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED){
     currentCall.delete()
     currentCall=null
 }