We have a script that will do a screenpop to a URL, for inbound call. And this is working fine.
When the call come in, script displayed and pop URL page.
Is there any way to make this page (screenpop page) automatically close upon call disconnected (see below screenshot), the problem is if there's a next call come in, agent will have 2 screenpop page opened (from previous call and this new call), and this will keep going, unless agent manually close the page.
thanks for response, just wondering means we need to use notification API ? if yes, i have tried that scenario, it works, but it took sometimes to wait subscribe conversation event
(to get the heartbeat "message": "WebSocket Heartbeat"),
just afraid the call disconnect before heartbeat started.
Alternatively, we ok no need screenpop got closed when call disconnected, but for next call, is there any way screenpop get opened in the same windows as previous, so existing opened screeenpop window, only page will get refreshed with new information from new interaction ?
Yes, I had thought about using the notification API. But according your reply, I recognized that way is not working expectedly sometimes.
I don't think it is possible to close a previously opened window from anything other than the parent window. So if you will do that, you need another server resource to relay status between previous window and new window.
How about below scenario?
New popup with conversation id via get parameter(id1).
The popup window(JS) will subscribe event "v2.users.{id}.conversations.calls" for own account.
When the JS received the event with conversation id(id2). If id2 is differ from id1, it can be decided as new call for own account. But you should classify it carefully because it might be consult call and so on.
If JS decided the event means the new call, close own window by window.close().