Java Question Library help again please.

giga

Well-Known Member
Licensed User
Longtime User
I am using the below JAVA code to produce a library but the line SipAudioCall.Listener listener = new SipAudioCall.Listener() {
Keeps returning an error: SipAudioCall.Listener cannot be resolved to a type

I have a class called SipAudioCall in this package.
:confused::confused:

Thanks for any advise.

package sipmanagerext;

import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import sipmanagerext.SipAudioCall;
import sipmanagerext.SipProfile;
import sipmanagerext.SipSession;
import android.util.Log;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;



@ShortName("Listener")
@Author("giga")
@Version(1.0f)
@DependsOn(values = { "android-9" })

/**
*
*/

public class Listener {

SipAudioCall.Listener listener = new SipAudioCall.Listener() {


public String TAG ="Listener";
static final Context context = null;

public void onRinging(Listener call, SipProfile caller) {
Log.e(TAG, "onRinging caller="+caller.getUriString()+"; call="+call.getState()+"; caller="+caller.getUriString());
super.onRinging(call, caller);
}


public void onRingingBack(SipAudioCall call) {
MediaPlayer mPlayer = MediaPlayer.create(context, R.raw.phone_calling);
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mPlayer.setLooping(true);
mPlayer.start();
}

public void onCallEstablished(SipAudioCall call) {
MediaPlayer mPlayer = MediaPlayer.create(context, R.raw.phone_calling);
mPlayer.stop();
call.startAudio();
}

public void onCallEnded(SipAudioCall call) {
Log.e(TAG, "onCallEnded: call="+call.getState());
super.onCallEnded(call);
}

public void onCallBusy(SipAudioCall call) {
Log.e(TAG, "onCallBusy: call="+call.getState());
super.onCallBusy(call);
}

public void onCallHeld(SipAudioCall call) {
Log.e(TAG, "onCallHeld: call="+call.getState());
super.onCallHeld(call);
}

public void onError(SipAudioCall call, final int errorCode, final String errorMessage) {
Log.e(TAG, "###onError errorCode="+errorCode+"; errorMessage="+errorMessage);
super.onError(call, errorCode, errorMessage);
}

public void onChanged(final SipAudioCall call) {
Log.e(TAG, "onChanged: call="+call.getState());
super.onChanged(call);
switch(call.getState()){
case SipSession.State.OUTGOING_CALL:
//making an outgoing call
break;
case SipSession.State.OUTGOING_CALL_RING_BACK:
//peer receives ringing event, what can I do to hear any thing until peer answers the call??
//...
break;
case SipSession.State.IN_CALL:
//call established, it works fine.
call.startAudio();
call.setSpeakerMode(false);
if(call.isMuted()){
call.toggleMute();
}
break;
case SipSession.State.READY_TO_CALL:
break;
}
}
};
}
 

giga

Well-Known Member
Licensed User
Longtime User
Why don't you use the SIP library?

I am also testing the "original" SIP library, It works great but I am having trouble with that one and don't see the below functions so I am trying to make a new one.

Dialing tone (when calling out)
CallHold
CallTransfer
Line selection (for multiline SIPs)


Thanks for the reply
 
Top