@azure/communication-call-automation 1.5.0-beta.2 → 1.5.0-beta.3

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. package/README.md +3 -1
  2. package/dist/browser/callAutomationClient.d.ts +2 -3
  3. package/dist/browser/callAutomationClient.d.ts.map +1 -1
  4. package/dist/browser/callAutomationClient.js +79 -31
  5. package/dist/browser/callAutomationClient.js.map +1 -1
  6. package/dist/browser/callAutomationEventParser.d.ts.map +1 -1
  7. package/dist/browser/callAutomationEventParser.js +9 -10
  8. package/dist/browser/callAutomationEventParser.js.map +1 -1
  9. package/dist/browser/callConnection.d.ts +1 -1
  10. package/dist/browser/callConnection.d.ts.map +1 -1
  11. package/dist/browser/callConnection.js +82 -38
  12. package/dist/browser/callConnection.js.map +1 -1
  13. package/dist/browser/callMedia.d.ts +1 -1
  14. package/dist/browser/callMedia.d.ts.map +1 -1
  15. package/dist/browser/callMedia.js +33 -12
  16. package/dist/browser/callMedia.js.map +1 -1
  17. package/dist/browser/callRecording.js +11 -6
  18. package/dist/browser/callRecording.js.map +1 -1
  19. package/dist/browser/contentDownloader.js +11 -12
  20. package/dist/browser/contentDownloader.js.map +1 -1
  21. package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.js +1 -2
  22. package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -1
  23. package/dist/browser/credential/callAutomationAuthPolicy.js +1 -1
  24. package/dist/browser/credential/callAutomationAuthPolicy.js.map +1 -1
  25. package/dist/browser/credential/cryptoUtils-browser.mjs.map +1 -1
  26. package/dist/browser/credential/cryptoUtils.js +1 -2
  27. package/dist/browser/generated/src/callAutomationApiClient.js +14 -5
  28. package/dist/browser/generated/src/callAutomationApiClient.js.map +1 -1
  29. package/dist/browser/generated/src/models/index.d.ts +305 -322
  30. package/dist/browser/generated/src/models/index.d.ts.map +1 -1
  31. package/dist/browser/generated/src/models/index.js +29 -35
  32. package/dist/browser/generated/src/models/index.js.map +1 -1
  33. package/dist/browser/generated/src/models/mappers.d.ts +41 -34
  34. package/dist/browser/generated/src/models/mappers.d.ts.map +1 -1
  35. package/dist/browser/generated/src/models/mappers.js +481 -462
  36. package/dist/browser/generated/src/models/mappers.js.map +1 -1
  37. package/dist/browser/generated/src/models/parameters.js +1 -1
  38. package/dist/browser/generated/src/models/parameters.js.map +1 -1
  39. package/dist/browser/generated/src/operations/callConnection.js +23 -40
  40. package/dist/browser/generated/src/operations/callConnection.js.map +1 -1
  41. package/dist/browser/generated/src/operations/callMedia.js +1 -0
  42. package/dist/browser/generated/src/operations/callMedia.js.map +1 -1
  43. package/dist/browser/generated/src/operations/callRecording.js +1 -0
  44. package/dist/browser/generated/src/operations/callRecording.js.map +1 -1
  45. package/dist/browser/generated/src/pagingHelper.js +2 -4
  46. package/dist/browser/generated/src/pagingHelper.js.map +1 -1
  47. package/dist/browser/models/constants.d.ts.map +1 -1
  48. package/dist/browser/models/constants.js +1 -1
  49. package/dist/browser/models/constants.js.map +1 -1
  50. package/dist/browser/models/events.d.ts +295 -209
  51. package/dist/browser/models/events.d.ts.map +1 -1
  52. package/dist/browser/models/events.js.map +1 -1
  53. package/dist/browser/models/models.d.ts +44 -4
  54. package/dist/browser/models/models.d.ts.map +1 -1
  55. package/dist/browser/models/models.js +1 -1
  56. package/dist/browser/models/models.js.map +1 -1
  57. package/dist/browser/models/options.d.ts +17 -0
  58. package/dist/browser/models/options.d.ts.map +1 -1
  59. package/dist/browser/models/options.js.map +1 -1
  60. package/dist/browser/models/responses.d.ts +1 -1
  61. package/dist/browser/models/responses.d.ts.map +1 -1
  62. package/dist/browser/models/responses.js.map +1 -1
  63. package/dist/browser/models/streaming.d.ts +26 -27
  64. package/dist/browser/models/streaming.d.ts.map +1 -1
  65. package/dist/browser/models/streaming.js +28 -57
  66. package/dist/browser/models/streaming.js.map +1 -1
  67. package/dist/browser/streamingData.d.ts.map +1 -1
  68. package/dist/browser/streamingData.js +10 -1
  69. package/dist/browser/streamingData.js.map +1 -1
  70. package/dist/browser/utli/converters.d.ts.map +1 -1
  71. package/dist/browser/utli/converters.js +30 -9
  72. package/dist/browser/utli/converters.js.map +1 -1
  73. package/dist/commonjs/callAutomationClient.d.ts +2 -3
  74. package/dist/commonjs/callAutomationClient.d.ts.map +1 -1
  75. package/dist/commonjs/callAutomationClient.js +79 -31
  76. package/dist/commonjs/callAutomationClient.js.map +1 -1
  77. package/dist/commonjs/callAutomationEventParser.d.ts.map +1 -1
  78. package/dist/commonjs/callAutomationEventParser.js +9 -10
  79. package/dist/commonjs/callAutomationEventParser.js.map +1 -1
  80. package/dist/commonjs/callConnection.d.ts +1 -1
  81. package/dist/commonjs/callConnection.d.ts.map +1 -1
  82. package/dist/commonjs/callConnection.js +82 -38
  83. package/dist/commonjs/callConnection.js.map +1 -1
  84. package/dist/commonjs/callMedia.d.ts +1 -1
  85. package/dist/commonjs/callMedia.d.ts.map +1 -1
  86. package/dist/commonjs/callMedia.js +42 -21
  87. package/dist/commonjs/callMedia.js.map +1 -1
  88. package/dist/commonjs/callRecording.js +12 -7
  89. package/dist/commonjs/callRecording.js.map +1 -1
  90. package/dist/commonjs/contentDownloader.js +11 -12
  91. package/dist/commonjs/contentDownloader.js.map +1 -1
  92. package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.js +1 -2
  93. package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -1
  94. package/dist/commonjs/credential/callAutomationAuthPolicy.js +1 -1
  95. package/dist/commonjs/credential/callAutomationAuthPolicy.js.map +1 -1
  96. package/dist/commonjs/generated/src/callAutomationApiClient.js +14 -5
  97. package/dist/commonjs/generated/src/callAutomationApiClient.js.map +1 -1
  98. package/dist/commonjs/generated/src/models/index.d.ts +305 -322
  99. package/dist/commonjs/generated/src/models/index.d.ts.map +1 -1
  100. package/dist/commonjs/generated/src/models/index.js +30 -36
  101. package/dist/commonjs/generated/src/models/index.js.map +1 -1
  102. package/dist/commonjs/generated/src/models/mappers.d.ts +41 -34
  103. package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -1
  104. package/dist/commonjs/generated/src/models/mappers.js +484 -465
  105. package/dist/commonjs/generated/src/models/mappers.js.map +1 -1
  106. package/dist/commonjs/generated/src/models/parameters.js +1 -1
  107. package/dist/commonjs/generated/src/models/parameters.js.map +1 -1
  108. package/dist/commonjs/generated/src/operations/callConnection.js +23 -39
  109. package/dist/commonjs/generated/src/operations/callConnection.js.map +1 -1
  110. package/dist/commonjs/generated/src/operations/callMedia.js +1 -0
  111. package/dist/commonjs/generated/src/operations/callMedia.js.map +1 -1
  112. package/dist/commonjs/generated/src/operations/callRecording.js +1 -0
  113. package/dist/commonjs/generated/src/operations/callRecording.js.map +1 -1
  114. package/dist/commonjs/generated/src/pagingHelper.js +2 -4
  115. package/dist/commonjs/generated/src/pagingHelper.js.map +1 -1
  116. package/dist/commonjs/models/constants.d.ts.map +1 -1
  117. package/dist/commonjs/models/constants.js +1 -1
  118. package/dist/commonjs/models/constants.js.map +1 -1
  119. package/dist/commonjs/models/events.d.ts +295 -209
  120. package/dist/commonjs/models/events.d.ts.map +1 -1
  121. package/dist/commonjs/models/events.js.map +1 -1
  122. package/dist/commonjs/models/models.d.ts +44 -4
  123. package/dist/commonjs/models/models.d.ts.map +1 -1
  124. package/dist/commonjs/models/models.js +2 -16
  125. package/dist/commonjs/models/models.js.map +1 -1
  126. package/dist/commonjs/models/options.d.ts +17 -0
  127. package/dist/commonjs/models/options.d.ts.map +1 -1
  128. package/dist/commonjs/models/options.js.map +1 -1
  129. package/dist/commonjs/models/responses.d.ts +1 -1
  130. package/dist/commonjs/models/responses.d.ts.map +1 -1
  131. package/dist/commonjs/models/responses.js.map +1 -1
  132. package/dist/commonjs/models/streaming.d.ts +26 -27
  133. package/dist/commonjs/models/streaming.d.ts.map +1 -1
  134. package/dist/commonjs/models/streaming.js +31 -59
  135. package/dist/commonjs/models/streaming.js.map +1 -1
  136. package/dist/commonjs/streamingData.d.ts.map +1 -1
  137. package/dist/commonjs/streamingData.js +10 -1
  138. package/dist/commonjs/streamingData.js.map +1 -1
  139. package/dist/commonjs/tsdoc-metadata.json +11 -11
  140. package/dist/commonjs/utli/converters.d.ts.map +1 -1
  141. package/dist/commonjs/utli/converters.js +30 -9
  142. package/dist/commonjs/utli/converters.js.map +1 -1
  143. package/dist/esm/callAutomationClient.d.ts +2 -3
  144. package/dist/esm/callAutomationClient.d.ts.map +1 -1
  145. package/dist/esm/callAutomationClient.js +79 -31
  146. package/dist/esm/callAutomationClient.js.map +1 -1
  147. package/dist/esm/callAutomationEventParser.d.ts.map +1 -1
  148. package/dist/esm/callAutomationEventParser.js +9 -10
  149. package/dist/esm/callAutomationEventParser.js.map +1 -1
  150. package/dist/esm/callConnection.d.ts +1 -1
  151. package/dist/esm/callConnection.d.ts.map +1 -1
  152. package/dist/esm/callConnection.js +82 -38
  153. package/dist/esm/callConnection.js.map +1 -1
  154. package/dist/esm/callMedia.d.ts +1 -1
  155. package/dist/esm/callMedia.d.ts.map +1 -1
  156. package/dist/esm/callMedia.js +33 -12
  157. package/dist/esm/callMedia.js.map +1 -1
  158. package/dist/esm/callRecording.js +11 -6
  159. package/dist/esm/callRecording.js.map +1 -1
  160. package/dist/esm/contentDownloader.js +11 -12
  161. package/dist/esm/contentDownloader.js.map +1 -1
  162. package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.js +1 -2
  163. package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -1
  164. package/dist/esm/credential/callAutomationAuthPolicy.js +1 -1
  165. package/dist/esm/credential/callAutomationAuthPolicy.js.map +1 -1
  166. package/dist/esm/generated/src/callAutomationApiClient.js +14 -5
  167. package/dist/esm/generated/src/callAutomationApiClient.js.map +1 -1
  168. package/dist/esm/generated/src/models/index.d.ts +305 -322
  169. package/dist/esm/generated/src/models/index.d.ts.map +1 -1
  170. package/dist/esm/generated/src/models/index.js +29 -35
  171. package/dist/esm/generated/src/models/index.js.map +1 -1
  172. package/dist/esm/generated/src/models/mappers.d.ts +41 -34
  173. package/dist/esm/generated/src/models/mappers.d.ts.map +1 -1
  174. package/dist/esm/generated/src/models/mappers.js +481 -462
  175. package/dist/esm/generated/src/models/mappers.js.map +1 -1
  176. package/dist/esm/generated/src/models/parameters.js +1 -1
  177. package/dist/esm/generated/src/models/parameters.js.map +1 -1
  178. package/dist/esm/generated/src/operations/callConnection.js +23 -40
  179. package/dist/esm/generated/src/operations/callConnection.js.map +1 -1
  180. package/dist/esm/generated/src/operations/callMedia.js +1 -0
  181. package/dist/esm/generated/src/operations/callMedia.js.map +1 -1
  182. package/dist/esm/generated/src/operations/callRecording.js +1 -0
  183. package/dist/esm/generated/src/operations/callRecording.js.map +1 -1
  184. package/dist/esm/generated/src/pagingHelper.js +2 -4
  185. package/dist/esm/generated/src/pagingHelper.js.map +1 -1
  186. package/dist/esm/models/constants.d.ts.map +1 -1
  187. package/dist/esm/models/constants.js +1 -1
  188. package/dist/esm/models/constants.js.map +1 -1
  189. package/dist/esm/models/events.d.ts +295 -209
  190. package/dist/esm/models/events.d.ts.map +1 -1
  191. package/dist/esm/models/events.js.map +1 -1
  192. package/dist/esm/models/models.d.ts +44 -4
  193. package/dist/esm/models/models.d.ts.map +1 -1
  194. package/dist/esm/models/models.js +1 -1
  195. package/dist/esm/models/models.js.map +1 -1
  196. package/dist/esm/models/options.d.ts +17 -0
  197. package/dist/esm/models/options.d.ts.map +1 -1
  198. package/dist/esm/models/options.js.map +1 -1
  199. package/dist/esm/models/responses.d.ts +1 -1
  200. package/dist/esm/models/responses.d.ts.map +1 -1
  201. package/dist/esm/models/responses.js.map +1 -1
  202. package/dist/esm/models/streaming.d.ts +26 -27
  203. package/dist/esm/models/streaming.d.ts.map +1 -1
  204. package/dist/esm/models/streaming.js +28 -57
  205. package/dist/esm/models/streaming.js.map +1 -1
  206. package/dist/esm/streamingData.d.ts.map +1 -1
  207. package/dist/esm/streamingData.js +10 -1
  208. package/dist/esm/streamingData.js.map +1 -1
  209. package/dist/esm/utli/converters.d.ts.map +1 -1
  210. package/dist/esm/utli/converters.js +30 -9
  211. package/dist/esm/utli/converters.js.map +1 -1
  212. package/dist/react-native/callAutomationClient.d.ts +2 -3
  213. package/dist/react-native/callAutomationClient.d.ts.map +1 -1
  214. package/dist/react-native/callAutomationClient.js +79 -31
  215. package/dist/react-native/callAutomationClient.js.map +1 -1
  216. package/dist/react-native/callAutomationEventParser.d.ts.map +1 -1
  217. package/dist/react-native/callAutomationEventParser.js +9 -10
  218. package/dist/react-native/callAutomationEventParser.js.map +1 -1
  219. package/dist/react-native/callConnection.d.ts +1 -1
  220. package/dist/react-native/callConnection.d.ts.map +1 -1
  221. package/dist/react-native/callConnection.js +82 -38
  222. package/dist/react-native/callConnection.js.map +1 -1
  223. package/dist/react-native/callMedia.d.ts +1 -1
  224. package/dist/react-native/callMedia.d.ts.map +1 -1
  225. package/dist/react-native/callMedia.js +33 -12
  226. package/dist/react-native/callMedia.js.map +1 -1
  227. package/dist/react-native/callRecording.js +11 -6
  228. package/dist/react-native/callRecording.js.map +1 -1
  229. package/dist/react-native/contentDownloader.js +11 -12
  230. package/dist/react-native/contentDownloader.js.map +1 -1
  231. package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.js +1 -2
  232. package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -1
  233. package/dist/react-native/credential/callAutomationAuthPolicy.js +1 -1
  234. package/dist/react-native/credential/callAutomationAuthPolicy.js.map +1 -1
  235. package/dist/react-native/generated/src/callAutomationApiClient.js +14 -5
  236. package/dist/react-native/generated/src/callAutomationApiClient.js.map +1 -1
  237. package/dist/react-native/generated/src/models/index.d.ts +305 -322
  238. package/dist/react-native/generated/src/models/index.d.ts.map +1 -1
  239. package/dist/react-native/generated/src/models/index.js +29 -35
  240. package/dist/react-native/generated/src/models/index.js.map +1 -1
  241. package/dist/react-native/generated/src/models/mappers.d.ts +41 -34
  242. package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -1
  243. package/dist/react-native/generated/src/models/mappers.js +481 -462
  244. package/dist/react-native/generated/src/models/mappers.js.map +1 -1
  245. package/dist/react-native/generated/src/models/parameters.js +1 -1
  246. package/dist/react-native/generated/src/models/parameters.js.map +1 -1
  247. package/dist/react-native/generated/src/operations/callConnection.js +23 -40
  248. package/dist/react-native/generated/src/operations/callConnection.js.map +1 -1
  249. package/dist/react-native/generated/src/operations/callMedia.js +1 -0
  250. package/dist/react-native/generated/src/operations/callMedia.js.map +1 -1
  251. package/dist/react-native/generated/src/operations/callRecording.js +1 -0
  252. package/dist/react-native/generated/src/operations/callRecording.js.map +1 -1
  253. package/dist/react-native/generated/src/pagingHelper.js +2 -4
  254. package/dist/react-native/generated/src/pagingHelper.js.map +1 -1
  255. package/dist/react-native/models/constants.d.ts.map +1 -1
  256. package/dist/react-native/models/constants.js +1 -1
  257. package/dist/react-native/models/constants.js.map +1 -1
  258. package/dist/react-native/models/events.d.ts +295 -209
  259. package/dist/react-native/models/events.d.ts.map +1 -1
  260. package/dist/react-native/models/events.js.map +1 -1
  261. package/dist/react-native/models/models.d.ts +44 -4
  262. package/dist/react-native/models/models.d.ts.map +1 -1
  263. package/dist/react-native/models/models.js +1 -1
  264. package/dist/react-native/models/models.js.map +1 -1
  265. package/dist/react-native/models/options.d.ts +17 -0
  266. package/dist/react-native/models/options.d.ts.map +1 -1
  267. package/dist/react-native/models/options.js.map +1 -1
  268. package/dist/react-native/models/responses.d.ts +1 -1
  269. package/dist/react-native/models/responses.d.ts.map +1 -1
  270. package/dist/react-native/models/responses.js.map +1 -1
  271. package/dist/react-native/models/streaming.d.ts +26 -27
  272. package/dist/react-native/models/streaming.d.ts.map +1 -1
  273. package/dist/react-native/models/streaming.js +28 -57
  274. package/dist/react-native/models/streaming.js.map +1 -1
  275. package/dist/react-native/streamingData.d.ts.map +1 -1
  276. package/dist/react-native/streamingData.js +10 -1
  277. package/dist/react-native/streamingData.js.map +1 -1
  278. package/dist/react-native/utli/converters.d.ts.map +1 -1
  279. package/dist/react-native/utli/converters.js +30 -9
  280. package/dist/react-native/utli/converters.js.map +1 -1
  281. package/package.json +38 -44
package/README.md CHANGED
@@ -30,7 +30,9 @@ To use this client library in the browser, first you need to use a bundler. For
30
30
  | CallAutomationClient | `CallAutomationClient` is the primary interface for developers using this client library. It can be used to initiate calls by `createCall` or `answerCall`. |
31
31
  | CallConnection | `CallConnection` represents a ongoing call. Once the call is established with `createCall` or `answerCall`, further actions can be performed for the call, such as `transfer` or `addParticipant`. |
32
32
  | CallMedia | `CallMedia` can be used to do media related actions, such as `play`, to play media file. This can be retrieved from established `CallConnection`. |
33
- | CallRecording | `CallRecording` can be used to do recording related actions, such as `startRecording`. This can be retrieved from `CallAutomationClient`.
33
+ | CallRecording | `CallRecording` can be used to do recording related actions, such as `startRecording`. This can be retrieved from `CallAutomationClient`. |
34
+ | Callback Events | Callback events are events sent back during duration of the call. It gives information and state of the call, such as `CallConnected`. `CallbackUrl` must be provided during `createCall` and `answerCall`, and callback events will be sent to this url. You can use `callAutomationEventParser` to parse these events when it arrives. |
35
+ | Incoming Call Event | When incoming call happens (that can be answered with `answerCall`), incoming call eventgrid event will be sent. This is different from Callback events above, and should be setup on Azure portal. See [Incoming Call][incomingcall] for detail. |
34
36
 
35
37
  ## Examples
36
38
 
@@ -1,11 +1,11 @@
1
1
  import type { KeyCredential, TokenCredential } from "@azure/core-auth";
2
2
  import type { CommonClientOptions } from "@azure/core-client";
3
- import { CommunicationIdentifier, CommunicationUserIdentifier } from "@azure/communication-common";
3
+ import type { CommunicationIdentifier, CommunicationUserIdentifier } from "@azure/communication-common";
4
4
  import { CallConnection } from "./callConnection.js";
5
5
  import { CallRecording } from "./callRecording.js";
6
6
  import type { AnswerCallOptions, ConnectCallOptions, CreateCallOptions, RedirectCallOptions, RejectCallOptions } from "./models/options.js";
7
7
  import type { AnswerCallResult, ConnectCallResult, CreateCallResult } from "./models/responses.js";
8
- import type { CallInvite, CallLocator } from "./models/models.js";
8
+ import { type CallInvite, type CallLocator } from "./models/models.js";
9
9
  /**
10
10
  * Client options used to configure CallAutomation Client API requests.
11
11
  */
@@ -23,7 +23,6 @@ export declare class CallAutomationClient {
23
23
  private readonly sourceIdentity?;
24
24
  private readonly credential;
25
25
  private readonly internalPipelineOptions;
26
- private readonly endpoint;
27
26
  /**
28
27
  * Initializes a new instance of the CallAutomationClient class.
29
28
  * @param connectionString - Connection string to connect to an Azure Communication Service resource.
@@ -1 +1 @@
1
- {"version":3,"file":"callAutomationClient.d.ts","sourceRoot":"","sources":["../../src/callAutomationClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EACL,uBAAuB,EAEvB,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAYrC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,KAAK,EAA4B,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAW5F;;GAEG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE;;OAEG;IACH,cAAc,CAAC,EAAE,2BAA2B,CAAC;CAC9C;AAUD;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA0B;IAClE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAmC;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAk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C,OAAO,CAAC,EAAE,2BAA2B;IAmCvC;;;OAGG;IACI,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,cAAc;IASlE;;OAEG;IACI,gBAAgB,IAAI,aAAa;IAQxC;;OAEG;IACI,iBAAiB,IAAI,2BAA2B,GAAG,SAAS;YAIrD,kBAAkB;IAgDhC;;;;;OAKG;IACU,UAAU,CACrB,iBAAiB,EAAE,UAAU,EAC7B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IAmB5B;;;;;OAKG;IACU,eAAe,CAC1B,kBAAkB,EAAE,uBAAuB,EAAE,EAC7C,WAAW,EAAE,MAAM,EAEnB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IAiB5B;;;;;OAKG;IACU,UAAU,CACrB,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IA2D5B;;;;;;OAMG;IACU,YAAY,CACvB,mBAAmB,EAAE,MAAM,EAC3B,iBAAiB,EAAE,UAAU,EAC7B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC;IAchB;;;;;OAKG;IACU,UAAU,CACrB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC;IAchB;;;;;OAKG;IACU,WAAW,CACtB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC;CA+D9B"}
@@ -1,12 +1,10 @@
1
- import { __rest } from "tslib";
2
1
  import { isTokenCredential } from "@azure/core-auth";
3
- import { createCommunicationAuthPolicy, } from "@azure/communication-common";
4
- import { parseClientArguments, isKeyCredential } from "@azure/communication-common";
2
+ import { parseClientArguments, isKeyCredential, createCommunicationAuthPolicy, } from "@azure/communication-common";
5
3
  import { logger } from "./models/logger.js";
6
4
  import { CallAutomationApiClient, } from "./generated/src/index.js";
7
5
  import { CallConnection } from "./callConnection.js";
8
6
  import { CallRecording } from "./callRecording.js";
9
- import { communicationIdentifierConverter, communicationIdentifierModelConverter, communicationUserIdentifierConverter, communicationUserIdentifierModelConverter, microsoftTeamsAppIdentifierModelConverter, phoneNumberIdentifierConverter, PhoneNumberIdentifierModelConverter, } from "./utli/converters.js";
7
+ import { communicationIdentifierConverter, communicationIdentifierModelConverter, communicationUserIdentifierConverter, communicationUserIdentifierModelConverter, phoneNumberIdentifierConverter, microsoftTeamsAppIdentifierModelConverter, PhoneNumberIdentifierModelConverter, } from "./utli/converters.js";
10
8
  import { randomUUID } from "@azure/core-util";
11
9
  /**
12
10
  * Checks whether the type of a value is CallAutomationClientOptions or not.
@@ -18,20 +16,26 @@ const isCallAutomationClientOptions = (options) => !!options && !isTokenCredenti
18
16
  * A CallAutomationClient represents a Client to the Azure Communication CallAutomation service.
19
17
  */
20
18
  export class CallAutomationClient {
19
+ callAutomationApiClient;
20
+ sourceIdentity;
21
+ credential;
22
+ internalPipelineOptions;
21
23
  constructor(connectionStringOrUrl, credentialOrOptions, maybeOptions = {}) {
22
24
  const options = isCallAutomationClientOptions(credentialOrOptions)
23
25
  ? credentialOrOptions
24
26
  : maybeOptions;
25
- if (!(options === null || options === void 0 ? void 0 : options.userAgentOptions)) {
27
+ if (!options?.userAgentOptions) {
26
28
  options.userAgentOptions = {};
27
29
  }
28
- this.internalPipelineOptions = Object.assign(Object.assign({}, options), {
29
- loggingOptions: {
30
- logger: logger.info,
30
+ this.internalPipelineOptions = {
31
+ ...options,
32
+ ...{
33
+ loggingOptions: {
34
+ logger: logger.info,
35
+ },
31
36
  },
32
- });
37
+ };
33
38
  const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);
34
- this.endpoint = url;
35
39
  const authPolicy = createCommunicationAuthPolicy(credential);
36
40
  this.credential = credential;
37
41
  this.callAutomationApiClient = new CallAutomationApiClient(url, this.internalPipelineOptions);
@@ -43,13 +47,13 @@ export class CallAutomationClient {
43
47
  * @param callConnectionId - The CallConnection id for the CallConnection instance. (ex: 421CONTOSO-cRD6-4RDc-a078-99dRANDOMf).
44
48
  */
45
49
  getCallConnection(callConnectionId) {
46
- return new CallConnection(callConnectionId, this.endpoint, this.credential, this.internalPipelineOptions);
50
+ return new CallConnection(callConnectionId, this.callAutomationApiClient.endpoint, this.credential, this.internalPipelineOptions);
47
51
  }
48
52
  /**
49
53
  * Initializes a new instance of CallRecording.
50
54
  */
51
55
  getCallRecording() {
52
- return new CallRecording(this.endpoint, this.credential, this.internalPipelineOptions);
56
+ return new CallRecording(this.callAutomationApiClient.endpoint, this.credential, this.internalPipelineOptions);
53
57
  }
54
58
  /**
55
59
  * Get Source Identity that is used for create and answer call
@@ -58,13 +62,25 @@ export class CallAutomationClient {
58
62
  return communicationUserIdentifierConverter(this.sourceIdentity);
59
63
  }
60
64
  async createCallInternal(request, options) {
61
- const optionsInternal = Object.assign(Object.assign({}, options), { repeatabilityFirstSent: new Date(), repeatabilityRequestID: randomUUID() });
62
- const _a = await this.callAutomationApiClient.createCall(request, optionsInternal), { callConnectionId, answeredBy, targets, sourceCallerIdNumber, source, answeredFor } = _a, result = __rest(_a, ["callConnectionId", "answeredBy", "targets", "sourceCallerIdNumber", "source", "answeredFor"]);
65
+ const optionsInternal = {
66
+ ...options,
67
+ repeatabilityFirstSent: new Date(),
68
+ repeatabilityRequestID: randomUUID(),
69
+ };
70
+ const { callConnectionId, answeredBy, targets, sourceCallerIdNumber, source, answeredFor, ...result } = await this.callAutomationApiClient.createCall(request, optionsInternal);
63
71
  if (callConnectionId) {
64
- const callConnectionPropertiesDto = Object.assign(Object.assign({}, result), { callConnectionId: callConnectionId, source: source ? communicationIdentifierConverter(source) : undefined, answeredby: communicationUserIdentifierConverter(answeredBy), answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined, targetParticipants: targets === null || targets === void 0 ? void 0 : targets.map((returnedTarget) => communicationIdentifierConverter(returnedTarget)), sourceCallerIdNumber: sourceCallerIdNumber
72
+ const callConnectionPropertiesDto = {
73
+ ...result,
74
+ callConnectionId: callConnectionId,
75
+ source: source ? communicationIdentifierConverter(source) : undefined,
76
+ answeredby: communicationUserIdentifierConverter(answeredBy),
77
+ answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,
78
+ targetParticipants: targets?.map((returnedTarget) => communicationIdentifierConverter(returnedTarget)),
79
+ sourceCallerIdNumber: sourceCallerIdNumber
65
80
  ? phoneNumberIdentifierConverter(sourceCallerIdNumber)
66
- : undefined });
67
- const callConnection = new CallConnection(callConnectionId, this.endpoint, this.credential, this.internalPipelineOptions);
81
+ : undefined,
82
+ };
83
+ const callConnection = new CallConnection(callConnectionId, this.callAutomationApiClient.endpoint, this.credential, this.internalPipelineOptions);
68
84
  const createCallResult = {
69
85
  callConnectionProperties: callConnectionPropertiesDto,
70
86
  callConnection: callConnection,
@@ -82,7 +98,6 @@ export class CallAutomationClient {
82
98
  async createCall(targetParticipant, callbackUrl, options = {}) {
83
99
  const request = {
84
100
  source: this.sourceIdentity,
85
- teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),
86
101
  targets: [communicationIdentifierModelConverter(targetParticipant.targetParticipant)],
87
102
  callbackUri: callbackUrl,
88
103
  operationContext: options.operationContext,
@@ -91,6 +106,7 @@ export class CallAutomationClient {
91
106
  transcriptionOptions: options.transcriptionOptions,
92
107
  sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(targetParticipant.sourceCallIdNumber),
93
108
  sourceDisplayName: targetParticipant.sourceDisplayName,
109
+ teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),
94
110
  };
95
111
  return this.createCallInternal(request, options);
96
112
  }
@@ -105,7 +121,6 @@ export class CallAutomationClient {
105
121
  options = {}) {
106
122
  const request = {
107
123
  source: this.sourceIdentity,
108
- teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),
109
124
  targets: targetParticipants.map((target) => communicationIdentifierModelConverter(target)),
110
125
  callbackUri: callbackUrl,
111
126
  operationContext: options.operationContext,
@@ -114,6 +129,7 @@ export class CallAutomationClient {
114
129
  transcriptionOptions: options.transcriptionOptions,
115
130
  sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(options.sourceCallIdNumber),
116
131
  sourceDisplayName: options.sourceDisplayName,
132
+ teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),
117
133
  };
118
134
  return this.createCallInternal(request, options);
119
135
  }
@@ -124,7 +140,7 @@ export class CallAutomationClient {
124
140
  * @param options - Additional request options contains answerCall api options.
125
141
  */
126
142
  async answerCall(incomingCallContext, callbackUrl, options = {}) {
127
- const { callIntelligenceOptions, mediaStreamingOptions, transcriptionOptions, operationContext } = options, operationOptions = __rest(options, ["callIntelligenceOptions", "mediaStreamingOptions", "transcriptionOptions", "operationContext"]);
143
+ const { callIntelligenceOptions, mediaStreamingOptions, transcriptionOptions, operationContext, ...operationOptions } = options;
128
144
  const request = {
129
145
  incomingCallContext: incomingCallContext,
130
146
  mediaStreamingOptions: mediaStreamingOptions,
@@ -134,13 +150,25 @@ export class CallAutomationClient {
134
150
  callbackUri: callbackUrl,
135
151
  answeredBy: this.sourceIdentity,
136
152
  };
137
- const optionsInternal = Object.assign(Object.assign({}, operationOptions), { repeatabilityFirstSent: new Date(), repeatabilityRequestID: randomUUID() });
138
- const _a = await this.callAutomationApiClient.answerCall(request, optionsInternal), { callConnectionId, targets, sourceCallerIdNumber, answeredBy, source, answeredFor } = _a, result = __rest(_a, ["callConnectionId", "targets", "sourceCallerIdNumber", "answeredBy", "source", "answeredFor"]);
153
+ const optionsInternal = {
154
+ ...operationOptions,
155
+ repeatabilityFirstSent: new Date(),
156
+ repeatabilityRequestID: randomUUID(),
157
+ };
158
+ const { callConnectionId, targets, sourceCallerIdNumber, answeredBy, source, answeredFor, ...result } = await this.callAutomationApiClient.answerCall(request, optionsInternal);
139
159
  if (callConnectionId) {
140
- const callConnectionProperties = Object.assign(Object.assign({}, result), { callConnectionId: callConnectionId, source: source ? communicationIdentifierConverter(source) : undefined, answeredby: communicationUserIdentifierConverter(answeredBy), answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined, targetParticipants: targets === null || targets === void 0 ? void 0 : targets.map((target) => communicationIdentifierConverter(target)), sourceCallerIdNumber: sourceCallerIdNumber
160
+ const callConnectionProperties = {
161
+ ...result,
162
+ callConnectionId: callConnectionId,
163
+ source: source ? communicationIdentifierConverter(source) : undefined,
164
+ answeredby: communicationUserIdentifierConverter(answeredBy),
165
+ answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,
166
+ targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),
167
+ sourceCallerIdNumber: sourceCallerIdNumber
141
168
  ? phoneNumberIdentifierConverter(sourceCallerIdNumber)
142
- : undefined });
143
- const callConnection = new CallConnection(callConnectionId, this.endpoint, this.credential, this.internalPipelineOptions);
169
+ : undefined,
170
+ };
171
+ const callConnection = new CallConnection(callConnectionId, this.callAutomationApiClient.endpoint, this.credential, this.internalPipelineOptions);
144
172
  const answerCallResult = {
145
173
  callConnectionProperties: callConnectionProperties,
146
174
  callConnection: callConnection,
@@ -161,7 +189,11 @@ export class CallAutomationClient {
161
189
  incomingCallContext: incomingCallContext,
162
190
  target: communicationIdentifierModelConverter(targetParticipant.targetParticipant),
163
191
  };
164
- const optionsInternal = Object.assign(Object.assign({}, options), { repeatabilityFirstSent: new Date(), repeatabilityRequestID: randomUUID() });
192
+ const optionsInternal = {
193
+ ...options,
194
+ repeatabilityFirstSent: new Date(),
195
+ repeatabilityRequestID: randomUUID(),
196
+ };
165
197
  return this.callAutomationApiClient.redirectCall(request, optionsInternal);
166
198
  }
167
199
  /**
@@ -175,7 +207,11 @@ export class CallAutomationClient {
175
207
  incomingCallContext: incomingCallContext,
176
208
  callRejectReason: options.callRejectReason,
177
209
  };
178
- const optionsInternal = Object.assign(Object.assign({}, options), { repeatabilityFirstSent: new Date(), repeatabilityRequestID: randomUUID() });
210
+ const optionsInternal = {
211
+ ...options,
212
+ repeatabilityFirstSent: new Date(),
213
+ repeatabilityRequestID: randomUUID(),
214
+ };
179
215
  return this.callAutomationApiClient.rejectCall(request, optionsInternal);
180
216
  }
181
217
  /**
@@ -205,12 +241,24 @@ export class CallAutomationClient {
205
241
  connectRequest.callLocator.kind = "serverCallLocator";
206
242
  connectRequest.callLocator.serverCallId = callLocator.id;
207
243
  }
208
- const optionsInternal = Object.assign(Object.assign({}, options), { repeatabilityFirstSent: new Date(), repeatabilityRequestID: randomUUID() });
209
- const _a = await this.callAutomationApiClient.connect(connectRequest, optionsInternal), { callConnectionId, targets, sourceCallerIdNumber, answeredBy, source, answeredFor } = _a, result = __rest(_a, ["callConnectionId", "targets", "sourceCallerIdNumber", "answeredBy", "source", "answeredFor"]);
244
+ const optionsInternal = {
245
+ ...options,
246
+ repeatabilityFirstSent: new Date(),
247
+ repeatabilityRequestID: randomUUID(),
248
+ };
249
+ const { callConnectionId, targets, sourceCallerIdNumber, answeredBy, source, answeredFor, ...result } = await this.callAutomationApiClient.connect(connectRequest, optionsInternal);
210
250
  if (callConnectionId) {
211
- const callConnectionProperties = Object.assign(Object.assign({}, result), { callConnectionId: callConnectionId, source: source ? communicationIdentifierConverter(source) : undefined, answeredby: answeredBy ? communicationUserIdentifierConverter(answeredBy) : undefined, targetParticipants: targets === null || targets === void 0 ? void 0 : targets.map((target) => communicationIdentifierConverter(target)), answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined, sourceCallerIdNumber: sourceCallerIdNumber
251
+ const callConnectionProperties = {
252
+ ...result,
253
+ callConnectionId: callConnectionId,
254
+ source: source ? communicationIdentifierConverter(source) : undefined,
255
+ answeredby: answeredBy ? communicationUserIdentifierConverter(answeredBy) : undefined,
256
+ targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),
257
+ answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,
258
+ sourceCallerIdNumber: sourceCallerIdNumber
212
259
  ? phoneNumberIdentifierConverter(sourceCallerIdNumber)
213
- : undefined });
260
+ : undefined,
261
+ };
214
262
  const callConnection = new CallConnection(callConnectionId, this.callAutomationApiClient.endpoint, this.credential, this.internalPipelineOptions);
215
263
  const connectResult = {
216
264
  callConnectionProperties: callConnectionProperties,
@@ -1 +1 @@
1
- {"version":3,"file":"callAutomationClient.js","sourceRoot":"","sources":["../../src/callAutomationClient.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAEL,6BAA6B,GAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAEL,uBAAuB,GAMxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAUnD,OAAO,EACL,gCAAgC,EAChC,qCAAqC,EACrC,oCAAoC,EACpC,yCAAyC,EACzC,yCAAyC,EACzC,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAW9C;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,CAAC,OAAY,EAA0C,EAAE,CAC7F,CAAC,CAAC,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IA0B/B,YACE,qBAA6B,EAC7B,mBAAmF,EACnF,eAA4C,EAAE;QAE9C,MAAM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C;QAEF,MAAM,KAQF,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,EARzE,EACJ,gBAAgB,EAChB,OAAO,EACP,oBAAoB,EACpB,UAAU,EACV,MAAM,EACN,WAAW,OAEkE,EAD1E,MAAM,cAPL,8FAQL,CAA8E,CAAC;QAEhF,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,wBAAwB,mCACzB,MAAM,KACT,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,EACrE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,oCAAoC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,EACrF,kBAAkB,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gCAAgC,CAAC,MAAM,CAAC,CAAC,EACtF,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,EAClF,oBAAoB,EAAE,oBAAoB;oBACxC,CAAC,CAAC,8BAA8B,CAAC,oBAAoB,CAAC;oBACtD,CAAC,CAAC,SAAS,GACd,CAAC;YACF,MAAM,cAAc,GAAG,IAAI,cAAc,CACvC,gBAAgB,EAChB,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EACrC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,uBAAuB,CAC7B,CAAC;YACF,MAAM,aAAa,GAAsB;gBACvC,wBAAwB,EAAE,wBAAwB;gBAClD,cAAc,EAAE,cAAc;aAC/B,CAAC;YACF,OAAO,aAAa,CAAC;QACvB,CAAC;QACD,MAAM,0EAA0E,CAAC;IACnF,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport {\n CommunicationIdentifier,\n createCommunicationAuthPolicy,\n CommunicationUserIdentifier,\n} from \"@azure/communication-common\";\nimport { parseClientArguments, isKeyCredential } from \"@azure/communication-common\";\nimport { logger } from \"./models/logger.js\";\nimport {\n AnswerCallRequest,\n CallAutomationApiClient,\n CommunicationUserIdentifierModel,\n CreateCallRequest,\n RedirectCallRequest,\n RejectCallRequest,\n ConnectRequest,\n} from \"./generated/src/index.js\";\nimport { CallConnection } from \"./callConnection.js\";\nimport { CallRecording } from \"./callRecording.js\";\nimport type {\n AnswerCallOptions,\n ConnectCallOptions,\n CreateCallOptions,\n RedirectCallOptions,\n RejectCallOptions,\n} from \"./models/options.js\";\nimport type { AnswerCallResult, ConnectCallResult, CreateCallResult } from \"./models/responses.js\";\nimport type { CallConnectionProperties, CallInvite, CallLocator } from \"./models/models.js\";\nimport {\n communicationIdentifierConverter,\n communicationIdentifierModelConverter,\n communicationUserIdentifierConverter,\n communicationUserIdentifierModelConverter,\n microsoftTeamsAppIdentifierModelConverter,\n phoneNumberIdentifierConverter,\n PhoneNumberIdentifierModelConverter,\n} from \"./utli/converters.js\";\nimport { randomUUID } from \"@azure/core-util\";\n/**\n * Client options used to configure CallAutomation Client API requests.\n */\nexport interface CallAutomationClientOptions extends CommonClientOptions {\n /**\n * The identifier of the source of the call for call creating/answering/inviting operation.\n */\n sourceIdentity?: CommunicationUserIdentifier;\n}\n\n/**\n * Checks whether the type of a value is CallAutomationClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isCallAutomationClientOptions = (options: any): options is CallAutomationClientOptions =>\n !!options && !isTokenCredential(options) && !isKeyCredential(options);\n\n/**\n * A CallAutomationClient represents a Client to the Azure Communication CallAutomation service.\n */\nexport class CallAutomationClient {\n private readonly callAutomationApiClient: CallAutomationApiClient;\n private readonly sourceIdentity?: CommunicationUserIdentifierModel;\n private readonly credential: TokenCredential | KeyCredential;\n private readonly internalPipelineOptions: InternalPipelineOptions;\n private readonly endpoint: string;\n /**\n * Initializes a new instance of the CallAutomationClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: CallAutomationClientOptions);\n\n /**\n * Initializes a new instance of the CallAutomationClient class using a TokenCredential or KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential or KeyCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options?: CallAutomationClientOptions,\n );\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | CallAutomationClientOptions,\n maybeOptions: CallAutomationClientOptions = {},\n ) {\n const options = isCallAutomationClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n if (!options?.userAgentOptions) {\n options.userAgentOptions = {};\n }\n\n this.internalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n this.endpoint = url;\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.credential = credential;\n\n this.callAutomationApiClient = new CallAutomationApiClient(url, this.internalPipelineOptions);\n this.callAutomationApiClient.pipeline.addPolicy(authPolicy);\n\n this.sourceIdentity = communicationUserIdentifierModelConverter(options.sourceIdentity);\n }\n\n /**\n * Initializes a new instance of CallConnection.\n * @param callConnectionId - The CallConnection id for the CallConnection instance. (ex: 421CONTOSO-cRD6-4RDc-a078-99dRANDOMf).\n */\n public getCallConnection(callConnectionId: string): CallConnection {\n return new CallConnection(\n callConnectionId,\n this.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n }\n\n /**\n * Initializes a new instance of CallRecording.\n */\n public getCallRecording(): CallRecording {\n return new CallRecording(this.endpoint, this.credential, this.internalPipelineOptions);\n }\n\n /**\n * Get Source Identity that is used for create and answer call\n */\n public getSourceIdentity(): CommunicationUserIdentifier | undefined {\n return communicationUserIdentifierConverter(this.sourceIdentity);\n }\n\n private async createCallInternal(\n request: CreateCallRequest,\n options?: CreateCallOptions,\n ): Promise<CreateCallResult> {\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const {\n callConnectionId,\n answeredBy,\n targets,\n sourceCallerIdNumber,\n source,\n answeredFor,\n ...result\n } = await this.callAutomationApiClient.createCall(request, optionsInternal);\n\n if (callConnectionId) {\n const callConnectionPropertiesDto: CallConnectionProperties = {\n ...result,\n callConnectionId: callConnectionId,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: communicationUserIdentifierConverter(answeredBy),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n targetParticipants: targets?.map((returnedTarget) =>\n communicationIdentifierConverter(returnedTarget),\n ),\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n const callConnection = new CallConnection(\n callConnectionId,\n this.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n const createCallResult: CreateCallResult = {\n callConnectionProperties: callConnectionPropertiesDto,\n callConnection: callConnection,\n };\n return createCallResult;\n }\n throw \"callConnectionProperties / callConnectionId is missing in createCall result\";\n }\n\n /**\n * Create an outgoing call from source to a target identity.\n * @param targetParticipant - A single target.\n * @param callbackUrl - The callback url.\n * @param options - Additional request options contains createCallConnection api options.\n */\n public async createCall(\n targetParticipant: CallInvite,\n callbackUrl: string,\n options: CreateCallOptions = {},\n ): Promise<CreateCallResult> {\n const request: CreateCallRequest = {\n source: this.sourceIdentity,\n teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),\n targets: [communicationIdentifierModelConverter(targetParticipant.targetParticipant)],\n callbackUri: callbackUrl,\n operationContext: options.operationContext,\n callIntelligenceOptions: options.callIntelligenceOptions,\n mediaStreamingOptions: options.mediaStreamingOptions,\n transcriptionOptions: options.transcriptionOptions,\n sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(\n targetParticipant.sourceCallIdNumber,\n ),\n sourceDisplayName: targetParticipant.sourceDisplayName,\n };\n\n return this.createCallInternal(request, options);\n }\n\n /**\n * Create an outgoing call from source to a group of targets identities.\n * @param targetParticipants - A group of targets identities.\n * @param callbackUrl - The callback url.\n * @param options - Additional request options contains createCallConnection api options.\n */\n public async createGroupCall(\n targetParticipants: CommunicationIdentifier[],\n callbackUrl: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: CreateCallOptions = {},\n ): Promise<CreateCallResult> {\n const request: CreateCallRequest = {\n source: this.sourceIdentity,\n teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),\n targets: targetParticipants.map((target) => communicationIdentifierModelConverter(target)),\n callbackUri: callbackUrl,\n operationContext: options.operationContext,\n callIntelligenceOptions: options.callIntelligenceOptions,\n mediaStreamingOptions: options.mediaStreamingOptions,\n transcriptionOptions: options.transcriptionOptions,\n sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(options.sourceCallIdNumber),\n sourceDisplayName: options.sourceDisplayName,\n };\n\n return this.createCallInternal(request, options);\n }\n\n /**\n * Answer the call.\n * @param incomingCallContext - The context associated with the call.\n * @param callbackUrl - The callback url.\n * @param options - Additional request options contains answerCall api options.\n */\n public async answerCall(\n incomingCallContext: string,\n callbackUrl: string,\n options: AnswerCallOptions = {},\n ): Promise<AnswerCallResult> {\n const {\n callIntelligenceOptions,\n mediaStreamingOptions,\n transcriptionOptions,\n operationContext,\n ...operationOptions\n } = options;\n const request: AnswerCallRequest = {\n incomingCallContext: incomingCallContext,\n mediaStreamingOptions: mediaStreamingOptions,\n transcriptionOptions: transcriptionOptions,\n callIntelligenceOptions: callIntelligenceOptions,\n operationContext: operationContext,\n callbackUri: callbackUrl,\n answeredBy: this.sourceIdentity,\n };\n const optionsInternal = {\n ...operationOptions,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const {\n callConnectionId,\n targets,\n sourceCallerIdNumber,\n answeredBy,\n source,\n answeredFor,\n ...result\n } = await this.callAutomationApiClient.answerCall(request, optionsInternal);\n\n if (callConnectionId) {\n const callConnectionProperties: CallConnectionProperties = {\n ...result,\n callConnectionId: callConnectionId,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: communicationUserIdentifierConverter(answeredBy),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n const callConnection = new CallConnection(\n callConnectionId,\n this.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n const answerCallResult: AnswerCallResult = {\n callConnectionProperties: callConnectionProperties,\n callConnection: callConnection,\n };\n return answerCallResult;\n }\n throw \"callConnectionProperties / callConnectionId is missing in createCall result\";\n }\n\n /**\n * Redirect the call.\n *\n * @param incomingCallContext - The context associated with the call.\n * @param targetParticipant - The target identity to redirect the call to.\n * @param options - Additional request options contains redirectCall api options.\n */\n public async redirectCall(\n incomingCallContext: string,\n targetParticipant: CallInvite,\n options: RedirectCallOptions = {},\n ): Promise<void> {\n const request: RedirectCallRequest = {\n incomingCallContext: incomingCallContext,\n target: communicationIdentifierModelConverter(targetParticipant.targetParticipant),\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n return this.callAutomationApiClient.redirectCall(request, optionsInternal);\n }\n\n /**\n * Reject the call.\n *\n * @param incomingCallContext - The context associated with the call.\n * @param options - Additional request options contains rejectCall api options.\n */\n public async rejectCall(\n incomingCallContext: string,\n options: RejectCallOptions = {},\n ): Promise<void> {\n const request: RejectCallRequest = {\n incomingCallContext: incomingCallContext,\n callRejectReason: options.callRejectReason,\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n return this.callAutomationApiClient.rejectCall(request, optionsInternal);\n }\n\n /**\n * Create connection to room call.\n * @param callLocator - Call locator to create connection.\n * @param callbackUrl - The callback url\n * @param options - Additional request options contains connect api options.\n */\n public async connectCall(\n callLocator: CallLocator,\n callbackUrl: string,\n options: ConnectCallOptions = {},\n ): Promise<ConnectCallResult> {\n const connectRequest: ConnectRequest = {\n callLocator: callLocator,\n callbackUri: callbackUrl,\n operationContext: options.operationContext,\n callIntelligenceOptions: options.callIntelligenceOptions,\n mediaStreamingOptions: options.mediaStreamingOptions,\n transcriptionOptions: options.transcriptionOptions,\n };\n\n if (callLocator.kind === \"groupCallLocator\") {\n connectRequest.callLocator.kind = \"groupCallLocator\";\n connectRequest.callLocator.groupCallId = callLocator.id;\n } else if (callLocator.kind === \"roomCallLocator\") {\n connectRequest.callLocator.kind = \"roomCallLocator\";\n connectRequest.callLocator.roomId = callLocator.id;\n } else {\n connectRequest.callLocator.kind = \"serverCallLocator\";\n connectRequest.callLocator.serverCallId = callLocator.id;\n }\n\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n const {\n callConnectionId,\n targets,\n sourceCallerIdNumber,\n answeredBy,\n source,\n answeredFor,\n ...result\n } = await this.callAutomationApiClient.connect(connectRequest, optionsInternal);\n\n if (callConnectionId) {\n const callConnectionProperties: CallConnectionProperties = {\n ...result,\n callConnectionId: callConnectionId,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: answeredBy ? communicationUserIdentifierConverter(answeredBy) : undefined,\n targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n const callConnection = new CallConnection(\n callConnectionId,\n this.callAutomationApiClient.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n const connectResult: ConnectCallResult = {\n callConnectionProperties: callConnectionProperties,\n callConnection: callConnection,\n };\n return connectResult;\n }\n throw \"callConnectionProperties / callConnectionId is missing in connect result\";\n }\n}\n"]}
1
+ {"version":3,"file":"callAutomationClient.js","sourceRoot":"","sources":["../../src/callAutomationClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAOrD,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,6BAA6B,GAC9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAEL,uBAAuB,GAMxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD,OAAO,EACL,gCAAgC,EAChC,qCAAqC,EACrC,oCAAoC,EACpC,yCAAyC,EACzC,8BAA8B,EAC9B,yCAAyC,EACzC,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAW9C;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,CAAC,OAAY,EAA0C,EAAE,CAC7F,CAAC,CAAC,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,uBAAuB,CAA0B;IACjD,cAAc,CAAoC;IAClD,UAAU,CAAkC;IAC5C,uBAAuB,CAA0B;IA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Credential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { CommonClientOptions } from \"@azure/core-client\";\nimport type { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport type {\n CommunicationIdentifier,\n CommunicationUserIdentifier,\n} from \"@azure/communication-common\";\nimport {\n parseClientArguments,\n isKeyCredential,\n createCommunicationAuthPolicy,\n} from \"@azure/communication-common\";\nimport { logger } from \"./models/logger.js\";\nimport {\n AnswerCallRequest,\n CallAutomationApiClient,\n CommunicationUserIdentifierModel,\n CreateCallRequest,\n RedirectCallRequest,\n RejectCallRequest,\n ConnectRequest,\n} from \"./generated/src/index.js\";\nimport { CallConnection } from \"./callConnection.js\";\nimport { CallRecording } from \"./callRecording.js\";\nimport type {\n AnswerCallOptions,\n ConnectCallOptions,\n CreateCallOptions,\n RedirectCallOptions,\n RejectCallOptions,\n} from \"./models/options.js\";\nimport type { AnswerCallResult, ConnectCallResult, CreateCallResult } from \"./models/responses.js\";\nimport {\n type CallConnectionProperties,\n type CallInvite,\n type CallLocator,\n} from \"./models/models.js\";\nimport {\n communicationIdentifierConverter,\n communicationIdentifierModelConverter,\n communicationUserIdentifierConverter,\n communicationUserIdentifierModelConverter,\n phoneNumberIdentifierConverter,\n microsoftTeamsAppIdentifierModelConverter,\n PhoneNumberIdentifierModelConverter,\n} from \"./utli/converters.js\";\nimport { randomUUID } from \"@azure/core-util\";\n/**\n * Client options used to configure CallAutomation Client API requests.\n */\nexport interface CallAutomationClientOptions extends CommonClientOptions {\n /**\n * The identifier of the source of the call for call creating/answering/inviting operation.\n */\n sourceIdentity?: CommunicationUserIdentifier;\n}\n\n/**\n * Checks whether the type of a value is CallAutomationClientOptions or not.\n *\n * @param options - The value being checked.\n */\nconst isCallAutomationClientOptions = (options: any): options is CallAutomationClientOptions =>\n !!options && !isTokenCredential(options) && !isKeyCredential(options);\n\n/**\n * A CallAutomationClient represents a Client to the Azure Communication CallAutomation service.\n */\nexport class CallAutomationClient {\n private readonly callAutomationApiClient: CallAutomationApiClient;\n private readonly sourceIdentity?: CommunicationUserIdentifierModel;\n private readonly credential: TokenCredential | KeyCredential;\n private readonly internalPipelineOptions: InternalPipelineOptions;\n /**\n * Initializes a new instance of the CallAutomationClient class.\n * @param connectionString - Connection string to connect to an Azure Communication Service resource.\n * Example: \"endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret\";\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(connectionString: string, options?: CallAutomationClientOptions);\n\n /**\n * Initializes a new instance of the CallAutomationClient class using a TokenCredential or KeyCredential.\n * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).\n * @param credential - TokenCredential or KeyCredential that is used to authenticate requests to the service.\n * @param options - Optional. Options to configure the HTTP pipeline.\n */\n constructor(\n endpoint: string,\n credential: TokenCredential | KeyCredential,\n options?: CallAutomationClientOptions,\n );\n\n constructor(\n connectionStringOrUrl: string,\n credentialOrOptions?: KeyCredential | TokenCredential | CallAutomationClientOptions,\n maybeOptions: CallAutomationClientOptions = {},\n ) {\n const options = isCallAutomationClientOptions(credentialOrOptions)\n ? credentialOrOptions\n : maybeOptions;\n\n if (!options?.userAgentOptions) {\n options.userAgentOptions = {};\n }\n\n this.internalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const authPolicy = createCommunicationAuthPolicy(credential);\n\n this.credential = credential;\n this.callAutomationApiClient = new CallAutomationApiClient(url, this.internalPipelineOptions);\n this.callAutomationApiClient.pipeline.addPolicy(authPolicy);\n\n this.sourceIdentity = communicationUserIdentifierModelConverter(options.sourceIdentity);\n }\n\n /**\n * Initializes a new instance of CallConnection.\n * @param callConnectionId - The CallConnection id for the CallConnection instance. (ex: 421CONTOSO-cRD6-4RDc-a078-99dRANDOMf).\n */\n public getCallConnection(callConnectionId: string): CallConnection {\n return new CallConnection(\n callConnectionId,\n this.callAutomationApiClient.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n }\n\n /**\n * Initializes a new instance of CallRecording.\n */\n public getCallRecording(): CallRecording {\n return new CallRecording(\n this.callAutomationApiClient.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n }\n\n /**\n * Get Source Identity that is used for create and answer call\n */\n public getSourceIdentity(): CommunicationUserIdentifier | undefined {\n return communicationUserIdentifierConverter(this.sourceIdentity);\n }\n\n private async createCallInternal(\n request: CreateCallRequest,\n options?: CreateCallOptions,\n ): Promise<CreateCallResult> {\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const {\n callConnectionId,\n answeredBy,\n targets,\n sourceCallerIdNumber,\n source,\n answeredFor,\n ...result\n } = await this.callAutomationApiClient.createCall(request, optionsInternal);\n\n if (callConnectionId) {\n const callConnectionPropertiesDto: CallConnectionProperties = {\n ...result,\n callConnectionId: callConnectionId,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: communicationUserIdentifierConverter(answeredBy),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n targetParticipants: targets?.map((returnedTarget) =>\n communicationIdentifierConverter(returnedTarget),\n ),\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n const callConnection = new CallConnection(\n callConnectionId,\n this.callAutomationApiClient.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n const createCallResult: CreateCallResult = {\n callConnectionProperties: callConnectionPropertiesDto,\n callConnection: callConnection,\n };\n return createCallResult;\n }\n throw \"callConnectionProperties / callConnectionId is missing in createCall result\";\n }\n\n /**\n * Create an outgoing call from source to a target identity.\n * @param targetParticipant - A single target.\n * @param callbackUrl - The callback url.\n * @param options - Additional request options contains createCallConnection api options.\n */\n public async createCall(\n targetParticipant: CallInvite,\n callbackUrl: string,\n options: CreateCallOptions = {},\n ): Promise<CreateCallResult> {\n const request: CreateCallRequest = {\n source: this.sourceIdentity,\n targets: [communicationIdentifierModelConverter(targetParticipant.targetParticipant)],\n callbackUri: callbackUrl,\n operationContext: options.operationContext,\n callIntelligenceOptions: options.callIntelligenceOptions,\n mediaStreamingOptions: options.mediaStreamingOptions,\n transcriptionOptions: options.transcriptionOptions,\n sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(\n targetParticipant.sourceCallIdNumber,\n ),\n sourceDisplayName: targetParticipant.sourceDisplayName,\n teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),\n };\n\n return this.createCallInternal(request, options);\n }\n\n /**\n * Create an outgoing call from source to a group of targets identities.\n * @param targetParticipants - A group of targets identities.\n * @param callbackUrl - The callback url.\n * @param options - Additional request options contains createCallConnection api options.\n */\n public async createGroupCall(\n targetParticipants: CommunicationIdentifier[],\n callbackUrl: string,\n // eslint-disable-next-line @azure/azure-sdk/ts-naming-options\n options: CreateCallOptions = {},\n ): Promise<CreateCallResult> {\n const request: CreateCallRequest = {\n source: this.sourceIdentity,\n targets: targetParticipants.map((target) => communicationIdentifierModelConverter(target)),\n callbackUri: callbackUrl,\n operationContext: options.operationContext,\n callIntelligenceOptions: options.callIntelligenceOptions,\n mediaStreamingOptions: options.mediaStreamingOptions,\n transcriptionOptions: options.transcriptionOptions,\n sourceCallerIdNumber: PhoneNumberIdentifierModelConverter(options.sourceCallIdNumber),\n sourceDisplayName: options.sourceDisplayName,\n teamsAppSource: microsoftTeamsAppIdentifierModelConverter(options.teamsAppSource),\n };\n\n return this.createCallInternal(request, options);\n }\n\n /**\n * Answer the call.\n * @param incomingCallContext - The context associated with the call.\n * @param callbackUrl - The callback url.\n * @param options - Additional request options contains answerCall api options.\n */\n public async answerCall(\n incomingCallContext: string,\n callbackUrl: string,\n options: AnswerCallOptions = {},\n ): Promise<AnswerCallResult> {\n const {\n callIntelligenceOptions,\n mediaStreamingOptions,\n transcriptionOptions,\n operationContext,\n ...operationOptions\n } = options;\n const request: AnswerCallRequest = {\n incomingCallContext: incomingCallContext,\n mediaStreamingOptions: mediaStreamingOptions,\n transcriptionOptions: transcriptionOptions,\n callIntelligenceOptions: callIntelligenceOptions,\n operationContext: operationContext,\n callbackUri: callbackUrl,\n answeredBy: this.sourceIdentity,\n };\n const optionsInternal = {\n ...operationOptions,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const {\n callConnectionId,\n targets,\n sourceCallerIdNumber,\n answeredBy,\n source,\n answeredFor,\n ...result\n } = await this.callAutomationApiClient.answerCall(request, optionsInternal);\n\n if (callConnectionId) {\n const callConnectionProperties: CallConnectionProperties = {\n ...result,\n callConnectionId: callConnectionId,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: communicationUserIdentifierConverter(answeredBy),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n const callConnection = new CallConnection(\n callConnectionId,\n this.callAutomationApiClient.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n const answerCallResult: AnswerCallResult = {\n callConnectionProperties: callConnectionProperties,\n callConnection: callConnection,\n };\n return answerCallResult;\n }\n throw \"callConnectionProperties / callConnectionId is missing in createCall result\";\n }\n\n /**\n * Redirect the call.\n *\n * @param incomingCallContext - The context associated with the call.\n * @param targetParticipant - The target identity to redirect the call to.\n * @param options - Additional request options contains redirectCall api options.\n */\n public async redirectCall(\n incomingCallContext: string,\n targetParticipant: CallInvite,\n options: RedirectCallOptions = {},\n ): Promise<void> {\n const request: RedirectCallRequest = {\n incomingCallContext: incomingCallContext,\n target: communicationIdentifierModelConverter(targetParticipant.targetParticipant),\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n return this.callAutomationApiClient.redirectCall(request, optionsInternal);\n }\n\n /**\n * Reject the call.\n *\n * @param incomingCallContext - The context associated with the call.\n * @param options - Additional request options contains rejectCall api options.\n */\n public async rejectCall(\n incomingCallContext: string,\n options: RejectCallOptions = {},\n ): Promise<void> {\n const request: RejectCallRequest = {\n incomingCallContext: incomingCallContext,\n callRejectReason: options.callRejectReason,\n };\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n return this.callAutomationApiClient.rejectCall(request, optionsInternal);\n }\n\n /**\n * Create connection to room call.\n * @param callLocator - Call locator to create connection.\n * @param callbackUrl - The callback url\n * @param options - Additional request options contains connect api options.\n */\n public async connectCall(\n callLocator: CallLocator,\n callbackUrl: string,\n options: ConnectCallOptions = {},\n ): Promise<ConnectCallResult> {\n const connectRequest: ConnectRequest = {\n callLocator: callLocator,\n callbackUri: callbackUrl,\n operationContext: options.operationContext,\n callIntelligenceOptions: options.callIntelligenceOptions,\n mediaStreamingOptions: options.mediaStreamingOptions,\n transcriptionOptions: options.transcriptionOptions,\n };\n\n if (callLocator.kind === \"groupCallLocator\") {\n connectRequest.callLocator.kind = \"groupCallLocator\";\n connectRequest.callLocator.groupCallId = callLocator.id;\n } else if (callLocator.kind === \"roomCallLocator\") {\n connectRequest.callLocator.kind = \"roomCallLocator\";\n connectRequest.callLocator.roomId = callLocator.id;\n } else {\n connectRequest.callLocator.kind = \"serverCallLocator\";\n connectRequest.callLocator.serverCallId = callLocator.id;\n }\n\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n\n const {\n callConnectionId,\n targets,\n sourceCallerIdNumber,\n answeredBy,\n source,\n answeredFor,\n ...result\n } = await this.callAutomationApiClient.connect(connectRequest, optionsInternal);\n\n if (callConnectionId) {\n const callConnectionProperties: CallConnectionProperties = {\n ...result,\n callConnectionId: callConnectionId,\n source: source ? communicationIdentifierConverter(source) : undefined,\n answeredby: answeredBy ? communicationUserIdentifierConverter(answeredBy) : undefined,\n targetParticipants: targets?.map((target) => communicationIdentifierConverter(target)),\n answeredFor: answeredFor ? phoneNumberIdentifierConverter(answeredFor) : undefined,\n sourceCallerIdNumber: sourceCallerIdNumber\n ? phoneNumberIdentifierConverter(sourceCallerIdNumber)\n : undefined,\n };\n const callConnection = new CallConnection(\n callConnectionId,\n this.callAutomationApiClient.endpoint,\n this.credential,\n this.internalPipelineOptions,\n );\n const connectResult: ConnectCallResult = {\n callConnectionProperties: callConnectionProperties,\n callConnection: callConnection,\n };\n return connectResult;\n }\n throw \"callConnectionProperties / callConnectionId is missing in connect result\";\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"callAutomationEventParser.d.ts","sourceRoot":"","sources":["../../src/callAutomationEventParser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,mBAAmB,EAsCpB,MAAM,oBAAoB,CAAC;AAO5B;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9C,mBAAmB,CA2IrB"}
1
+ {"version":3,"file":"callAutomationEventParser.d.ts","sourceRoot":"","sources":["../../src/callAutomationEventParser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,mBAAmB,EAqCpB,MAAM,oBAAoB,CAAC;AAO5B;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9C,mBAAmB,CAwIrB"}
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { __rest } from "tslib";
4
3
  import { createSerializer } from "@azure/core-client";
5
4
  import { communicationIdentifierConverter, callParticipantConverter } from "./utli/converters.js";
6
5
  import { CloudEventMapper } from "./models/mapper.js";
@@ -37,9 +36,6 @@ export function parseCallAutomationEvent(encodedEvents) {
37
36
  case "Microsoft.Communication.CallConnected":
38
37
  callbackEvent = { kind: "CallConnected" };
39
38
  break;
40
- case "Microsoft.Communication.IncomingCall":
41
- callbackEvent = { kind: "IncomingCall" };
42
- break;
43
39
  case "Microsoft.Communication.CallDisconnected":
44
40
  callbackEvent = { kind: "CallDisconnected" };
45
41
  break;
@@ -134,16 +130,16 @@ export function parseCallAutomationEvent(encodedEvents) {
134
130
  case "Microsoft.Communication.MediaStreamingFailed":
135
131
  callbackEvent = { kind: "MediaStreamingFailed" };
136
132
  break;
137
- case "Microsoft.Communication.StartRecordingFailed":
138
- callbackEvent = { kind: "StartRecordingFailed" };
139
- break;
140
133
  case "Microsoft.Communication.PlayStarted":
141
134
  callbackEvent = { kind: "PlayStarted" };
142
135
  break;
136
+ case "Microsoft.Communication.StartRecordingFailed":
137
+ callbackEvent = { kind: "StartRecordingFailed" };
138
+ break;
143
139
  default:
144
140
  throw new TypeError(`Unknown Call Automation Event type: ${eventType}`);
145
141
  }
146
- return Object.assign(Object.assign({}, parsed), callbackEvent);
142
+ return { ...parsed, ...callbackEvent };
147
143
  }
148
144
  function parseAndWrap(jsonStringOrObject) {
149
145
  if (typeof jsonStringOrObject === "string") {
@@ -169,7 +165,10 @@ function parseAndWrap(jsonStringOrObject) {
169
165
  }
170
166
  }
171
167
  function participantsParserForEvent(data) {
172
- const { participants } = data, rest = __rest(data, ["participants"]);
173
- return Object.assign(Object.assign({}, rest), { participants: participants === null || participants === void 0 ? void 0 : participants.map((participant) => callParticipantConverter(participant)) });
168
+ const { participants, ...rest } = data;
169
+ return {
170
+ ...rest,
171
+ participants: participants?.map((participant) => callParticipantConverter(participant)),
172
+ };
174
173
  }
175
174
  //# sourceMappingURL=callAutomationEventParser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"callAutomationEventParser.js","sourceRoot":"","sources":["../../src/callAutomationEventParser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACt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pC,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,kBAAkB,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,IAAS;IAC3C,MAAM,EAAE,YAAY,KAAc,IAAI,EAAb,IAAI,UAAK,IAAI,EAAhC,gBAAyB,CAAO,CAAC;IACvC,uCACK,IAAI,KACP,YAAY,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,GAAG,CAAC,CAAC,WAAoC,EAAE,EAAE,CACvE,wBAAwB,CAAC,WAAW,CAAC,CACtC,IACD;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { communicationIdentifierConverter, callParticipantConverter } from \"./utli/converters.js\";\nimport type {\n CallAutomationEvent,\n AddParticipantSucceeded,\n AddParticipantFailed,\n CallConnected,\n CallDisconnected,\n CallTransferAccepted,\n CallTransferFailed,\n ParticipantsUpdated,\n RecordingStateChanged,\n PlayCompleted,\n PlayFailed,\n PlayCanceled,\n RecognizeCompleted,\n RecognizeCanceled,\n RecognizeFailed,\n RemoveParticipantSucceeded,\n RemoveParticipantFailed,\n ContinuousDtmfRecognitionToneReceived,\n ContinuousDtmfRecognitionToneFailed,\n ContinuousDtmfRecognitionStopped,\n SendDtmfTonesCompleted,\n SendDtmfTonesFailed,\n CancelAddParticipantSucceeded,\n CancelAddParticipantFailed,\n TranscriptionStarted,\n TranscriptionStopped,\n TranscriptionUpdated,\n TranscriptionFailed,\n CreateCallFailed,\n AnswerFailed,\n HoldFailed,\n ConnectFailed,\n MediaStreamingStarted,\n MediaStreamingStopped,\n MediaStreamingFailed,\n StartRecordingFailed,\n PlayStarted,\n IncomingCall,\n} from \"./models/events.js\";\n\nimport { CloudEventMapper } from \"./models/mapper.js\";\nimport type { CallParticipantInternal } from \"./generated/src/index.js\";\n\nconst serializer = createSerializer();\n\n/**\n * Helper function for parsing Acs callback events.\n */\nexport function parseCallAutomationEvent(\n encodedEvents: string | Record<string, unknown>,\n): CallAutomationEvent {\n const decodedInput = parseAndWrap(encodedEvents);\n\n // parse cloudevent\n const deserialized = serializer.deserialize(CloudEventMapper, decodedInput, \"\");\n const data = deserialized.data;\n const eventType = deserialized.type;\n\n // get proper callbackevent and its parser\n let callbackEvent: CallAutomationEvent;\n let parsed: any = data;\n switch (eventType) {\n case \"Microsoft.Communication.AddParticipantSucceeded\":\n callbackEvent = { kind: \"AddParticipantSucceeded\" } as AddParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.AddParticipantFailed\":\n callbackEvent = { kind: \"AddParticipantFailed\" } as AddParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.RemoveParticipantSucceeded\":\n callbackEvent = { kind: \"RemoveParticipantSucceeded\" } as RemoveParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.RemoveParticipantFailed\":\n callbackEvent = { kind: \"RemoveParticipantFailed\" } as RemoveParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.CallConnected\":\n callbackEvent = { kind: \"CallConnected\" } as CallConnected;\n break;\n case \"Microsoft.Communication.IncomingCall\":\n callbackEvent = { kind: \"IncomingCall\" } as IncomingCall;\n break;\n case \"Microsoft.Communication.CallDisconnected\":\n callbackEvent = { kind: \"CallDisconnected\" } as CallDisconnected;\n break;\n case \"Microsoft.Communication.CallTransferAccepted\":\n callbackEvent = { kind: \"CallTransferAccepted\" } as CallTransferAccepted;\n break;\n case \"Microsoft.Communication.CallTransferFailed\":\n callbackEvent = { kind: \"CallTransferFailed\" } as CallTransferFailed;\n break;\n case \"Microsoft.Communication.ParticipantsUpdated\":\n callbackEvent = { kind: \"ParticipantsUpdated\" } as ParticipantsUpdated;\n parsed = participantsParserForEvent(data);\n break;\n case \"Microsoft.Communication.RecordingStateChanged\":\n callbackEvent = { kind: \"RecordingStateChanged\" } as RecordingStateChanged;\n break;\n case \"Microsoft.Communication.PlayCompleted\":\n callbackEvent = { kind: \"PlayCompleted\" } as PlayCompleted;\n break;\n case \"Microsoft.Communication.PlayFailed\":\n callbackEvent = { kind: \"PlayFailed\" } as PlayFailed;\n break;\n case \"Microsoft.Communication.PlayCanceled\":\n callbackEvent = { kind: \"PlayCanceled\" } as PlayCanceled;\n break;\n case \"Microsoft.Communication.RecognizeCompleted\":\n callbackEvent = { kind: \"RecognizeCompleted\" } as RecognizeCompleted;\n break;\n case \"Microsoft.Communication.RecognizeCanceled\":\n callbackEvent = { kind: \"RecognizeCanceled\" } as RecognizeCanceled;\n break;\n case \"Microsoft.Communication.RecognizeFailed\":\n callbackEvent = { kind: \"RecognizeFailed\" } as RecognizeFailed;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionToneReceived\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionToneReceived\",\n } as ContinuousDtmfRecognitionToneReceived;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionToneFailed\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionToneFailed\",\n } as ContinuousDtmfRecognitionToneFailed;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionStopped\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionStopped\",\n } as ContinuousDtmfRecognitionStopped;\n break;\n case \"Microsoft.Communication.SendDtmfTonesCompleted\":\n callbackEvent = { kind: \"SendDtmfTonesCompleted\" } as SendDtmfTonesCompleted;\n break;\n case \"Microsoft.Communication.SendDtmfTonesFailed\":\n callbackEvent = { kind: \"SendDtmfTonesFailed\" } as SendDtmfTonesFailed;\n break;\n case \"Microsoft.Communication.CancelAddParticipantSucceeded\":\n callbackEvent = { kind: \"CancelAddParticipantSucceeded\" } as CancelAddParticipantSucceeded;\n break;\n case \"Microsoft.Communication.CancelAddParticipantFailed\":\n callbackEvent = { kind: \"CancelAddParticipantFailed\" } as CancelAddParticipantFailed;\n break;\n case \"Microsoft.Communication.TranscriptionStarted\":\n callbackEvent = { kind: \"TranscriptionStarted\" } as TranscriptionStarted;\n break;\n case \"Microsoft.Communication.TranscriptionStopped\":\n callbackEvent = { kind: \"TranscriptionStopped\" } as TranscriptionStopped;\n break;\n case \"Microsoft.Communication.TranscriptionUpdated\":\n callbackEvent = { kind: \"TranscriptionUpdated\" } as TranscriptionUpdated;\n break;\n case \"Microsoft.Communication.TranscriptionFailed\":\n callbackEvent = { kind: \"TranscriptionFailed\" } as TranscriptionFailed;\n break;\n case \"Microsoft.Communication.CreateCallFailed\":\n callbackEvent = { kind: \"CreateCallFailed\" } as CreateCallFailed;\n break;\n case \"Microsoft.Communication.AnswerFailed\":\n callbackEvent = { kind: \"AnswerFailed\" } as AnswerFailed;\n break;\n case \"Microsoft.Communication.HoldFailed\":\n callbackEvent = { kind: \"HoldFailed\" } as HoldFailed;\n break;\n case \"Microsoft.Communication.ConnectFailed\":\n callbackEvent = { kind: \"ConnectFailed\" } as ConnectFailed;\n break;\n case \"Microsoft.Communication.MediaStreamingStarted\":\n callbackEvent = { kind: \"MediaStreamingStarted\" } as MediaStreamingStarted;\n break;\n case \"Microsoft.Communication.MediaStreamingStopped\":\n callbackEvent = { kind: \"MediaStreamingStopped\" } as MediaStreamingStopped;\n break;\n case \"Microsoft.Communication.MediaStreamingFailed\":\n callbackEvent = { kind: \"MediaStreamingFailed\" } as MediaStreamingFailed;\n break;\n case \"Microsoft.Communication.StartRecordingFailed\":\n callbackEvent = { kind: \"StartRecordingFailed\" } as StartRecordingFailed;\n break;\n case \"Microsoft.Communication.PlayStarted\":\n callbackEvent = { kind: \"PlayStarted\" } as PlayStarted;\n break;\n default:\n throw new TypeError(`Unknown Call Automation Event type: ${eventType}`);\n }\n\n return { ...parsed, ...callbackEvent } as CallAutomationEvent;\n}\n\nfunction parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n if (o.length === 0) {\n throw Error(\"Empty event array.\");\n }\n return o[0];\n } else {\n return o;\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n if (jsonStringOrObject.length === 0) {\n throw Error(\"Empty event array.\");\n }\n return jsonStringOrObject[0];\n } else {\n return jsonStringOrObject;\n }\n}\n\nfunction participantsParserForEvent(data: any): any {\n const { participants, ...rest } = data;\n return {\n ...rest,\n participants: participants?.map((participant: CallParticipantInternal) =>\n callParticipantConverter(participant),\n ),\n };\n}\n"]}
1
+ {"version":3,"file":"callAutomationEventParser.js","sourceRoot":"","sources":["../../src/callAutomationEventParser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAyClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAA+C;IAE/C,MAAM,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;IAEjD,mBAAmB;IACnB,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;IAChF,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IAC/B,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC;IAEpC,0CAA0C;IAC1C,IAAI,aAAkC,CAAC;IACvC,IAAI,MAAM,GAAQ,IAAI,CAAC;IACvB,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,iDAAiD;YACpD,aAAa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AAC,kBAAoD;IACxE,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACzC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACnB,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACpC,CAAC;YACD,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACd,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACtC,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,kBAAkB,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,SAAS,0BAA0B,CAAC,IAAS;IAC3C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACvC,OAAO;QACL,GAAG,IAAI;QACP,YAAY,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,WAAoC,EAAE,EAAE,CACvE,wBAAwB,CAAC,WAAW,CAAC,CACtC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createSerializer } from \"@azure/core-client\";\nimport { communicationIdentifierConverter, callParticipantConverter } from \"./utli/converters.js\";\nimport type {\n CallAutomationEvent,\n AddParticipantSucceeded,\n AddParticipantFailed,\n CallConnected,\n CallDisconnected,\n CallTransferAccepted,\n CallTransferFailed,\n ParticipantsUpdated,\n RecordingStateChanged,\n PlayCompleted,\n PlayFailed,\n PlayCanceled,\n RecognizeCompleted,\n RecognizeCanceled,\n RecognizeFailed,\n RemoveParticipantSucceeded,\n RemoveParticipantFailed,\n ContinuousDtmfRecognitionToneReceived,\n ContinuousDtmfRecognitionToneFailed,\n ContinuousDtmfRecognitionStopped,\n SendDtmfTonesCompleted,\n SendDtmfTonesFailed,\n CancelAddParticipantSucceeded,\n CancelAddParticipantFailed,\n TranscriptionStarted,\n TranscriptionStopped,\n TranscriptionUpdated,\n TranscriptionFailed,\n CreateCallFailed,\n AnswerFailed,\n HoldFailed,\n ConnectFailed,\n MediaStreamingStarted,\n MediaStreamingStopped,\n MediaStreamingFailed,\n PlayStarted,\n StartRecordingFailed,\n} from \"./models/events.js\";\n\nimport { CloudEventMapper } from \"./models/mapper.js\";\nimport type { CallParticipantInternal } from \"./generated/src/index.js\";\n\nconst serializer = createSerializer();\n\n/**\n * Helper function for parsing Acs callback events.\n */\nexport function parseCallAutomationEvent(\n encodedEvents: string | Record<string, unknown>,\n): CallAutomationEvent {\n const decodedInput = parseAndWrap(encodedEvents);\n\n // parse cloudevent\n const deserialized = serializer.deserialize(CloudEventMapper, decodedInput, \"\");\n const data = deserialized.data;\n const eventType = deserialized.type;\n\n // get proper callbackevent and its parser\n let callbackEvent: CallAutomationEvent;\n let parsed: any = data;\n switch (eventType) {\n case \"Microsoft.Communication.AddParticipantSucceeded\":\n callbackEvent = { kind: \"AddParticipantSucceeded\" } as AddParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.AddParticipantFailed\":\n callbackEvent = { kind: \"AddParticipantFailed\" } as AddParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.RemoveParticipantSucceeded\":\n callbackEvent = { kind: \"RemoveParticipantSucceeded\" } as RemoveParticipantSucceeded;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.RemoveParticipantFailed\":\n callbackEvent = { kind: \"RemoveParticipantFailed\" } as RemoveParticipantFailed;\n parsed.participant = communicationIdentifierConverter(data.participant);\n break;\n case \"Microsoft.Communication.CallConnected\":\n callbackEvent = { kind: \"CallConnected\" } as CallConnected;\n break;\n case \"Microsoft.Communication.CallDisconnected\":\n callbackEvent = { kind: \"CallDisconnected\" } as CallDisconnected;\n break;\n case \"Microsoft.Communication.CallTransferAccepted\":\n callbackEvent = { kind: \"CallTransferAccepted\" } as CallTransferAccepted;\n break;\n case \"Microsoft.Communication.CallTransferFailed\":\n callbackEvent = { kind: \"CallTransferFailed\" } as CallTransferFailed;\n break;\n case \"Microsoft.Communication.ParticipantsUpdated\":\n callbackEvent = { kind: \"ParticipantsUpdated\" } as ParticipantsUpdated;\n parsed = participantsParserForEvent(data);\n break;\n case \"Microsoft.Communication.RecordingStateChanged\":\n callbackEvent = { kind: \"RecordingStateChanged\" } as RecordingStateChanged;\n break;\n case \"Microsoft.Communication.PlayCompleted\":\n callbackEvent = { kind: \"PlayCompleted\" } as PlayCompleted;\n break;\n case \"Microsoft.Communication.PlayFailed\":\n callbackEvent = { kind: \"PlayFailed\" } as PlayFailed;\n break;\n case \"Microsoft.Communication.PlayCanceled\":\n callbackEvent = { kind: \"PlayCanceled\" } as PlayCanceled;\n break;\n case \"Microsoft.Communication.RecognizeCompleted\":\n callbackEvent = { kind: \"RecognizeCompleted\" } as RecognizeCompleted;\n break;\n case \"Microsoft.Communication.RecognizeCanceled\":\n callbackEvent = { kind: \"RecognizeCanceled\" } as RecognizeCanceled;\n break;\n case \"Microsoft.Communication.RecognizeFailed\":\n callbackEvent = { kind: \"RecognizeFailed\" } as RecognizeFailed;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionToneReceived\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionToneReceived\",\n } as ContinuousDtmfRecognitionToneReceived;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionToneFailed\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionToneFailed\",\n } as ContinuousDtmfRecognitionToneFailed;\n break;\n case \"Microsoft.Communication.ContinuousDtmfRecognitionStopped\":\n callbackEvent = {\n kind: \"ContinuousDtmfRecognitionStopped\",\n } as ContinuousDtmfRecognitionStopped;\n break;\n case \"Microsoft.Communication.SendDtmfTonesCompleted\":\n callbackEvent = { kind: \"SendDtmfTonesCompleted\" } as SendDtmfTonesCompleted;\n break;\n case \"Microsoft.Communication.SendDtmfTonesFailed\":\n callbackEvent = { kind: \"SendDtmfTonesFailed\" } as SendDtmfTonesFailed;\n break;\n case \"Microsoft.Communication.CancelAddParticipantSucceeded\":\n callbackEvent = { kind: \"CancelAddParticipantSucceeded\" } as CancelAddParticipantSucceeded;\n break;\n case \"Microsoft.Communication.CancelAddParticipantFailed\":\n callbackEvent = { kind: \"CancelAddParticipantFailed\" } as CancelAddParticipantFailed;\n break;\n case \"Microsoft.Communication.TranscriptionStarted\":\n callbackEvent = { kind: \"TranscriptionStarted\" } as TranscriptionStarted;\n break;\n case \"Microsoft.Communication.TranscriptionStopped\":\n callbackEvent = { kind: \"TranscriptionStopped\" } as TranscriptionStopped;\n break;\n case \"Microsoft.Communication.TranscriptionUpdated\":\n callbackEvent = { kind: \"TranscriptionUpdated\" } as TranscriptionUpdated;\n break;\n case \"Microsoft.Communication.TranscriptionFailed\":\n callbackEvent = { kind: \"TranscriptionFailed\" } as TranscriptionFailed;\n break;\n case \"Microsoft.Communication.CreateCallFailed\":\n callbackEvent = { kind: \"CreateCallFailed\" } as CreateCallFailed;\n break;\n case \"Microsoft.Communication.AnswerFailed\":\n callbackEvent = { kind: \"AnswerFailed\" } as AnswerFailed;\n break;\n case \"Microsoft.Communication.HoldFailed\":\n callbackEvent = { kind: \"HoldFailed\" } as HoldFailed;\n break;\n case \"Microsoft.Communication.ConnectFailed\":\n callbackEvent = { kind: \"ConnectFailed\" } as ConnectFailed;\n break;\n case \"Microsoft.Communication.MediaStreamingStarted\":\n callbackEvent = { kind: \"MediaStreamingStarted\" } as MediaStreamingStarted;\n break;\n case \"Microsoft.Communication.MediaStreamingStopped\":\n callbackEvent = { kind: \"MediaStreamingStopped\" } as MediaStreamingStopped;\n break;\n case \"Microsoft.Communication.MediaStreamingFailed\":\n callbackEvent = { kind: \"MediaStreamingFailed\" } as MediaStreamingFailed;\n break;\n case \"Microsoft.Communication.PlayStarted\":\n callbackEvent = { kind: \"PlayStarted\" } as PlayStarted;\n break;\n case \"Microsoft.Communication.StartRecordingFailed\":\n callbackEvent = { kind: \"StartRecordingFailed\" } as StartRecordingFailed;\n break;\n default:\n throw new TypeError(`Unknown Call Automation Event type: ${eventType}`);\n }\n\n return { ...parsed, ...callbackEvent } as CallAutomationEvent;\n}\n\nfunction parseAndWrap(jsonStringOrObject: string | Record<string, unknown>): any {\n if (typeof jsonStringOrObject === \"string\") {\n const o = JSON.parse(jsonStringOrObject);\n if (Array.isArray(o)) {\n if (o.length === 0) {\n throw Error(\"Empty event array.\");\n }\n return o[0];\n } else {\n return o;\n }\n }\n\n if (Array.isArray(jsonStringOrObject)) {\n if (jsonStringOrObject.length === 0) {\n throw Error(\"Empty event array.\");\n }\n return jsonStringOrObject[0];\n } else {\n return jsonStringOrObject;\n }\n}\n\nfunction participantsParserForEvent(data: any): any {\n const { participants, ...rest } = data;\n return {\n ...rest,\n participants: participants?.map((participant: CallParticipantInternal) =>\n callParticipantConverter(participant),\n ),\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { CommunicationIdentifier } from "@azure/communication-common";
2
2
  import { CallMedia } from "./callMedia.js";
3
3
  import { CallAutomationApiClientOptionalParams } from "./generated/src/index.js";
4
- import type { CallConnectionProperties, CallInvite, CallParticipant } from "./models/models.js";
4
+ import { type CallConnectionProperties, type CallInvite, type CallParticipant } from "./models/models.js";
5
5
  import type { AddParticipantOptions, CancelAddParticipantOperationOptions, GetCallConnectionPropertiesOptions, GetParticipantOptions, HangUpOptions, MuteParticipantOption, RemoveParticipantsOption, TransferCallToParticipantOptions } from "./models/options.js";
6
6
  import type { ListParticipantsResult, TransferCallResult, AddParticipantResult, RemoveParticipantResult, MuteParticipantResult, CancelAddParticipantOperationResult } from "./models/responses.js";
7
7
  import type { KeyCredential, TokenCredential } from "@azure/core-auth";
@@ -1 +1 @@
1
- {"version":3,"file":"callConnection.d.ts","sourceRoot":"","sources":["../../src/callConnection.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EAExB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAGL,qCAAqC,EAKtC,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,wBAAwB,EACxB,UAAU,EACV,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,qBAAqB,EACrB,oCAAoC,EACpC,kCAAkC,EAClC,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,gCAAgC,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mCAAmC,EACpC,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA0B;IAClE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAwC;gBAEtF,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C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