[sr-dev] git:master: modules_k:dialog: new dialog callback: DLGCB_RPC_CONTEXT
Ovidiu Sas
osas at voipembedded.com
Sun Jun 27 20:17:08 CEST 2010
Module: sip-router
Branch: master
Commit: ea6356bcbd80470d2183c6626eedaf7535dc3a2c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ea6356bcbd80470d2183c6626eedaf7535dc3a2c
Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date: Sun Jun 27 14:22:10 2010 -0400
modules_k:dialog: new dialog callback: DLGCB_RPC_CONTEXT
- implementing a new dialog callback for rpc qos context interogation
---
modules_k/dialog/dialog.c | 17 +++++++++++++++++
modules_k/dialog/dlg_cb.h | 3 ++-
modules_k/qos/qos_handlers.c | 22 ++++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c
index cc33f39..f00021e 100644
--- a/modules_k/dialog/dialog.c
+++ b/modules_k/dialog/dialog.c
@@ -1146,6 +1146,9 @@ static inline void internal_rpc_print_dlg(rpc_t *rpc, void *c, struct dlg_cell *
rpc->printf(c, "\tcaller_bind_addr:%.*s callee_bind_addr:",
dlg->bind_addr[DLG_CALLER_LEG]->sock_str.len, dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s);
}
+ if (with_context) {
+ run_dlg_callbacks( DLGCB_RPC_CONTEXT, dlg, NULL, DLG_DIR_NONE, NULL);
+ }
}
/*!
@@ -1294,9 +1297,15 @@ static void internal_rpc_profile_print_dlgs(rpc_t *rpc, void *c, str *profile_na
static const char *rpc_print_dlgs_doc[2] = {
"Print all dialogs", 0
};
+static const char *rpc_print_dlgs_ctx_doc[2] = {
+ "Print all dialogs with associated context", 0
+};
static const char *rpc_print_dlg_doc[2] = {
"Print dialog based on callid and fromtag", 0
};
+static const char *rpc_print_dlg_ctx_doc[2] = {
+ "Print dialog with associated context based on callid and fromtag", 0
+};
static const char *rpc_end_dlg_entry_id_doc[2] = {
"End a given dialog based on [h_entry] [h_id]", 0
};
@@ -1315,9 +1324,15 @@ static const char *rpc_dlg_bridge_doc[2] = {
static void rpc_print_dlgs(rpc_t *rpc, void *c) {
internal_rpc_print_dlgs(rpc, c, 0);
}
+static void rpc_print_dlgs_ctx(rpc_t *rpc, void *c) {
+ internal_rpc_print_dlgs(rpc, c, 1);
+}
static void rpc_print_dlg(rpc_t *rpc, void *c) {
internal_rpc_print_single_dlg(rpc, c, 0);
}
+static void rpc_print_dlg_ctx(rpc_t *rpc, void *c) {
+ internal_rpc_print_single_dlg(rpc, c, 1);
+}
static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
unsigned int h_entry, h_id;
struct dlg_cell * dlg = NULL;
@@ -1367,7 +1382,9 @@ static void rpc_dlg_bridge(rpc_t *rpc, void *c) {
static rpc_export_t rpc_methods[] = {
{"dlg.list", rpc_print_dlgs, rpc_print_dlgs_doc, 0},
+ {"dlg.list_ctx", rpc_print_dlgs_ctx, rpc_print_dlgs_ctx_doc, 0},
{"dlg.dlg_list", rpc_print_dlg, rpc_print_dlg_doc, 0},
+ {"dlg.dlg_list_ctx", rpc_print_dlg_ctx, rpc_print_dlg_ctx_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_list", rpc_profile_print_dlgs, rpc_profile_print_dlgs_doc, 0},
diff --git a/modules_k/dialog/dlg_cb.h b/modules_k/dialog/dlg_cb.h
index 3f22b33..3013809 100644
--- a/modules_k/dialog/dlg_cb.h
+++ b/modules_k/dialog/dlg_cb.h
@@ -64,7 +64,8 @@ typedef int (*register_dlgcb_f)(struct dlg_cell* dlg, int cb_types,
#define DLGCB_RESPONSE_FWDED (1<<8)
#define DLGCB_RESPONSE_WITHIN (1<<9)
#define DLGCB_MI_CONTEXT (1<<10)
-#define DLGCB_DESTROY (1<<11)
+#define DLGCB_RPC_CONTEXT (1<<11)
+#define DLGCB_DESTROY (1<<12)
struct dlg_callback {
int types;
diff --git a/modules_k/qos/qos_handlers.c b/modules_k/qos/qos_handlers.c
index 9858df0..85416ba 100644
--- a/modules_k/qos/qos_handlers.c
+++ b/modules_k/qos/qos_handlers.c
@@ -58,6 +58,7 @@ static void qos_dialog_destroy_CB(struct dlg_cell* did, int type, struct dlg_cb_
static void qos_dialog_request_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params);
static void qos_dialog_response_CB(struct dlg_cell* did, int type,struct dlg_cb_params * params);
+static void qos_dialog_rpc_context_CB(struct dlg_cell* did, int type,struct dlg_cb_params * params);
/**
* The value of the message flag to flag an INVITE we want to process
@@ -90,6 +91,8 @@ static void setup_dialog_callbacks(struct dlg_cell *did, qos_ctx_t *ctx)
dlg_binds->register_dlgcb(did, DLGCB_MI_CONTEXT,
qos_dialog_mi_context_CB, (void *)ctx, NULL);
+ dlg_binds->register_dlgcb(did, DLGCB_RPC_CONTEXT,
+ qos_dialog_rpc_context_CB, (void *)ctx, NULL);
return;
}
@@ -279,3 +282,22 @@ static void qos_dialog_response_CB(struct dlg_cell* did, int type, struct dlg_cb
return;
}
+/********************************* RPC *********************************/
+void qos_dialog_rpc_context_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params)
+{
+ qos_ctx_t* qos_ctx = (qos_ctx_t*)*(params->param);
+ qos_sdp_t* qos_sdp;
+
+ qos_sdp = qos_ctx->pending_sdp;
+ if (qos_sdp) {
+ /* print pendign sdp context */
+ }
+
+ qos_sdp = qos_ctx->negotiated_sdp;
+ if (qos_sdp) {
+ /* print negotiated sdp context */
+ }
+
+ return;
+}
+
More information about the sr-dev
mailing list