Skip to content

Commit

Permalink
Allow passing additional params to startCall function (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
trieuduongle authored and MrHertal committed Aug 20, 2021
1 parent 8b2727b commit ecb69ec
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/RNTwilioPhone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,23 @@ class RNTwilioPhone {
});
}

static async startCall(to: string, calleeName?: string, from?: string) {
static async startCall(
to: string,
calleeName?: string,
from?: string,
additionalParams: ConnectParams = {}
) {
const accessToken = await RNTwilioPhone.fetchAccessToken();
const params: ConnectParams = { to };

if (from) {
params.from = from;
}

TwilioPhone.startCall(accessToken, params);
TwilioPhone.startCall(accessToken, {
...params,
...additionalParams,
});

const uuid = ramdomUuid().toLowerCase();
RNTwilioPhone.activeCall = { uuid: null, sid: null };
Expand Down

0 comments on commit ecb69ec

Please sign in to comment.