Skip to content

Audio Call issues #311

@muneeb-mt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions