@signalhousellc/sdk 1.5.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +5 -56
  2. package/index.d.ts +1 -0
  3. package/index.js +2 -0
  4. package/package.json +32 -34
  5. package/voice-browser.d.ts +1 -0
  6. package/voice-browser.js +2 -0
  7. package/warn.js +7 -0
  8. package/webhooks.d.ts +1 -0
  9. package/webhooks.js +2 -0
  10. package/scripts/install-skills.mjs +0 -329
  11. package/skills/VENDORED.json +0 -22
  12. package/skills/signalhouse-10dlc/SKILL.md +0 -172
  13. package/skills/signalhouse-10dlc/examples/brightsmile-onboarding.md +0 -62
  14. package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +0 -104
  15. package/skills/signalhouse-advisor/SKILL.md +0 -84
  16. package/skills/signalhouse-numbers/SKILL.md +0 -82
  17. package/skills/signalhouse-setup/SKILL.md +0 -121
  18. package/skills/signalhouse-sms/SKILL.md +0 -81
  19. package/skills/signalhouse-webhooks/SKILL.md +0 -148
  20. package/src/SignalHouseSDK.js +0 -201
  21. package/src/domains/Agents.js +0 -987
  22. package/src/domains/Auth.js +0 -225
  23. package/src/domains/Billing.js +0 -265
  24. package/src/domains/Brands.js +0 -566
  25. package/src/domains/Campaigns.js +0 -691
  26. package/src/domains/Dnc.js +0 -168
  27. package/src/domains/Groups.js +0 -187
  28. package/src/domains/Landings.js +0 -237
  29. package/src/domains/Messages.js +0 -609
  30. package/src/domains/Notifications.js +0 -62
  31. package/src/domains/Numbers.js +0 -574
  32. package/src/domains/Onboarding.js +0 -128
  33. package/src/domains/Registrations.js +0 -246
  34. package/src/domains/Shortlinks.js +0 -80
  35. package/src/domains/Subgroups.js +0 -136
  36. package/src/domains/Subscriptions.js +0 -164
  37. package/src/domains/Templates.js +0 -403
  38. package/src/domains/Tickets.js +0 -100
  39. package/src/domains/Users.js +0 -228
  40. package/src/domains/Voice.js +0 -41
  41. package/src/domains/Webhooks.js +0 -125
  42. package/src/domains/voice/Analytics.js +0 -82
  43. package/src/domains/voice/CallLogs.js +0 -111
  44. package/src/domains/voice/Calls.js +0 -118
  45. package/src/domains/voice/GlobalVoiceSettings.js +0 -54
  46. package/src/domains/voice/NumberRoutes.js +0 -82
  47. package/src/domains/voice/ProgrammableVoiceProfiles.js +0 -191
  48. package/src/domains/voice/SipProfiles.js +0 -203
  49. package/src/domains/voice/SipTrunks.js +0 -203
  50. package/src/domains/voice/Tokens.js +0 -96
  51. package/src/domains/voice/browser/Call.js +0 -366
  52. package/src/domains/voice/browser/Device.js +0 -484
  53. package/src/domains/voice/browser/index.js +0 -17
  54. package/src/webhooks/verifySignature.js +0 -66
@@ -1,118 +0,0 @@
1
- /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {Object} CreateCallData
9
- * @property {string} to - Destination phone number in E.164 format (e.g. "+15551234567") or SIP URI.
10
- * @property {string} from - Caller ID to present on the outbound leg. Must be an account-owned phone number when not using a SIP trunk.
11
- * @property {string} [sip_trunk_id] - Route via a configured SIP trunk. Mutually exclusive with `sip_profile_id` and `to_identity` for the trunk path.
12
- * @property {string} [sip_profile_id] - Two-leg-with-bridge: ring this persistent SIP profile first, then dial `to` and bridge. Mutually exclusive with `to_identity`.
13
- * @property {string} [to_identity] - Two-leg-with-bridge: ring the SDK-registered identity by logical name (the value passed to `tokens.create({identity})`), then dial `to` and bridge. Mutually exclusive with `sip_profile_id`.
14
- * @property {string} [answer_url] - Webhook URL fetched on call answer; returns call-control instructions.
15
- * @property {"GET"|"POST"} [answer_method] - HTTP method for `answer_url`. Defaults to POST.
16
- * @property {string} [status_callback] - Webhook URL for call status updates (QUEUED, RINGING, ANSWERED, COMPLETED, FAILED).
17
- * @property {"GET"|"POST"} [status_callback_method] - HTTP method for `status_callback`. Defaults to POST.
18
- * @property {boolean} [recording_enabled] - Record both legs of the call. Defaults to false.
19
- * @property {boolean} [transcription_enabled] - Transcribe the recording. Defaults to false.
20
- * @property {string} [ivr_flow_id] - Route the call into an AI IVR flow on answer instead of webhook control.
21
- * @property {Object} [metadata] - Free-form metadata persisted on the call log.
22
- */
23
-
24
- /**
25
- * @typedef {Object} ListCallsFilters
26
- * @property {number} [page] - Page number (1-indexed). Defaults to 1.
27
- * @property {number} [limit] - Page size (1-100). Defaults to 20.
28
- * @property {"QUEUED"|"RINGING"|"IN_PROGRESS"|"COMPLETED"|"FAILED"|"BUSY"|"NO_ANSWER"|"CANCELED"} [status] - Filter by call status.
29
- * @property {"INBOUND"|"OUTBOUND"} [direction] - Filter by call direction.
30
- * @property {string} [from] - Filter by caller number.
31
- * @property {string} [to] - Filter by destination number.
32
- * @property {string} [date_from] - ISO-8601 lower bound on start_time.
33
- * @property {string} [date_to] - ISO-8601 upper bound on start_time.
34
- */
35
-
36
- /**
37
- * Voice calls. REST API for placing outbound calls and inspecting call logs.
38
- * Wraps voice-backend's `/voice/v1/calls` surface. Accessed via `sdk.voice.calls`.
39
- *
40
- * Origination modes:
41
- * - **Single-leg** (no trunk/profile/identity): Twilio-style direct outbound — dial `to` from caller-ID `from`. Customer's `from` must be an account-owned number.
42
- * - **SIP trunk** (`sip_trunk_id`): Route via a configured trunk; the trunk's auth/ACL governs caller-ID rules.
43
- * - **Two-leg-with-bridge** (`sip_profile_id` OR `to_identity`): Ring the SDK-registered endpoint first, then dial `to` and bridge. `to_identity` resolves to the most recently-minted unexpired ephemeral identity for that name.
44
- */
45
- export class Calls {
46
- constructor(client, enableAdmin) {
47
- this.client = client;
48
- this.enableAdmin = enableAdmin;
49
- }
50
-
51
- /**
52
- * Create an outbound call.
53
- * @async
54
- * @roles api, admin, developer, billing, user
55
- * @param {Object} params - Request parameters.
56
- * @param {CreateCallData} params.callData - The call to place.
57
- * @param {RequestOptions} [params.options] - Additional options for the request.
58
- * @throws {Error} If callData is missing.
59
- * @returns {Promise<SdkResponse<any>>} The created call: `{ call_id, status, direction, from, to, created_at }`.
60
- */
61
- async create({ callData, options = {} }) {
62
- this.client._require({ callData });
63
- return this.client(`/voice/v1/calls`, { method: "POST", body: callData, ...options });
64
- }
65
-
66
- /**
67
- * List call logs for the current account, paginated and filterable.
68
- * @async
69
- * @roles api, admin, developer, billing, user
70
- * @param {Object} [params] - Request parameters.
71
- * @param {ListCallsFilters} [params.filters] - Optional filters.
72
- * @param {RequestOptions} [params.options] - Additional options for the request.
73
- * @returns {Promise<SdkResponse<any>>} `{ calls: [...], total, page, limit }`.
74
- */
75
- async list({ filters = {}, options = {} } = {}) {
76
- const query = new URLSearchParams();
77
- for (const [k, v] of Object.entries(filters)) {
78
- if (v !== undefined && v !== null && v !== "") query.set(k, String(v));
79
- }
80
- const qs = query.toString();
81
- const path = qs ? `/voice/v1/calls?${qs}` : `/voice/v1/calls`;
82
- return this.client(path, { method: "GET", ...options });
83
- }
84
-
85
- /**
86
- * Get a single call log by ID.
87
- * @async
88
- * @roles api, admin, developer, billing, user
89
- * @param {Object} params - Request parameters.
90
- * @param {string} params.id - The call log UUID (the value returned as `call_id` from `create`).
91
- * @param {RequestOptions} [params.options] - Additional options for the request.
92
- * @throws {Error} If id is missing.
93
- * @returns {Promise<SdkResponse<any>>} The call log.
94
- */
95
- async get({ id, options = {} }) {
96
- this.client._require({ id });
97
- const safeId = encodeURIComponent(id);
98
- return this.client(`/voice/v1/calls/${safeId}`, { method: "GET", ...options });
99
- }
100
-
101
- /**
102
- * Hang up an in-progress call.
103
- * @async
104
- * @roles api, admin, developer, billing, user
105
- * @param {Object} params - Request parameters.
106
- * @param {string} params.id - The call log UUID.
107
- * @param {"NORMAL"|"BUSY"|"NO_ANSWER"|"REJECTED"} [params.reason] - Hangup reason recorded on the call log. Defaults to NORMAL.
108
- * @param {RequestOptions} [params.options] - Additional options for the request.
109
- * @throws {Error} If id is missing.
110
- * @returns {Promise<SdkResponse<any>>} `{ success: boolean, message: string }`.
111
- */
112
- async hangup({ id, reason, options = {} }) {
113
- this.client._require({ id });
114
- const safeId = encodeURIComponent(id);
115
- const body = reason ? { reason } : {};
116
- return this.client(`/voice/v1/calls/${safeId}/hangup`, { method: "POST", body, ...options });
117
- }
118
- }
@@ -1,54 +0,0 @@
1
- /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {Object} GlobalVoiceSettingsData
9
- * @property {string[]} [acceptedRegions] - Accepted regions as country calling codes; empty = all allowed.
10
- * @property {number|null} [maxSpendPerMinute] - Baseline max spend per minute (dollars); null = no limit.
11
- * @property {boolean} [e911Enabled] - Whether numbers may dial 911.
12
- */
13
-
14
- /**
15
- * Global Voice Settings — account-wide voice defaults (accepted regions, max
16
- * spend per minute, E911). SIP trunks and Programmable Voice Profiles override
17
- * these. Calls the voice-backend service mounted under /voice. Accessed via
18
- * `sdk.voice.globalVoiceSettings`.
19
- */
20
- export class GlobalVoiceSettings {
21
- constructor(client, enableAdmin) {
22
- this.client = client;
23
- this.enableAdmin = enableAdmin;
24
- }
25
-
26
- /**
27
- * Get the current account's global voice settings. Returns `data: null` if the
28
- * account has never configured them (defaults apply).
29
- * @async
30
- * @roles api, admin, developer, billing, user
31
- * @param {Object} [params] - Request parameters.
32
- * @param {RequestOptions} [params.options] - Additional options for the request.
33
- * @returns {Promise<SdkResponse<any>>} `{ success, data: { accountId, acceptedRegions, maxSpendPerMinute, e911Enabled, ... } | null }`.
34
- */
35
- async get({ options = {} } = {}) {
36
- return this.client(`/voice/api/v1/global-voice-settings`, { method: "GET", ...options });
37
- }
38
-
39
- /**
40
- * Upsert the account's global voice settings. Partial — only the fields you
41
- * provide are written; omitted fields are preserved.
42
- * @async
43
- * @roles api, admin, developer
44
- * @param {Object} params - Request parameters.
45
- * @param {GlobalVoiceSettingsData} params.settingsData - Fields to set.
46
- * @param {RequestOptions} [params.options] - Additional options for the request.
47
- * @throws {Error} If settingsData is missing.
48
- * @returns {Promise<SdkResponse<any>>} `{ success, data: { ...settings } }`.
49
- */
50
- async update({ settingsData, options = {} }) {
51
- this.client._require({ settingsData });
52
- return this.client(`/voice/api/v1/global-voice-settings`, { method: "PUT", body: settingsData, ...options });
53
- }
54
- }
@@ -1,82 +0,0 @@
1
- /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {Object} NumberRouteData
9
- * @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"|"VOICEMAIL"} routeAction - How inbound calls to the number are handled.
10
- * @property {string|null} [forwardToE164] - FORWARD destination (required for FORWARD), or the WEBRTC no-answer destination when noAnswerAction is FORWARD.
11
- * @property {"VOICEMAIL"|"FORWARD"|"KEEP_RINGING"|null} [noAnswerAction] - WEBRTC only: what happens when nobody answers (default VOICEMAIL).
12
- * @property {number|null} [noAnswerSeconds] - WEBRTC only: seconds to ring before the no-answer action, 5-120 (default 20).
13
- * @property {string|null} [routeSipTrunkId] - SIP trunk to deliver to (required for SIP_TRUNK).
14
- * @property {string|null} [routeSipProfileId] - SIP endpoint to ring (required for SIP_PROFILE).
15
- * @property {string|null} [webhookUrl] - SHML program URL (required for CALL_CONTROL).
16
- * @property {string|null} [routeAgentProfileId] - AI agent profile id, AGP… (required for AI).
17
- * @property {boolean} [recordingEnabled] - Record calls handled by this route.
18
- */
19
-
20
- /**
21
- * Number Routes — one inbound route set directly on a single phone number. A
22
- * number's own route takes priority over its Programmable Voice Profile and
23
- * subgroup voice settings. Calls the voice-backend service mounted under
24
- * /voice. Accessed via `sdk.voice.numberRoutes`.
25
- */
26
- export class NumberRoutes {
27
- constructor(client, enableAdmin) {
28
- this.client = client;
29
- this.enableAdmin = enableAdmin;
30
- }
31
-
32
- /**
33
- * Get a number's own route and the routing currently in effect for it.
34
- * @async
35
- * @roles api, admin, developer, billing, user
36
- * @param {Object} params - Request parameters.
37
- * @param {string} params.e164 - The phone number in E.164 (leading + optional).
38
- * @param {RequestOptions} [params.options] - Additional options for the request.
39
- * @throws {Error} If e164 is missing.
40
- * @returns {Promise<SdkResponse<any>>} `{ e164, route: {...} | null, effective: {...} }`.
41
- */
42
- async get({ e164, options = {} }) {
43
- this.client._require({ e164 });
44
- const safeE164 = encodeURIComponent(e164);
45
- return this.client(`/voice/api/v1/numbers/${safeE164}/route`, { method: "GET", ...options });
46
- }
47
-
48
- /**
49
- * Set (create or replace) a number's route. The whole route is replaced:
50
- * fields the new routeAction doesn't use are cleared.
51
- * @async
52
- * @roles api, admin, developer
53
- * @param {Object} params - Request parameters.
54
- * @param {string} params.e164 - The phone number in E.164 (leading + optional).
55
- * @param {NumberRouteData} params.routeData - The route to set.
56
- * @param {RequestOptions} [params.options] - Additional options for the request.
57
- * @throws {Error} If e164 or routeData is missing.
58
- * @returns {Promise<SdkResponse<any>>} `{ e164, route: {...}, effective: {...} }`.
59
- */
60
- async set({ e164, routeData, options = {} }) {
61
- this.client._require({ e164, routeData });
62
- const safeE164 = encodeURIComponent(e164);
63
- return this.client(`/voice/api/v1/numbers/${safeE164}/route`, { method: "PUT", body: routeData, ...options });
64
- }
65
-
66
- /**
67
- * Remove a number's own route. The number falls back to its Programmable
68
- * Voice Profile, subgroup voice settings, or the default.
69
- * @async
70
- * @roles api, admin, developer
71
- * @param {Object} params - Request parameters.
72
- * @param {string} params.e164 - The phone number in E.164 (leading + optional).
73
- * @param {RequestOptions} [params.options] - Additional options for the request.
74
- * @throws {Error} If e164 is missing.
75
- * @returns {Promise<SdkResponse<any>>} `{ e164, route: null, effective: {...} }`.
76
- */
77
- async delete({ e164, options = {} }) {
78
- this.client._require({ e164 });
79
- const safeE164 = encodeURIComponent(e164);
80
- return this.client(`/voice/api/v1/numbers/${safeE164}/route`, { method: "DELETE", ...options });
81
- }
82
- }
@@ -1,191 +0,0 @@
1
- /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {Object} CreateProgrammableVoiceProfileData
9
- * @property {string} name - Profile name (required).
10
- * @property {string[]} subgroupIds - Subgroups this profile spans (required, at least one).
11
- * @property {string} [region] - Region/POP label.
12
- * @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"} [routeAction] - Inbound call action (default "FORWARD"). Deliver the call to a PSTN number (FORWARD), ring the profile's subgroup registered softphones (WEBRTC), send to a SIP trunk (SIP_TRUNK), ring a registered SIP endpoint (SIP_PROFILE), hand the call to your programmable call-control webhook that returns SHML (CALL_CONTROL), or answer it with an AI agent (AI).
13
- * @property {string} [forwardToE164] - Destination number, required when routeAction is "FORWARD".
14
- * @property {number} [forwardAfterSeconds] - Ring seconds before the action fires.
15
- * @property {string} [routeSipTrunkId] - SIP trunk id, required when routeAction is "SIP_TRUNK".
16
- * @property {string} [routeSipProfileId] - SIP endpoint id, required when routeAction is "SIP_PROFILE".
17
- * @property {string} [webhookUrl] - Your inbound voice webhook (SHML program URL), required when routeAction is "CALL_CONTROL". Inbound calls to this profile's numbers are driven by the SHML your webhook returns.
18
- * @property {string} [routeAgentProfileId] - AI agent profile id (AGP…), required when routeAction is "AI". The agent's prompt, voice, model and tools are read when the call lands, so editing the agent takes effect on the next call with nothing to re-save here.
19
- * @property {boolean} [recordingEnabled] - Record calls on this profile.
20
- * @property {boolean} [enabled] - Active state (default true).
21
- */
22
-
23
- /**
24
- * @typedef {Object} UpdateProgrammableVoiceProfileData
25
- * @property {string} [name] - Profile name.
26
- * @property {string[]} [subgroupIds] - Subgroups this profile spans.
27
- * @property {string|null} [region] - Region/POP label.
28
- * @property {"FORWARD"|"WEBRTC"|"SIP_TRUNK"|"SIP_PROFILE"|"CALL_CONTROL"|"AI"} [routeAction] - Inbound call action (FORWARD | WEBRTC | SIP_TRUNK | SIP_PROFILE | CALL_CONTROL | AI).
29
- * @property {string|null} [forwardToE164] - FORWARD destination.
30
- * @property {number|null} [forwardAfterSeconds] - Ring seconds before the action fires.
31
- * @property {string|null} [routeSipTrunkId] - SIP trunk id (required when routeAction is "SIP_TRUNK").
32
- * @property {string|null} [routeSipProfileId] - SIP endpoint id (required when routeAction is "SIP_PROFILE").
33
- * @property {string|null} [webhookUrl] - Inbound voice webhook / SHML program URL (required when routeAction is "CALL_CONTROL"). Pass null to clear.
34
- * @property {string|null} [routeAgentProfileId] - AI agent profile id (AGP…), required when routeAction is "AI". Pass null to clear.
35
- * @property {boolean} [recordingEnabled] - Record calls on this profile.
36
- * @property {boolean} [enabled] - Active state.
37
- */
38
-
39
- /**
40
- * Programmable Voice Profile management. A Programmable Voice Profile groups a
41
- * set of the account's numbers (across one or more subgroups) under a single
42
- * inbound call-handling decision routed through Signal House's own voice servers
43
- * — the same idea as a SIP trunk, but without a customer SBC. A number can
44
- * belong to at most one profile and is mutually exclusive with SIP trunks.
45
- *
46
- * Calls the voice-backend service mounted under /voice. Accessed via
47
- * `sdk.voice.programmableVoiceProfiles`.
48
- */
49
- export class ProgrammableVoiceProfiles {
50
- constructor(client, enableAdmin) {
51
- this.client = client;
52
- this.enableAdmin = enableAdmin;
53
- }
54
-
55
- /**
56
- * List all Programmable Voice Profiles for the current account.
57
- * @async
58
- * @roles api, admin, developer, billing, user
59
- * @param {Object} [params] - Request parameters.
60
- * @param {RequestOptions} [params.options] - Additional options for the request.
61
- * @returns {Promise<SdkResponse<any>>} `{ profiles: [...] }`.
62
- */
63
- async list({ options = {} } = {}) {
64
- return this.client(`/voice/api/v1/programmable-voice-profiles`, { method: "GET", ...options });
65
- }
66
-
67
- /**
68
- * Get a single Programmable Voice Profile by ID.
69
- * @async
70
- * @roles api, admin, developer, billing, user
71
- * @param {Object} params - Request parameters.
72
- * @param {string} params.id - The profile UUID.
73
- * @param {RequestOptions} [params.options] - Additional options for the request.
74
- * @throws {Error} If id is missing.
75
- * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
76
- */
77
- async get({ id, options = {} }) {
78
- this.client._require({ id });
79
- const safeId = encodeURIComponent(id);
80
- return this.client(`/voice/api/v1/programmable-voice-profiles/${safeId}`, { method: "GET", ...options });
81
- }
82
-
83
- /**
84
- * Create a Programmable Voice Profile.
85
- * @async
86
- * @roles api, admin, developer
87
- * @param {Object} params - Request parameters.
88
- * @param {CreateProgrammableVoiceProfileData} params.profileData - The profile to create.
89
- * @param {RequestOptions} [params.options] - Additional options for the request.
90
- * @throws {Error} If profileData is missing.
91
- * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
92
- */
93
- async create({ profileData, options = {} }) {
94
- this.client._require({ profileData });
95
- return this.client(`/voice/api/v1/programmable-voice-profiles`, { method: "POST", body: profileData, ...options });
96
- }
97
-
98
- /**
99
- * Update an existing Programmable Voice Profile (partial).
100
- * @async
101
- * @roles api, admin, developer
102
- * @param {Object} params - Request parameters.
103
- * @param {string} params.id - The profile UUID.
104
- * @param {UpdateProgrammableVoiceProfileData} params.updateData - Fields to update.
105
- * @param {RequestOptions} [params.options] - Additional options for the request.
106
- * @throws {Error} If id or updateData is missing.
107
- * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
108
- */
109
- async update({ id, updateData, options = {} }) {
110
- this.client._require({ id, updateData });
111
- const safeId = encodeURIComponent(id);
112
- return this.client(`/voice/api/v1/programmable-voice-profiles/${safeId}`, { method: "PATCH", body: updateData, ...options });
113
- }
114
-
115
- /**
116
- * Toggle a profile active/inactive.
117
- * @async
118
- * @roles api, admin, developer
119
- * @param {Object} params - Request parameters.
120
- * @param {string} params.id - The profile UUID.
121
- * @param {RequestOptions} [params.options] - Additional options for the request.
122
- * @throws {Error} If id is missing.
123
- * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
124
- */
125
- async toggleActive({ id, options = {} }) {
126
- this.client._require({ id });
127
- const safeId = encodeURIComponent(id);
128
- return this.client(`/voice/api/v1/programmable-voice-profiles/${safeId}/toggle-active`, { method: "POST", ...options });
129
- }
130
-
131
- /**
132
- * Delete a Programmable Voice Profile. Its number assignments cascade away,
133
- * so those numbers fall back to subgroup/global routing.
134
- * @async
135
- * @roles api, admin, developer
136
- * @param {Object} params - Request parameters.
137
- * @param {string} params.id - The profile UUID.
138
- * @param {RequestOptions} [params.options] - Additional options for the request.
139
- * @throws {Error} If id is missing.
140
- * @returns {Promise<SdkResponse<any>>} `{ message: string }`.
141
- */
142
- async delete({ id, options = {} }) {
143
- this.client._require({ id });
144
- const safeId = encodeURIComponent(id);
145
- return this.client(`/voice/api/v1/programmable-voice-profiles/${safeId}`, { method: "DELETE", ...options });
146
- }
147
-
148
- /**
149
- * Assign a phone number (by E.164) to this profile. Rejected if the number is
150
- * already configured on a SIP trunk/endpoint or another profile — it must be
151
- * de-configured there first (mutual exclusivity).
152
- * @async
153
- * @roles api, admin, developer
154
- * @param {Object} params - Request parameters.
155
- * @param {string} params.id - The profile UUID.
156
- * @param {string} params.e164 - The phone number in E.164 (a leading "+" is optional).
157
- * @param {RequestOptions} [params.options] - Additional options for the request.
158
- * @throws {Error} If id or e164 is missing.
159
- * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
160
- */
161
- async assignNumber({ id, e164, options = {} }) {
162
- this.client._require({ id, e164 });
163
- const safeId = encodeURIComponent(id);
164
- return this.client(`/voice/api/v1/programmable-voice-profiles/${safeId}/assign-number`, {
165
- method: "POST",
166
- body: { e164 },
167
- ...options,
168
- });
169
- }
170
-
171
- /**
172
- * Unassign a phone number (by E.164) from this profile.
173
- * @async
174
- * @roles api, admin, developer
175
- * @param {Object} params - Request parameters.
176
- * @param {string} params.id - The profile UUID.
177
- * @param {string} params.e164 - The phone number in E.164 (a leading "+" is optional).
178
- * @param {RequestOptions} [params.options] - Additional options for the request.
179
- * @throws {Error} If id or e164 is missing.
180
- * @returns {Promise<SdkResponse<any>>} `{ profile: {...} }`.
181
- */
182
- async unassignNumber({ id, e164, options = {} }) {
183
- this.client._require({ id, e164 });
184
- const safeId = encodeURIComponent(id);
185
- return this.client(`/voice/api/v1/programmable-voice-profiles/${safeId}/unassign-number`, {
186
- method: "POST",
187
- body: { e164 },
188
- ...options,
189
- });
190
- }
191
- }
@@ -1,203 +0,0 @@
1
- /** @typedef {import('../../SignalHouseSDK.js').RequestOptions} RequestOptions */
2
- /**
3
- * @template T
4
- * @typedef {import('../../SignalHouseSDK.js').SdkResponse<T>} SdkResponse
5
- */
6
-
7
- /**
8
- * @typedef {Object} CreateSipProfileData
9
- * @property {string} name - Profile name (required).
10
- * @property {boolean} [recordingAllowed] - Permit call recording on this endpoint.
11
- * @property {boolean} [transcriptionEnabled] - Permit transcription on calls to/from this endpoint.
12
- * @property {boolean} [sentimentFlag] - Permit sentiment analysis on this endpoint.
13
- */
14
-
15
- /**
16
- * @typedef {Object} UpdateSipProfileData
17
- * @property {string} [name] - Profile name.
18
- * @property {string} [sipUsername] - SIP username override.
19
- * @property {string} [password] - New password (also the way to "regenerate" — pass a fresh value).
20
- * @property {"UDP"|"TCP"|"TLS"} [transport] - SIP transport.
21
- * @property {boolean} [recordingAllowed] - Permit call recording.
22
- * @property {boolean} [transcriptionEnabled] - Permit transcription.
23
- * @property {boolean} [sentimentFlag] - Permit sentiment analysis.
24
- */
25
-
26
- /**
27
- * SIP Profile / endpoint management. A SIP profile is a single registerable
28
- * UA — a desk phone, a softphone, a SIP-capable device — that registers to
29
- * Signal House with a username and password. Distinct from a SIP trunk,
30
- * which represents a peer-to-peer link to another PBX or carrier.
31
- *
32
- * Calls the voice-backend service mounted under /voice. Accessed via
33
- * `sdk.voice.sipProfiles`.
34
- */
35
- export class SipProfiles {
36
- constructor(client, enableAdmin) {
37
- this.client = client;
38
- this.enableAdmin = enableAdmin;
39
- }
40
-
41
- /**
42
- * List all SIP profiles belonging to the current account.
43
- * @async
44
- * @roles api, admin, developer, billing, user
45
- * @param {Object} [params] - Request parameters.
46
- * @param {RequestOptions} [params.options] - Additional options for the request.
47
- * @returns {Promise<SdkResponse<any>>} `{ sipProfiles: [...] }`.
48
- */
49
- async list({ options = {} } = {}) {
50
- return this.client(`/voice/sip-profiles`, { method: "GET", ...options });
51
- }
52
-
53
- /**
54
- * Get a single SIP profile by ID. NOTE: response does NOT include the
55
- * password — use `getPassword({ id })` to retrieve it.
56
- * @async
57
- * @roles api, admin, developer, billing, user
58
- * @param {Object} params - Request parameters.
59
- * @param {string} params.id - The SIP profile UUID.
60
- * @param {RequestOptions} [params.options] - Additional options for the request.
61
- * @throws {Error} If id is missing.
62
- * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
63
- */
64
- async get({ id, options = {} }) {
65
- this.client._require({ id });
66
- const safeId = encodeURIComponent(id);
67
- return this.client(`/voice/sip-profiles/${safeId}`, { method: "GET", ...options });
68
- }
69
-
70
- /**
71
- * Get the password for a SIP profile. The password is generated by the
72
- * server on create and stored; this endpoint returns the stored value
73
- * (it is NOT one-time-visible like the create response — calling getPassword
74
- * later still returns the password as long as it has not been replaced).
75
- * @async
76
- * @roles api, admin, developer, billing, user
77
- * @param {Object} params - Request parameters.
78
- * @param {string} params.id - The SIP profile UUID.
79
- * @param {RequestOptions} [params.options] - Additional options for the request.
80
- * @throws {Error} If id is missing.
81
- * @returns {Promise<SdkResponse<any>>} `{ password: string|null }`.
82
- */
83
- async getPassword({ id, options = {} }) {
84
- this.client._require({ id });
85
- const safeId = encodeURIComponent(id);
86
- return this.client(`/voice/sip-profiles/${safeId}/password`, { method: "GET", ...options });
87
- }
88
-
89
- /**
90
- * List valid SIP transports + their address/port per region from the DB.
91
- * Used by edit-profile UI to populate transport selectors.
92
- * @async
93
- * @roles api, admin, developer, billing, user
94
- * @param {Object} [params] - Request parameters.
95
- * @param {RequestOptions} [params.options] - Additional options for the request.
96
- * @returns {Promise<SdkResponse<any>>} `{ transports: [{ transport, address, port }, ...] }`.
97
- */
98
- async getTransports({ options = {} } = {}) {
99
- return this.client(`/voice/sip-profiles/transports`, { method: "GET", ...options });
100
- }
101
-
102
- /**
103
- * Create a new SIP profile. The server generates the SIP username and
104
- * password; the password is returned on the create response at the top
105
- * level (NOT nested inside `sipProfile`) and is the only chance to surface
106
- * it without an explicit `getPassword` lookup.
107
- * @async
108
- * @roles api, admin, developer, billing, user
109
- * @param {Object} params - Request parameters.
110
- * @param {CreateSipProfileData} params.profileData - The SIP profile to create.
111
- * @param {RequestOptions} [params.options] - Additional options for the request.
112
- * @throws {Error} If profileData is missing.
113
- * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...}, password: string, sipServer: string, message: string }`.
114
- */
115
- async create({ profileData, options = {} }) {
116
- this.client._require({ profileData });
117
- return this.client(`/voice/sip-profiles`, { method: "POST", body: profileData, ...options });
118
- }
119
-
120
- /**
121
- * Update an existing SIP profile. To rotate the password, pass a new
122
- * `password` value here — there is no dedicated regenerate endpoint.
123
- * @async
124
- * @roles api, admin, developer, billing, user
125
- * @param {Object} params - Request parameters.
126
- * @param {string} params.id - The SIP profile UUID.
127
- * @param {UpdateSipProfileData} params.updateData - Fields to update.
128
- * @param {RequestOptions} [params.options] - Additional options for the request.
129
- * @throws {Error} If id or updateData is missing.
130
- * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
131
- */
132
- async update({ id, updateData, options = {} }) {
133
- this.client._require({ id, updateData });
134
- const safeId = encodeURIComponent(id);
135
- return this.client(`/voice/sip-profiles/${safeId}`, { method: "PATCH", body: updateData, ...options });
136
- }
137
-
138
- /**
139
- * Delete a SIP profile by ID. Unassigns any linked numbers and frees the
140
- * extension as a side-effect.
141
- * @async
142
- * @roles api, admin, developer, billing, user
143
- * @param {Object} params - Request parameters.
144
- * @param {string} params.id - The SIP profile UUID.
145
- * @param {RequestOptions} [params.options] - Additional options for the request.
146
- * @throws {Error} If id is missing.
147
- * @returns {Promise<SdkResponse<any>>} `{ message: string }`.
148
- */
149
- async delete({ id, options = {} }) {
150
- this.client._require({ id });
151
- const safeId = encodeURIComponent(id);
152
- return this.client(`/voice/sip-profiles/${safeId}`, { method: "DELETE", ...options });
153
- }
154
-
155
- /**
156
- * Assign a phone number to this SIP profile — routes inbound calls on that
157
- * number to the endpoint. Prefer `e164` (numbers are Mongo-authoritative); the
158
- * legacy `phoneNumberId` (a voice-backend phone-number UUID) is still accepted.
159
- * @async
160
- * @roles api, admin, developer, billing, user
161
- * @param {Object} params - Request parameters.
162
- * @param {string} params.id - The SIP profile UUID.
163
- * @param {string} [params.e164] - The phone number in E.164 to assign (preferred).
164
- * @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
165
- * @param {RequestOptions} [params.options] - Additional options for the request.
166
- * @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
167
- * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
168
- */
169
- async assignNumber({ id, e164, phoneNumberId, options = {} }) {
170
- this.client._require({ id });
171
- if (!e164 && !phoneNumberId) this.client._require({ e164 });
172
- const safeId = encodeURIComponent(id);
173
- return this.client(`/voice/sip-profiles/${safeId}/assign-number`, {
174
- method: "POST",
175
- body: e164 ? { e164 } : { phoneNumberId },
176
- ...options,
177
- });
178
- }
179
-
180
- /**
181
- * Unassign a phone number from this SIP profile. Prefer `e164`; the legacy
182
- * `phoneNumberId` (a voice-backend phone-number UUID) is still accepted.
183
- * @async
184
- * @roles api, admin, developer, billing, user
185
- * @param {Object} params - Request parameters.
186
- * @param {string} params.id - The SIP profile UUID.
187
- * @param {string} [params.e164] - The phone number in E.164 to unassign (preferred).
188
- * @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
189
- * @param {RequestOptions} [params.options] - Additional options for the request.
190
- * @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
191
- * @returns {Promise<SdkResponse<any>>} `{ sipProfile: {...} }`.
192
- */
193
- async unassignNumber({ id, e164, phoneNumberId, options = {} }) {
194
- this.client._require({ id });
195
- if (!e164 && !phoneNumberId) this.client._require({ e164 });
196
- const safeId = encodeURIComponent(id);
197
- return this.client(`/voice/sip-profiles/${safeId}/unassign-number`, {
198
- method: "POST",
199
- body: e164 ? { e164 } : { phoneNumberId },
200
- ...options,
201
- });
202
- }
203
- }