Giter VIP home page Giter VIP logo

Comments (7)

MrHertal avatar MrHertal commented on September 28, 2024

Hi,

Maybe RNTwilioPhone is not initialized yet when you are calling startCall.

Can you show the entire component with the call to startCall?

from react-native-twilio-phone.

wavemirani avatar wavemirani commented on September 28, 2024

Hi,

Maybe RNTwilioPhone is not initialized yet when you are calling startCall.

Can you show the entire component with the call to startCall?

Hello,

also While I am trying to RNTwilioPhone.initialize() it retuns error 'RNTwilioPhone.fetchAccessToken is not a function'

import React, {useState} from 'react'
import { View, Text, Button } from "react-native";
import { RNTwilioPhone } from 'react-native-twilio-phone';
import axios from "axios";

export default function TwilioTest() {
const callKeepOptions = {
ios: {
appName: 'TwilioPhone Example',
supportsVideo: false,
},
android: {
alertTitle: 'Permissions required',
alertDescription: 'This application needs to access your phone accounts',
cancelButton: 'Cancel',
okButton: 'OK',
additionalPermissions: [],
// Required to get audio in background when using Android 11
foregroundService: {
channelId: 'com.app.xxxxxx',
channelName: 'Foreground service for my app',
notificationTitle: 'My app is running on background',
},
},
};

const options = {
requestPermissionsOnInit: true, // Default: true - Set to false if you want to request permissions manually
};

async function fetchAccessToken1() {
  axios.get('https://xxxxxx.com/api/Account/getTwilioToken').then(res => {
    return RNTwilioPhone.initialize(callKeepOptions, res.data.TwilioToken. options);
  }).catch(err => console.log('err>>>>>>', err))
};


  React.useEffect(() => {
    fetchAccessToken1()
  }, []);

  async function startCall() {
    try {
      await RNTwilioPhone.startCall('+00123456789');
    } catch (e) {
      console.log(e);
    }
  }
return (
    <View>
        <Text>Twilio Test</Text>
        <Button title = "call" onPress= {() => startCall()} />
    </View>
)

}

//===================================================================================

also, I am generating the token from C# throw bellow the attached code

using System;
using System.Collections.Generic;
using Twilio.Jwt.AccessToken;

class Example
{
static void Main(string[] args)
{
// These values are necessary for any access token
const string twilioAccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string twilioApiKey = "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string twilioApiSecret = "your_secret";

    // These are specific to Voice
    const string outgoingApplicationSid = "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    const string identity = "user";

    // Create a Voice grant for this token
    var grant = new VoiceGrant();
    grant.OutgoingApplicationSid = outgoingApplicationSid;

    // Optional: add to allow incoming calls
    grant.IncomingAllow = true;

    var grants = new HashSet<IGrant>
    {
        { grant }
    };

    // Create an Access Token generator
    var token = new Token(
        twilioAccountSid,
        twilioApiKey,
        twilioApiSecret,
        identity,
        grants: grants);

    Console.WriteLine(token.ToJwt());
}

}

from react-native-twilio-phone.

MrHertal avatar MrHertal commented on September 28, 2024

Thanks @wavemirani,

You are not initializing this module correctly.
Please read the documentation carefully. Then you can check how the module is initialized in the example app.

fetchAccessToken is a function that is calling an API endpoint to get a fresh token.
Twilio is providing some example projects that you can use to create that API endpoint.

from react-native-twilio-phone.

sumerpalgit avatar sumerpalgit commented on September 28, 2024

Thanks @MrHertal ,

Now, We are getting fetchAccessToken and calling is working. But now we will calling call with masking which twilio provide so can you please advice us on same.

from react-native-twilio-phone.

MrHertal avatar MrHertal commented on September 28, 2024

Hi @sumerpalgit,

What is call with masking? Do you have a link to Twilio documentation that describes it?

from react-native-twilio-phone.

sumerpalgit avatar sumerpalgit commented on September 28, 2024

Hello @MrHertal

Here is link for twilio documentation for : https://www.twilio.com/docs/sms/tutorials/masked-numbers-php-laravel

from react-native-twilio-phone.

MrHertal avatar MrHertal commented on September 28, 2024

Sorry @sumerpalgit I cannot help you with this because I have never built call masking.

You should contact Twilio support, I am sure they will help you setting this up.

I will close this issue for now. Let me know if you need help with this package.

from react-native-twilio-phone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.