sentdm 0.38.1 → 0.40.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 (281) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +1 -1
  4. data/lib/sentdm/client.rb +3 -20
  5. data/lib/sentdm/internal/voice_agents_page.rb +115 -0
  6. data/lib/sentdm/models/call_event.rb +8 -6
  7. data/lib/sentdm/models/call_event_payload.rb +29 -9
  8. data/lib/sentdm/models/channels/voice_create_params.rb +23 -11
  9. data/lib/sentdm/models/channels/voice_number.rb +23 -1
  10. data/lib/sentdm/models/channels/voice_update_params.rb +12 -1
  11. data/lib/sentdm/models/message_send_params.rb +8 -1
  12. data/lib/sentdm/models/template.rb +6 -5
  13. data/lib/sentdm/models/template_body.rb +8 -8
  14. data/lib/sentdm/models/voice/agent_create_params.rb +142 -0
  15. data/lib/sentdm/models/{calls/participant_list_params.rb → voice/agent_delete_params.rb} +3 -3
  16. data/lib/sentdm/models/voice/agent_list_params.rb +38 -0
  17. data/lib/sentdm/models/{calls/participant_remove_all_params.rb → voice/agent_retrieve_params.rb} +3 -3
  18. data/lib/sentdm/models/voice/agent_rotate_secret_params.rb +34 -0
  19. data/lib/sentdm/models/voice/agent_update_params.rb +141 -0
  20. data/lib/sentdm/models/{calls/api_response_of_list_of_call_participant.rb → voice/api_response_of_call.rb} +7 -7
  21. data/lib/sentdm/models/voice/api_response_of_call_recordings.rb +45 -0
  22. data/lib/sentdm/models/voice/api_response_of_calls_list.rb +44 -0
  23. data/lib/sentdm/models/voice/api_response_of_voice_agent.rb +51 -0
  24. data/lib/sentdm/models/voice/api_response_of_voice_agent_secret.rb +45 -0
  25. data/lib/sentdm/models/voice/api_response_of_voice_agents_list.rb +48 -0
  26. data/lib/sentdm/models/voice/api_response_of_voice_catalogue.rb +49 -0
  27. data/lib/sentdm/models/{channels → voice}/api_response_of_voice_token.rb +5 -5
  28. data/lib/sentdm/models/voice/call.rb +241 -0
  29. data/lib/sentdm/models/{calls/participant_remove_params.rb → voice/call_hangup_params.rb} +8 -8
  30. data/lib/sentdm/models/voice/call_list_params.rb +103 -0
  31. data/lib/sentdm/models/voice/call_list_recordings_params.rb +28 -0
  32. data/lib/sentdm/models/voice/call_party.rb +33 -0
  33. data/lib/sentdm/models/{calls/participant_update_params.rb → voice/call_record_params.rb} +10 -17
  34. data/lib/sentdm/models/voice/call_recording.rb +40 -0
  35. data/lib/sentdm/models/voice/call_recordings.rb +26 -0
  36. data/lib/sentdm/models/voice/call_retrieve_params.rb +28 -0
  37. data/lib/sentdm/models/voice/call_timeline_entry.rb +28 -0
  38. data/lib/sentdm/models/voice/calls/api_response_of_list_of_call_participant.rb +51 -0
  39. data/lib/sentdm/models/voice/calls/call_participant.rb +62 -0
  40. data/lib/sentdm/models/voice/calls/call_participant_target.rb +32 -0
  41. data/lib/sentdm/models/voice/calls/participant_add_params.rb +68 -0
  42. data/lib/sentdm/models/voice/calls/participant_list_params.rb +30 -0
  43. data/lib/sentdm/models/voice/calls/participant_remove_all_params.rb +30 -0
  44. data/lib/sentdm/models/voice/calls/participant_remove_params.rb +36 -0
  45. data/lib/sentdm/models/voice/calls/participant_update_params.rb +66 -0
  46. data/lib/sentdm/models/voice/calls_list.rb +28 -0
  47. data/lib/sentdm/models/voice/catalogue_list_params.rb +22 -0
  48. data/lib/sentdm/models/{channels/voice_create_token_params.rb → voice/token_create_params.rb} +4 -4
  49. data/lib/sentdm/models/voice/voice_agent.rb +138 -0
  50. data/lib/sentdm/models/voice/voice_agent_audio.rb +19 -0
  51. data/lib/sentdm/models/voice/voice_agent_audio_spec.rb +20 -0
  52. data/lib/sentdm/models/voice/voice_agent_limits.rb +31 -0
  53. data/lib/sentdm/models/voice/voice_agent_limits_spec.rb +40 -0
  54. data/lib/sentdm/models/voice/voice_agent_party.rb +25 -0
  55. data/lib/sentdm/models/voice/voice_agent_party_spec.rb +28 -0
  56. data/lib/sentdm/models/voice/voice_agent_secret.rb +27 -0
  57. data/lib/sentdm/models/voice/voice_agent_speech.rb +31 -0
  58. data/lib/sentdm/models/voice/voice_agent_speech_spec.rb +40 -0
  59. data/lib/sentdm/models/voice/voice_agent_transcripts.rb +25 -0
  60. data/lib/sentdm/models/voice/voice_agent_transcripts_spec.rb +32 -0
  61. data/lib/sentdm/models/voice/voice_agents_list.rb +30 -0
  62. data/lib/sentdm/models/voice/voice_catalogue.rb +30 -0
  63. data/lib/sentdm/models/voice/voice_catalogue_voice.rb +43 -0
  64. data/lib/sentdm/models/{channels → voice}/voice_token.rb +9 -3
  65. data/lib/sentdm/models/webhook_create_params.rb +31 -5
  66. data/lib/sentdm/models/webhook_response.rb +66 -4
  67. data/lib/sentdm/models/webhook_update_params.rb +15 -3
  68. data/lib/sentdm/models.rb +2 -30
  69. data/lib/sentdm/resources/channels/voice.rb +43 -63
  70. data/lib/sentdm/resources/channels.rb +2 -2
  71. data/lib/sentdm/resources/profiles/campaigns.rb +3 -2
  72. data/lib/sentdm/resources/voice/agents.rb +319 -0
  73. data/lib/sentdm/resources/voice/calls/participants.rb +244 -0
  74. data/lib/sentdm/resources/voice/calls.rb +269 -0
  75. data/lib/sentdm/resources/voice/catalogue.rb +71 -0
  76. data/lib/sentdm/resources/voice/tokens.rb +86 -0
  77. data/lib/sentdm/resources/voice.rb +142 -0
  78. data/lib/sentdm/resources/webhooks.rb +43 -15
  79. data/lib/sentdm/version.rb +1 -1
  80. data/lib/sentdm.rb +59 -28
  81. data/rbi/sentdm/client.rbi +2 -19
  82. data/rbi/sentdm/internal/voice_agents_page.rbi +71 -0
  83. data/rbi/sentdm/models/call_event.rbi +14 -10
  84. data/rbi/sentdm/models/call_event_payload.rbi +34 -9
  85. data/rbi/sentdm/models/channels/voice_create_params.rbi +33 -17
  86. data/rbi/sentdm/models/channels/voice_number.rbi +31 -0
  87. data/rbi/sentdm/models/channels/voice_update_params.rbi +14 -0
  88. data/rbi/sentdm/models/message_send_params.rbi +16 -2
  89. data/rbi/sentdm/models/template.rbi +12 -10
  90. data/rbi/sentdm/models/template_body.rbi +12 -12
  91. data/rbi/sentdm/models/voice/agent_create_params.rbi +215 -0
  92. data/rbi/sentdm/models/{calls/participant_remove_all_params.rbi → voice/agent_delete_params.rbi} +3 -6
  93. data/rbi/sentdm/models/voice/agent_list_params.rbi +66 -0
  94. data/rbi/sentdm/models/voice/agent_retrieve_params.rbi +48 -0
  95. data/rbi/sentdm/models/{calls/participant_remove_params.rbi → voice/agent_rotate_secret_params.rbi} +11 -8
  96. data/rbi/sentdm/models/voice/agent_update_params.rbi +211 -0
  97. data/rbi/sentdm/models/voice/api_response_of_call.rbi +76 -0
  98. data/rbi/sentdm/models/voice/api_response_of_call_recordings.rbi +81 -0
  99. data/rbi/sentdm/models/{calls/api_response_of_list_of_call_participant.rbi → voice/api_response_of_calls_list.rbi} +12 -9
  100. data/rbi/sentdm/models/voice/api_response_of_voice_agent.rbi +85 -0
  101. data/rbi/sentdm/models/voice/api_response_of_voice_agent_secret.rbi +81 -0
  102. data/rbi/sentdm/models/voice/api_response_of_voice_agents_list.rbi +83 -0
  103. data/rbi/sentdm/models/voice/api_response_of_voice_catalogue.rbi +83 -0
  104. data/rbi/sentdm/models/{channels → voice}/api_response_of_voice_token.rbi +6 -8
  105. data/rbi/sentdm/models/voice/call.rbi +329 -0
  106. data/rbi/sentdm/models/voice/call_hangup_params.rbi +61 -0
  107. data/rbi/sentdm/models/voice/call_list_params.rbi +134 -0
  108. data/rbi/sentdm/models/{calls/participant_list_params.rbi → voice/call_list_recordings_params.rbi} +3 -3
  109. data/rbi/sentdm/models/voice/call_party.rbi +47 -0
  110. data/rbi/sentdm/models/{calls/participant_update_params.rbi → voice/call_record_params.rbi} +12 -21
  111. data/rbi/sentdm/models/voice/call_recording.rbi +63 -0
  112. data/rbi/sentdm/models/voice/call_recordings.rbi +49 -0
  113. data/rbi/sentdm/models/voice/call_retrieve_params.rbi +48 -0
  114. data/rbi/sentdm/models/voice/call_timeline_entry.rbi +44 -0
  115. data/rbi/sentdm/models/voice/calls/api_response_of_list_of_call_participant.rbi +84 -0
  116. data/rbi/sentdm/models/voice/calls/call_participant.rbi +97 -0
  117. data/rbi/sentdm/models/voice/calls/call_participant_target.rbi +49 -0
  118. data/rbi/sentdm/models/voice/calls/participant_add_params.rbi +104 -0
  119. data/rbi/sentdm/models/voice/calls/participant_list_params.rbi +53 -0
  120. data/rbi/sentdm/models/voice/calls/participant_remove_all_params.rbi +53 -0
  121. data/rbi/sentdm/models/voice/calls/participant_remove_params.rbi +63 -0
  122. data/rbi/sentdm/models/voice/calls/participant_update_params.rbi +96 -0
  123. data/rbi/sentdm/models/voice/calls_list.rbi +54 -0
  124. data/rbi/sentdm/models/voice/catalogue_list_params.rbi +40 -0
  125. data/rbi/sentdm/models/{channels/voice_create_token_params.rbi → voice/token_create_params.rbi} +3 -6
  126. data/rbi/sentdm/models/voice/voice_agent.rbi +196 -0
  127. data/rbi/sentdm/models/voice/voice_agent_audio.rbi +30 -0
  128. data/rbi/sentdm/models/voice/voice_agent_audio_spec.rbi +33 -0
  129. data/rbi/sentdm/models/voice/voice_agent_limits.rbi +57 -0
  130. data/rbi/sentdm/models/voice/voice_agent_limits_spec.rbi +62 -0
  131. data/rbi/sentdm/models/voice/voice_agent_party.rbi +36 -0
  132. data/rbi/sentdm/models/voice/voice_agent_party_spec.rbi +45 -0
  133. data/rbi/sentdm/models/voice/voice_agent_secret.rbi +37 -0
  134. data/rbi/sentdm/models/voice/voice_agent_speech.rbi +48 -0
  135. data/rbi/sentdm/models/voice/voice_agent_speech_spec.rbi +62 -0
  136. data/rbi/sentdm/models/voice/voice_agent_transcripts.rbi +43 -0
  137. data/rbi/sentdm/models/voice/voice_agent_transcripts_spec.rbi +51 -0
  138. data/rbi/sentdm/models/voice/voice_agents_list.rbi +55 -0
  139. data/rbi/sentdm/models/voice/voice_catalogue.rbi +59 -0
  140. data/rbi/sentdm/models/voice/voice_catalogue_voice.rbi +75 -0
  141. data/rbi/sentdm/models/{channels → voice}/voice_token.rbi +8 -4
  142. data/rbi/sentdm/models/webhook_create_params.rbi +41 -3
  143. data/rbi/sentdm/models/webhook_response.rbi +112 -3
  144. data/rbi/sentdm/models/webhook_update_params.rbi +18 -3
  145. data/rbi/sentdm/models.rbi +2 -30
  146. data/rbi/sentdm/resources/channels/voice.rbi +57 -67
  147. data/rbi/sentdm/resources/channels.rbi +2 -2
  148. data/rbi/sentdm/resources/messages.rbi +8 -1
  149. data/rbi/sentdm/resources/profiles/campaigns.rbi +3 -2
  150. data/rbi/sentdm/resources/voice/agents.rbi +316 -0
  151. data/rbi/sentdm/resources/voice/calls/participants.rbi +212 -0
  152. data/rbi/sentdm/resources/voice/calls.rbi +244 -0
  153. data/rbi/sentdm/resources/voice/catalogue.rbi +59 -0
  154. data/rbi/sentdm/resources/voice/tokens.rbi +84 -0
  155. data/rbi/sentdm/resources/voice.rbi +136 -0
  156. data/rbi/sentdm/resources/webhooks.rbi +56 -16
  157. data/sig/sentdm/client.rbs +1 -1
  158. data/sig/sentdm/internal/voice_agents_page.rbs +41 -0
  159. data/sig/sentdm/models/call_event_payload.rbs +12 -0
  160. data/sig/sentdm/models/channels/voice_create_params.rbs +9 -4
  161. data/sig/sentdm/models/channels/voice_number.rbs +12 -0
  162. data/sig/sentdm/models/channels/voice_update_params.rbs +5 -0
  163. data/sig/sentdm/models/voice/agent_create_params.rbs +99 -0
  164. data/sig/sentdm/models/{calls/participant_remove_all_params.rbs → voice/agent_delete_params.rbs} +3 -3
  165. data/sig/sentdm/models/voice/agent_list_params.rbs +40 -0
  166. data/sig/sentdm/models/{calls/participant_list_params.rbs → voice/agent_retrieve_params.rbs} +3 -3
  167. data/sig/sentdm/models/{calls/participant_remove_params.rbs → voice/agent_rotate_secret_params.rbs} +8 -8
  168. data/sig/sentdm/models/voice/agent_update_params.rbs +108 -0
  169. data/sig/sentdm/models/{calls/api_response_of_list_of_call_participant.rbs → voice/api_response_of_call.rbs} +7 -7
  170. data/sig/sentdm/models/voice/api_response_of_call_recordings.rbs +41 -0
  171. data/sig/sentdm/models/voice/api_response_of_calls_list.rbs +41 -0
  172. data/sig/sentdm/models/voice/api_response_of_voice_agent.rbs +41 -0
  173. data/sig/sentdm/models/voice/api_response_of_voice_agent_secret.rbs +41 -0
  174. data/sig/sentdm/models/voice/api_response_of_voice_agents_list.rbs +41 -0
  175. data/sig/sentdm/models/voice/api_response_of_voice_catalogue.rbs +41 -0
  176. data/sig/sentdm/models/{channels → voice}/api_response_of_voice_token.rbs +5 -5
  177. data/sig/sentdm/models/voice/call.rbs +175 -0
  178. data/sig/sentdm/models/voice/call_hangup_params.rbs +40 -0
  179. data/sig/sentdm/models/voice/call_list_params.rbs +79 -0
  180. data/sig/sentdm/models/voice/call_list_recordings_params.rbs +32 -0
  181. data/sig/sentdm/models/voice/call_party.rbs +19 -0
  182. data/sig/sentdm/models/{calls/participant_update_params.rbs → voice/call_record_params.rbs} +8 -13
  183. data/sig/sentdm/models/voice/call_recording.rbs +34 -0
  184. data/sig/sentdm/models/voice/call_recordings.rbs +22 -0
  185. data/sig/sentdm/models/voice/call_retrieve_params.rbs +32 -0
  186. data/sig/sentdm/models/voice/call_timeline_entry.rbs +21 -0
  187. data/sig/sentdm/models/voice/calls/api_response_of_list_of_call_participant.rbs +43 -0
  188. data/sig/sentdm/models/voice/calls/call_participant.rbs +54 -0
  189. data/sig/sentdm/models/voice/calls/call_participant_target.rbs +25 -0
  190. data/sig/sentdm/models/voice/calls/participant_add_params.rbs +65 -0
  191. data/sig/sentdm/models/voice/calls/participant_list_params.rbs +34 -0
  192. data/sig/sentdm/models/voice/calls/participant_remove_all_params.rbs +36 -0
  193. data/sig/sentdm/models/voice/calls/participant_remove_params.rbs +42 -0
  194. data/sig/sentdm/models/voice/calls/participant_update_params.rbs +63 -0
  195. data/sig/sentdm/models/voice/calls_list.rbs +33 -0
  196. data/sig/sentdm/models/voice/catalogue_list_params.rbs +27 -0
  197. data/sig/sentdm/models/{channels/voice_create_token_params.rbs → voice/token_create_params.rbs} +3 -3
  198. data/sig/sentdm/models/voice/voice_agent.rbs +116 -0
  199. data/sig/sentdm/models/voice/voice_agent_audio.rbs +19 -0
  200. data/sig/sentdm/models/voice/voice_agent_audio_spec.rbs +17 -0
  201. data/sig/sentdm/models/voice/voice_agent_limits.rbs +38 -0
  202. data/sig/sentdm/models/voice/voice_agent_limits_spec.rbs +34 -0
  203. data/sig/sentdm/models/{calls/call_participant_target.rbs → voice/voice_agent_party.rbs} +4 -4
  204. data/sig/sentdm/models/voice/voice_agent_party_spec.rbs +19 -0
  205. data/sig/sentdm/models/voice/voice_agent_secret.rbs +19 -0
  206. data/sig/sentdm/models/voice/voice_agent_speech.rbs +32 -0
  207. data/sig/sentdm/models/voice/voice_agent_speech_spec.rbs +26 -0
  208. data/sig/sentdm/models/voice/voice_agent_transcripts.rbs +23 -0
  209. data/sig/sentdm/models/voice/voice_agent_transcripts_spec.rbs +20 -0
  210. data/sig/sentdm/models/voice/voice_agents_list.rbs +35 -0
  211. data/sig/sentdm/models/voice/voice_catalogue.rbs +35 -0
  212. data/sig/sentdm/models/voice/voice_catalogue_voice.rbs +42 -0
  213. data/sig/sentdm/models/{channels → voice}/voice_token.rbs +3 -1
  214. data/sig/sentdm/models/webhook_create_params.rbs +12 -0
  215. data/sig/sentdm/models/webhook_response.rbs +46 -3
  216. data/sig/sentdm/models/webhook_update_params.rbs +5 -0
  217. data/sig/sentdm/models.rbs +2 -30
  218. data/sig/sentdm/resources/channels/voice.rbs +3 -11
  219. data/sig/sentdm/resources/voice/agents.rbs +74 -0
  220. data/sig/sentdm/resources/voice/calls/participants.rbs +52 -0
  221. data/sig/sentdm/resources/{calls/participants.rbs → voice/calls.rbs} +25 -21
  222. data/sig/sentdm/resources/voice/catalogue.rbs +14 -0
  223. data/sig/sentdm/resources/voice/tokens.rbs +19 -0
  224. data/sig/sentdm/resources/voice.rbs +15 -0
  225. data/sig/sentdm/resources/webhooks.rbs +3 -0
  226. metadata +176 -83
  227. data/lib/sentdm/models/api_response_of_call.rb +0 -43
  228. data/lib/sentdm/models/api_response_of_call_recordings.rb +0 -43
  229. data/lib/sentdm/models/api_response_of_calls_list.rb +0 -42
  230. data/lib/sentdm/models/call.rb +0 -134
  231. data/lib/sentdm/models/call_hangup_params.rb +0 -32
  232. data/lib/sentdm/models/call_list_params.rb +0 -83
  233. data/lib/sentdm/models/call_list_recordings_params.rb +0 -26
  234. data/lib/sentdm/models/call_party.rb +0 -31
  235. data/lib/sentdm/models/call_record_params.rb +0 -55
  236. data/lib/sentdm/models/call_recording.rb +0 -38
  237. data/lib/sentdm/models/call_recordings.rb +0 -24
  238. data/lib/sentdm/models/call_retrieve_params.rb +0 -26
  239. data/lib/sentdm/models/call_timeline_entry.rb +0 -26
  240. data/lib/sentdm/models/calls/call_participant.rb +0 -60
  241. data/lib/sentdm/models/calls/call_participant_target.rb +0 -30
  242. data/lib/sentdm/models/calls/participant_add_params.rb +0 -66
  243. data/lib/sentdm/models/calls_list.rb +0 -26
  244. data/lib/sentdm/resources/calls/participants.rb +0 -231
  245. data/lib/sentdm/resources/calls.rb +0 -236
  246. data/rbi/sentdm/models/api_response_of_call.rbi +0 -74
  247. data/rbi/sentdm/models/api_response_of_call_recordings.rbi +0 -74
  248. data/rbi/sentdm/models/api_response_of_calls_list.rbi +0 -74
  249. data/rbi/sentdm/models/call.rbi +0 -179
  250. data/rbi/sentdm/models/call_hangup_params.rbi +0 -59
  251. data/rbi/sentdm/models/call_list_params.rbi +0 -112
  252. data/rbi/sentdm/models/call_list_recordings_params.rbi +0 -46
  253. data/rbi/sentdm/models/call_party.rbi +0 -41
  254. data/rbi/sentdm/models/call_record_params.rbi +0 -83
  255. data/rbi/sentdm/models/call_recording.rbi +0 -59
  256. data/rbi/sentdm/models/call_recordings.rbi +0 -39
  257. data/rbi/sentdm/models/call_retrieve_params.rbi +0 -46
  258. data/rbi/sentdm/models/call_timeline_entry.rbi +0 -40
  259. data/rbi/sentdm/models/calls/call_participant.rbi +0 -92
  260. data/rbi/sentdm/models/calls/call_participant_target.rbi +0 -47
  261. data/rbi/sentdm/models/calls/participant_add_params.rbi +0 -98
  262. data/rbi/sentdm/models/calls_list.rbi +0 -47
  263. data/rbi/sentdm/resources/calls/participants.rbi +0 -199
  264. data/rbi/sentdm/resources/calls.rbi +0 -207
  265. data/sig/sentdm/models/api_response_of_call.rbs +0 -39
  266. data/sig/sentdm/models/api_response_of_call_recordings.rbs +0 -39
  267. data/sig/sentdm/models/api_response_of_calls_list.rbs +0 -39
  268. data/sig/sentdm/models/call.rbs +0 -101
  269. data/sig/sentdm/models/call_hangup_params.rbs +0 -38
  270. data/sig/sentdm/models/call_list_params.rbs +0 -67
  271. data/sig/sentdm/models/call_list_recordings_params.rbs +0 -30
  272. data/sig/sentdm/models/call_party.rbs +0 -17
  273. data/sig/sentdm/models/call_record_params.rbs +0 -54
  274. data/sig/sentdm/models/call_recording.rbs +0 -32
  275. data/sig/sentdm/models/call_recordings.rbs +0 -17
  276. data/sig/sentdm/models/call_retrieve_params.rbs +0 -30
  277. data/sig/sentdm/models/call_timeline_entry.rbs +0 -19
  278. data/sig/sentdm/models/calls/call_participant.rbs +0 -52
  279. data/sig/sentdm/models/calls/participant_add_params.rbs +0 -63
  280. data/sig/sentdm/models/calls_list.rbs +0 -26
  281. data/sig/sentdm/resources/calls.rbs +0 -50
@@ -0,0 +1,244 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
6
+ class Calls
7
+ # Phone calls from the numbers you hold, driven by your own callback URL.
8
+ #
9
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
10
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
11
+ # short-lived token that lets a user of your app place and receive calls as that
12
+ # number. When a call arrives or a caller presses a key, a signed question is
13
+ # POSTed to the callback URL and the answer decides the call;
14
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
15
+ # before a real call reaches it, and
16
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
17
+ # The call events themselves (`call.completed` and the rest) arrive through your
18
+ # webhooks.
19
+ #
20
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
21
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
22
+ # conference participants while it is live. A leg to a phone number runs for at
23
+ # most what your balance affords at the destination's rate.
24
+ #
25
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
26
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
27
+ # call as text (speech recognised and spoken for the agent) or as audio,
28
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
29
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
30
+ # `fallback` and `limits` say what it may do on a call. The agent's
31
+ # `signing_secret` is shown on create and on
32
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
33
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
34
+ # it is bound to it on `/v3/channels/voice`.
35
+ class Participants
36
+ # Some parameter documentations has been truncated, see
37
+ # {Sentdm::Models::Voice::Calls::ParticipantUpdateParams} for more details.
38
+ #
39
+ # Mutes or unmutes one participant of the conference room a live call is in, named
40
+ # by the participant's own call id from the participants list: send muted true to
41
+ # silence them, muted false to let them be heard again. Muting a participant who
42
+ # is already muted succeeds, as does unmuting one who is not. A participant who is
43
+ # not in this call's room answers 404. A call that has ended answers 409, as does
44
+ # a call that is not in a conference.
45
+ #
46
+ # @overload update(participant_id, id:, muted: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
47
+ #
48
+ # @param participant_id [String] Path param: The participant's own call id from the route, as listed by the parti
49
+ #
50
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
51
+ #
52
+ # @param muted [Boolean] Body param: true to mute the participant, false to unmute them
53
+ #
54
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
55
+ #
56
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
57
+ #
58
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
59
+ #
60
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
61
+ #
62
+ # @return [nil]
63
+ #
64
+ # @see Sentdm::Models::Voice::Calls::ParticipantUpdateParams
65
+ def update(participant_id, params)
66
+ parsed, options = Sentdm::Voice::Calls::ParticipantUpdateParams.dump_request(params)
67
+ id =
68
+ parsed.delete(:id) do
69
+ raise ArgumentError.new("missing required path argument #{_1}")
70
+ end
71
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
72
+ @client.request(
73
+ method: :patch,
74
+ path: ["v3/voice/calls/%1$s/participants/%2$s", id, participant_id],
75
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
76
+ body: parsed.except(*header_params.keys),
77
+ model: NilClass,
78
+ options: options
79
+ )
80
+ end
81
+
82
+ # Some parameter documentations has been truncated, see
83
+ # {Sentdm::Models::Voice::Calls::ParticipantListParams} for more details.
84
+ #
85
+ # Lists who is in the conference room one of your live calls is in: each
86
+ # participant's own call id, who they are, whether the room mutes them, and how
87
+ # long they have been connected. The call itself is one of the participants. Use a
88
+ # participant's id to mute or remove them; it is also a call id, so GET
89
+ # /v3/voice/calls/{id} accepts it. A call that has ended answers 409, as does a
90
+ # call that is not in a conference.
91
+ #
92
+ # @overload list(id, x_profile_id: nil, request_options: {})
93
+ #
94
+ # @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
95
+ #
96
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
97
+ #
98
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
99
+ #
100
+ # @return [Sentdm::Models::Voice::Calls::APIResponseOfListOfCallParticipant]
101
+ #
102
+ # @see Sentdm::Models::Voice::Calls::ParticipantListParams
103
+ def list(id, params = {})
104
+ parsed, options = Sentdm::Voice::Calls::ParticipantListParams.dump_request(params)
105
+ @client.request(
106
+ method: :get,
107
+ path: ["v3/voice/calls/%1$s/participants", id],
108
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
109
+ model: Sentdm::Voice::Calls::APIResponseOfListOfCallParticipant,
110
+ options: options
111
+ )
112
+ end
113
+
114
+ # Some parameter documentations has been truncated, see
115
+ # {Sentdm::Models::Voice::Calls::ParticipantAddParams} for more details.
116
+ #
117
+ # Dials one of your app users or a phone number into a call that is in a
118
+ # conference room, and answers with the participant's own call record. The
119
+ # participant is a call of their own: it has its own id, can be looked up and hung
120
+ # up, and is billed and reported through call.completed and call.failed like any
121
+ # other call. Every participant needs a positive balance. A phone participant is
122
+ # called from caller_id, which must be one of your numbers, or from the call's
123
+ # owning number when omitted, and needs a destination you may call. Only a call
124
+ # your answer connected to a conference can take participants: a call connected to
125
+ # a user or a number answers 409.
126
+ #
127
+ # @overload add(id, caller_id: nil, sandbox: nil, to: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
128
+ #
129
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
130
+ #
131
+ # @param caller_id [String, nil] Body param: The number shown to a phone participant as the caller, in E.164 form
132
+ #
133
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
134
+ #
135
+ # @param to [Sentdm::Models::Voice::Calls::CallParticipantTarget] Body param: A participant to add to a call
136
+ #
137
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
138
+ #
139
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
140
+ #
141
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
142
+ #
143
+ # @return [Sentdm::Models::Voice::APIResponseOfCall]
144
+ #
145
+ # @see Sentdm::Models::Voice::Calls::ParticipantAddParams
146
+ def add(id, params = {})
147
+ parsed, options = Sentdm::Voice::Calls::ParticipantAddParams.dump_request(params)
148
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
149
+ @client.request(
150
+ method: :post,
151
+ path: ["v3/voice/calls/%1$s/participants", id],
152
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
153
+ body: parsed.except(*header_params.keys),
154
+ model: Sentdm::Voice::APIResponseOfCall,
155
+ options: options
156
+ )
157
+ end
158
+
159
+ # Some parameter documentations has been truncated, see
160
+ # {Sentdm::Models::Voice::Calls::ParticipantRemoveParams} for more details.
161
+ #
162
+ # Removes one participant from the conference room a live call is in, named by the
163
+ # participant's own call id from the participants list. Their leg ends and is
164
+ # reported through call.completed like any other call; everyone else stays
165
+ # connected. A participant who is not in this call's room answers 404. A call that
166
+ # has ended answers 409, as does a call that is not in a conference.
167
+ #
168
+ # @overload remove(participant_id, id:, sandbox: nil, x_profile_id: nil, request_options: {})
169
+ #
170
+ # @param participant_id [String] Path param: The participant's own call id from the route, as listed by the parti
171
+ #
172
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
173
+ #
174
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
175
+ #
176
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
177
+ #
178
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
179
+ #
180
+ # @return [nil]
181
+ #
182
+ # @see Sentdm::Models::Voice::Calls::ParticipantRemoveParams
183
+ def remove(participant_id, params)
184
+ parsed, options = Sentdm::Voice::Calls::ParticipantRemoveParams.dump_request(params)
185
+ id =
186
+ parsed.delete(:id) do
187
+ raise ArgumentError.new("missing required path argument #{_1}")
188
+ end
189
+ header_params = {x_profile_id: "x-profile-id"}
190
+ @client.request(
191
+ method: :delete,
192
+ path: ["v3/voice/calls/%1$s/participants/%2$s", id, participant_id],
193
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
194
+ body: parsed.except(*header_params.keys),
195
+ model: NilClass,
196
+ options: options
197
+ )
198
+ end
199
+
200
+ # Some parameter documentations has been truncated, see
201
+ # {Sentdm::Models::Voice::Calls::ParticipantRemoveAllParams} for more details.
202
+ #
203
+ # Removes every participant from the conference room a live call is in, the call
204
+ # itself included. Every leg ends and is reported through call.completed like any
205
+ # other call. A room that is already empty answers 204 as well. A call that has
206
+ # ended answers 409, as does a call that is not in a conference.
207
+ #
208
+ # @overload remove_all(id, sandbox: nil, x_profile_id: nil, request_options: {})
209
+ #
210
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
211
+ #
212
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
213
+ #
214
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
215
+ #
216
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
217
+ #
218
+ # @return [nil]
219
+ #
220
+ # @see Sentdm::Models::Voice::Calls::ParticipantRemoveAllParams
221
+ def remove_all(id, params = {})
222
+ parsed, options = Sentdm::Voice::Calls::ParticipantRemoveAllParams.dump_request(params)
223
+ header_params = {x_profile_id: "x-profile-id"}
224
+ @client.request(
225
+ method: :delete,
226
+ path: ["v3/voice/calls/%1$s/participants", id],
227
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
228
+ body: parsed.except(*header_params.keys),
229
+ model: NilClass,
230
+ options: options
231
+ )
232
+ end
233
+
234
+ # @api private
235
+ #
236
+ # @param client [Sentdm::Client]
237
+ def initialize(client:)
238
+ @client = client
239
+ end
240
+ end
241
+ end
242
+ end
243
+ end
244
+ end
@@ -0,0 +1,269 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
6
+ # Phone calls from the numbers you hold, driven by your own callback URL.
7
+ #
8
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
9
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
10
+ # short-lived token that lets a user of your app place and receive calls as that
11
+ # number. When a call arrives or a caller presses a key, a signed question is
12
+ # POSTed to the callback URL and the answer decides the call;
13
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
14
+ # before a real call reaches it, and
15
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
16
+ # The call events themselves (`call.completed` and the rest) arrive through your
17
+ # webhooks.
18
+ #
19
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
20
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
+ # conference participants while it is live. A leg to a phone number runs for at
22
+ # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
34
+ class Calls
35
+ # Phone calls from the numbers you hold, driven by your own callback URL.
36
+ #
37
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
38
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
39
+ # short-lived token that lets a user of your app place and receive calls as that
40
+ # number. When a call arrives or a caller presses a key, a signed question is
41
+ # POSTed to the callback URL and the answer decides the call;
42
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
43
+ # before a real call reaches it, and
44
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
45
+ # The call events themselves (`call.completed` and the rest) arrive through your
46
+ # webhooks.
47
+ #
48
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
49
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
50
+ # conference participants while it is live. A leg to a phone number runs for at
51
+ # most what your balance affords at the destination's rate.
52
+ #
53
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
54
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
55
+ # call as text (speech recognised and spoken for the agent) or as audio,
56
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
57
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
58
+ # `fallback` and `limits` say what it may do on a call. The agent's
59
+ # `signing_secret` is shown on create and on
60
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
61
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
62
+ # it is bound to it on `/v3/channels/voice`.
63
+ # @return [Sentdm::Resources::Voice::Calls::Participants]
64
+ attr_reader :participants
65
+
66
+ # Some parameter documentations has been truncated, see
67
+ # {Sentdm::Models::Voice::CallRetrieveParams} for more details.
68
+ #
69
+ # Retrieves one of your calls by id: the parties, the owning number, the phone
70
+ # number the call was connected to and the caller id it showed, the current status
71
+ # with its failure reason, duration, price with the billed legs and what each
72
+ # cost, recording availability, and a timeline of when the call entered each
73
+ # status.
74
+ #
75
+ # @overload retrieve(id, x_profile_id: nil, request_options: {})
76
+ #
77
+ # @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
78
+ #
79
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
80
+ #
81
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
82
+ #
83
+ # @return [Sentdm::Models::Voice::APIResponseOfCall]
84
+ #
85
+ # @see Sentdm::Models::Voice::CallRetrieveParams
86
+ def retrieve(id, params = {})
87
+ parsed, options = Sentdm::Voice::CallRetrieveParams.dump_request(params)
88
+ @client.request(
89
+ method: :get,
90
+ path: ["v3/voice/calls/%1$s", id],
91
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
92
+ model: Sentdm::Voice::APIResponseOfCall,
93
+ options: options
94
+ )
95
+ end
96
+
97
+ # Some parameter documentations has been truncated, see
98
+ # {Sentdm::Models::Voice::CallListParams} for more details.
99
+ #
100
+ # Retrieves a paginated list of your calls, most recent first. Filter by
101
+ # direction, status, the owning number, the mode (inapp, or agent for calls your
102
+ # voice agents answered), the agent that answered, and the time the call started
103
+ # (from and to are inclusive). Each call carries the phone number it was connected
104
+ # to, the caller id it showed, and the billed legs with what each cost. Use the
105
+ # call webhooks for real-time updates; this list is for looking calls up
106
+ # afterwards.
107
+ #
108
+ # @overload list(agent_id: nil, direction: nil, from: nil, mode: nil, number: nil, page: nil, page_size: nil, status: nil, to: nil, x_profile_id: nil, request_options: {})
109
+ #
110
+ # @param agent_id [String, nil] Query param: Optional filter on the voice agent that answered the call, such as
111
+ #
112
+ # @param direction [String, nil] Query param: Optional direction filter: outbound for calls placed from your app,
113
+ #
114
+ # @param from [Time, nil] Query param: Only calls started at or after this time (ISO 8601)
115
+ #
116
+ # @param mode [String, nil] Query param: Optional mode filter: inapp for calls routed by your number's callb
117
+ #
118
+ # @param number [String, nil] Query param: Optional filter on the number that owns the call, one of your voice
119
+ #
120
+ # @param page [Integer] Query param: Page number (1-indexed)
121
+ #
122
+ # @param page_size [Integer] Query param: Number of items per page
123
+ #
124
+ # @param status [String, nil] Query param: Optional status filter: initiated, ringing, answered, completed, fa
125
+ #
126
+ # @param to [Time, nil] Query param: Only calls started at or before this time (ISO 8601)
127
+ #
128
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
129
+ #
130
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
131
+ #
132
+ # @return [Sentdm::Internal::CallsPage<Sentdm::Models::Voice::Call>]
133
+ #
134
+ # @see Sentdm::Models::Voice::CallListParams
135
+ def list(params = {})
136
+ query_params = [:agent_id, :direction, :from, :mode, :number, :page, :page_size, :status, :to]
137
+ parsed, options = Sentdm::Voice::CallListParams.dump_request(params)
138
+ query = Sentdm::Internal::Util.encode_query_params(parsed.slice(*query_params))
139
+ @client.request(
140
+ method: :get,
141
+ path: "v3/voice/calls",
142
+ query: query,
143
+ headers: parsed.except(*query_params).transform_keys(x_profile_id: "x-profile-id"),
144
+ page: Sentdm::Internal::CallsPage,
145
+ model: Sentdm::Voice::Call,
146
+ options: options
147
+ )
148
+ end
149
+
150
+ # Some parameter documentations has been truncated, see
151
+ # {Sentdm::Models::Voice::CallHangupParams} for more details.
152
+ #
153
+ # Ends one of your live calls. The call then ends the way any other call does once
154
+ # the disconnect is reported: an answered call as COMPLETED with call.completed, a
155
+ # call still ringing as NO_ANSWER, REJECTED or FAILED with call.failed. A call
156
+ # that has already ended answers 409, as do a call with no phone leg, such as one
157
+ # between two app users, and a call one of your voice agents answers.
158
+ #
159
+ # @overload hangup(id, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
160
+ #
161
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
162
+ #
163
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
164
+ #
165
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
166
+ #
167
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
168
+ #
169
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
170
+ #
171
+ # @return [nil]
172
+ #
173
+ # @see Sentdm::Models::Voice::CallHangupParams
174
+ def hangup(id, params = {})
175
+ parsed, options = Sentdm::Voice::CallHangupParams.dump_request(params)
176
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
177
+ @client.request(
178
+ method: :post,
179
+ path: ["v3/voice/calls/%1$s/hangup", id],
180
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
181
+ body: parsed.except(*header_params.keys),
182
+ model: NilClass,
183
+ options: options
184
+ )
185
+ end
186
+
187
+ # Some parameter documentations has been truncated, see
188
+ # {Sentdm::Models::Voice::CallListRecordingsParams} for more details.
189
+ #
190
+ # Returns pre-signed links to the recordings of one of your calls, each valid
191
+ # until its url_expires_at. A recording appears once the call was recorded, by a
192
+ # connect answer with record set, a startRecording instruction or the recordings
193
+ # command, and the call.recording_ready webhook has been sent; until then, and for
194
+ # a call that was never recorded, the list is empty. A call recorded more than
195
+ # once lists every recording, oldest first, each under the recording_id its
196
+ # call.recording_ready webhook carried.
197
+ #
198
+ # @overload list_recordings(id, x_profile_id: nil, request_options: {})
199
+ #
200
+ # @param id [String] The call id from the route, as carried by call webhooks and the calls list, for
201
+ #
202
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
203
+ #
204
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
205
+ #
206
+ # @return [Sentdm::Models::Voice::APIResponseOfCallRecordings]
207
+ #
208
+ # @see Sentdm::Models::Voice::CallListRecordingsParams
209
+ def list_recordings(id, params = {})
210
+ parsed, options = Sentdm::Voice::CallListRecordingsParams.dump_request(params)
211
+ @client.request(
212
+ method: :get,
213
+ path: ["v3/voice/calls/%1$s/recordings", id],
214
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
215
+ model: Sentdm::Voice::APIResponseOfCallRecordings,
216
+ options: options
217
+ )
218
+ end
219
+
220
+ # Some parameter documentations has been truncated, see
221
+ # {Sentdm::Models::Voice::CallRecordParams} for more details.
222
+ #
223
+ # Starts or stops recording one of your live calls. Use start to begin recording
224
+ # mid-call, or stop to end a recording, whether it was started here or by a
225
+ # connect answer with record set. A call that has already ended answers 409, as do
226
+ # a call with no phone leg, such as one between two app users, and a call one of
227
+ # your voice agents answers, neither of which can be recorded this way.
228
+ #
229
+ # @overload record(id, action: nil, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
230
+ #
231
+ # @param id [String] Path param: The call id from the route, as carried by call webhooks and the call
232
+ #
233
+ # @param action [String] Body param: start to begin recording, stop to end it
234
+ #
235
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
236
+ #
237
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
238
+ #
239
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
240
+ #
241
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
242
+ #
243
+ # @return [nil]
244
+ #
245
+ # @see Sentdm::Models::Voice::CallRecordParams
246
+ def record(id, params = {})
247
+ parsed, options = Sentdm::Voice::CallRecordParams.dump_request(params)
248
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
249
+ @client.request(
250
+ method: :post,
251
+ path: ["v3/voice/calls/%1$s/recordings", id],
252
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
253
+ body: parsed.except(*header_params.keys),
254
+ model: NilClass,
255
+ options: options
256
+ )
257
+ end
258
+
259
+ # @api private
260
+ #
261
+ # @param client [Sentdm::Client]
262
+ def initialize(client:)
263
+ @client = client
264
+ @participants = Sentdm::Resources::Voice::Calls::Participants.new(client: client)
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
6
+ # Phone calls from the numbers you hold, driven by your own callback URL.
7
+ #
8
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
9
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
10
+ # short-lived token that lets a user of your app place and receive calls as that
11
+ # number. When a call arrives or a caller presses a key, a signed question is
12
+ # POSTed to the callback URL and the answer decides the call;
13
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
14
+ # before a real call reaches it, and
15
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
16
+ # The call events themselves (`call.completed` and the rest) arrive through your
17
+ # webhooks.
18
+ #
19
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
20
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
+ # conference participants while it is live. A leg to a phone number runs for at
22
+ # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
34
+ class Catalogue
35
+ # Some parameter documentations has been truncated, see
36
+ # {Sentdm::Models::Voice::CatalogueListParams} for more details.
37
+ #
38
+ # The names a voice agent's `speech.voice` and `speech.language` accept, with the
39
+ # default marked. The list grows as voices are added; a name is never removed
40
+ # without notice.
41
+ #
42
+ # @overload list(x_profile_id: nil, request_options: {})
43
+ #
44
+ # @param x_profile_id [String] Profile UUID to scope the request to a child profile. Only organization API keys
45
+ #
46
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
47
+ #
48
+ # @return [Sentdm::Models::Voice::APIResponseOfVoiceCatalogue]
49
+ #
50
+ # @see Sentdm::Models::Voice::CatalogueListParams
51
+ def list(params = {})
52
+ parsed, options = Sentdm::Voice::CatalogueListParams.dump_request(params)
53
+ @client.request(
54
+ method: :get,
55
+ path: "v3/voice/voices",
56
+ headers: parsed.transform_keys(x_profile_id: "x-profile-id"),
57
+ model: Sentdm::Voice::APIResponseOfVoiceCatalogue,
58
+ options: options
59
+ )
60
+ end
61
+
62
+ # @api private
63
+ #
64
+ # @param client [Sentdm::Client]
65
+ def initialize(client:)
66
+ @client = client
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentdm
4
+ module Resources
5
+ class Voice
6
+ # Phone calls from the numbers you hold, driven by your own callback URL.
7
+ #
8
+ # `POST /v3/channels/voice` enables a number for calls, with the callback URL Sent
9
+ # asks what to do with each call on it, and `POST /v3/voice/tokens` mints a
10
+ # short-lived token that lets a user of your app place and receive calls as that
11
+ # number. When a call arrives or a caller presses a key, a signed question is
12
+ # POSTed to the callback URL and the answer decides the call;
13
+ # `POST /v3/channels/voice/{number}/test` checks the URL answers the way we need
14
+ # before a real call reaches it, and
15
+ # `POST /v3/channels/voice/{number}/rotate-secret` replaces the signing secret.
16
+ # The call events themselves (`call.completed` and the rest) arrive through your
17
+ # webhooks.
18
+ #
19
+ # Every call is a record under `/v3/voice/calls`: read it, list its recordings
20
+ # once one is ready, hang it up, start or stop recording, and add, mute or remove
21
+ # conference participants while it is live. A leg to a phone number runs for at
22
+ # most what your balance affords at the destination's rate.
23
+ #
24
+ # **Voice agents.** `POST /v3/voice/agents` creates an agent that answers calls
25
+ # through the Sent Voice Gateway: `session_type` says whether Sent carries the
26
+ # call as text (speech recognised and spoken for the agent) or as audio,
27
+ # `websocket_url` is where the gateway dials the agent for each call (leave it out
28
+ # and the agent dials in with your API key), and `tools`, `transfer_targets`,
29
+ # `fallback` and `limits` say what it may do on a call. The agent's
30
+ # `signing_secret` is shown on create and on
31
+ # `POST /v3/voice/agents/{id}/rotate-secret` only. Voices and languages for text
32
+ # sessions come from `GET /v3/voice/voices`. A number takes calls to an agent once
33
+ # it is bound to it on `/v3/channels/voice`.
34
+ class Tokens
35
+ # Some parameter documentations has been truncated, see
36
+ # {Sentdm::Models::Voice::TokenCreateParams} for more details.
37
+ #
38
+ # Mints a short-lived token for one of your app users. Call this from your backend
39
+ # and return the token to your app, which passes it to the voice client SDK to
40
+ # register. The identity is bound to the given number, or to your default app-call
41
+ # number when omitted, and calls placed by that identity are routed through the
42
+ # bound number. Minting again re-binds the identity, so an identity can move
43
+ # between numbers.
44
+ #
45
+ # @overload create(identity: nil, number: nil, sandbox: nil, ttl: nil, idempotency_key: nil, x_profile_id: nil, request_options: {})
46
+ #
47
+ # @param identity [String] Body param: Your identifier for the app user, such as an agent or account id. Le
48
+ #
49
+ # @param number [String, nil] Body param: One of your voice-enabled phone numbers in E.164 format. Calls place
50
+ #
51
+ # @param sandbox [Boolean] Body param: Sandbox flag - when true, the operation is simulated without side ef
52
+ #
53
+ # @param ttl [Integer, nil] Body param: Token lifetime in seconds. Defaults to 600 and cannot exceed 3600.
54
+ #
55
+ # @param idempotency_key [String] Header param: Unique key to ensure idempotent request processing. Must be 1-255
56
+ #
57
+ # @param x_profile_id [String] Header param: Profile UUID to scope the request to a child profile. Only organiz
58
+ #
59
+ # @param request_options [Sentdm::RequestOptions, Hash{Symbol=>Object}, nil]
60
+ #
61
+ # @return [Sentdm::Models::Voice::APIResponseOfVoiceToken]
62
+ #
63
+ # @see Sentdm::Models::Voice::TokenCreateParams
64
+ def create(params = {})
65
+ parsed, options = Sentdm::Voice::TokenCreateParams.dump_request(params)
66
+ header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"}
67
+ @client.request(
68
+ method: :post,
69
+ path: "v3/voice/tokens",
70
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
71
+ body: parsed.except(*header_params.keys),
72
+ model: Sentdm::Voice::APIResponseOfVoiceToken,
73
+ options: options
74
+ )
75
+ end
76
+
77
+ # @api private
78
+ #
79
+ # @param client [Sentdm::Client]
80
+ def initialize(client:)
81
+ @client = client
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end