[sr-dev] git:master: modules_k/dialog: rpc interface fixes
Ovidiu Sas
osas at voipembedded.com
Thu Jun 24 16:24:14 CEST 2010
Module: sip-router
Branch: master
Commit: 6e00d85416e3138d152a280358e79693d738e14a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6e00d85416e3138d152a280358e79693d738e14a
Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date: Thu Jun 24 10:28:52 2010 -0400
modules_k/dialog: rpc interface fixes
- force to string all rpc parameters
- enable optianal parameters for profile specific rpc commands
---
modules_k/dialog/dialog.c | 39 +++++++++++++--------------------------
1 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c
index 458201c..cc33f39 100644
--- a/modules_k/dialog/dialog.c
+++ b/modules_k/dialog/dialog.c
@@ -1183,7 +1183,7 @@ static void internal_rpc_print_single_dlg(rpc_t *rpc, void *c, int with_context)
struct dlg_cell *dlg;
unsigned int h_entry;
- if (rpc->scan(c, "SS", &callid, &from_tag) < 2) return;
+ if (rpc->scan(c, ".S.S", &callid, &from_tag) < 2) return;
h_entry = core_hash( &callid, &from_tag, d_table->size);
d_entry = &(d_table->entries[h_entry]);
@@ -1303,15 +1303,9 @@ static const char *rpc_end_dlg_entry_id_doc[2] = {
static const char *rpc_profile_get_size_doc[2] = {
"Returns the number of dialogs belonging to a profile", 0
};
-static const char *rpc_profile_w_val_get_size_doc[2] = {
- "Returns the number of dialogs belonging to a profile with value", 0
-};
static const char *rpc_profile_print_dlgs_doc[2] = {
"Lists all the dialogs belonging to a profile", 0
};
-static const char *rpc_profile_w_val_print_dlgs_doc[2] = {
- "Lists all the dialogs belonging to a profile with value", 0
-};
static const char *rpc_dlg_bridge_doc[2] = {
"Bridge two SIP addresses in a call using INVITE(hold)-REFER-BYE mechanism:\
to, from, [outbound SIP proxy]", 0
@@ -1339,31 +1333,26 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
}
static void rpc_profile_get_size(rpc_t *rpc, void *c) {
str profile_name = {NULL,0};
-
- if (rpc->scan(c, "S", &profile_name) < 1) return;
- internal_rpc_profile_get_size(rpc, c, &profile_name, NULL);
- return;
-}
-static void rpc_profile_w_val_get_size(rpc_t *rpc, void *c) {
- str profile_name = {NULL,0};
str value = {NULL,0};
- if (rpc->scan(c, "SS", &profile_name, &value) < 2) return;
- internal_rpc_profile_get_size(rpc, c, &profile_name, &value);
+ if (rpc->scan(c, ".S", &profile_name) < 1) return;
+ if (rpc->scan(c, "*.S", &value) > 0) {
+ internal_rpc_profile_get_size(rpc, c, &profile_name, &value);
+ } else {
+ internal_rpc_profile_get_size(rpc, c, &profile_name, NULL);
+ }
return;
}
static void rpc_profile_print_dlgs(rpc_t *rpc, void *c) {
str profile_name = {NULL,0};
-
- if (rpc->scan(c, "S", &profile_name) < 1) return;
- internal_rpc_profile_print_dlgs(rpc, c, &profile_name, NULL);
-}
-static void rpc_profile_w_val_print_dlgs(rpc_t *rpc, void *c) {
- str profile_name = {NULL,0};
str value = {NULL,0};
- if (rpc->scan(c, "SS", &profile_name, &value) < 2) return;
- internal_rpc_profile_print_dlgs(rpc, c, &profile_name, &value);
+ if (rpc->scan(c, ".S", &profile_name) < 1) return;
+ if (rpc->scan(c, "*.S", &value) > 0) {
+ internal_rpc_profile_print_dlgs(rpc, c, &profile_name, &value);
+ } else {
+ internal_rpc_profile_print_dlgs(rpc, c, &profile_name, NULL);
+ }
return;
}
static void rpc_dlg_bridge(rpc_t *rpc, void *c) {
@@ -1381,9 +1370,7 @@ static rpc_export_t rpc_methods[] = {
{"dlg.dlg_list", rpc_print_dlg, rpc_print_dlg_doc, 0},
{"dlg.end_dlg", rpc_end_dlg_entry_id, rpc_end_dlg_entry_id_doc, 0},
{"dlg.profile_get_size", rpc_profile_get_size, rpc_profile_get_size_doc, 0},
- {"dlg.profile_w_value_get_size", rpc_profile_w_val_get_size, rpc_profile_w_val_get_size_doc, 0},
{"dlg.profile_list", rpc_profile_print_dlgs, rpc_profile_print_dlgs_doc, 0},
- {"dlg.profile_w_value_list", rpc_profile_w_val_print_dlgs, rpc_profile_w_val_print_dlgs_doc, 0},
{"dlg.bridge_dlg", rpc_dlg_bridge, rpc_dlg_bridge_doc, 0},
{0, 0, 0, 0}
};
More information about the sr-dev
mailing list