Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RocketChat
Rocket.Chat.js.SDK
Commits
9ef2be3f
Unverified
Commit
9ef2be3f
authored
Sep 14, 2021
by
Murtaza Patrawala
Committed by
GitHub
Sep 14, 2021
Browse files
Merge pull request #144 from dhruvjain99/handle-decline-call-status
[NEW] Support Video and Audio calling in Livechat
parents
e387b2f4
b19147cc
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lib/api/Livechat.ts
View file @
9ef2be3f
...
...
@@ -40,6 +40,7 @@ export default class ApiLivechat extends ApiBase {
}
async
deleteVisitor
()
{
return
(
await
this
.
del
(
`livechat/visitor/
${
this
.
credentials
.
token
}
`
)).
visitor
}
async
updateVisitorStatus
(
status
:
string
)
{
return
(
await
this
.
post
(
`livechat/visitor.status`
,
{
token
:
this
.
credentials
.
token
,
status
})).
status
}
async
updateCallStatus
(
callStatus
:
string
,
rid
:
string
,
callId
:
string
)
{
return
(
await
this
.
post
(
`livechat/visitor.callStatus`
,
{
token
:
this
.
credentials
.
token
,
callStatus
,
rid
,
callId
})).
callStatus
}
async
nextAgent
(
department
:
string
=
''
)
{
return
(
await
this
.
get
(
`livechat/agent.next/
${
this
.
credentials
.
token
}
`
,
{
department
})).
agent
}
async
agent
({
rid
}:
any
)
{
return
(
await
this
.
get
(
`livechat/agent.info/
${
rid
}
/
${
this
.
credentials
.
token
}
`
)).
agent
}
async
message
(
id
:
string
,
params
:
ILivechatRoom
)
{
return
(
await
this
.
get
(
`livechat/message/
${
id
}
`
,
{
token
:
this
.
credentials
.
token
,
...
params
})).
message
}
...
...
src/lib/clients/Livechat.ts
View file @
9ef2be3f
...
...
@@ -83,6 +83,10 @@ export default class LivechatClient extends LivechatRest implements ISocket {
return
(
await
this
.
socket
as
IDriver
).
notifyVisitorTyping
(
rid
,
username
,
typing
,
this
.
credentials
.
token
)
}
async
notifyCallDeclined
(
rid
:
string
)
{
return
(
await
this
.
socket
as
IDriver
).
notifyCallDeclined
(
rid
)
}
async
subscribe
(
topic
:
string
,
eventName
:
string
)
{
const
{
token
}
=
this
.
credentials
return
(
await
this
.
socket
as
ISocket
).
subscribe
(
topic
,
eventName
,
{
token
,
visitorToken
:
token
})
...
...
src/lib/drivers/ddp.ts
View file @
9ef2be3f
...
...
@@ -584,6 +584,10 @@ export class DDPDriver extends EventEmitter implements ISocket, IDriver {
return
this
.
ddp
.
call
(
'
stream-notify-room
'
,
`
${
rid
}
/typing`
,
username
,
typing
,
{
token
})
}
notifyCallDeclined
=
(
rid
:
string
)
=>
{
return
this
.
ddp
.
call
(
'
stream-notify-room
'
,
`
${
rid
}
/webrtc`
,
'
callStatus
'
,
{
callStatus
:
'
declined
'
})
}
ejsonMessage
=
(
message
:
any
)
=>
{
if
(
message
.
ts
)
{
message
.
ts
=
new
Date
(
message
.
ts
.
$date
)
...
...
src/lib/drivers/index.ts
View file @
9ef2be3f
...
...
@@ -50,6 +50,8 @@ export interface IDriver {
onTyping
(
cb
:
ICallback
):
Promise
<
any
>
notifyVisitorTyping
(
rid
:
string
,
username
:
string
,
typing
:
boolean
,
token
:
string
):
Promise
<
any
>
notifyCallDeclined
(
rid
:
string
):
Promise
<
any
>
methodCall
(
method
:
string
,
...
args
:
any
[]):
Promise
<
any
>
}
...
...
src/lib/drivers/mqtt.ts
View file @
9ef2be3f
...
...
@@ -123,6 +123,10 @@ export class MQTTDriver extends EventEmitter implements ISocket, IDriver {
return
Promise
.
resolve
()
as
any
}
notifyCallDeclined
(
rid
:
string
):
Promise
<
any
>
{
return
Promise
.
resolve
()
as
any
}
onStreamData
(
name
:
string
,
cb
:
ICallback
):
Promise
<
any
>
{
return
Promise
.
resolve
(
this
.
on
(
name
,
({
fields
:
{
args
:
[
message
]
}
}:
any
)
=>
cb
((
message
))))
as
any
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment