struct janus_plugin_result *janus_videocall_handle_message(janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep) { if(g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized)) return janus_plugin_result_new(JANUS_PLUGIN_ERROR, g_atomic_int_get(&stopping) ? "Shutting down" : "Plugin not initialized", NULL); janus_videocall_message *msg = g_malloc0(sizeof(janus_videocall_message)); msg->handle = handle; msg->transaction = transaction; msg->message = message; msg->jsep = jsep; g_async_queue_push(messages, msg); /* All the requests to this plugin are handled asynchronously */ return janus_plugin_result_new(JANUS_PLUGIN_OK_WAIT, NULL, NULL); }
struct janus_plugin_result *janus_source_handle_message(janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep) { if (g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized)) return janus_plugin_result_new(JANUS_PLUGIN_ERROR, g_atomic_int_get(&stopping) ? "Shutting down" : "Plugin not initialized", NULL); janus_source_message *msg = g_malloc0(sizeof(janus_source_message)); msg->handle = handle; msg->transaction = transaction; msg->message = message; msg->jsep = jsep; g_async_queue_push(messages, msg); /* All the requests to this plugin are handled asynchronously: we add a comment * (a JSON object with a "hint" string in it, that's what the core expects), * but we don't have to: other plugins don't put anything in there */ return janus_plugin_result_new(JANUS_PLUGIN_OK_WAIT, "I'm taking my time!", NULL); }
struct janus_plugin_result *janus_videocall_handle_message(janus_plugin_session *handle, char *transaction, char *message, char *sdp_type, char *sdp) { if(g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized)) return janus_plugin_result_new(JANUS_PLUGIN_ERROR, g_atomic_int_get(&stopping) ? "Shutting down" : "Plugin not initialized"); janus_videocall_message *msg = calloc(1, sizeof(janus_videocall_message)); if(msg == NULL) { JANUS_LOG(LOG_FATAL, "Memory error!\n"); return janus_plugin_result_new(JANUS_PLUGIN_ERROR, "Memory error"); } msg->handle = handle; msg->transaction = transaction; msg->message = message; msg->sdp_type = sdp_type; msg->sdp = sdp; g_async_queue_push(messages, msg); /* All the requests to this plugin are handled asynchronously */ return janus_plugin_result_new(JANUS_PLUGIN_OK_WAIT, NULL); }
struct janus_plugin_result *janus_echotest_handle_message(janus_plugin_session *handle, char *transaction, char *message, char *sdp_type, char *sdp) { if(stopping || !initialized) return janus_plugin_result_new(JANUS_PLUGIN_ERROR, stopping ? "Shutting down" : "Plugin not initialized"); JANUS_LOG(LOG_VERB, "%s\n", message); janus_echotest_message *msg = calloc(1, sizeof(janus_echotest_message)); if(msg == NULL) { JANUS_LOG(LOG_FATAL, "Memory error!\n"); return janus_plugin_result_new(JANUS_PLUGIN_ERROR, "Memory error"); } msg->handle = handle; msg->transaction = transaction; msg->message = message; msg->sdp_type = sdp_type; msg->sdp = sdp; g_async_queue_push(messages, msg); /* All the requests to this plugin are handled asynchronously */ return janus_plugin_result_new(JANUS_PLUGIN_OK_WAIT, "I'm taking my time!"); }
struct janus_plugin_result *janus_serial_handle_message(janus_plugin_session *handle, char *transaction, char *message, char *sdp_type, char *sdp) { if(g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized)) return janus_plugin_result_new(JANUS_PLUGIN_ERROR, g_atomic_int_get(&stopping) ? "Shutting down" : "Plugin not initialized"); janus_serial_message *msg = calloc(1, sizeof(janus_serial_message)); if(msg == NULL) { JANUS_LOG(LOG_FATAL, "Memory error!\n"); return janus_plugin_result_new(JANUS_PLUGIN_ERROR, "Memory error"); } json_t *root,*data; json_error_t error; const char *str; msg->handle = handle; msg->transaction = transaction; msg->message = message; msg->sdp_type = sdp_type; msg->sdp = sdp; g_async_queue_push(messages, msg); //inserito da giovanni //Janus.log("gelosia messaggio" + message); //JANUS_LOG(LOG_INFO, "GELOSIA messaggio: %s \n", message); root = json_loads(message, 0, &error); data = json_object_get(root, "audio" ); str = json_string_value(data); JANUS_LOG(LOG_INFO, "messaggio parsato: %s \n", str); char request[256]; memset(request,'\0',256); strncpy(request,message,strlen(message)); write(fd,request,strlen(request)); usleep(25+strlen(request)*100); /* All the requests to this plugin are handled asynchronously */ return janus_plugin_result_new(JANUS_PLUGIN_OK_WAIT, "I'm taking my time!"); }