Comments (7)
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.
Hi,
Maybe
RNTwilioPhone
is not initialized yet when you are callingstartCall
.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.
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.
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.
Hi @sumerpalgit,
What is call with masking? Do you have a link to Twilio documentation that describes it?
from react-native-twilio-phone.
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.
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)
- Upgrade ios and android Twilio SDK's to support Umatilla Oregon public edge HOT 1
- Hangup does not work HOT 2
- Video call HOT 1
- two simultaneous calls cause a crash
- Incoming call not working on ios with adhoc profile with voip certificate
- End call listener gets call automatically of RNCallKeep for android when app is in active(foreground and background) both) HOT 2
- The incoming phone call can not connect when app has been killed HOT 1
- incoming call automatic disconnect if android app is in forground.
- Caller is not able to end the call HOT 1
- How to send my own UUID? HOT 2
- Android: Not able to accept the call when call is coming in kill/background state
- can we get call uuid when ringing
- Hide my app name prompt in dialer for outgoing calls
- Official Twilio Voice React Native SDK HOT 2
- When I answer on the incoming call, in the app, I can't join to it. On IOS HOT 2
- In Recents Tab on iOS, my calls show but when I click them, nothing happens HOT 2
- # Warning - 13214 # Dial: Invalid callerId
- [TypeError: null is not an object (evaluating '_reactNativeTwilioPhone.TwilioPhone.register')]
- Android: Not receiving Phone calls When app is in background.
- If I receive an incoming call while the application is open, I do not want to display the notification. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-twilio-phone.