mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-13 13:07:06 +00:00
FS-10167: Refactoring and cleanup
This commit is contained in:
1 parent
53116495d1
commit
84540ea857
18 files changed
+293
-115
No files matched your search
@@ -42,7 +42,7 @@ ks_bool_t test_echo_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
result = blade_protocol_execute_response_result_get(brpcres);
|
||||
result = blade_rpcexecute_response_result_get(brpcres);
|
||||
ks_assert(result);
|
||||
|
||||
text = cJSON_GetObjectCstr(result, "text");
|
||||
@@ -106,7 +106,7 @@ ks_bool_t blade_locate_response_handler(blade_rpc_response_t *brpcres, void *dat
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(params, "text", "hello world!");
|
||||
blade_protocol_execute(bh, nodeid, "test.echo", res_result_protocol, res_result_realm, params, test_echo_response_handler, NULL);
|
||||
blade_handle_rpcexecute(bh, nodeid, "test.echo", res_result_protocol, res_result_realm, params, test_echo_response_handler, NULL);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ void command_execute(blade_handle_t *bh, char *args)
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_protocol_locate(bh, "test", "mydomain.com", blade_locate_response_handler, NULL);
|
||||
blade_handle_rpclocate(bh, "test", "mydomain.com", blade_locate_response_handler, NULL);
|
||||
}
|
||||
|
||||
void command_subscribe(blade_handle_t *bh, char *args)
|
||||
@@ -293,7 +293,7 @@ void command_subscribe(blade_handle_t *bh, char *args)
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_protocol_subscribe(bh, "test.event", "test", "mydomain.com", KS_FALSE, blade_subscribe_response_handler, NULL, test_event_request_handler, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.event", "test", "mydomain.com", KS_FALSE, blade_subscribe_response_handler, NULL, test_event_request_handler, NULL);
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
|
||||
@@ -66,7 +66,7 @@ ks_bool_t test_echo_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
ks_assert(bs);
|
||||
|
||||
// @todo get the inner parameters of a blade.execute request for protocolrpcs
|
||||
params = blade_protocol_execute_request_params_get(brpcreq);
|
||||
params = blade_rpcexecute_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
text = cJSON_GetObjectCstr(params, "text");
|
||||
@@ -80,7 +80,7 @@ ks_bool_t test_echo_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
result = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(result, "text", text);
|
||||
|
||||
blade_protocol_execute_response_send(brpcreq, result);
|
||||
blade_rpcexecute_response_send(brpcreq, result);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
@@ -242,8 +242,8 @@ void command_publish(blade_handle_t *bh, char *args)
|
||||
blade_rpc_create(&brpc, bh, "test.echo", "test", "mydomain.com", test_echo_request_handler, NULL);
|
||||
blade_rpcmgr_protocolrpc_add(blade_handle_rpcmgr_get(bh), brpc);
|
||||
|
||||
// @todo build up json-based method schema for each protocolrpc registered above, and pass into blade_protocol_publish() to attach to the request, to be stored in the blade_protocol_t tracked by the master node
|
||||
blade_protocol_publish(bh, "test", "mydomain.com", blade_publish_response_handler, NULL);
|
||||
// @todo build up json-based method schema for each protocolrpc registered above, and pass into blade_handle_rpcpublish() to attach to the request, to be stored in the blade_protocol_t tracked by the master node
|
||||
blade_handle_rpcpublish(bh, "test", "mydomain.com", blade_publish_response_handler, NULL);
|
||||
}
|
||||
|
||||
void command_broadcast(blade_handle_t *bh, char *args)
|
||||
@@ -251,7 +251,7 @@ void command_broadcast(blade_handle_t *bh, char *args)
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_protocol_broadcast(bh, NULL, "test.event", "test", "mydomain.com", NULL, test_event_response_handler, NULL);
|
||||
blade_handle_rpcbroadcast(bh, NULL, "test.event", "test", "mydomain.com", NULL, test_event_response_handler, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ ks_bool_t test_join_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
result = blade_protocol_execute_response_result_get(brpcres);
|
||||
result = blade_rpcexecute_response_result_get(brpcres);
|
||||
ks_assert(result);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.join response processing\n", blade_session_id_get(bs));
|
||||
@@ -125,7 +125,7 @@ ks_bool_t test_leave_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
result = blade_protocol_execute_response_result_get(brpcres);
|
||||
result = blade_rpcexecute_response_result_get(brpcres);
|
||||
ks_assert(result);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.leave response processing\n", blade_session_id_get(bs));
|
||||
@@ -149,7 +149,7 @@ ks_bool_t test_talk_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_response_sessionid_get(brpcres));
|
||||
ks_assert(bs);
|
||||
|
||||
result = blade_protocol_execute_response_result_get(brpcres);
|
||||
result = blade_rpcexecute_response_result_get(brpcres);
|
||||
ks_assert(result);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.talk response processing\n", blade_session_id_get(bs));
|
||||
@@ -175,10 +175,10 @@ ks_bool_t test_join_broadcast_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
params = blade_protocol_broadcast_request_params_get(brpcreq);
|
||||
params = blade_rpcbroadcast_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
broadcaster_nodeid = blade_protocol_broadcast_request_broadcaster_nodeid_get(brpcreq);
|
||||
broadcaster_nodeid = blade_rpcbroadcast_request_broadcaster_nodeid_get(brpcreq);
|
||||
ks_assert(broadcaster_nodeid);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.join (%s) broadcast processing\n", blade_session_id_get(bs), broadcaster_nodeid);
|
||||
@@ -204,10 +204,10 @@ ks_bool_t test_leave_broadcast_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
params = blade_protocol_broadcast_request_params_get(brpcreq);
|
||||
params = blade_rpcbroadcast_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
broadcaster_nodeid = blade_protocol_broadcast_request_broadcaster_nodeid_get(brpcreq);
|
||||
broadcaster_nodeid = blade_rpcbroadcast_request_broadcaster_nodeid_get(brpcreq);
|
||||
ks_assert(broadcaster_nodeid);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.leave (%s) broadcast processing\n", blade_session_id_get(bs), broadcaster_nodeid);
|
||||
@@ -233,10 +233,10 @@ ks_bool_t test_talk_broadcast_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
broadcaster_nodeid = blade_protocol_broadcast_request_broadcaster_nodeid_get(brpcreq);
|
||||
broadcaster_nodeid = blade_rpcbroadcast_request_broadcaster_nodeid_get(brpcreq);
|
||||
ks_assert(broadcaster_nodeid);
|
||||
|
||||
params = blade_protocol_broadcast_request_params_get(brpcreq);
|
||||
params = blade_rpcbroadcast_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
// @todo pull out text from params
|
||||
@@ -385,7 +385,7 @@ void command_locate(blade_handle_t *bh, char *args)
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
||||
blade_protocol_locate(bh, "test", "mydomain.com", test_locate_response_handler, NULL);
|
||||
blade_handle_rpclocate(bh, "test", "mydomain.com", test_locate_response_handler, NULL);
|
||||
}
|
||||
|
||||
void command_join(blade_handle_t *bh, char *args)
|
||||
@@ -403,11 +403,11 @@ void command_join(blade_handle_t *bh, char *args)
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_execute(bh, g_testcon_nodeid, "test.join", "test", "mydomain.com", params, test_join_response_handler, NULL);
|
||||
blade_handle_rpcexecute(bh, g_testcon_nodeid, "test.join", "test", "mydomain.com", params, test_join_response_handler, NULL);
|
||||
|
||||
blade_protocol_subscribe(bh, "test.join", "test", "mydomain.com", KS_FALSE, NULL, NULL, test_join_broadcast_handler, NULL);
|
||||
blade_protocol_subscribe(bh, "test.leave", "test", "mydomain.com", KS_FALSE, NULL, NULL, test_leave_broadcast_handler, NULL);
|
||||
blade_protocol_subscribe(bh, "test.talk", "test", "mydomain.com", KS_FALSE, NULL, NULL, test_talk_broadcast_handler, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.join", "test", "mydomain.com", KS_FALSE, NULL, NULL, test_join_broadcast_handler, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.leave", "test", "mydomain.com", KS_FALSE, NULL, NULL, test_leave_broadcast_handler, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.talk", "test", "mydomain.com", KS_FALSE, NULL, NULL, test_talk_broadcast_handler, NULL);
|
||||
}
|
||||
|
||||
void command_leave(blade_handle_t *bh, char *args)
|
||||
@@ -424,11 +424,11 @@ void command_leave(blade_handle_t *bh, char *args)
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_execute(bh, g_testcon_nodeid, "test.leave", "test", "mydomain.com", params, test_leave_response_handler, NULL);
|
||||
blade_handle_rpcexecute(bh, g_testcon_nodeid, "test.leave", "test", "mydomain.com", params, test_leave_response_handler, NULL);
|
||||
|
||||
blade_protocol_subscribe(bh, "test.join", "test", "mydomain.com", KS_TRUE, NULL, NULL, NULL, NULL);
|
||||
blade_protocol_subscribe(bh, "test.leave", "test", "mydomain.com", KS_TRUE, NULL, NULL, NULL, NULL);
|
||||
blade_protocol_subscribe(bh, "test.talk", "test", "mydomain.com", KS_TRUE, NULL, NULL, NULL, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.join", "test", "mydomain.com", KS_TRUE, NULL, NULL, NULL, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.leave", "test", "mydomain.com", KS_TRUE, NULL, NULL, NULL, NULL);
|
||||
blade_handle_rpcsubscribe(bh, "test.talk", "test", "mydomain.com", KS_TRUE, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void command_talk(blade_handle_t *bh, char *args)
|
||||
@@ -451,7 +451,7 @@ void command_talk(blade_handle_t *bh, char *args)
|
||||
|
||||
cJSON_AddStringToObject(params, "text", args);
|
||||
|
||||
blade_protocol_execute(bh, g_testcon_nodeid, "test.talk", "test", "mydomain.com", params, test_talk_response_handler, NULL);
|
||||
blade_handle_rpcexecute(bh, g_testcon_nodeid, "test.talk", "test", "mydomain.com", params, test_talk_response_handler, NULL);
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
|
||||
@@ -133,10 +133,10 @@ ks_bool_t test_join_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
requester_nodeid = blade_protocol_execute_request_requester_nodeid_get(brpcreq);
|
||||
requester_nodeid = blade_rpcexecute_request_requester_nodeid_get(brpcreq);
|
||||
ks_assert(requester_nodeid);
|
||||
|
||||
params = blade_protocol_execute_request_params_get(brpcreq);
|
||||
params = blade_rpcexecute_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.join request processing\n", blade_session_id_get(bs));
|
||||
@@ -152,11 +152,11 @@ ks_bool_t test_join_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
|
||||
result = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_execute_response_send(brpcreq, result);
|
||||
blade_rpcexecute_response_send(brpcreq, result);
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_broadcast(bh, requester_nodeid, "test.join", "test", "mydomain.com", params, NULL, NULL);
|
||||
blade_handle_rpcbroadcast(bh, requester_nodeid, "test.join", "test", "mydomain.com", params, NULL, NULL);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
@@ -182,10 +182,10 @@ ks_bool_t test_leave_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
requester_nodeid = blade_protocol_execute_request_requester_nodeid_get(brpcreq);
|
||||
requester_nodeid = blade_rpcexecute_request_requester_nodeid_get(brpcreq);
|
||||
ks_assert(requester_nodeid);
|
||||
|
||||
params = blade_protocol_execute_request_params_get(brpcreq);
|
||||
params = blade_rpcexecute_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Session (%s) test.leave (%s) request processing\n", blade_session_id_get(bs), requester_nodeid);
|
||||
@@ -198,11 +198,11 @@ ks_bool_t test_leave_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
|
||||
result = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_execute_response_send(brpcreq, result);
|
||||
blade_rpcexecute_response_send(brpcreq, result);
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_broadcast(bh, requester_nodeid, "test.leave", "test", "mydomain.com", params, NULL, NULL);
|
||||
blade_handle_rpcbroadcast(bh, requester_nodeid, "test.leave", "test", "mydomain.com", params, NULL, NULL);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
@@ -228,10 +228,10 @@ ks_bool_t test_talk_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
bs = blade_sessionmgr_session_lookup(blade_handle_sessionmgr_get(bh), blade_rpc_request_sessionid_get(brpcreq));
|
||||
ks_assert(bs);
|
||||
|
||||
requester_nodeid = blade_protocol_execute_request_requester_nodeid_get(brpcreq);
|
||||
requester_nodeid = blade_rpcexecute_request_requester_nodeid_get(brpcreq);
|
||||
ks_assert(requester_nodeid);
|
||||
|
||||
params = blade_protocol_execute_request_params_get(brpcreq);
|
||||
params = blade_rpcexecute_request_params_get(brpcreq);
|
||||
ks_assert(params);
|
||||
|
||||
text = cJSON_GetObjectCstr(params, "text");
|
||||
@@ -243,13 +243,13 @@ ks_bool_t test_talk_request_handler(blade_rpc_request_t *brpcreq, void *data)
|
||||
|
||||
result = cJSON_CreateObject();
|
||||
|
||||
blade_protocol_execute_response_send(brpcreq, result);
|
||||
blade_rpcexecute_response_send(brpcreq, result);
|
||||
|
||||
params = cJSON_CreateObject();
|
||||
|
||||
cJSON_AddStringToObject(params, "text", text);
|
||||
|
||||
blade_protocol_broadcast(bh, requester_nodeid, "test.talk", "test", "mydomain.com", params, NULL, NULL);
|
||||
blade_handle_rpcbroadcast(bh, requester_nodeid, "test.talk", "test", "mydomain.com", params, NULL, NULL);
|
||||
|
||||
return KS_FALSE;
|
||||
}
|
||||
@@ -326,7 +326,7 @@ int main(int argc, char **argv)
|
||||
blade_rpc_create(&brpc, bh, "test.talk", "test", "mydomain.com", test_talk_request_handler, test);
|
||||
blade_rpcmgr_protocolrpc_add(blade_handle_rpcmgr_get(bh), brpc);
|
||||
|
||||
blade_protocol_publish(bh, "test", "mydomain.com", test_publish_response_handler, test);
|
||||
blade_handle_rpcpublish(bh, "test", "mydomain.com", test_publish_response_handler, test);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user