Module: sip-router
Branch: master
Commit: 18a4a8a33939edc6e5d74fdc21c33d9835a62f61
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=18a4a8a…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Fri Dec 21 23:09:23 2012 +0000
modules_k/registrar: Extended C-API to include a URI lookup
- Enhancement added by Hugh Waite @ Crocodile RCS
---
modules_k/registrar/api.c | 16 ++++++++++++++++
modules_k/registrar/api.h | 4 ++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/modules_k/registrar/api.c b/modules_k/registrar/api.c
index e676e91..adce1be 100644
--- a/modules_k/registrar/api.c
+++ b/modules_k/registrar/api.c
@@ -81,6 +81,21 @@ int regapi_lookup(struct sip_msg *msg, char *table)
/**
*
*/
+int regapi_lookup_uri(struct sip_msg *msg, char *table, str * uri)
+{
+ udomain_t* d;
+
+ if(ul.get_udomain(table, &d)<0)
+ {
+ LM_ERR("usrloc domain [%s] not found\n", table);
+ return -1;
+ }
+ return lookup(msg, d, uri);
+}
+
+/**
+ *
+ */
int regapi_registered(struct sip_msg *msg, char *table)
{
udomain_t* d;
@@ -105,6 +120,7 @@ int bind_registrar(registrar_api_t* api)
api->save = regapi_save;
api->save_uri = regapi_save_uri;
api->lookup = regapi_lookup;
+ api->lookup_uri = regapi_lookup_uri;
api->registered = regapi_registered;
return 0;
diff --git a/modules_k/registrar/api.h b/modules_k/registrar/api.h
index 3756015..006c596 100644
--- a/modules_k/registrar/api.h
+++ b/modules_k/registrar/api.h
@@ -40,6 +40,9 @@ int regapi_save_uri(struct sip_msg *msg, char *table, int flags, str
*uri);
typedef int (*regapi_lookup_f)(struct sip_msg *msg, char *table);
int regapi_lookup(struct sip_msg *msg, char *table);
+typedef int (*regapi_lookup_uri_f)(struct sip_msg *msg, char *table, str *uri);
+int regapi_lookup_uri(struct sip_msg *msg, char *table, str *uri);
+
/**
* @brief REGISTRAR API structure
*/
@@ -47,6 +50,7 @@ typedef struct registrar_api {
regapi_save_f save;
regapi_save_uri_f save_uri;
regapi_lookup_f lookup;
+ regapi_lookup_uri_f lookup_uri;
regapi_lookup_f registered;
} registrar_api_t;