Skip to content

Commit 71ee54c

Browse files
committed
Adding the ObserveForceMute flag
1 parent 8422a2d commit 71ee54c

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

opentok/opentok.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,43 @@ def dial(self, session_id, token, sip_uri, options=[]):
10051005
Boolean 'secure': A Boolean flag that indicates whether the media must be transmitted
10061006
encrypted (true) or not (false, the default)
10071007
1008-
:rtype: A SipCall object, which contains data of the SIP call: id, connectionId and streamId
1008+
Boolean 'observeForceMute': A Boolean flag that determines whether the SIP endpoint should
1009+
honor the force mute action. Defaults to False if moderator does not want to observe force
1010+
mute a stream and set to True if the moderator wants to observe force mute a stream.
1011+
1012+
This is an example of what the payload POST data body could look like:
1013+
1014+
{
1015+
"sessionId": "Your OpenTok session ID",
1016+
"token": "Your valid OpenTok token",
1017+
"sip": {
1018+
"uri": "sip:[email protected];transport=tls",
1019+
"from": "[email protected]",
1020+
"headers": {
1021+
"headerKey": "headerValue"
1022+
},
1023+
"auth": {
1024+
"username": "username",
1025+
"password": "password"
1026+
},
1027+
"secure": true|false,
1028+
"observeForceMute": true|false
1029+
}
1030+
}
1031+
1032+
:rtype: A SipCall object, which contains data of the SIP call: id, connectionId and streamId.
1033+
This is what the response body should look like after returning with a status code of 200:
1034+
1035+
{
1036+
"id": "b0a5a8c7-dc38-459f-a48d-a7f2008da853",
1037+
"connectionId": "e9f8c166-6c67-440d-994a-04fb6dfed007",
1038+
"streamId": "482bce73-f882-40fd-8ca5-cb74ff416036",
1039+
}
1040+
1041+
Note: Your response will have a different: id, connectionId and streamId
10091042
"""
10101043
payload = {"sessionId": session_id, "token": token, "sip": {"uri": sip_uri}}
1044+
observeForceMute = False
10111045

10121046
if "from" in options:
10131047
payload["sip"]["from"] = options["from"]
@@ -1021,6 +1055,11 @@ def dial(self, session_id, token, sip_uri, options=[]):
10211055
if "secure" in options:
10221056
payload["sip"]["secure"] = options["secure"]
10231057

1058+
if "observeForceMute" in options:
1059+
observeForceMute = True
1060+
payload["sip"]["observeForceMute"] = options["observeForceMute"]
1061+
1062+
10241063
endpoint = self.endpoints.dial_url()
10251064

10261065
logger.debug(

tests/test_sip_call.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def test_sip_call_with_aditional_options(self):
102102
"headers": {"headerKey": "headerValue"},
103103
"auth": {"username": "username", "password": "password"},
104104
"secure": True,
105+
"observeForceMute": True
105106
}
106107

107108
sip_call_response = self.opentok.dial(

0 commit comments

Comments
 (0)