本文介绍了没有音频采用原生Android SIP库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用的是本地SIP库,我可以连接并与服务器就好了注册。当我拨打电话,它击中的代理,它的路线到正规的电话,然后调用inputed数。它将连接细,而在另一端的电话接收到呼叫,但没有音频。我知道代理可以处理音频,因为有一个iPhone应用程序打在同一台服务器,并将其连接就好了。

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.

下面是我的code为打出电话:

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();
        }
    }

}

在我的清单我有

<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" />

和我使用的是支持SIP的平板电脑以及支持SIP的注2测试。

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

推荐答案

这或许不必要的

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

SIP相关

<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" />

这篇关于没有音频采用原生Android SIP库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 18:11