I am using Android SIP API to create my sip client and FREE PBX for sip server. But I am facing this issue, while calling to some extension, if this user is not registered to server, it gives me the error response in 8 seconds. Here is my code.
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
// Much of the client's interaction with the SIP Stack will
// happen via listeners. Even making an outgoing call, don't
// forget to set up a listener to set things up once the call is
// established.
@Override
public void onCallEstablished(SipAudioCall call) {
call.startAudio();
call.setSpeakerMode(true);
if (call.isMuted())
call.toggleMute();
updateStatus("call established.");
}
@Override
public void onCallEnded(SipAudioCall call) {
updateStatus("call ended.");
}
@Override
public void onError(SipAudioCall call, int errorCode,
String errorMessage) {
delay = System.currentTimeMillis() - delay;
delay = delay / 1000;
Log.v("", "call failed: time taken in decision is " + delay
+ " seconds.");
endCall(call);
makeGsmCall(numberString);
super.onError(call, errorCode, errorMessage);
}
};
delay=System.currentTimeMillies();
SipState.sipAudioCall = SipState.sipManager.makeAudioCall(SipState.localSipProfile.getUriString(), sipAddress,
listener, 0);
In this code, the onError(), method is called after 8 seconds. Can we minimize that? Or if there is some other method we could achieve that?
Also I have seen other applications like sipdroid and linephone, they seem to take no time to tell that specified username is unavailable.
Please help me. Thanks.