Phone numbers are the gateway for users to interact with your voice AI agents through traditional phone calls. Pinecall makes it easy to acquire, configure, and manage phone numbers across multiple countries.
You can acquire new phone numbers programmatically using our SDK or through the Pinecall dashboard.
import { Pinecall } from '@pinecall/sdk';
const pinecall = new Pinecall({ apiKey: process.env.PINECALL_API_KEY});
async function acquirePhoneNumber() { // List available phone numbers in the US const availableNumbers = await pinecall.phoneNumbers.list({ country: 'US', type: 'local', // 'local' or 'toll-free' areaCode: '415' // Optional: specify area code }); console.log(`Found ${availableNumbers.length} available numbers`); // Acquire the first available number if (availableNumbers.length > 0) { const phoneNumber = await pinecall.phoneNumbers.acquire({ phoneNumber: availableNumbers[0].number }); console.log(`Acquired phone number: ${phoneNumber.number}`); return phoneNumber; }}
After acquiring a phone number, you need to configure it by assigning it to an agent and setting up call handling preferences.
// Configure a phone number and assign it to an agentasync function configurePhoneNumber(phoneNumberId, agentId) { const updatedNumber = await pinecall.phoneNumbers.update(phoneNumberId, { agentId: agentId, // The agent that will handle calls callHandling: { voicemail: { enabled: true, // Enable voicemail when agent is unavailable transcribe: true // Transcribe voicemail messages }, operating_hours: { timezone: 'America/Los_Angeles', schedule: [ { day: 'monday', start: '09:00', end: '17:00' }, { day: 'tuesday', start: '09:00', end: '17:00' }, { day: 'wednesday', start: '09:00', end: '17:00' }, { day: 'thursday', start: '09:00', end: '17:00' }, { day: 'friday', start: '09:00', end: '17:00' } ] } } }); console.log(`Phone number ${updatedNumber.number} configured successfully`); return updatedNumber;}
Pinecall provides several methods to help you manage your phone numbers:
// List all your phone numbersconst numbers = await pinecall.phoneNumbers.list();
// Get details for a specific phone numberconst number = await pinecall.phoneNumbers.get('pn_12345');
// Update a phone number configurationconst updatedNumber = await pinecall.phoneNumbers.update('pn_12345', { friendlyName: 'Customer Support Line', agentId: 'agent_67890'});
// Release a phone number you no longer needawait pinecall.phoneNumbers.release('pn_12345');
Type | Description | Use Case |
---|---|---|
Local | Numbers with specific area codes | Local businesses, regional services |
Toll-Free | Numbers that are free for callers (800, 888, etc.) | Customer support, national services |
Mobile | Mobile phone numbers in select countries | SMS-enabled services, personal assistants |
International | Numbers from various countries worldwide | Global businesses, international support |
Phone number availability varies by country and region. Pinecall currently supports phone numbers in the following regions:
Contact us for specific country availability not listed here.
Pinecall offers advanced call routing capabilities to ensure calls are handled appropriately:
Configure your agent to forward calls to human operators when certain conditions are met.
Distribute calls across multiple agents to balance workload and specialization.
Route calls based on caller information, time of day, or other custom criteria.
Place callers in a queue with customizable wait messages when all agents are busy.
// Configure advanced call routingawait pinecall.phoneNumbers.update('pn_12345', { callHandling: { routing: { type: 'conditional', conditions: [ { // During business hours, route to primary agent condition: 'during_business_hours', agentId: 'agent_primary' }, { // For VIP callers, route to premium agent condition: 'caller_in_group:vip', agentId: 'agent_premium' }, { // Default fallback agent agentId: 'agent_after_hours' } ], // Enable human escalation humanEscalation: { enabled: true, forwardTo: '+15551234567', escalationTriggers: ['user_request', 'agent_recommendation'] } } }});
Now that you understand how to manage phone numbers, you can: