[sr-dev] git:master: pua_reginfo: add ruid for location records
Daniel-Constantin Mierla
miconda at gmail.com
Wed Sep 18 22:19:21 CEST 2013
Module: sip-router
Branch: master
Commit: 9ee44c6079c8d30138ece619295974e17993aa04
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9ee44c6079c8d30138ece619295974e17993aa04
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Sep 18 22:17:55 2013 +0200
pua_reginfo: add ruid for location records
- patch by Wonbin Cho, FS#339
---
modules/pua_reginfo/Makefile | 3 +++
modules/pua_reginfo/notify.c | 13 ++++++++++++-
modules/pua_reginfo/pua_reginfo.c | 6 ++++++
3 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/modules/pua_reginfo/Makefile b/modules/pua_reginfo/Makefile
index b6d8e40..532f159 100644
--- a/modules/pua_reginfo/Makefile
+++ b/modules/pua_reginfo/Makefile
@@ -24,4 +24,7 @@ endif
DEFS+=-DKAMAILIO_MOD_INTERFACE
+SERLIBPATH=../../lib
+SER_LIBS+=$(SERLIBPATH)/srutils/srutils
+
include ../../Makefile.modules
diff --git a/modules/pua_reginfo/notify.c b/modules/pua_reginfo/notify.c
index 176c16c..1187e34 100644
--- a/modules/pua_reginfo/notify.c
+++ b/modules/pua_reginfo/notify.c
@@ -26,6 +26,7 @@
#include "../../parser/parse_content.h"
#include "../../parser/parse_uri.h"
#include "../../modules/usrloc/usrloc.h"
+#include "../../lib/srutils/sruid.h"
#include <libxml/parser.h>
#include "pua_reginfo.h"
@@ -62,7 +63,10 @@
#define RESULT_CONTACTS_FOUND 1
#define RESULT_NO_CONTACTS 2
-int process_contact(udomain_t * domain, urecord_t ** ul_record, str aor, str callid, int cseq, int expires, int event, str contact_uri) {
+extern sruid_t _reginfo_sruid;
+
+int process_contact(udomain_t * domain, urecord_t ** ul_record, str aor, str callid,
+ int cseq, int expires, int event, str contact_uri) {
str no_str = {0, 0};
static str no_ua = str_init("n/a");
static ucontact_info_t ci;
@@ -102,6 +106,13 @@ int process_contact(udomain_t * domain, urecord_t ** ul_record, str aor, str cal
/* set expire time */
ci.expires = time(0) + expires;
+ /* set ruid */
+ if(sruid_next(&_reginfo_sruid) < 0) {
+ LM_ERR("failed to generate ruid");
+ } else {
+ ci.ruid = _reginfo_sruid.uid;
+ }
+
/* Now we start looking for the contact: */
if (((*ul_record)->contacts == 0)
|| (ul.get_ucontact(*ul_record, &contact_uri, &callid, &no_str, cseq+1, &ul_contact) != 0)) {
diff --git a/modules/pua_reginfo/pua_reginfo.c b/modules/pua_reginfo/pua_reginfo.c
index a9ffe76..73d7113 100644
--- a/modules/pua_reginfo/pua_reginfo.c
+++ b/modules/pua_reginfo/pua_reginfo.c
@@ -25,6 +25,7 @@
#include "../pua/pua_bind.h"
/* Bindings to usrloc */
#include "../usrloc/usrloc.h"
+#include "../../lib/srutils/sruid.h"
#include "pua_reginfo.h"
#include "subscribe.h"
@@ -43,6 +44,7 @@ str server_address = {NULL, 0};
int publish_reginfo = 1;
+sruid_t _reginfo_sruid;
/** Fixup functions */
static int domain_fixup(void** param, int param_no);
@@ -161,6 +163,10 @@ static int mod_init(void)
return -1;
}
}
+
+ if(sruid_init(&_reginfo_sruid, (char)'-', "regi", SRUID_INC)<0)
+ return -1;
+
return 0;
}
More information about the sr-dev
mailing list