summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip/include/pjsip/sip_transaction.h8
-rw-r--r--pjsip/include/pjsip/sip_ua_layer.h13
-rw-r--r--pjsip/src/pjsip/sip_transaction.c19
-rw-r--r--pjsip/src/pjsip/sip_ua_layer.c18
4 files changed, 58 insertions, 0 deletions
diff --git a/pjsip/include/pjsip/sip_transaction.h b/pjsip/include/pjsip/sip_transaction.h
index f47005e3..9550c32a 100644
--- a/pjsip/include/pjsip/sip_transaction.h
+++ b/pjsip/include/pjsip/sip_transaction.h
@@ -159,6 +159,14 @@ PJ_DECL(pjsip_module*) pjsip_tsx_layer_instance(void);
PJ_DECL(pj_status_t) pjsip_tsx_layer_destroy(void);
/**
+ * Retrieve the current number of transactions currently registered
+ * in the hash table.
+ *
+ * @return Number of transactions.
+ */
+PJ_DECL(unsigned) pjsip_tsx_layer_get_tsx_count(void);
+
+/**
* Find a transaction with the specified key. The transaction key normally
* is created by calling #pjsip_tsx_create_key() from an incoming message.
*
diff --git a/pjsip/include/pjsip/sip_ua_layer.h b/pjsip/include/pjsip/sip_ua_layer.h
index 67d3e644..19852777 100644
--- a/pjsip/include/pjsip/sip_ua_layer.h
+++ b/pjsip/include/pjsip/sip_ua_layer.h
@@ -81,6 +81,19 @@ PJ_DECL(pjsip_user_agent*) pjsip_ua_instance(void);
/**
+ * Retrieve the current number of dialog-set currently registered
+ * in the hash table. Note that dialog-set is different than dialog
+ * when the request forks. In this case, all dialogs created from
+ * the original request will belong to the same dialog set. When
+ * no forking occurs, the number of dialog sets will be equal to
+ * the number of dialogs.
+ *
+ * @return Number of dialog sets.
+ */
+PJ_DECL(pj_uint32_t) pjsip_ua_get_dlg_set_count(void);
+
+
+/**
* Find a dialog with the specified Call-ID and tags properties. This
* function may optionally lock the matching dialog instance before
* returning it back to the caller.
diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c
index dbbccf60..61f85cef 100644
--- a/pjsip/src/pjsip/sip_transaction.c
+++ b/pjsip/src/pjsip/sip_transaction.c
@@ -581,6 +581,25 @@ static void mod_tsx_layer_unregister_tsx( pjsip_transaction *tsx)
/*
+ * Retrieve the current number of transactions currently registered in
+ * the hash table.
+ */
+PJ_DEF(unsigned) pjsip_tsx_layer_get_tsx_count(void)
+{
+ unsigned count;
+
+ /* Are we registered? */
+ PJ_ASSERT_RETURN(mod_tsx_layer.endpt!=NULL, 0);
+
+ pj_mutex_lock(mod_tsx_layer.mutex);
+ count = pj_hash_count(mod_tsx_layer.htable);
+ pj_mutex_unlock(mod_tsx_layer.mutex);
+
+ return count;
+}
+
+
+/*
* Find a transaction.
*/
PJ_DEF(pjsip_transaction*) pjsip_tsx_layer_find_tsx( const pj_str_t *key,
diff --git a/pjsip/src/pjsip/sip_ua_layer.c b/pjsip/src/pjsip/sip_ua_layer.c
index c345b011..19cccbd0 100644
--- a/pjsip/src/pjsip/sip_ua_layer.c
+++ b/pjsip/src/pjsip/sip_ua_layer.c
@@ -412,6 +412,24 @@ PJ_DEF(pjsip_dialog*) pjsip_tsx_get_dlg( pjsip_transaction *tsx )
}
+/*
+ * Retrieve the current number of dialog-set currently registered
+ * in the hash table.
+ */
+PJ_DEF(unsigned) pjsip_ua_get_dlg_set_count(void)
+{
+ unsigned count;
+
+ PJ_ASSERT_RETURN(mod_ua.endpt, 0);
+
+ pj_mutex_lock(mod_ua.mutex);
+ count = pj_hash_count(mod_ua.dlg_table);
+ pj_mutex_unlock(mod_ua.mutex);
+
+ return count;
+}
+
+
/*
* Find a dialog.
*/