Open ihorMarynichZazmic opened 1 month ago
Hi @ihorMarynichZazmic please format your code using the Github code snippet syntax, using triple backticks. It helps with readability for debugging your issue.
Let's specify further what is not working. Are you able to make outgoing calls, receive incoming calls, etc.? Do you see any crashes or strange behavior in your app? Any errors logged to console?
Hi @mhuynh5757,
Thank you for following up. Here’s some additional context to clarify the issue.
Current Problem The main issue is that the token generated with the provided code snippet does not appear to be working as expected, specifically for making outgoing calls. Here’s what we’re experiencing:
Outgoing Calls: When attempting to place an outgoing call, the app stays in the initialization phase, and no Call SID is generated in the Twilio console. Incoming Calls: Incoming calls also do not seem to trigger any notifications or updates on the device. Errors and Logs: We are not seeing any error messages in the console, but there is no evidence of the call setup either in our app or the Twilio console. Code Context Here is the code snippet we’re using to generate the token, reformatted for readability:
const voiceGrant = new VoiceGrant({
outgoingApplicationSid: twilioOutgoingApplicationSid,
incomingAllow: true
});
const token = new AccessToken(
twilioAccountSid,
twilioApiKey,
twilioApiSecret,
{ identity: identity }
);
token.addGrant(voiceGrant);
return token.toJwt();
We are using the official Twilio library with subaccounts, and the necessary credentials (Account SID, API Key, API Secret) have been double-checked.
Additional Details Environment: This issue is occurring on our production environment with subaccounts. Expected Behavior: We expected the token to allow the app to successfully initiate an outgoing call and connect through Twilio. If there are any suggestions for debugging this setup or if we need to check any specific configurations, we would appreciate the guidance.
Thank you! Ihor
Hi @ihorMarynichZazmic thanks for the further clarification and the reformatting, I really appreciate it. Are you attempting to make calls from a subaccount to a client registered with the parent account? It is my understanding that you can only make calls between clients registered to the same account SID, meaning that the following scenario will not work:
Account A
Subaccount B (parent account A)
Alice uses a token made with Account A
Bob uses a token made with Account B
Alice calls Bob, or Bob calls Alice
Let me verify this with my team, but I'm fairly confident this scenario will not work.
Hi @ihorMarynichZazmic thanks for the further clarification and the reformatting, I really appreciate it. Are you attempting to make calls from a subaccount to a client registered with the parent account? It is my understanding that you can only make calls between clients registered to the same account SID, meaning that the following scenario will not work:
Account A Subaccount B (parent account A) Alice uses a token made with Account A Bob uses a token made with Account B Alice calls Bob, or Bob calls Alice
Let me verify this with my team, but I'm fairly confident this scenario will not work.
Hello,
We are not do calls between sub accounts. We are trying to make a call from sub account to our phone number in USA. So we just want make it working to call from our active phone number in sub account using sub account credentials
Hi @varfolomejevigorzazmic thanks for the additional info. Could I ask for more details about your dev environment? Are you targeting Android or iOS? Are you using a real device or a virtual one? Do you see any errors in the native logs, Xcode for iOS and Android Studio/logcat for Android?
Hi @mhuynh5757 Myself and @varfolomejevigorzazmic are working on the same project and have the same indentical condition What exactly do you mean by dev environment, maybe give an example? I'm trying targeting on iOS, next step will be on Android. Yes, I used a real device. I'm not using Xcode for iOS and Android Studio/logcat for Android because I'm working on expo with manager flow.
Token Generation and Registration: The token appears to be generated and fetched correctly:
LOG Fetching Twilio token... LOG Twilio token fetched: eyJhbGciOiJIUzI1NiIs... LOG Voice client registered with token Outgoing Call Attempt:
The call parameters include a from number (+12525422504), a recipient type (ios), and a to number (e.g., +17162885949). Despite setting these parameters, the outgoing call object logs show _from and _to as undefined. Error Details:
During the call process, the call remains in the "connecting" state and finally ends with a "Decline" error: ERROR ConnectFailure: [Decline: Decline (31603): Decline]
We are trying to generate a token for Twilio Voice using the following code snippet:
voiceGrant = new VoiceGrant({
outgoingApplicationSid: twilioOutgoingApplicationSid,
incomingAllow: true
});
const token = new AccessToken(
twilioAccountSid,
twilioApiKey,
twilioApiSecret,
{ identity:identity }
);
token.addGrant(voiceGrant);
return token.toJwt();
We are using the official library and subaccounts, but it's not working as expected. Please assist us further.