Closed santanushyamal closed 4 years ago
I am getting error with make call function. it always return error. Error code are 11750, 52134
Hi @santanushyamal
While it's not very clear to figure out what's wrong from the code snippets you provided, the 11750
error code indicates that the TwiML response from your endpoint is too large for Twilio to process and you probably want to check that part.
The 52134 error means the PushKit device token from your iOS app is malformed and cannot be used for sending notification requests to Apple. Please make sure you are following the latest version of the Voice iOS quickstart for PushKit/CallKit integration.
Please provide Twilio Call SIDs where you are seeing errors. You can find Call SIDs either in the Xcode debugger or from the Twilio console.
Hi @bchen-twilio I am getting error with makecall function and placecall function for client to client voice call. We have checked the twilio cosole Debugger. The error codes are 11750, 52134.
Below the code environment details. 1) Server programming language : PHP (LARAVEL) 2) APP : iOS and Android. 3) Below are the code details of makeCall function and placeCall function.
public function makeCall(Request $request){ $callerId = $request->Caller; $to = $request->to; $callerNumber = ''; $response = new VoiceResponse(); if (!isset($to) || empty($to)) { $response->say('Congratulations! You have just made your first call! Good bye.'); } else if (is_numeric($to)) { $dial = $response->dial($callerNumber); $dial->number($to); } else { $dial = $response->dial($callerId); $dial->client($to); } return $response; }
//////////////////////////// public function placeCall(Request $request){ $identity = 'alice'; $callerNumber = ''; $callerId = $request->Caller; $to = $request->to; $client = new Client($this->key, $this->secret, $this->sid); $call = NULL; if (!isset($to) || empty($to)) { $call = $client->calls->create( 'client'.$to, // Call this number $callerId, // From a valid Twilio number array( 'url' => 'https://'.$_SERVER['HTTP_HOST'].'/api/incoming' ) ); } else if (is_numeric($to)) { $call = $client->calls->create( $to, // Call this number $callerNumber, // From a valid Twilio number array( 'url' => 'https://'.$_SERVER['HTTP_HOST'].'/api/incoming' ) ); } else { $call = $client->calls->create( 'client:'.$to, // Call this number $callerId, // From a valid Twilio number array( 'url' => 'https://'.$_SERVER['HTTP_HOST'].'/api/incoming' ) ); }
print $call;
}
Which endpoint is the TwiML app using? makeCall
or placeCall
?
For the 52134 error, please check your iOS implementation and make sure that your application is using the correct format of the PushKit device token. For the 11750 error, we will need a Call SID, or you can also check the TwiML response return from your server endpoint. From the documentation of 11750, the TwiML response is either malformed or too large for Twilio to handle.
The endpoint of TwiML app is makeCall. Call SID : CA5593ec91f4e94781495ffd8082fed19d
Thanks for the Call SID @santanushyamal. Unfortunately Twilio was not able to save the TwiML response from your app endpoint because it is larger than 64kb. Can you please add some debug message and check the contents returned from your makeCall endpoint? It should look like this
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callId="client:alice">
<Client>bob</Client>
</Dial>
</Response>
When I call my placeCall function, it does not return any error code. But call did not connect. I got some response with SID. this SID is CA19bcc422a18fed44c09c42746690dcd1
Hi @santanushyamal
For the Call CA19bcc422a18fed44c09c42746690dcd1
, it showed that there was no registration record for the client identity santanu
you were trying to call. Please check if your mobile client is using the correct identity in the access token when calling the TwilioVoice.register()
method.
Hi @bchen-twilio,
Thanks for your suggestions. We are still struggling with the 'Client to Client' audio call. We need your help.
Here are the details:
We have checked the iOS implementation and it is using push kit device token with data format.
We have checked the debug message and now the TwiML response returns from my server end-point (makeCall) -"Congratulations! You have just made your first call! Good bye."
Here is the CALL SID for your reference : CA2c383b33a396dbccdbcbc26d97d3476a
Awaiting for your response.
Thanks
To make client to client calls:
makeCall
endpoint as the Voice incoming URL in the Twilio dev console. This endpoint should return a TwiML containing the builder.params
dictionary such as the receiver client identity.makeCall
endpoint should be able to parse the additional information out of the HTTP request parameters and determine the call receiver identity to be put inside the Hi @bchen-twilio,
We have changed the identity value using the 'builder.params' dictionary in iOS. But the 'makeCall' API is always getting an empty value for the "To" field and it always shows "Congratulations! You have just made your first call! Good bye."
Let us know your suggestion regarding how we will get the "To" value in the "makeCall" API. We have attached the PHP 'accessToken' code for your reference.
CALL SID : CAb7d56e7951ce6d57d4ae7a15fd4b28f9
Here is the iOS code of performVoiceCall:
func performVoiceCall(uuid: UUID, client: String?, completionHandler: @escaping (Bool) -> Void) { guard let accessToken = fetchAccessToken() else { completionHandler(false) return }
let connectOptions = TVOConnectOptions(accessToken: accessToken) { builder in
builder.params = ["to": "bob"]
builder.uuid = uuid
}
let call = TwilioVoice.connect(with: connectOptions, delegate: self)
activeCall = call
activeCalls[call.uuid.uuidString] = call
callKitCompletionCallback = completionHandler
}
Here is the PHP code for generating access token:
public function accessToken(Request $request){
try{
$identity = $request->identity;
// Create access token, which we will serialize and send to the client
$token = new AccessToken($this->sid, $this->key, $this->secret, 3600, $identity);
// Create Voice grant
$voiceGrant = new VoiceGrant();
$voiceGrant->setOutgoingApplicationSid($this->outGoingId);
$voiceGrant->setPushCredentialSid($this->push_credential_sid);
// Optional: add to allow incoming calls
$voiceGrant->setIncomingAllow(true);
// Add grant to token
$token->addGrant($voiceGrant);
// Serialize the token as a JWT
return $token->toJWT();
//echo $token->toJWT();
}catch(Exception $e){
return $e->getMessage();
}
}
Thanks. Waiting for your response.
Hi @santanushyamal
Have you tried to extract the value on your sever endpoint using the lowercased to
?
Yes, we have checked with lowercase "to" and uppercase "To" both. But the results are the same.
Hi @santanushyamal
I checked your Call SID and it doesn't seem very clear to me how the makeCall
endpoint is used. I can see the makeCall
endpoint was hit when the call was made, but it didn't return a TwiML directly. This is my hunch, but it seems that the makeCall endpoint URL you provided in the TwiML app uses a plain-text http
and the request was redirected to the https
endpoint. Can you try updating the link in your TwiML App with the secured link?
Hi @bchen-twilio,
Thanks for your suggestion. We have checked with http and https both. Results are the same.
The problem was related to makeCall endpoint (Error 11750) and now we have successfully done the audio call in iOS using APNS. But it is not working for android.
Can we use FCM PUSH_CREDENTIAL_SID for the iOS audio call?
It would be good if you suggest how we can use one PUSH_CREDENTIAL_SID for iOS and android both.
Thanks again.
Glad that the TwiML issue has been resolved @santanushyamal.
The Push Credentials are not sharable between iOS and Android mobile clients - you need to created separate Push Credentials using your FCM credentials and Apple VoIP certificate and use corresponding Push Credential SIDs in the access token in your Android and iOS mobile clients.
Since the original endpoint issue has been resolved, I will close this ticket. Please feel free to create new tickets here if you run into problem with the server components or the Android quickstart/iOS quickstart if you need platform specific help.
Cheers, -bobie
public function makeCall(Request $request){ $callerId = 'client:quick_start'; $to = isset($_POST["to"]) ? $_POST["to"] : ""; if (!isset($to) || empty($to)) { $to = isset($_GET["to"]) ? $_GET["to"] : ""; }
I am getting error.