Module: kamailio
Branch: master
Commit: fa347d4de2e25cf38615503a70b8b29c54ed5265
URL:
https://github.com/kamailio/kamailio/commit/fa347d4de2e25cf38615503a70b8b29…
Author: jaybeepee <jason.penton(a)gmail.com>
Committer: jaybeepee <jason.penton(a)gmail.com>
Date: 2016-10-20T14:05:15+02:00
modules/ims_usrloc_scscf: add param max_notification list size and stat of current size
---
Modified: modules/ims_usrloc_scscf/ul_rpc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/fa347d4de2e25cf38615503a70b8b29…
Patch:
https://github.com/kamailio/kamailio/commit/fa347d4de2e25cf38615503a70b8b29…
---
diff --git a/modules/ims_usrloc_scscf/ul_rpc.c b/modules/ims_usrloc_scscf/ul_rpc.c
index a455fc2..37fddf5 100644
--- a/modules/ims_usrloc_scscf/ul_rpc.c
+++ b/modules/ims_usrloc_scscf/ul_rpc.c
@@ -25,15 +25,44 @@
#include "dlist.h"
#include "ucontact.h"
#include "udomain.h"
+#include "dlist.h"
static const char* ul_rpc_dump_doc[2] = {"Dump SCSCF user location tables", 0
};
static const char* ul_rpc_showimpu_doc[2] = {"Dump SCSCF IMPU information", 0
};
+static const char* ul_rpc_snapshot_doc[2] = {"Dump snapshot of SCSCF usrloc to
file", 0 };
static unsigned int contact_buflen = 0;
static str contact_buf = {0,0};
+static void ul_rpc_snapshot(rpc_t* rpc, void *ctx) {
+ str filename;
+ time_t current_time;
+ struct tm *t;
+ char str_time[100];
+
+ if (rpc->scan(ctx, "S", &filename) < 1) {
+ rpc->fault(ctx, 400, "required filename to dump usrloc snapshot to");
+ return;
+ }
+
+
+ LM_DBG("Dumping S-CSCF usrloc snapshot to file: [%.s]\n", filename.len,
filename.s);
+
+ current_time = time(NULL);
+ t = localtime(¤t_time);
+ strftime(str_time, 100, "%Y-%m-%d %H:%M:%S", t);
+ FILE *f = fopen(filename.s, "a");
+ fprintf(f, "########################################################\n");
+ fprintf(f, "Dumping USRLOC for S-CSCF: %s\n", str_time);
+ fprintf(f, "########################################################\n\n");
+ print_all_udomains(f);
+ fflush(f);
+ fclose(f);
+}
+
static void ul_rpc_show_impu(rpc_t* rpc, void* ctx) {
int i, j;
+ impu_contact_t *impucontact;
str impu;
int res;
udomain_t* domain;
@@ -174,7 +203,6 @@ static void ul_rpc_show_impu(rpc_t* rpc, void* ctx) {
}
impucontact = impucontact->next;
}
- }
unlock_udomain(domain, &impu);
@@ -224,8 +252,9 @@ static void ul_rpc_dump(rpc_t* rpc, void* ctx)
}
rpc_export_t ul_rpc[] = {
- {"ulscscf.status", ul_rpc_dump, ul_rpc_dump_doc, 0},
- {"ulscscf.showimpu", ul_rpc_show_impu, ul_rpc_showimpu_doc, 0},
+ {"ulscscf.status", ul_rpc_dump, ul_rpc_dump_doc, 0},
+ {"ulscscf.showimpu", ul_rpc_show_impu, ul_rpc_showimpu_doc, 0},
+ {"ulscscf.snapshot", ul_rpc_snapshot, ul_rpc_snapshot_doc, 0},
{0, 0, 0, 0}
};