@lidiya11

Из-за чего ошибка IN_PROGRESS при регистрации в Freeswitch?

При попытке регистрации пользователя в Freeswitch у меня появляется ошибка с IN_PROGRESS "The client is in a transaction and cannot initiate a new one." При использовании Zoiper все работает, но в моем приложении Registration failed. Из-за чего это может быть?

Вот классы sip и IncomingCallReceiver, переписанные с документации андроид:
public class SIPObject {
public SipProfile mSipProfile = null;
public SipProfile peepSipProfile = null;
public SipManager mSipManager = null;
Context mainActivity;
SipAudioCall.Listener listener;
SipAudioCall call;
SIPObject(Context mainActivity, String username, String domain, String password){
this.mainActivity = mainActivity;
if (mSipManager == null) {
mSipManager = SipManager.newInstance(mainActivity);
}
SipProfile.Builder builder = null;
try {
builder = new SipProfile.Builder(username, domain);
} catch (ParseException e) {
e.printStackTrace();
}
builder.setPassword(password);
mSipProfile = builder.build();
incomeCall();
}
public void setSipAudioCall(SipAudioCall c){
call = c;
}
public void incomeCall(){
Intent intent = new Intent();
intent.setAction("android.SipDemo.INCOMING_CALL");
PendingIntent pendingIntent = PendingIntent.getBroadcast(mainActivity, 0, intent, Intent.FILL_IN_DATA);
try {
mSipManager.open(mSipProfile, pendingIntent, null);
} catch (SipException e) {
e.printStackTrace();
Log.d("sip", "SipException "+e);
}
checkRegister();
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
call = mSipManager.makeAudioCall(mSipProfile.getUriString(), String.valueOf(peepSipProfile), listener, 30);
} catch (SipException e) {
e.printStackTrace();
}
}
public void checkRegister(){
try {
mSipManager.setRegistrationListener(mSipProfile.getUriString(), new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
updateStatus("Ready");
}
public void onRegistrationDone(String localProfileUri, long expiryTime) {
updateStatus("Ready");
}
public void onRegistrationFailed(String localProfileUri, int errorCode,
String errorMessage) {
updateStatus("Registration failed. Please check settings.");
}
});
} catch (SipException e) {
e.printStackTrace();
}
}
public void updateStatus(String m){
Log.d("sip", " " + m);
}
@SuppressLint("LongLogTag")
public void closeLocalProfile() {
if (mSipManager == null) {
return;
}
try {
if (mSipProfile != null) {
mSipManager.close(mSipProfile.getUriString());
}
} catch (Exception ee) {
Log.d("sip", "Failed to close local profile.", ee);
}
}
public void makeCall() {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onCallEstablished(SipAudioCall call) {
call.startAudio();
call.setSpeakerMode(true);
call.toggleMute();
}
@Override
public void onCallEnded(SipAudioCall call) {
try {
call.endCall();
} catch (SipException e) {
e.printStackTrace();
}
call.close();
}
};
}
}
---------------------------------------------------------------------------------------------------
public class IncomingCallReceiver extends BroadcastReceiver {
/**
* Processes the incoming call, answers it, and hands it over to the
* WalkieTalkieActivity.
* @param context The context under which the receiver is running.
* @param intent The intent being received.
*/
public SIPObject sipObject ;
MainActivity mainActivity;
public IncomingCallReceiver(Context context) {
sipObject = new SIPObject(context, "1010", "192.168.1.3:5060", "1234");
}
@Override
public void onReceive(Context context, Intent intent) {
SipAudioCall incomingCall = null;
mainActivity = (MainActivity) context;
try {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onRinging(SipAudioCall call, SipProfile caller) {
try {
call.answerCall(30);
} catch (Exception e) {
e.printStackTrace();
}
}
};
Thread.sleep(10000);
sipObject = new SIPObject(context, "1010", "192.168.1.3:5060", "1234");
incomingCall = sipObject.mSipManager.takeAudioCall(intent, listener);
incomingCall.answerCall(30);
incomingCall.startAudio();
incomingCall.setSpeakerMode(true);
if(incomingCall.isMuted()) {
incomingCall.toggleMute();
}
sipObject.call = incomingCall;
sipObject.setSipAudioCall(incomingCall);
} catch (Exception e) {
if (incomingCall != null) {
incomingCall.close();
}
}
}
}
  • Вопрос задан
  • 88 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы