mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
FS-9683: Pass call recovery status to Verto
Previously, users implementing a Verto workflow where both user login and placing a new call are automated (eg., visiting a URL, and the videoconference loads automatically) faced the challenge of not having a reliable way to know that a page load will result in Verto's call recovery mechanism reconnecting an existing detached call or not. This adds a verto.clientReady JSON-RPC message, emitted after all calls are re-attached, which contains a 'reattached_sessions' array, containing the sess_id of any reattached session. Client side, this can be caught in the onMessage handler, under the $.verto.enum.message.clientReady key.
This commit is contained in:
@@ -1232,6 +1232,11 @@ static void drop_detached(void)
|
||||
static void attach_calls(jsock_t *jsock)
|
||||
{
|
||||
verto_pvt_t *tech_pvt;
|
||||
cJSON *msg = NULL;
|
||||
cJSON *params = NULL;
|
||||
cJSON *reattached_sessions = NULL;
|
||||
|
||||
reattached_sessions = cJSON_CreateArray();
|
||||
|
||||
switch_thread_rwlock_rdlock(verto_globals.tech_rwlock);
|
||||
for(tech_pvt = verto_globals.tech_head; tech_pvt; tech_pvt = tech_pvt->next) {
|
||||
@@ -1241,9 +1246,14 @@ static void attach_calls(jsock_t *jsock)
|
||||
}
|
||||
|
||||
tech_reattach(tech_pvt, jsock);
|
||||
cJSON_AddItemToArray(reattached_sessions, cJSON_CreateString(jsock->uuid_str));
|
||||
}
|
||||
}
|
||||
switch_thread_rwlock_unlock(verto_globals.tech_rwlock);
|
||||
|
||||
msg = jrpc_new_req("verto.clientReady", NULL, ¶ms);
|
||||
cJSON_AddItemToObject(params, "reattached_sessions", reattached_sessions);
|
||||
jsock_queue_event(jsock, &msg, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
static void detach_calls(jsock_t *jsock)
|
||||
|
||||
Reference in New Issue
Block a user