Skip to main content

Field Services

Voice for dispatch-driven businesses — HVAC, plumbing, electrical, pest control, security, vehicle rental, etc.

Pattern: business-hour routing with AI overflow​

Dial plan that does this​

TypeScript
await ds.dialPlans.create(
{
name: 'Main dispatch line',
entry_node: 'hours',
nodes: [
{
id: 'hours',
type: 'schedule',
config: { schedule: businessHours.id, open: 'ring_dispatch', closed: 'ai_intake' },
},
{
id: 'ring_dispatch',
type: 'ring_all_users',
config: { timeout: 25, next: 'ai_intake' },
},
{
id: 'ai_intake',
type: 'voice_app',
config: { voice_app: dispatchAgent.id },
},
],
},
{ dialstackAccount: account.id }
);

businessHours is a schedule from the Schedules API and dispatchAgent is a voice app.

The AI Voice App fires a webhook to your on-call rotation system when it captures an after-hours job. Full Voice App setup: Voice Apps.

Pattern: dispatcher click-to-call from the job screen​

Give dispatchers a button on every job card that dials the customer. The dispatcher's own phones ring first; when they answer, DialStack dials the customer and connects the two.

TypeScript
import { useDialstack } from '@dialstack/sdk-react';

function JobCard({ job, dispatcher }) {
const dialstack = useDialstack();

return (
<button
onClick={() =>
dialstack.calls.create({
userId: dispatcher.id,
dialString: job.customer_phone,
})
}
>
Call {job.customer_name}
</button>
);
}

useDialstack() returns the instance passed to <DialstackComponentsProvider>, so this runs on the account session your backend minted. Full behavior (which phones ring, dial string formats, errors): Click-to-Call.

Pattern: log every call to the job record​

TypeScript
if (event.type === 'call.end') {
const job = await db.jobs.findOne({ customer_phone: event.data.from_number });
if (job) {
await db.jobActivity.insert({
job_id: job.id,
call_id: event.data.call_id,
user_id: event.data.user_id,
direction: event.data.direction,
duration: event.data.duration_seconds,
status: event.data.status,
ended_at: event.data.ended_at,
});
}
}

Full event surface: Activity Logging.

Build this with DialStack​