datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
272 stars 229 forks source link

How I know the call state ? #131

Open florindumitru opened 5 years ago

florindumitru commented 5 years ago

Hi, I need to know which event can detect the call state changes. For example when a call is active or not, if destination answered .

Thanks

cmendes0101 commented 5 years ago

Its in the readme to listen for events

endpoint.addListener("call_changed", (newCall) => { if (call.getId() === newCall.getId()) { // Our call changed, do smth. } }

Look at the sample app, it pretty much does most functionality: https://github.com/datso/react-native-pjsip-app/blob/master/app/modules/pjsip.js#L48

florindumitru commented 5 years ago

I already tried that and the state not change. GetState and _state remains in ringing state

cmendes0101 commented 5 years ago

Did you try the other events? If so which ones did you try and which event are you exactly looking for that is not working?

florindumitru commented 5 years ago

I want to know when the call is established. I makeCall and after I need too check when deatination answer to the call to can stop the ringing

cmendes0101 commented 5 years ago

Why are you not using SIP ringing?

You probably want to use call.getState() and look for PJSIP_INV_STATE_CONFIRMED. Mostly all are in the example app. Please take the time to go through and understand how that works

glocore commented 5 years ago

Hi @cmendes0101, I have a different problem: when calling to pjsip, the other party is not able to hear a ring. I am however able to answer the call from pjsip no problem. Here's a related issue, I'd greatly appreciate your help on this.

cmendes0101 commented 5 years ago

@platonish Probably should open a separate issue instead of linking tickets that are possible not related since this was knowing call state. The other ticket sounds closer to your issue