]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-9683: Pass call recovery status to Verto
authorChad Phillips <chad@apartmentlines.com>
Thu, 6 Jul 2017 20:54:08 +0000 (13:54 -0700)
committerChad Phillips <chad@apartmentlines.com>
Thu, 6 Jul 2017 20:54:08 +0000 (13:54 -0700)
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.

html5/verto/demo/verto.js
html5/verto/js/src/jquery.verto.js
html5/verto/verto_communicator/src/vertoService/services/vertoService.js
html5/verto/video_demo-live_canvas/verto.js
html5/verto/video_demo/verto.js
src/mod/endpoints/mod_verto/mod_verto.c

index 137a1654a446e07ce1c26ff4008b0eec4e835212..9a7b5829d851b2fe75c67c957c5a969e5b6c8ac2 100644 (file)
@@ -159,6 +159,9 @@ var callbacks = {
                 }
             }
             break;
+        case $.verto.enum.message.clientReady:
+//            console.error("clientReady", data);
+                                               break;
         case $.verto.enum.message.info:
            var body = data.body;
 
index 3e47dbfff0325d0a231a306529619cafccfb5b19..5a01d94aceb51075a009f56f37131edb706c34ea 100644 (file)
 
                 break;
 
+            case 'verto.clientReady':
+                verto.callbacks.onMessage(verto, null, $.verto.enum.message.clientReady, data.params);
+                console.debug("CLIENT READY", data.params);
+                break;
+
             default:
                 console.error("INVALID METHOD OR NON-EXISTANT CALL REFERENCE IGNORED", data.method);
                 break;
 
     $.verto.enum.state = $.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");
     $.verto.enum.direction = $.verto.ENUM("inbound outbound");
-    $.verto.enum.message = $.verto.ENUM("display info pvtEvent");
+    $.verto.enum.message = $.verto.ENUM("display info pvtEvent clientReady");
 
     $.verto.enum = Object.freeze($.verto.enum);
 
index 5ac1e7d3ba88cc69d72fe6c88191a8a5485d2f14..a8903531598e17f47d03d660399e669ac2f0a9fc 100644 (file)
@@ -632,6 +632,11 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
               case $.verto.enum.message.display:
                     $rootScope.$apply(function() {});
                     break;
+              case $.verto.enum.message.clientReady:
+                    $rootScope.$emit('clientReady', {
+                      reattached_sessions: params.reattached_sessions,
+                    });
+                    break;
               default:
                 console.warn('Got a not implemented message:', msg, dialog, params);
                 break;
index 201f9ca33b48bbf083c1e2b03372f0374825a2c2..bb895e2a748bf86b8543e359dd2c7d3ef4c470df 100644 (file)
@@ -750,6 +750,9 @@ var callbacks = {
                 }
             }
             break;
+        case $.verto.enum.message.clientReady:
+//            console.error("clientReady", data);
+                                               break;
         case $.verto.enum.message.info:
            if (data.msg) {
                data = data.msg;
index 3b6abe75c738f8a7157f595d5dc6ce9785b901ce..376619fd89e7e2c5525c051af7750270f0932edd 100644 (file)
@@ -441,6 +441,9 @@ var callbacks = {
                 }
             }
             break;
+        case $.verto.enum.message.clientReady:
+//            console.error("clientReady", data);
+                                               break;
         case $.verto.enum.message.info:
            if (data.msg) {
                data = data.msg;
index 287d343753de512c655f58f2cf62e3531bb9f2c4..f843969a03acad65aba0e2eeb7e63637ed6f6a1b 100644 (file)
@@ -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, &params);
+       cJSON_AddItemToObject(params, "reattached_sessions", reattached_sessions);
+       jsock_queue_event(jsock, &msg, SWITCH_TRUE);
 }
 
 static void detach_calls(jsock_t *jsock)