[sr-dev] git:master:0f55ff03: Merge pull request #397 from UserAd/master

Alexandr Dubovikov alexandr.dubovikov at gmail.com
Thu Nov 12 14:01:02 CET 2015


Module: kamailio
Branch: master
Commit: 0f55ff0351382eeb88df956e190459b73bc6ef4d
URL: https://github.com/kamailio/kamailio/commit/0f55ff0351382eeb88df956e190459b73bc6ef4d

Author: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Committer: Alexandr Dubovikov <alexandr.dubovikov at gmail.com>
Date: 2015-11-12T14:00:56+01:00

Merge pull request #397 from UserAd/master

sipcapture: add async support

---

Modified: modules/sipcapture/README
Modified: modules/sipcapture/doc/sipcapture_admin.xml
Modified: modules/sipcapture/sipcapture.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0f55ff0351382eeb88df956e190459b73bc6ef4d.diff
Patch: https://github.com/kamailio/kamailio/commit/0f55ff0351382eeb88df956e190459b73bc6ef4d.patch

---

diff --git a/modules/sipcapture/README b/modules/sipcapture/README
index 1f9fa2d..bef4af4 100644
--- a/modules/sipcapture/README
+++ b/modules/sipcapture/README
@@ -235,6 +235,10 @@ modparam("sipcapture", "hash_source", "to_user")
    when the DB driver has support for it. If no INSERT DELAYED support is
    offered by DB driver, then standard INSERT is used.
 
+   If set to 2, use ASYNC INSERT to store sip message into capture table
+   when the DB driver has support for it. If no ASYNC INSERT support is
+   offered by DB driver, then standard INSERT is used.
+
    Default value is 0 (no INSERT DELAYED).
 
    Example 1.5. db_insert_mode example
diff --git a/modules/sipcapture/doc/sipcapture_admin.xml b/modules/sipcapture/doc/sipcapture_admin.xml
index 7a835bd..2723acf 100644
--- a/modules/sipcapture/doc/sipcapture_admin.xml
+++ b/modules/sipcapture/doc/sipcapture_admin.xml
@@ -168,6 +168,11 @@ modparam("sipcapture", "hash_source", "to_user")
                 is offered by DB driver, then standard INSERT is used.
                 </para>
                 <para>
+                If set to 2, use ASYNC INSERT to store sip message into capture table
+                when the DB driver has support for it. If no ASYNC INSERT support is
+                offered by DB driver, then standard INSERT is used.
+                </para>
+                <para>
                 Default value is 0 (no INSERT DELAYED).
                 </para>
                 <example>
diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c
index 256ddc7..d373de0 100644
--- a/modules/sipcapture/sipcapture.c
+++ b/modules/sipcapture/sipcapture.c
@@ -1491,6 +1491,8 @@ static int sip_capture_store(struct _sipcapture_object *sco, str *dtable, _captu
 
 	if (db_insert_mode == 1 && c->db_funcs.insert_delayed != NULL)
 		insert = c->db_funcs.insert_delayed;
+	else if (db_insert_mode == 2 && c->db_funcs.insert_async != NULL)
+		insert = c->db_funcs.insert_async;
 	else
 		insert = c->db_funcs.insert;
 	ret = insert(c->db_con, db_keys, db_vals, NR_KEYS);
@@ -2362,6 +2364,11 @@ int receive_logging_json_msg(char * buf, unsigned int len, struct hep_generic_re
                 	LM_ERR("failed to insert delayed into database\n");
                         goto error;
                 }
+	} else if (db_insert_mode==2 && c->db_funcs.insert_async!=NULL) {
+		if (c->db_funcs.insert_async(c->db_con, db_keys, db_vals, RTCP_NR_KEYS) < 0) {
+			LM_ERR("failed to insert async into database\n");
+			goto error;
+		}
         } else if (c->db_funcs.insert(c->db_con, db_keys, db_vals, RTCP_NR_KEYS) < 0) {
 		LM_ERR("failed to insert into database\n");
                 goto error;               




More information about the sr-dev mailing list