Skip to content

Access token life time for incoming calls #617

@EugeneBasalyga

Description

@EugeneBasalyga

Pre-submission Checklist

  • I have verified that the issue occurs with the latest release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Description

Hi, could you please explain how registering access tokens works for incoming calls.
On my backend for testing purposes i have set up access token life time for 1 minute (ttl: 60).

  getToken({identity, platform}) {
    const {
      AccessToken,
      AccessToken: {VoiceGrant},
    } = jwt;

    const accessToken = new AccessToken(
      this.accountSid,
      this.apiKeySid,
      this.apiKeySecret,
      {
        identity,
        ttl: 60,
      },
    );

    const voiceGrant = new VoiceGrant({
      outgoingApplicationSid: this.voiceOutgoingTwimlAppSid,
      incomingAllow: true,
      ...(platform !== undefined && {
        pushCredentialSid: platform === PLATFORM.IOS ? this.twilioApnPushCredentialSid : this.twilioFcmPushCredentialSid,
      }),
    });

    accessToken.addGrant(voiceGrant);

    return accessToken.toJwt();
  }

Then on mobile side registering this token.
await voice.register(token);

When using such token after a minute for outgoing call it will be automatically disconnected.
But for incoming calls it works even after an hour. Could you please clarify how exactly access tokens expiration works for incoming calls? What happens with previous tokens if i register a new one? What happens with previous tokens if i unregister the latest one?

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