Skip to content

Commit 4a891d4

Browse files
committed
add sample code for Reading custom context Java, JS, Python
1 parent 13654f7 commit 4a891d4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

articles/communication-services/how-tos/call-automation/custom-context.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,42 @@ var sipHeaders = callCustomContext.SipHeaders;
234234

235235
// Proceed to answer or reject call as usual
236236
```
237+
238+
### [Java](#tab/java)
239+
```java
240+
AcsIncomingCallEventData incomingEvent = <incoming call event from Event Grid>;
241+
// Retrieve incoming call custom context
242+
AcsIncomingCallCustomContext callCustomContext = incomingEvent.getCustomContext();
243+
244+
// Inspect dictionary with key/value pairs
245+
Map<String, String> voipHeaders = callCustomContext.getVoipHeaders();
246+
Map<String, String> sipHeaders = callCustomContext.getSipHeaders();
247+
248+
// Proceed to answer or reject call as usual
249+
```
250+
251+
### [JavaScript](#tab/javascript)
252+
```javascript
253+
// Retrieve incoming call custom context
254+
const callCustomContext = incomingEvent.customContext;
255+
256+
// Inspect dictionary with key/value pairs
257+
const voipHeaders = callCustomContext.voipHeaders;
258+
const sipHeaders = callCustomContext.sipHeaders;
259+
260+
// Proceed to answer or reject call as usual
261+
```
262+
263+
### [Python](#tab/python)
264+
```python
265+
# Retrieve incoming call custom context
266+
callCustomContext = incomingEvent.customContext
267+
268+
# Inspect dictionary with key/value pairs
269+
voipHeaders = callCustomContext.voipHeaders
270+
sipHeaders = callCustomContext.sipHeaders
271+
```
272+
237273
-----
238274
# Additional resources
239275

0 commit comments

Comments
 (0)