Comments (6)
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.
@imakou Please provide logs, or any other information that I could use to reproduce the issue.
from react-native-pjsip.
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.
@omar-othmann What actually solves your code example ?
from react-native-pjsip.
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?
from react-native-pjsip.
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)
- getting error while creating account "_registration": {"_active": false, "_reason": undefined, "_status": "PJSIP_SC_TRYING", "_statusText": "In Progress"}} HOT 4
- Unable to build on Android
- createAccount iOS not complete registration HOT 19
- BUG
- Wrong Aspect Ratio of PreviewVideoView (iOS) HOT 1
- Stoped in PJSIP_INV_STATE_CONNECTING HOT 1
- call hangup issue
- what is default incoming call time without accept call
- Does react-native-pjsip support conference calls with video?
- Unhandled promise rejection error
- unable to detect call status while 2 call end
- call_terminated event not working. while third call end in Samsung galaxy a51 android version 11 HOT 1
- app crached after clicked in "call button" without error in log
- not work call_terminated HOT 1
- udp not work with wifi connection.
- React-native 0.67.2 HOT 1
- how do i use SRTP
- Is this library still working? if so, Can someone guide me through the installation process? HOT 3
- Increase the number of ringing HOT 2
- ha1 hash
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-pjsip.