Karim
01/22/2025, 1:58 PMVapi
01/22/2025, 2:00 PMjavascript
// Assuming `sdk` is your initialized web SDK instance
// Function to start a call and get the call ID
function startCallAndGetId() {
sdk.createPhoneCall({
// ... your call parameters ...
}).then(callDetails => {
// callDetails should contain the call ID and other metadata
const callId = callDetails.id;
console.log('Call ID:', callId);
// You can now link this call ID with your reporting
}).catch(error => {
console.error('Error starting the call:', error);
});
}
// Call the function to start the call
startCallAndGetId();
Please replace sdk.createPhoneCall
with the actual method provided by the web SDK you are using, and ensure that the parameters passed to the method match the SDK's requirements. The callDetails
object is expected to contain the call ID, but you should refer to the SDK's documentation to know the exact structure of the response.
If you need more specific instructions or if there's a particular part of the SDK you're unsure about, please let me know, and I'll be happy to assist further!Vapi
01/22/2025, 2:00 PMKarim
01/22/2025, 2:07 PMShubham Bajaj
01/23/2025, 6:32 AMts
const response = vapi.start(assistantId);