Can i create a conference call or add contact to current call react-native-pjsip?

Viewed 544
1 Answers

So, i have my own module wich do have conference call, React-native-sip-pjsip,

The code for the conference is on the file android/src/main/java/com/carusto/ReactNativePjSip/PjSipService.java, and looks like this:

    private void handleCallConference(Intent intent) {
        try {

            List<AudioMedia> mCallsAudioMedia = new ArrayList<>();

            for (PjSipCall currCall : mCalls)
            {
                for (int i = 0; i < currCall.getInfo().getMedia().size(); i++) {
                    currCall.unhold();
                    Media media = currCall.getMedia(i);
                    CallMediaInfo mediaInfo = currCall.getInfo().getMedia().get(i);
                    if (mediaInfo.getType() == pjmedia_type.PJMEDIA_TYPE_AUDIO && media != null) {
                        AudioMedia audioMedia = AudioMedia.typecastFromMedia(media);
                        mCallsAudioMedia.add(audioMedia);

                    }
                }
            }

            for (int i = 0; i < mCallsAudioMedia.size(); i++) {
                for (int j = 0; j < mCallsAudioMedia.size(); j++) {
                    if( i != j) {
                        mCallsAudioMedia.get(i).startTransmit(mCallsAudioMedia.get(j));
                    }
                }
            }

            mEmitter.fireIntentHandled(intent);
        } catch (Exception e) {
            mEmitter.fireIntentHandled(intent, e);
        }
    }

This function will:

unhold all current calls.

Make all the current contacts hear each other using transport.

So, you can use my code on your own module, or use my module itself. You can call this function as you call the makecall function, and so on (Too much depends of how you're using it).

Related