Skip to Content
Dial v1 live 🎉
SdkCall History

Call History

Track and manage your call history across all wallet-to-wallet communications.

Get Call History

const history = await dial.calls.getHistory({ limit: 50, offset: 0 }); console.log(`You have ${history.length} calls`);

Call Record Object

interface CallRecord { id: string; from: string; // Caller wallet address to: string; // Recipient wallet address type: 'audio' | 'video'; status: 'completed' | 'missed' | 'declined' | 'failed'; direction: 'incoming' | 'outgoing'; startedAt: Date; endedAt?: Date; duration: number; // in seconds recording?: { url: string; duration: number; }; }

Filter Call History

By Status

// Get only missed calls const missedCalls = await dial.calls.getHistory({ status: 'missed', limit: 20 }); // Get completed calls const completedCalls = await dial.calls.getHistory({ status: 'completed' });

By Direction

// Get incoming calls const incomingCalls = await dial.calls.getHistory({ direction: 'incoming' }); // Get outgoing calls const outgoingCalls = await dial.calls.getHistory({ direction: 'outgoing' });

By Contact

// Get calls with specific address const callsWithContact = await dial.calls.getHistory({ with: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb' });

By Date Range

const calls = await dial.calls.getHistory({ from: new Date('2025-01-01'), to: new Date('2025-12-31') });

By Type

// Video calls only const videoCalls = await dial.calls.getHistory({ type: 'video' }); // Audio calls only const audioCalls = await dial.calls.getHistory({ type: 'audio' });

Pagination

// First page const page1 = await dial.calls.getHistory({ limit: 20, offset: 0 }); // Second page const page2 = await dial.calls.getHistory({ limit: 20, offset: 20 });

Get Single Call

const call = await dial.calls.get(callId); console.log('Call duration:', call.duration); console.log('Call status:', call.status);

Delete Call from History

await dial.calls.deleteFromHistory(callId);

Clear All History

await dial.calls.clearHistory();

Call Statistics

const stats = await dial.calls.getStatistics(); console.log('Total calls:', stats.totalCalls); console.log('Total duration:', stats.totalDuration); console.log('Missed calls:', stats.missedCalls); console.log('Average duration:', stats.avgDuration);

Export Call History

// Export as JSON const json = await dial.calls.exportHistory({ format: 'json' }); // Export as CSV const csv = await dial.calls.exportHistory({ format: 'csv' }); // Download const blob = new Blob([csv], { type: 'text/csv' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'call-history.csv'; a.click();

Complete Example: Call History Component

import { useState, useEffect } from 'react'; import { DialClient, CallRecord } from '@dial/sdk'; export function CallHistory({ dial }) { const [calls, setCalls] = useState<CallRecord[]>([]); const [filter, setFilter] = useState<string>('all'); const [loading, setLoading] = useState(true); useEffect(() => { loadHistory(); }, [filter]); const loadHistory = async () => { setLoading(true); const params: any = { limit: 50 }; if (filter !== 'all') { params.status = filter; } const history = await dial.calls.getHistory(params); setCalls(history); setLoading(false); }; const deleteCall = async (callId: string) => { await dial.calls.deleteFromHistory(callId); setCalls(calls.filter(c => c.id !== callId)); }; const formatDuration = (seconds: number) => { const mins = Math.floor(seconds / 60); const secs = seconds % 60; return `${mins}:${secs.toString().padStart(2, '0')}`; }; const getCallIcon = (call: CallRecord) => { if (call.status === 'missed') return '📵'; if (call.direction === 'incoming') return '📞'; return '📲'; }; return ( <div className="call-history"> <h2>Call History</h2> <div className="filters"> <button onClick={() => setFilter('all')} className={filter === 'all' ? 'active' : ''} > All </button> <button onClick={() => setFilter('missed')} className={filter === 'missed' ? 'active' : ''} > Missed </button> <button onClick={() => setFilter('completed')} className={filter === 'completed' ? 'active' : ''} > Completed </button> </div> {loading ? ( <div>Loading...</div> ) : ( <div className="call-list"> {calls.map(call => ( <div key={call.id} className="call-item"> <span className="icon">{getCallIcon(call)}</span> <div className="info"> <div className="contact"> {call.direction === 'incoming' ? call.from : call.to} </div> <div className="details"> {call.type} • {formatDuration(call.duration)} </div> <div className="time"> {call.startedAt.toLocaleString()} </div> </div> <button onClick={() => deleteCall(call.id)}> 🗑️ </button> </div> ))} </div> )} </div> ); }

Sync Across Devices

Call history is automatically synced across all devices using the same wallet address:

// History is automatically synced // No additional configuration needed // Listen for sync events dial.on('history:synced', () => { console.log('History synced across devices'); });

Privacy

// Enable end-to-end encryption for call metadata await dial.calls.enablePrivateHistory(true); // History is stored encrypted on-chain // Only accessible with your wallet signature

Next Steps

Last updated on