我想知道如何在使用android.net.sip
API進行傳出呼叫時獲得呼叫ID。 我目前只是做一個傳出的電話,因爲他們在android sip演示。 call = manager.makeAudioCall(me.getUriString(), sipAddress, listener, 30);
我也在文檔中看到,您可以在撥打電話時創建SIP會話以獲取呼叫ID,但我無法弄清楚。有關SipManager
的文檔,請參見http://developer.android.com/reference/android/net/sip/SipManager.html#createSipSession(android.net.sip.SipProfile。在進行音頻通話之前,我也正在做這件事:如何使用android.net.sip API從傳出呼叫獲取呼叫ID
manager.createSipSession(me, new SipSession.Listener(){
@Override
public void onCalling(SipSession session) {
String callId = session.getCallId();
Log.d(TAG, "onCalling. call ID: " + callId);
}
@Override
public void onRingingBack(SipSession session) {
String callId = session.getCallId();
Log.d(TAG, "onRinging. call ID!!!: " + callId);
}
@Override
public void onCallEstablished(SipSession session,
String sessionDescription) {
String callId = session.getCallId();
Log.d(TAG, "onCallEstablished: call ID!!!: " + callId);
}
});
但是當我撥打電話時沒有任何方法正在被呼叫。
在sip會話中設置呼叫ID之前可能需要一點時間,給您一個空的呼叫ID,但是如果您在ss.getCallId()之前執行'Thread.sleep(100)'; '一定會給你通話ID。 – John 2012-08-02 12:54:08