Skip to content

Audio Call issues #311

Open
Open

Description

@muneeb-mt

Hi @ccvlad. I hope you are doing well. In connectycube version 3.21.0 for react-native app, I am facing an issue here:

async startCall(usersIds, callType, options = {}) {
console.log({callType: callType});
try {
const session = ConnectyCube.videochat.createNewSession(
usersIds,
callType,
options,
);
store.dispatch(setCallSession({session}));
const CURRENT_USER_CALLER_ID = this.currentUser.callerId;
CallNotification(usersIds, CURRENT_USER_CALLER_ID);
await this.setMediaDevices();

  // create local stream
  const mediaOptions = {...CallService.MEDIA_OPTIONS};
  if (callType === ConnectyCube.videochat.CallType.AUDIO) {
    mediaOptions.video = false;
  }
  const stream = await this.callSession.getUserMedia(mediaOptions);
  // store streams
  const streams = [{userId: LOCAL_STREAM_USER_ID, stream: stream}];
  for (let uId of usersIds) {
    streams.push({userId: uId, stream: null});
  }
  store.dispatch(addOrUpdateStreams({streams}));
  this.callSession.call({});
  // report to CallKit (iOS only)
  this.reportStartCall(
    this.callSession.ID,
    this.currentUser?.profileResponse?.firstName || '',
    getCallRecipientString(usersIds),
    'generic',
    callType === 'video',
  );
  this.playSound('outgoing');
  this.setSpeakerphoneOn(
    this.callSession.callType === ConnectyCube.videochat.CallType.VIDEO,
  );
  return session;
} catch (error) {
  **console.log({'Not able to call the user': error.message});**
}

}

Note: If the callType is 2, which means audiocall, ConnectyCube.videochat.createNewSession is nit creating a session, hence I'm failed to get and create an audio call. Response is:

{"Not able to call the user": {"constraintName": undefined, "message": "Permission denied.", "name": "SecurityError"}}

My function to call startCall in callService:

const startCall = async callType => {
if (!profileData?.profileResponse.callerId) {
showToast('error', 'Error', 'Unable to make audio call with this user');
return;
} else {
const selectedOpponentsIds = [data.callerId];
ConnectyCube.videochat.CallType.AUDIO;
const callSession = await callService.startCall(
selectedOpponentsIds,
callType,
);
const pushParams = {
message: Incoming call from ${data.firstName || ''},
ios_voip: 1,
handle: data.firstName || '',
initiatorId: callSession.initiatorID,
opponentsIds: selectedOpponentsIds.join(','),
uuid: callSession.ID,
callType:
callType === ConnectyCube.videochat.CallType.VIDEO
? 'video'
: 'audio',
};
pushNotificationsService.sendPushNotification(
selectedOpponentsIds,
pushParams,
);
dispatch(onStartCall(data));
}
};

I need an urgent help in it. Thanks

Activity

  1. ccvlad commented on Jun 1, 2023

    @ccvlad
    Contributor

    Hi @muneeb-mt

    Please check the getUserMedia(mediaOptions) - is the audio = true? Or check your mic input, which must be permitted by the system.

    It seems that you didn't manage to get a stream from the getUserMedia()

  2. muneeb-mt commented on Jun 1, 2023

    @muneeb-mt
    Author

    Yes - that's my point in video call -> calltype = 1. I'm getting the stream and its fine but in calltype = 2, that is audio, there is no stream @ccvlad

  3. muneeb-mt commented on Jun 1, 2023

    @muneeb-mt
    Author

    Thank you @ccvlad. I have solved the problem with your help.

  4. muneeb-mt commented on Jun 1, 2023

    @muneeb-mt
    Author

    Thank you @ccvlad. I have solved the problem with your help.

  5. ccvlad commented on Jun 1, 2023

    @ccvlad
    Contributor

    Based on the error message:

    1. Make sure you are passing the correct parameters to getUserMedia.
    2. Ensure that you haven't blocked the microphone permissions on your system (you might have allowed the camera but accidentally blocked the microphone).

    The ConnectyCube.videochat.createNewSession(...) just make a new WebRTC instance with methods and props. The callType saves in the instance as a property of it and can't call the error you've pointed.

  6. muneeb-mt commented on Jun 1, 2023

    @muneeb-mt
    Author

    @ccvlad
    I got this error: {"Not able to call the user": [TypeError: null is not an object (evaluating 'client.jid._local')]}

    Conditions No. 1: After first call -> if the opponent ends the call or the current user ends the call and we again click to call, we got this error
    Conditions No. 2: If the kill the app and again try to call -> we got the same error
    Why? Can you suggest any thing here?

  7. muneeb-mt commented on Jun 1, 2023

    @muneeb-mt
    Author

    @ccvlad @banshiAnton @DaveLomber @TatankaConCube Any solution for this?
    Actually our app is live and we are getting these problems and now we are reaching you people to ask you this. Much appreciated 🙌 . Thank you in advance 👍 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions