2017-06-14 49 views
2

我正在PJSIP在android,如何檢查來電只是音頻通話或視頻。如何識別?我用下面的代碼,但它不工作如何知道來電有沒有視頻或沒有在PJSIP android

@Override 
    public void onIncomingCall(OnIncomingCallParam prm) { 
     System.out.println("======== Incoming call ======== "); 
     MyCall call = new MyCall(this, prm.getCallId()); 
     try { 
      CallSetting setting = call.getInfo().getSetting(); 
      Log.d(" Log APP ", "onIncomingCall: Audio " + setting.getAudioCount() + " Video" + setting.getVideoCount()); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 

    } 

但音頻和視頻數量總是1,但同時使電話,我已經把視頻0

MyCall call = new MyCall(account); 
     CallOpParam prm = new CallOpParam(); 
     CallSetting setting = new CallSetting(); 
     setting.setAudioCount(1); 
     setting.setVideoCount(0); 
     prm.setOpt(setting); 
     try { 
      call.makeCall(buddy_uri, prm); 
     } catch (Exception e) { 
      call.delete(); 
      e.printStackTrace(); 
      return; 
     } 

請告訴我怎麼樣了識別來電有視頻與否。?

回答

1

經過大量的研究,我發現PJSIP協議不提供來電視頻計數。 CallSetting是由所有用戶自己設置的。 Asterisk服務器不會將呼叫設置發送到接收方端。但是Asterisk的ID提供了有關媒體的支持信息

callInfo.getRemOfferer() 
// It returns a boolean value if true then server support video calling. 

所以,你可以使用的邏輯是這樣

long videoCount = (callInfo.getRemOfferer()) ? callInfo.getRemVideoCount() : callInfo.getSetting().getVideoCount(); 
// if server support video call then check remote server video count value its retrun value in 0,1 format if server not support then chek call setting 

如果視頻計數1的意思是這是一個視頻通話。

有關更多詳細信息,請檢查此 PJSIP Call Setting

-2

你需要檢查遠程細節: sipCall.getInfo()getRemVideoCount()

其中 「sipCall」 是你的 「呼叫(的MyCall)」 對象。

+0

您可以使用自己的對象;) –