我正在尝试使用sip和freeswitch开发具有调用功能的Android应用程序。我能够成功注册一个配置文件,并且能够调用freeswitch的测试IVR配置文件。但是,我听不到任何声音。
以下是包含所有权限和功能的清单摘录
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<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" />
以下是我的SipAudioCall.Listener的片段
listener = new SipAudioCall.Listener() {
@Override
public void onCalling(SipAudioCall call) {
//super.onCalling(call);
Log.d(TAG, "Initiating session!");
}
@Override
public void onCallEstablished(SipAudioCall call) {
//super.onCallEstablished(call);
Log.d(TAG, "Call started!");
call.startAudio();
call.setSpeakerMode(true);
if (call.isMuted()) {
Log.d(TAG, "Muted");
call.toggleMute();
}
}
@Override
public void onRinging(SipAudioCall call, SipProfile caller) {
//super.onRinging(call, caller);
Log.d(TAG, "Ringing!");
}
@Override
public void onRingingBack(SipAudioCall call) {
//super.onRingingBack(call);
Log.d(TAG, "Ringing back");
}
@Override
public void onCallEnded(SipAudioCall call) {
//super.onCallEnded(call);
Log.d(TAG, "Call ended");
}
@Override
public void onError(SipAudioCall call, int errorCode, String errorMessage) {
//super.onError(call, errorCode, errorMessage);
Log.d(TAG, "Error! " + errorMessage);
}
};
call = sipManager.makeAudioCall(sipProfile.getUriString(), "sip:5000@192.168.0.6", listener, 30);
答案 0 :(得分:0)
试试这个方法
@Override
public void onCallEstablished(SipAudioCall call) {
//super.onCallEstablished(call);
Log.d(TAG, "Call started!");
call.setSpeakerMode(true);
call.startAudio();
}
而不是
@Override
public void onCallEstablished(SipAudioCall call) {
//super.onCallEstablished(call);
Log.d(TAG, "Call started!");
call.startAudio();
call.setSpeakerMode(true);
if (call.isMuted()) {
Log.d(TAG, "Muted");
call.toggleMute();
}
}
答案 1 :(得分:0)
检查以下几点以解决此问题:
首先检查一下sip softphone,然后转到Android。