No audio using native android sip library

匿名 (未验证) 提交于 2019-12-03 09:14:57

问题:

So I'm using the native sip library, and I can connect and register with the server just fine. And when I make the call, it hits a proxy that routes it to a regular phone call, then calls the number inputed. It will connect fine, and the phone on the other end receives the call, but there is no audio. I know the proxy can handle audio because there is an iPhone app hitting the same server and it connects just fine.

Here's my code for making the call :

public void makeCall(String s) {      SipAudioCall.Listener listener = new SipAudioCall.Listener() {          @Override         public void onCallEstablished(SipAudioCall call) {                   Log.d(TAG, "Call Established");                 call.startAudio();                  //I've tried with speaker mode on and off                 call.setSpeakerMode(true);           }          @Override         public void onCallEnded(SipAudioCall call) {              Log.d(TAG, "Call Ended");          }     };      if (sipManager != null && sipProfile != null) {         try {             Log.d(TAG, "Make call");             sipManager.makeAudioCall(sipProfile.getUriString(), app.sipToUri(s, sipProfile.getProxyAddress()), listener, 30);         } catch (SipException e) {             e.printStackTrace();         }     }  } 

In my manifest I have

<uses-permission android:name="android.permission.USE_SIP"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>  <uses-feature android:name="android.hardware.sip.voip" android:required="true" /> <uses-feature android:name="android.hardware.wifi" android:required="true" /> <uses-feature android:name="android.hardware.microphone" android:required="true" /> 

And I'm using a sip enabled tablet as well as a sip enabled note 2 to test.

回答1:

This maybe unnecessary

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> 

SIP related

<uses-permission android:name="android.permission.CONFIGURE_SIP" /> <uses-feature android:name="android.software.sip" android:required="true" /> <uses-feature android:name="android.software.sip.voip" android:required="true" /> 

This you need if you use speaker

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!