Module: sip-router
Branch: master
Commit: e6201dd5b6d49183567cbd6df47564f65b3d435c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e6201dd…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: Sun Jan 23 12:51:07 2011 -0500
modules_k/textops: update docs for is_audio_on_hold()
---
modules_k/textops/doc/textops_admin.xml | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/modules_k/textops/doc/textops_admin.xml b/modules_k/textops/doc/textops_admin.xml
index 0c8ea28..b978f36 100644
--- a/modules_k/textops/doc/textops_admin.xml
+++ b/modules_k/textops/doc/textops_admin.xml
@@ -1131,6 +1131,31 @@ if(has_body("application/sdp"))
<section>
<title>
+ <function moreinfo="none">is_audio_on_hold()</function>
+ </title>
+ <para>
+ The function returns <emphasis>true</emphasis> if the SIP message
+ has a body attached and at least one audio stream in on hold.
+ </para>
+ <para>
+ This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
+ FAILURE_ROUTE and BRANCH_ROUTE.
+ </para>
+ <example>
+ <title><function>is_audio_on_hold</function> usage</title>
+ <programlisting format="linespecific">
+...
+if(is_audio_on_hold())
+{
+ # do interesting stuff here
+}
+...
+</programlisting>
+ </example>
+ </section>
+
+ <section>
+ <title>
<function moreinfo="none">is_privacy(privacy_type)</function>
</title>
<para>
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: eee864b9cea1451ee1d3a6b6e651ad9ca6dc1350
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=eee864b…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Jan 20 13:23:56 2011 +0200
Further refactoring of usrloc and p_usrloc
---
modules_k/p_usrloc/udomain.h | 32 +++++++++++++++++++++++--
modules_k/p_usrloc/urecord.h | 1 +
modules_k/usrloc/dlist.h | 49 ++++++++++++++++++++++++++++++++++++++
modules_k/usrloc/ucontact.h | 11 ++++++++
modules_k/usrloc/udomain.h | 42 +++++++++++++++++++++++++++++++++
modules_k/usrloc/urecord.h | 53 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 185 insertions(+), 3 deletions(-)
diff --git a/modules_k/p_usrloc/udomain.h b/modules_k/p_usrloc/udomain.h
index e6ce0ef..7524b37 100644
--- a/modules_k/p_usrloc/udomain.h
+++ b/modules_k/p_usrloc/udomain.h
@@ -90,9 +90,6 @@ void free_udomain(udomain_t* _d);
void print_udomain(FILE* _f, udomain_t* _d);
-
-
-
/*!
* \brief Timer function to cleanup expired contacts, DB_ONLY db_mode
* \param _d cleaned domain
@@ -158,5 +155,34 @@ void unlock_udomain(udomain_t* _d, str *_aor);
+/*!
+ * \brief Create and insert a new record
+ * \param _d domain to insert the new record
+ * \param _aor address of the record
+ * \param _r new created record
+ * \return return 0 on success, -1 on failure
+ */
+int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+
+/*!
+ * \brief Obtain a urecord pointer if the urecord exists in domain
+ * \param _d domain to search the record
+ * \param _aor address of record
+ * \param _r new created record
+ * \return 0 if a record was found, 1 if nothing could be found
+ */
+int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+
+/*!
+ * \brief Delete a urecord from domain
+ * \param _d domain where the record should be deleted
+ * \param _aor address of record
+ * \param _r deleted record
+ * \return 0 on success, -1 if the record could not be deleted
+ */
+int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
+
#endif
diff --git a/modules_k/p_usrloc/urecord.h b/modules_k/p_usrloc/urecord.h
index 34442d8..14bafc6 100644
--- a/modules_k/p_usrloc/urecord.h
+++ b/modules_k/p_usrloc/urecord.h
@@ -163,4 +163,5 @@ int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
void release_urecord(urecord_t* _r);
+
#endif
diff --git a/modules_k/usrloc/dlist.h b/modules_k/usrloc/dlist.h
index 5602c67..87692df 100644
--- a/modules_k/usrloc/dlist.h
+++ b/modules_k/usrloc/dlist.h
@@ -54,6 +54,19 @@ extern dlist_t* root;
/*!
+ * \brief Registers a new domain with usrloc
+ *
+ * Registers a new domain with usrloc. If the domain exists,
+ * a pointer to existing structure will be returned, otherwise
+ * a new domain will be created
+ * \param _n domain name
+ * \param _d new created domain
+ * \return 0 on success, -1 on failure
+ */
+int register_udomain(const char* _n, udomain_t** _d);
+
+
+/*!
* \brief Free all allocated memory for domains
*/
void free_all_udomains(void);
@@ -74,6 +87,42 @@ int synchronize_all_udomains(void);
/*!
+ * \brief Get all contacts from the usrloc, in partitions if wanted
+ *
+ * Return list of all contacts for all currently registered
+ * users in all domains. The caller must provide buffer of
+ * sufficient length for fitting all those contacts. In the
+ * case when buffer was exhausted, the function returns
+ * estimated amount of additional space needed, in this
+ * case the caller is expected to repeat the call using
+ * this value as the hint.
+ *
+ * Information is packed into the buffer as follows:
+ *
+ * +------------+----------+-----+------+-----+
+ * |contact1.len|contact1.s|sock1|flags1|path1|
+ * +------------+----------+-----+------+-----+
+ * |contact2.len|contact2.s|sock2|flags2|path1|
+ * +------------+----------+-----+------+-----+
+ * |..........................................|
+ * +------------+----------+-----+------+-----+
+ * |contactN.len|contactN.s|sockN|flagsN|pathN|
+ * +------------+----------+-----+------+-----+
+ * |000000000000|
+ * +------------+
+ *
+ * \param buf target buffer
+ * \param len length of buffer
+ * \param flags contact flags
+ * \param part_idx part index
+ * \param part_max maximal part
+ * \return 0 on success, positive if buffer size was not sufficient, negative on failure
+ */
+int get_all_ucontacts(void *, int, unsigned int,
+ unsigned int part_idx, unsigned int part_max);
+
+
+/*!
* \brief Loops through all domains summing up the number of users
* \return the number of users, could be zero
*/
diff --git a/modules_k/usrloc/ucontact.h b/modules_k/usrloc/ucontact.h
index 9686a07..6a8a4df 100644
--- a/modules_k/usrloc/ucontact.h
+++ b/modules_k/usrloc/ucontact.h
@@ -39,6 +39,7 @@
#include <stdio.h>
#include "usrloc.h"
+
/*! \brief ancient time used for marking the contacts forced to expired */
#define UL_EXPIRED_TIME 10
@@ -137,5 +138,15 @@ int db_update_ucontact(ucontact_t* _c);
*/
int db_delete_ucontact(ucontact_t* _c);
+/* ====== Module interface ====== */
+
+/*!
+ * \brief Update ucontact with new values
+ * \param _r record the contact belongs to
+ * \param _c updated contact
+ * \param _ci new contact informations
+ * \return 0 on success, -1 on failure
+ */
+int update_ucontact(struct urecord* _r, ucontact_t* _c, ucontact_info_t* _ci);
#endif
diff --git a/modules_k/usrloc/udomain.h b/modules_k/usrloc/udomain.h
index 62509c6..b10df5d 100644
--- a/modules_k/usrloc/udomain.h
+++ b/modules_k/usrloc/udomain.h
@@ -138,6 +138,21 @@ int mem_insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
*/
void mem_delete_urecord(udomain_t* _d, struct urecord* _r);
+
+/*! \brief
+ * Timer handler for given domain
+ */
+void lock_udomain(udomain_t* _d, str *_aor);
+
+
+/*!
+ * \brief Release lock for a domain
+ * \param _d domain
+ * \param _aor address of record, uses as hash source for the lock slot
+ */
+void unlock_udomain(udomain_t* _d, str *_aor);
+
+
/*!
* \brief Get lock for a slot
* \param _d domain
@@ -155,7 +170,34 @@ void unlock_ulslot(udomain_t* _d, int i);
/* ===== module interface ======= */
+/*!
+ * \brief Create and insert a new record
+ * \param _d domain to insert the new record
+ * \param _aor address of the record
+ * \param _r new created record
+ * \return return 0 on success, -1 on failure
+ */
+int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+
+/*!
+ * \brief Obtain a urecord pointer if the urecord exists in domain
+ * \param _d domain to search the record
+ * \param _aor address of record
+ * \param _r new created record
+ * \return 0 if a record was found, 1 if nothing could be found
+ */
+int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
+
+/*!
+ * \brief Delete a urecord from domain
+ * \param _d domain where the record should be deleted
+ * \param _aor address of record
+ * \param _r deleted record
+ * \return 0 on success, -1 if the record could not be deleted
+ */
+int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
#endif
diff --git a/modules_k/usrloc/urecord.h b/modules_k/usrloc/urecord.h
index 93231d0..5245b2a 100644
--- a/modules_k/usrloc/urecord.h
+++ b/modules_k/usrloc/urecord.h
@@ -38,6 +38,11 @@
#include "ucontact.h"
#include "usrloc.h"
+struct hslot; /*!< Hash table slot */
+
+
+
+
/*!
* \brief Create and initialize new record structure
* \param _dom domain name
@@ -114,6 +119,54 @@ void timer_urecord(urecord_t* _r);
int db_delete_urecord(urecord_t* _r);
+/* ===== Module interface ======== */
+
+
+/*!
+ * \brief Release urecord previously obtained through get_urecord
+ * \warning Failing to calls this function after get_urecord will
+ * result in a memory leak when the DB_ONLY mode is used. When
+ * the records is later deleted, e.g. with delete_urecord, then
+ * its not necessary, as this function already releases the record.
+ * \param _r released record
+ */
+void release_urecord(urecord_t* _r);
+
+/*!
+ * \brief Create and insert new contact into urecord
+ * \param _r record into the new contact should be inserted
+ * \param _contact contact string
+ * \param _ci contact information
+ * \param _c new created contact
+ * \return 0 on success, -1 on failure
+ */
+int insert_ucontact(urecord_t* _r, str* _contact,
+ ucontact_info_t* _ci, ucontact_t** _c);
+
+
+/*!
+ * \brief Delete ucontact from urecord
+ * \param _r record where the contact belongs to
+ * \param _c deleted contact
+ * \return 0 on success, -1 on failure
+ */
+int delete_ucontact(urecord_t* _r, struct ucontact* _c);
+
+
+/*!
+ * \brief Get pointer to ucontact with given contact
+ * \param _r record where to search the contacts
+ * \param _c contact string
+ * \param _callid callid
+ * \param _path path
+ * \param _cseq CSEQ number
+ * \param _co found contact
+ * \return 0 - found, 1 - not found, -1 - invalid found,
+ * -2 - found, but to be skipped (same cseq)
+ */
+int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
+ int _cseq,
+ struct ucontact** _co);
#endif
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: 75d2b1e18a265501729c0186a918b865b44af79b
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=75d2b1e…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Jan 20 12:06:04 2011 +0200
modules_k/usrloc Further refactoring of code
---
modules_k/usrloc/ucontact.h | 1 -
modules_k/usrloc/ul_callback.h | 5 +-
modules_k/usrloc/usrloc.c | 4 +
modules_k/usrloc/usrloc.h | 135 ----------------------------------------
4 files changed, 7 insertions(+), 138 deletions(-)
diff --git a/modules_k/usrloc/ucontact.h b/modules_k/usrloc/ucontact.h
index 8ef3491..9686a07 100644
--- a/modules_k/usrloc/ucontact.h
+++ b/modules_k/usrloc/ucontact.h
@@ -39,7 +39,6 @@
#include <stdio.h>
#include "usrloc.h"
-
/*! \brief ancient time used for marking the contacts forced to expired */
#define UL_EXPIRED_TIME 10
diff --git a/modules_k/usrloc/ul_callback.h b/modules_k/usrloc/ul_callback.h
index bb322cb..dadce6d 100644
--- a/modules_k/usrloc/ul_callback.h
+++ b/modules_k/usrloc/ul_callback.h
@@ -32,6 +32,7 @@
#ifndef _UL_CALLBACKS_H
#define _UL_CALLBACKS_H
+#include "../../dprint.h"
/* forward declaration for ucontact_t */
struct ucontact;
@@ -84,8 +85,8 @@ static inline void run_ul_callbacks( int type , struct ucontact *c)
for (cbp=ulcb_list->first; cbp; cbp=cbp->next) {
if(cbp->types&type) {
- /*LM_DBG("contact=%p, callback type %d/%d, id %d entered\n",
- c, type, cbp->types, cbp->id );*/
+ LM_DBG("contact=%p, callback type %d/%d, id %d entered\n",
+ c, type, cbp->types, cbp->id );
cbp->callback( c, type, cbp->param );
}
}
diff --git a/modules_k/usrloc/usrloc.c b/modules_k/usrloc/usrloc.c
index f5e1dde..b7a4283 100644
--- a/modules_k/usrloc/usrloc.c
+++ b/modules_k/usrloc/usrloc.c
@@ -34,6 +34,10 @@
*/
#include "usrloc.h"
+#include "dlist.h"
+#include "urecord.h"
+#include "ucontact.h"
+#include "udomain.h"
#include "../../sr_module.h"
#include "ul_mod.h"
diff --git a/modules_k/usrloc/usrloc.h b/modules_k/usrloc/usrloc.h
index f57387e..827e568 100644
--- a/modules_k/usrloc/usrloc.h
+++ b/modules_k/usrloc/usrloc.h
@@ -124,168 +124,33 @@ typedef struct urecord {
struct urecord* next; /*!< Previous item in the hash entry */
} urecord_t;
-/*!
- * \brief Create and insert a new record
- * \param _d domain to insert the new record
- * \param _aor address of the record
- * \param _r new created record
- * \return return 0 on success, -1 on failure
- */
typedef int (*insert_urecord_t)(struct udomain* _d, str* _aor, struct urecord** _r);
-int insert_urecord(struct udomain* _d, str* _aor, struct urecord** _r);
-
-/*!
- * \brief Obtain a urecord pointer if the urecord exists in domain
- * \param _d domain to search the record
- * \param _aor address of record
- * \param _r new created record
- * \return 0 if a record was found, 1 if nothing could be found
- */
typedef int (*get_urecord_t)(struct udomain* _d, str* _aor, struct urecord** _r);
-int get_urecord(struct udomain* _d, str* _aor, struct urecord** _r);
-
-/*!
- * \brief Delete a urecord from domain
- * \param _d domain where the record should be deleted
- * \param _aor address of record
- * \param _r deleted record
- * \return 0 on success, -1 if the record could not be deleted
- */
typedef int (*delete_urecord_t)(struct udomain* _d, str* _aor, struct urecord* _r);
-int delete_urecord(struct udomain* _d, str* _aor, struct urecord* _r);
-
-/*!
- * \brief Update ucontact with new values
- * \param _r record the contact belongs to
- * \param _c updated contact
- * \param _ci new contact informations
- * \return 0 on success, -1 on failure
- */
typedef int (*update_ucontact_t)(struct urecord* _r, struct ucontact* _c,
struct ucontact_info* _ci);
-int update_ucontact(struct urecord* _r, struct ucontact* _c, struct ucontact_info* _ci);
-
-/*!
- * \brief Release urecord previously obtained through get_urecord
- * \warning Failing to calls this function after get_urecord will
- * result in a memory leak when the DB_ONLY mode is used. When
- * the records is later deleted, e.g. with delete_urecord, then
- * its not necessary, as this function already releases the record.
- * \param _r released record
- */
typedef void (*release_urecord_t)(struct urecord* _r);
-void release_urecord(struct urecord* _r);
-
-/*!
- * \brief Create and insert new contact into urecord
- * \param _r record into the new contact should be inserted
- * \param _contact contact string
- * \param _ci contact information
- * \param _c new created contact
- * \return 0 on success, -1 on failure
- */
typedef int (*insert_ucontact_t)(struct urecord* _r, str* _contact,
struct ucontact_info* _ci, struct ucontact** _c);
-int insert_ucontact(struct urecord* _r, str* _contact,
- struct ucontact_info* _ci, struct ucontact** _c);
-
-/*!
- * \brief Delete ucontact from urecord
- * \param _r record where the contact belongs to
- * \param _c deleted contact
- * \return 0 on success, -1 on failure
- */
typedef int (*delete_ucontact_t)(struct urecord* _r, struct ucontact* _c);
-int delete_ucontact(struct urecord* _r, struct ucontact* _c);
-
-/*!
- * \brief Get pointer to ucontact with given contact
- * \param _r record where to search the contacts
- * \param _c contact string
- * \param _callid callid
- * \param _path path
- * \param _cseq CSEQ number
- * \param _co found contact
- * \return 0 - found, 1 - not found, -1 - invalid found,
- * -2 - found, but to be skipped (same cseq)
- */
typedef int (*get_ucontact_t)(struct urecord* _r, str* _c, str* _callid,
str* _path, int _cseq,
struct ucontact** _co);
-int get_ucontact(struct urecord* _r, str* _c, str* _callid, str* _path,
- int _cseq,
- struct ucontact** _co);
-/*! \brief
- * Timer handler for given domain
- */
typedef void (*lock_udomain_t)(struct udomain* _d, str *_aor);
-void lock_udomain(struct udomain* _d, str *_aor);
-
-/*!
- * \brief Release lock for a domain
- * \param _d domain
- * \param _aor address of record, uses as hash source for the lock slot
- */
typedef void (*unlock_udomain_t)(struct udomain* _d, str *_aor);
-void unlock_udomain(struct udomain* _d, str *_aor);
-/*!
- * \brief Registers a new domain with usrloc
- *
- * Registers a new domain with usrloc. If the domain exists,
- * a pointer to existing structure will be returned, otherwise
- * a new domain will be created
- * \param _n domain name
- * \param _d new created domain
- * \return 0 on success, -1 on failure
- */
typedef int (*register_udomain_t)(const char* _n, struct udomain** _d);
-int register_udomain(const char* _n, struct udomain** _d);
-/*!
- * \brief Get all contacts from the usrloc, in partitions if wanted
- *
- * Return list of all contacts for all currently registered
- * users in all domains. The caller must provide buffer of
- * sufficient length for fitting all those contacts. In the
- * case when buffer was exhausted, the function returns
- * estimated amount of additional space needed, in this
- * case the caller is expected to repeat the call using
- * this value as the hint.
- *
- * Information is packed into the buffer as follows:
- *
- * +------------+----------+-----+------+-----+
- * |contact1.len|contact1.s|sock1|flags1|path1|
- * +------------+----------+-----+------+-----+
- * |contact2.len|contact2.s|sock2|flags2|path1|
- * +------------+----------+-----+------+-----+
- * |..........................................|
- * +------------+----------+-----+------+-----+
- * |contactN.len|contactN.s|sockN|flagsN|pathN|
- * +------------+----------+-----+------+-----+
- * |000000000000|
- * +------------+
- *
- * \param buf target buffer
- * \param len length of buffer
- * \param flags contact flags
- * \param part_idx part index
- * \param part_max maximal part
- * \return 0 on success, positive if buffer size was not sufficient, negative on failure
- */
typedef int (*get_all_ucontacts_t) (void* buf, int len, unsigned int flags,
unsigned int part_idx, unsigned int part_max);
-int get_all_ucontacts(void *, int, unsigned int,
- unsigned int part_idx, unsigned int part_max);
/*! usrloc API export structure */
typedef struct usrloc_api {
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: a03b115c72508aed5578bd10b3c96d196fc6d693
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a03b115…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Thu Jan 20 12:08:34 2011 +0200
module_k/p_usrloc Refactoring of p_usrloc (it uses the usrloc API include)
---
modules_k/p_usrloc/dlist.h | 55 +++++++++++++++++++++++++++++++++++++++++
modules_k/p_usrloc/ucontact.c | 2 +-
modules_k/p_usrloc/ucontact.h | 4 +--
modules_k/p_usrloc/udomain.h | 15 +++++++++++
modules_k/p_usrloc/urecord.h | 48 +++++++++++++++++++++++++++++++++++
modules_k/p_usrloc/usrloc.c | 4 +++
6 files changed, 124 insertions(+), 4 deletions(-)
diff --git a/modules_k/p_usrloc/dlist.h b/modules_k/p_usrloc/dlist.h
index 97bbbb3..8ba4b92 100644
--- a/modules_k/p_usrloc/dlist.h
+++ b/modules_k/p_usrloc/dlist.h
@@ -70,5 +70,60 @@ int synchronize_all_udomains(void);
unsigned long get_number_of_users(void);
+/*!
+ * \brief Registers a new domain with usrloc
+ *
+ * Registers a new domain with usrloc. If the domain exists,
+ * a pointer to existing structure will be returned, otherwise
+ * a new domain will be created
+ * \param _n domain name
+ * \param _d new created domain
+ * \return 0 on success, -1 on failure
+ */
+int register_udomain(const char* _n, udomain_t** _d);
+
+/*!
+ * \brief Get all contacts from the usrloc, in partitions if wanted
+ *
+ * Return list of all contacts for all currently registered
+ * users in all domains. The caller must provide buffer of
+ * sufficient length for fitting all those contacts. In the
+ * case when buffer was exhausted, the function returns
+ * estimated amount of additional space needed, in this
+ * case the caller is expected to repeat the call using
+ * this value as the hint.
+ *
+ * Information is packed into the buffer as follows:
+ *
+ * +------------+----------+-----+------+-----+
+ * |contact1.len|contact1.s|sock1|flags1|path1|
+ * +------------+----------+-----+------+-----+
+ * |contact2.len|contact2.s|sock2|flags2|path1|
+ * +------------+----------+-----+------+-----+
+ * |..........................................|
+ * +------------+----------+-----+------+-----+
+ * |contactN.len|contactN.s|sockN|flagsN|pathN|
+ * +------------+----------+-----+------+-----+
+ * |000000000000|
+ * +------------+
+ *
+ * \param buf target buffer
+ * \param len length of buffer
+ * \param flags contact flags
+ * \param part_idx part index
+ * \param part_max maximal part
+ * \return 0 on success, positive if buffer size was not sufficient, negative on failure
+ */
+int get_all_ucontacts(void *, int, unsigned int,
+ unsigned int part_idx, unsigned int part_max);
+
+/*!
+ * \brief Find a particular domain, small wrapper around find_dlist
+ * \param _d domain name
+ * \param _p pointer to domain if found
+ * \return 1 if domain was found, 0 otherwise
+ */
+int find_domain(str* _d, udomain_t** _p);
+
#endif
diff --git a/modules_k/p_usrloc/ucontact.c b/modules_k/p_usrloc/ucontact.c
index b97f0f1..f7c0b9e 100644
--- a/modules_k/p_usrloc/ucontact.c
+++ b/modules_k/p_usrloc/ucontact.c
@@ -46,7 +46,7 @@
#include "urecord.h"
#include "ucontact.h"
#include "ul_db_layer.h"
-
+#include "dlist.h"
/*!
* \brief Create a new contact structure
diff --git a/modules_k/p_usrloc/ucontact.h b/modules_k/p_usrloc/ucontact.h
index 3dcb126..b8cf662 100644
--- a/modules_k/p_usrloc/ucontact.h
+++ b/modules_k/p_usrloc/ucontact.h
@@ -45,9 +45,6 @@
/*! \brief ancient time used for marking the contacts forced to expired */
#define UL_EXPIRED_TIME 10
-/*! \brief Valid contact is a contact that either didn't expire yet or is permanent */
-#define VALID_CONTACT(c, t) ((c->expires>t) || (c->expires==0))
-
/*!
* \brief Create a new contact structure
@@ -149,4 +146,5 @@ int db_delete_ucontact(ucontact_t* _c);
struct urecord;
+
#endif
diff --git a/modules_k/p_usrloc/udomain.h b/modules_k/p_usrloc/udomain.h
index 6a9a7a8..e6ce0ef 100644
--- a/modules_k/p_usrloc/udomain.h
+++ b/modules_k/p_usrloc/udomain.h
@@ -40,6 +40,7 @@
#include "../../locking.h"
#include "../../str.h"
#include "../../lib/srdb1/db.h"
+#include "../usrloc/usrloc.h"
#include "urecord.h"
#include "hslot.h"
@@ -142,6 +143,20 @@ void unlock_ulslot(udomain_t* _d, int i);
/* ===== module interface ======= */
+/*! \brief
+ * Timer handler for given domain
+ */
+void lock_udomain(udomain_t* _d, str *_aor);
+
+
+/*!
+ * \brief Release lock for a domain
+ * \param _d domain
+ * \param _aor address of record, uses as hash source for the lock slot
+ */
+void unlock_udomain(udomain_t* _d, str *_aor);
+
+
#endif
diff --git a/modules_k/p_usrloc/urecord.h b/modules_k/p_usrloc/urecord.h
index dfabddc..34442d8 100644
--- a/modules_k/p_usrloc/urecord.h
+++ b/modules_k/p_usrloc/urecord.h
@@ -113,6 +113,54 @@ void timer_urecord(urecord_t* _r);
*/
int db_delete_urecord(struct udomain* _d, urecord_t* _r);
+/*!
+ * \brief Create and insert new contact into urecord
+ * \param _r record into the new contact should be inserted
+ * \param _contact contact string
+ * \param _ci contact information
+ * \param _c new created contact
+ * \return 0 on success, -1 on failure
+ */
+int insert_ucontact(urecord_t* _r, str* _contact,
+ ucontact_info_t* _ci, ucontact_t** _c);
+
+
+/*!
+ * \brief Delete ucontact from urecord
+ * \param _r record where the contact belongs to
+ * \param _c deleted contact
+ * \return 0 on success, -1 on failure
+ */
+int delete_ucontact(urecord_t* _r, struct ucontact* _c);
+
+
+/*!
+ * \brief Get pointer to ucontact with given contact
+ * \param _r record where to search the contacts
+ * \param _c contact string
+ * \param _callid callid
+ * \param _path path
+ * \param _cseq CSEQ number
+ * \param _co found contact
+ * \return 0 - found, 1 - not found, -1 - invalid found,
+ * -2 - found, but to be skipped (same cseq)
+ */
+int get_ucontact(urecord_t* _r, str* _c, str* _callid, str* _path,
+ int _cseq,
+ struct ucontact** _co);
+
+/* ===== Module interface ======== */
+
+
+/*!
+ * \brief Release urecord previously obtained through get_urecord
+ * \warning Failing to calls this function after get_urecord will
+ * result in a memory leak when the DB_ONLY mode is used. When
+ * the records is later deleted, e.g. with delete_urecord, then
+ * its not necessary, as this function already releases the record.
+ * \param _r released record
+ */
+void release_urecord(urecord_t* _r);
#endif
diff --git a/modules_k/p_usrloc/usrloc.c b/modules_k/p_usrloc/usrloc.c
index b74632f..3a1b4fc 100644
--- a/modules_k/p_usrloc/usrloc.c
+++ b/modules_k/p_usrloc/usrloc.c
@@ -36,6 +36,10 @@
#include "../usrloc/usrloc.h"
#include "../../sr_module.h"
#include "p_usrloc_mod.h"
+#include "ucontact.h"
+#include "udomain.h"
+#include "dlist.h"
+#include "urecord.h"
/*! nat branch flag */
extern unsigned int nat_bflag;
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: 9b75b8d0da994d3f27a2b756fe944c3f1cdccfd8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9b75b8d…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Tue Jan 18 15:06:17 2011 +0200
modules/usrloc Refactoring of usrloc: Moved interface declaration/definitions to one common header (usrloc.h)
Before, mostly every header was included when using usrloc, thus the private parts were not hidden to user.
Added a udomain_head_t data type which contains the first member of the udomain_t structure (this structure is different
between p_usrloc and usrloc)
---
modules_k/usrloc/dlist.h | 56 +--------
modules_k/usrloc/ucontact.h | 79 +------------
modules_k/usrloc/udomain.h | 53 +--------
modules_k/usrloc/ul_callback.h | 11 +-
modules_k/usrloc/ul_mod.h | 4 -
modules_k/usrloc/urecord.h | 76 +------------
modules_k/usrloc/usrloc.h | 262 +++++++++++++++++++++++++++++++++++++++-
7 files changed, 269 insertions(+), 272 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=9b7…
Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: 0ea2d47311f4655714853a567bdd07609af4575f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0ea2d47…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Tue Jan 18 15:03:29 2011 +0200
modules/usrloc Some refactoring of usrloc to allow both usrloc and p_usrloc to coexist and share structs, code etc.
First commit contains changes to code (.c files)
Module interface (exported to registrar) is now in a common file "usrloc.h" which is used by every user of user location modules.
P_usrloc also uses that header so changes to usrloc also affect it(changes to interface)
---
modules_k/p_usrloc/usrloc.h | 69 ----------------------------------------
modules_k/usrloc/ucontact.c | 2 +-
modules_k/usrloc/udomain.c | 2 +-
modules_k/usrloc/ul_callback.c | 2 +-
modules_k/usrloc/ul_mi.c | 2 +-
modules_k/usrloc/urecord.c | 2 +-
6 files changed, 5 insertions(+), 74 deletions(-)
diff --git a/modules_k/p_usrloc/usrloc.h b/modules_k/p_usrloc/usrloc.h
deleted file mode 100644
index 5077b52..0000000
--- a/modules_k/p_usrloc/usrloc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * $Id: usrloc.h 5193 2008-11-13 10:21:53Z henningw $
- *
- * Copyright (C) 2001-2003 FhG Fokus
- *
- * This file is part of Kamailio, a free SIP server.
- *
- * Kamailio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * Kamailio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*! \file
- * \brief USRLOC - module API exports interface
- * \ingroup usrloc
- */
-
-#ifndef USRLOC_H
-#define USRLOC_H
-
-
-#include "dlist.h"
-#include "udomain.h"
-#include "urecord.h"
-#include "ucontact.h"
-#include "ul_callback.h"
-
-
-/*! usrloc API export structure */
-typedef struct usrloc_api {
- int use_domain; /*! use_domain module parameter */
- int db_mode; /*! db_mode module parameter */
- unsigned int nat_flag; /*! nat_flag module parameter */
-
- register_udomain_t register_udomain;
- get_all_ucontacts_t get_all_ucontacts;
-
- insert_urecord_t insert_urecord;
- delete_urecord_t delete_urecord;
- get_urecord_t get_urecord;
- lock_udomain_t lock_udomain;
- unlock_udomain_t unlock_udomain;
-
- release_urecord_t release_urecord;
- insert_ucontact_t insert_ucontact;
- delete_ucontact_t delete_ucontact;
- get_ucontact_t get_ucontact;
-
- update_ucontact_t update_ucontact;
-
- register_ulcb_t register_ulcb;
-} usrloc_api_t;
-
-
-/*! usrloc API export bind function */
-typedef int (*bind_usrloc_t)(usrloc_api_t* api);
-
-
-#endif
diff --git a/modules_k/usrloc/ucontact.c b/modules_k/usrloc/ucontact.c
index 170ce00..3f9639e 100644
--- a/modules_k/usrloc/ucontact.c
+++ b/modules_k/usrloc/ucontact.c
@@ -45,7 +45,7 @@
#include "ul_callback.h"
#include "urecord.h"
#include "ucontact.h"
-
+#include "usrloc.h"
/*!
* \brief Create a new contact structure
diff --git a/modules_k/usrloc/udomain.c b/modules_k/usrloc/udomain.c
index 8f21e0f..58c89d7 100644
--- a/modules_k/usrloc/udomain.c
+++ b/modules_k/usrloc/udomain.c
@@ -46,7 +46,7 @@
#include "../../lib/kcore/hash_func.h"
#include "ul_mod.h" /* usrloc module parameters */
#include "utime.h"
-
+#include "usrloc.h"
#ifdef STATISTICS
static char *build_stat_name( str* domain, char *var_name)
diff --git a/modules_k/usrloc/ul_callback.c b/modules_k/usrloc/ul_callback.c
index 91c4d5e..0519919 100644
--- a/modules_k/usrloc/ul_callback.c
+++ b/modules_k/usrloc/ul_callback.c
@@ -38,7 +38,7 @@
#include "../../error.h"
#include "../../mem/shm_mem.h"
#include "ul_callback.h"
-
+#include "ucontact.h"
struct ulcb_head_list* ulcb_list = 0;
diff --git a/modules_k/usrloc/ul_mi.c b/modules_k/usrloc/ul_mi.c
index bb7d50a..62d8017 100644
--- a/modules_k/usrloc/ul_mi.c
+++ b/modules_k/usrloc/ul_mi.c
@@ -44,7 +44,7 @@
#include "udomain.h"
#include "utime.h"
#include "ul_mod.h"
-
+#include "usrloc.h"
/*! CSEQ nr used */
#define MI_UL_CSEQ 1
diff --git a/modules_k/usrloc/urecord.c b/modules_k/usrloc/urecord.c
index e0ff894..5ce2813 100644
--- a/modules_k/usrloc/urecord.c
+++ b/modules_k/usrloc/urecord.c
@@ -43,7 +43,7 @@
#include "ul_mod.h"
#include "utime.h"
#include "ul_callback.h"
-
+#include "usrloc.h"
/*! contact matching mode */
int matching_mode = CONTACT_ONLY;
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#97 - pooling of libsrdb1 doesnt restrict database connection to 1 thread and gives issues with postgresql
User who did this - Henning Westerholt (henningw)
Reason for closing: Fixed
Additional comments about closing: Hi Robert,
i think this is now in the git master, thanks to the work of Daniel. Please re-open if you still see issues.
Henning
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=97
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#112 - typo in RLS (k) module Content-Type
User who did this - Henning Westerholt (henningw)
Reason for closing: Fixed
Additional comments about closing: Thanks, fixed in master and stable branches.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=112
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
Henning Westerholt has taken ownership of the following task:
FS#112 - typo in RLS (k) module Content-Type
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=112
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Klaus Darilion (klaus3000)
Attached to Project - sip-router
Summary - typo in RLS (k) module Content-Type
Task Type - Bug Report
Category - Core
Status - Assigned
Assigned To - Andrei Pelinescu-Onciul
Operating System - All
Severity - Low
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - # rgrep UTF-8r *
modules_k/rls/notify.c: "Content-Type: application/rlmi+xml;charset=\"UTF-8r\"\r\n");
I guess it should be "UTF-8" instead of "UTF-8r"
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=112
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A user has added themself to the list of users assigned to this task.
FS#112 - typo in RLS (k) module Content-Type
User who did this - Klaus Darilion (klaus3000)
http://sip-router.org/tracker/index.php?do=details&task_id=112
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Module: sip-router
Branch: master
Commit: efc3f1f5050ea2302952158098d61b457a7c8df1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=efc3f1f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sat Jan 15 16:29:02 2011 +0100
xhttp: exported xhttp reply via inter-module api
---
modules/xhttp/api.h | 58 +++++++++++++++++++++++++++++++++++++++++++++
modules/xhttp/xhttp_mod.c | 17 +++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)
diff --git a/modules/xhttp/api.h b/modules/xhttp/api.h
new file mode 100644
index 0000000..0fc7ee5
--- /dev/null
+++ b/modules/xhttp/api.h
@@ -0,0 +1,58 @@
+/**
+ * $Id$
+ *
+ * Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com)
+ *
+ * This file is part of kamailio, a free SIP server.
+ *
+ * kamailio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * kamailio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _XHTTP_API_H_
+#define _XHTTP_API_H_
+
+#include "../../sr_module.h"
+
+typedef int (*xhttp_reply_f)(sip_msg_t *msg, int code, str *reason,
+ str *ctype, str *body);
+
+typedef struct xhttp_api {
+ xhttp_reply_f reply;
+} xhttp_api_t;
+
+typedef int (*bind_xhttp_f)(xhttp_api_t* api);
+int bind_xhttp(xhttp_api_t* api);
+
+/**
+ * @brief Load the XHTTP API
+ */
+static inline int xhttp_load_api(xhttp_api_t *api)
+{
+ bind_xhttp_f bindxhttp;
+
+ bindxhttp = (bind_xhttp_f)find_export("bind_xhttp", 0, 0);
+ if(bindxhttp == 0) {
+ LM_ERR("cannot find bind_xhttp\n");
+ return -1;
+ }
+ if(bindxhttp(api)<0)
+ {
+ LM_ERR("cannot bind xhttp api\n");
+ return -1;
+ }
+ return 0;
+}
+
+#endif
diff --git a/modules/xhttp/xhttp_mod.c b/modules/xhttp/xhttp_mod.c
index 1c5ff7e..23ac3c4 100644
--- a/modules/xhttp/xhttp_mod.c
+++ b/modules/xhttp/xhttp_mod.c
@@ -44,6 +44,8 @@
#include "../../mod_fix.h"
#include "../../pvar.h"
+#include "api.h"
+
MODULE_VERSION
static int xhttp_handler(sip_msg_t* msg);
@@ -69,6 +71,8 @@ sl_api_t slb;
static cmd_export_t cmds[] = {
{"xhttp_reply", (cmd_function)w_xhttp_send_reply,
4, fixup_xhttp_reply, 0, REQUEST_ROUTE},
+ {"bind_xhttp", (cmd_function)bind_xhttp,
+ 0, 0, 0, ANY_ROUTE},
{0, 0, 0, 0, 0}
};
@@ -486,4 +490,17 @@ static int fixup_xhttp_reply(void** param, int param_no)
return 0;
}
+/**
+ *
+ */
+int bind_xhttp(xhttp_api_t* api)
+{
+ if (!api) {
+ ERR("Invalid parameter value\n");
+ return -1;
+ }
+ api->reply = xhttp_send_reply;
+ return 0;
+}
+
/** @} */