Code Monkey home page Code Monkey logo

Comments (6)

datso avatar datso commented on September 4, 2024

It is possible that codecs are incompatible, or many other cases could happen. Please attach the pjsip logs that shows the problem.

from react-native-pjsip.

datso avatar datso commented on September 4, 2024

@imakou Please provide logs, or any other information that I could use to reproduce the issue.

from react-native-pjsip.

omar-othmann avatar omar-othmann commented on September 4, 2024

in PjSipBroadcastEmiter

func: public void fireCallReceivedEvent(PjSipCall call)

there you know is incoming call

for example:
public void fireCallReceivedEvent(PjSipCall call) {
if(haveCall){
try {
CallOpParam prm = new CallOpParam(true);
prm.setStatusCode(pjsip_status_code.PJSIP_SC_BUSY_HERE);
call.hangup(prm);
prm.delete();
} catch (Exception e) {
e.printStackTrace();
}
return;
}
if(DelListener.callListener != null){
DelListener.callListener.onCall(call);
haveCall = true;
}
}

you can make static class with listener
for example:
public class DelListener {
public static CallListener callListener;
public static CallListenerCommands callListenerCommands;
public static interface CallListener{
public void onCall(Call call);
}

public static interface CallListenerCommands{
    public void onStateChange(Call call);
    public void onCallCancel(Call call);
}



public static void setOnCallListener(CallListener call){
    callListener = call;
}

public static void setOnCallListenerCommands(CallListenerCommands call){
    callListenerCommands = call;
}

}

in your application service implements DelListener.CallListener
now you have func: onCall(Call call) in your application service

@OverRide
public void onCall(Call call) {
Intent dialogIntent = new Intent(this, IncomingCallActivity.class);
dialogIntent.putExtra("id", call.getId());
dialogIntent.putExtra("username", "Omar Othman");
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(dialogIntent);
}

in your incomingCallActivity
getIntent()
example:
private int callId = 0;
onCreate:
Intent i = getIntent();
callId = i.getIntExtra("id", -1);

now if answer button clicked:
intent = new Intent(PjActions.ACTION_ANSWER_CALL, null, this, PjSipService.class);
intent.putExtra("call_id", callId);
startService(intent);

if decline button clicked:
intent = new Intent(PjActions.ACTION_DECLINE_CALL, null, this, PjSipService.class);
intent.putExtra("call_id", callId);
startService(intent);

that's all
you need to create layout for incomingcall and activity, change the code to your application
is very easy!

don't forget to set DelListener in your application service: onCreate
DelListener.setOnCallListener(this);

from react-native-pjsip.

datso avatar datso commented on September 4, 2024

@omar-othmann What actually solves your code example ?

from react-native-pjsip.

imakou avatar imakou commented on September 4, 2024

Hi Vadim,
I can not run the app on my emulator now.
It seems that everything works fine but handling the incoming phone call.
It always shows " initializing".

Where can I get the logs for you?

screenshot_1516648030

from react-native-pjsip.

datso avatar datso commented on September 4, 2024

So, this is the demo application, I don't have plans to fix the bugs for this application.

from react-native-pjsip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.