From e0fd465da5f4fbecc5c87ebfbb4623789ad283ee Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Thu, 19 Jan 2017 09:05:14 +0100 Subject: [PATCH] New upstream version 4.4.5 --- ChangeLog | 417 ++++++++++++++++++ Makefile.defs | 2 +- autover.h | 4 +- lib/srdb1/schema/entities.xml | 2 +- lib/srdb1/schema/topos_d.xml | 6 +- lib/srdb1/schema/topos_t.xml | 8 +- modules/async/async_mod.c | 4 +- modules/db_text/dbt_api.c | 109 +++-- modules/db_text/dbt_api.h | 6 +- modules/db_text/dbt_base.c | 186 ++++++-- modules/db_text/dbt_lib.c | 62 ++- modules/db_text/dbt_lib.h | 6 +- modules/db_text/dbt_res.c | 202 ++++++++- modules/db_text/dbt_res.h | 14 +- modules/db_text/dbt_tb.c | 4 +- modules/db_text/dbtext.c | 8 +- modules/db_text/dbtext.h | 4 + modules/dialog/dlg_cseq.c | 46 +- modules/dialplan/dp_repl.c | 39 +- modules/dispatcher/README | 63 +-- modules/dispatcher/doc/dispatcher.cfg | 64 +-- modules/dispatcher/doc/dispatcher_admin.xml | 58 +-- modules/jsonrpc-s/README | 75 +++- modules/jsonrpc-s/doc/jsonrpc-s_admin.xml | 60 ++- modules/kazoo/kz_amqp.c | 4 +- modules/kazoo/kz_hash.c | 4 +- modules/lcr/README | 18 +- modules/lcr/doc/lcr_admin.xml | 8 +- modules/memcached/mcd_var.c | 4 +- modules/mohqueue/mohq.c | 4 +- modules/presence/notify.c | 42 +- modules/presence/notify.h | 2 +- modules/presence/presence.c | 2 +- modules/presence/subscribe.c | 8 +- modules/pua_dialoginfo/pua_dialoginfo.c | 9 +- modules/ratelimit/ratelimit.c | 3 - modules/rtjson/rtjson_routing.c | 22 +- modules/rtpengine/README | 8 +- modules/rtpengine/doc/rtpengine_admin.xml | 7 +- modules/rtpproxy/README | 8 +- modules/rtpproxy/doc/rtpproxy_admin.xml | 7 +- modules/sipcapture/hep.c | 16 +- modules/sipcapture/hep.h | 6 + modules/sipcapture/sipcapture.c | 12 +- modules/statsd/statsd.c | 2 +- modules/tm/t_msgbuilder.c | 55 ++- modules/tmx/README | 9 + modules/tmx/doc/tmx_admin.xml | 10 + modules/xmlrpc/xmlrpc.c | 1 + pkg/kamailio/centos/6/kamailio.spec | 2 +- pkg/kamailio/deb/debian/changelog | 6 + pkg/kamailio/deb/jessie/changelog | 6 + pkg/kamailio/deb/precise/changelog | 6 + pkg/kamailio/deb/sid/changelog | 6 + pkg/kamailio/deb/squeeze/changelog | 6 + pkg/kamailio/deb/stretch/changelog | 6 + pkg/kamailio/deb/trusty/changelog | 6 + pkg/kamailio/deb/wheezy/changelog | 6 + pkg/kamailio/deb/xenial/changelog | 6 + pkg/kamailio/fedora/17/kamailio.spec | 2 +- pkg/kamailio/oracle/el6/kamailio.spec | 2 +- pkg/kamailio/oracle/el7/kamailio.spec | 2 +- pkg/kamailio/rpm/kamailio.spec-4.1 | 2 +- pkg/kamailio/rpm/kamailio.spec.CenOS | 2 +- pkg/kamailio/rpm/kamailio.spec.SuSE | 2 +- srapi.c | 4 + srapi.h | 2 + utils/kamctl/db_berkeley/kamailio/aliases | 2 +- utils/kamctl/db_berkeley/kamailio/domain | 2 +- .../kamctl/db_berkeley/kamailio/domain_attrs | 2 +- utils/kamctl/db_berkeley/kamailio/grp | 2 +- utils/kamctl/db_berkeley/kamailio/location | 2 +- .../db_berkeley/kamailio/location_attrs | 2 +- utils/kamctl/db_berkeley/kamailio/sip_trace | 2 +- utils/kamctl/db_berkeley/kamailio/topos_d | 2 +- utils/kamctl/db_berkeley/kamailio/topos_t | 2 +- utils/kamctl/db_berkeley/kamailio/uri | 2 +- .../db_berkeley/kamailio/usr_preferences | 2 +- utils/kamctl/db_sqlite/avpops-create.sql | 2 +- utils/kamctl/db_sqlite/domain-create.sql | 4 +- utils/kamctl/db_sqlite/group-create.sql | 2 +- utils/kamctl/db_sqlite/registrar-create.sql | 2 +- utils/kamctl/db_sqlite/siptrace-create.sql | 2 +- utils/kamctl/db_sqlite/topos-create.sql | 14 +- utils/kamctl/db_sqlite/uri_db-create.sql | 2 +- utils/kamctl/db_sqlite/usrloc-create.sql | 4 +- utils/kamctl/dbtext/kamailio/topos_d | 2 +- utils/kamctl/dbtext/kamailio/topos_t | 2 +- utils/kamctl/mysql/avpops-create.sql | 2 +- utils/kamctl/mysql/domain-create.sql | 4 +- utils/kamctl/mysql/group-create.sql | 2 +- utils/kamctl/mysql/registrar-create.sql | 2 +- utils/kamctl/mysql/siptrace-create.sql | 2 +- utils/kamctl/mysql/topos-create.sql | 14 +- utils/kamctl/mysql/uri_db-create.sql | 2 +- utils/kamctl/mysql/usrloc-create.sql | 4 +- utils/kamctl/oracle/avpops-create.sql | 2 +- utils/kamctl/oracle/domain-create.sql | 4 +- utils/kamctl/oracle/group-create.sql | 2 +- utils/kamctl/oracle/registrar-create.sql | 2 +- utils/kamctl/oracle/siptrace-create.sql | 2 +- utils/kamctl/oracle/topos-create.sql | 14 +- utils/kamctl/oracle/uri_db-create.sql | 2 +- utils/kamctl/oracle/usrloc-create.sql | 4 +- utils/kamctl/postgres/avpops-create.sql | 2 +- utils/kamctl/postgres/domain-create.sql | 4 +- utils/kamctl/postgres/group-create.sql | 2 +- utils/kamctl/postgres/registrar-create.sql | 2 +- utils/kamctl/postgres/siptrace-create.sql | 2 +- utils/kamctl/postgres/topos-create.sql | 14 +- utils/kamctl/postgres/uri_db-create.sql | 2 +- utils/kamctl/postgres/usrloc-create.sql | 4 +- utils/kamctl/xhttp_pi/pi_framework.xml | 3 - 113 files changed, 1525 insertions(+), 426 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b274292c..fd914602e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,420 @@ +===================== 2017-01-18 Version 4.4.5 Released ===================== + +===================== Changes Since Version 4.4.4 =========================== + +commit d0e563e23a1e45111d8236482abd7733fb1f0a28 +Author: Daniel-Constantin Mierla +Date: Wed Jan 18 15:54:15 2017 +0100 + + Makefile.defs: version set to 4.4.5 + +commit 388b441bbff120d3643b22d6084e87c3843df6c0 +Author: Daniel-Constantin Mierla +Date: Wed Jan 18 15:15:24 2017 +0100 + + pkg: version set to 4.4.5 in deb specs + +commit 91f2bf0bba902638788ba13c77cfc57d582d73cc +Author: Daniel-Constantin Mierla +Date: Wed Jan 18 14:43:37 2017 +0100 + + pkg: set version to 4.4.5 in rpm specs + +commit fafbc5c78d8f1456a1da28fed68778377524e5e7 +Merge: 6dbadcb 18c64d2 +Author: lazedo +Date: Wed Jan 18 13:23:35 2017 +0000 + + Merge pull request #940 from kamailio/lazedo/db_text_fetch + + db_text: implement fetch and memory constraints + +commit 6dbadcbc076a78c8ace46af3215a503084eab848 +Merge: aa27479 1114fe0 +Author: lazedo +Date: Wed Jan 18 13:09:12 2017 +0000 + + Merge pull request #938 from kamailio/lazedo/kazoo-patch-44 + + kazoo: fix kz_amqp_get_zones + +commit 18c64d2c9ff1527655055f75aa22e7d68c307874 +Author: lazedo +Date: Wed Jan 18 10:00:22 2017 +0000 + + db_text: implement fetch and memory constraints + + when dealing with large db_text files, pkg_memory is not suitable for + operating the database. + + implementing fetch allows modules like presence & registrar & usrloc + to query large tables without constraints on pkg_memory. + + creates tmp tables in shared memory for query results + +commit 1114fe01abdb791379274b4f388317d600d72e38 +Author: lazedo +Date: Wed Jan 18 09:19:44 2017 +0000 + + kazoo: fix kz_amqp_add_zone + +commit c84e8c5269f4823a3dce078bee4afcf583d8ef44 +Author: lazedo +Date: Wed Jan 18 08:45:14 2017 +0000 + + kazoo: extra logs in hash lookup + +commit d4156e946e4ac99f968b8d065932a9d7570404ac +Author: lazedo +Date: Wed Jan 18 08:42:44 2017 +0000 + + kazoo: initialize pointers and return default zones + +commit aa27479ad204b6826aea03d777af9401ffd26a11 +Author: Charles Chance +Date: Tue Jan 17 22:46:57 2017 +0000 + + presence: delay aux_body_processing until after subscription has been updated + + - fixes out-of-sequence version when subs_db_mode <> 3 and fast_notify is enabled + +commit df5ef6183350d99f77087dd83950ef35466e84a1 +Author: Robert Boisvert +Date: Tue Oct 18 18:00:42 2016 -0400 + + mohqueue: fix pointer for RTP statistics error + + (cherry picked from commit dc96dfdee3c6a8e56ed9e5929e444bf8ee2f5cdd) + + Conflicts: + modules/mohqueue/mohq.c + +commit 124b6d1b1a614eb6a8cf9c7b5281b4eb038751f4 +Author: Kamailio Dev +Date: Tue Jan 17 14:16:11 2017 +0100 + + modules: readme files regenerated - dispatcher ... + +commit 3e5def30a8eeae76ac7352a5b9ba4e4a2f83fe9c +Author: Daniel-Constantin Mierla +Date: Thu Jan 12 16:34:35 2017 +0100 + + dialog: handle replies to local cancel for cseq updates + + (cherry picked from commit fab1b5dc4edc74555b965a6c305d7643629e0225) + +commit 869b496334373c7a43b6412d05d446d582be5112 +Author: Daniel-Constantin Mierla +Date: Wed Jan 11 15:22:50 2017 +0100 + + dialog: increase cseq after uac auth for local acks + + - related to GH #918, #919 + + (cherry picked from commit b75d4ca219d7185e0a73cc9132760fe05227faa4) + +commit 3c53097213f686833a953e69aca0c66c7021b441 +Author: Daniel-Constantin Mierla +Date: Tue Jan 10 14:26:27 2017 +0100 + + dialog: use uac cseq header names from cfg env + + (cherry picked from commit a1189074af0946b1a4b57dff795d0f642818ad35) + +commit 49370420039936554d87950cec85d5fd22bcdaca +Author: Daniel-Constantin Mierla +Date: Tue Jan 10 14:27:06 2017 +0100 + + tm: if transaction had an uac auth, propagate cseq headers for local ACK and CANCEL + + - related to GH #870, #918, #919 + + (cherry picked from commit 526ec68fa56cb8066db9da3a4b82f9e20aebf8c3) + +commit 693e70cdd787beccc6edb7ed1c721a2960536cc1 +Author: Daniel-Constantin Mierla +Date: Tue Jan 10 14:25:13 2017 +0100 + + core: keep names for uac cseq helper headers in cfg env + + - shared by dialog and tm for cseq updates after uac auth + + (cherry picked from commit 391dce68f712d7b38eb48188f3ae2413da0f70c6) + +commit 6dd3f8c7c0c42a25871e15a56e751d36eb305e97 +Author: Daniel-Constantin Mierla +Date: Tue Jan 17 11:54:57 2017 +0100 + + tm: generate from tag if not provided for request_within() + + - related to GH #931 + + (cherry picked from commit 96ca5c95e9380a56d886fad699a5966b7b00f5b6) + +commit 035ed5d420cfd46ab5af0aa37ec52fa1c4836fe0 +Author: Daniel-Constantin Mierla +Date: Tue Jan 17 13:40:26 2017 +0100 + + statsd: include usr_avp.h instead of usr_avp.c + + - backport of commit 344baa0bae643f235e85ad8f670f412acadab0f1 + +commit 9902d21f5f3f76ee93cd1a9a0a63c981b1c9eb88 +Author: Daniel-Constantin Mierla +Date: Mon Dec 12 18:32:34 2016 +0100 + + xmlrpc: init delayed context for rpc_fault() + + - may fix the GH #878, reported by Juha Heinanen + + (cherry picked from commit 6b3ce6376258211d317620d4d96bd3d88788b6a3) + +commit 0f7a688d8670f171be0d4f4f36c5c7a005f946a0 +Author: Guilherme C Pilon +Date: Wed Nov 30 13:41:12 2016 -0200 + + ratelimit module not working properly when FEEDBACK algorithm is used - deleting unused lines + + (cherry picked from commit 22b040c944228cfc7795f4481465dd230bff6f99) + +commit 864c29081177204d238006f6308a6b09f982d6f5 +Author: Guilherme C Pilon +Date: Wed Nov 30 13:33:44 2016 -0200 + + ratelimit module not working properly when FEEDBACK algorithm is used + + (cherry picked from commit bb768faae3367c1209e735de71ab9fdcd5d068d5) + +commit 125eab75cc5febcea92eddadca4be2a83f70d7a1 +Author: Daniel-Constantin Mierla +Date: Tue Jan 17 13:32:05 2017 +0100 + + kamctl: regenerated db creation script to update default datetime value + +commit 7de5934632c0b00387c3ebc004cd86eb677711ab +Author: Daniel-Constantin Mierla +Date: Sun Nov 27 15:38:56 2016 +0100 + + lib/srdb1 - set default datetime value to 2000-01-01 + + - 1900 is before the start of epoch and can result in unexpected + behaviour with some time related functions + + (cherry picked from commit 3efa32c9cdfc7a7bdc913724fba92f7b7a76434c) + +commit bc5d67854da18c1535abf2a54c7b8a5e21eea0cc +Author: Daniel-Constantin Mierla +Date: Mon Nov 21 12:15:54 2016 +0100 + + rtpproxy: added note about rtpproxy_manage() afte t_continue() + + - or after any other function that does suspend/resume of the + transaction + - it behaves as used in failure_route + + (cherry picked from commit e128d46e6a675b8cf5f8b584850c08cd16328af4) + +commit 7918a50ce645eb09d77e701526392a638f703cda +Author: Daniel-Constantin Mierla +Date: Mon Nov 21 12:12:10 2016 +0100 + + rtpengine: added note about rtpproxy_manage() afte t_continue() + + - or after any other function that does suspend/resume of the + transaction + - it behaves as used in failure_route + - related to GH #855 + + (cherry picked from commit 63f3e24ba2c0b9749f5c5d3268c633c629e20f89) + +commit 95ed5f71854e747b2336b8bd3b0e7f0c4b1b5a5b +Author: Daniel-Constantin Mierla +Date: Thu Nov 17 11:00:51 2016 +0100 + + tmx: added note to t_continue() docs about failure context of executed route block + + (cherry picked from commit 29635011f94a142fe5cde32558b8dfd095dd7820) + +commit 676b0bedfd045d7e7ffbfa5e5ecb137f8603e643 +Author: Mikko Lehto +Date: Mon Nov 14 15:50:54 2016 +0200 + + modules/dispatcher: fixed typo in documentation + + (cherry picked from commit 72f28fdcfd88b4f915156a992a6b1f12db79edc5) + +commit b1502145939ca9aec0ae73d93477eb5492e8536b +Author: Armen Babikyan +Date: Sat Nov 12 22:57:41 2016 -0800 + + memcached: fix deletion bug + + (cherry picked from commit c5f6cce69d7cae48f0769d89e9098a8526089055) + +commit 97d70c15a35195f0345c4143f29962b2bd0632de +Author: Daniel-Constantin Mierla +Date: Fri Nov 11 14:32:31 2016 +0100 + + jsonrpc-s: added section to show examples with rpc commands over jsonrpc + + (cherry picked from commit cdd703dcae172ad0692877addaa9fea80c06defc) + +commit 61a30f8432100118a1b9d3ed731f986900f80352 +Author: Daniel-Constantin Mierla +Date: Thu Nov 10 09:45:02 2016 +0100 + + async: updated to the name of functions for timers instead of macros + + (cherry picked from commit 60269ead4973b745f529e42c6e2c60287a040c64) + +commit 1e2dcd44036577377dce14bd71a9f238d4c7e355 +Author: Kamailio Dev +Date: Tue Jan 17 10:31:12 2017 +0100 + + modules: readme files regenerated - lcr ... + +commit 078fc57346efaa2944aa234166f21fd0a03c76bc +Author: Victor Seva +Date: Tue Jan 17 10:26:05 2017 +0100 + + lcr: fix documentation + + 'dont_strip_or_tag_flag' module parameter was renamed to + 'dont_strip_or_prefix_flag' at 8c0501bfaa27acab9721953e8c1551687c96edf2. + +commit 2250b3e562d6dbcab1477c7ed5a71daa7e462bb9 +Author: Daniel-Constantin Mierla +Date: Thu Dec 22 09:15:22 2016 +0100 + + rtjson: enforce send socket with the attribute from json + + - reported by Diego Nadares + (backport of 1d23f81353dd7a68b0f537e9a064587a5f733bb7) + +commit 39874e415c754263e6c847bb19d89c5ef615e376 +Author: Daniel-Constantin Mierla +Date: Tue Dec 20 08:36:20 2016 +0100 + + dialplan: safe checks for match expression + + - test if null to avoid invalid use in comparison functions + - reported by Julia Boudniatsky + (backport of commit 3a48835cf68f583ff2fbd7cec9bd76ddc0a1b6fc) + +commit 30f53f1484144d2069f5d3724a65e160bbb6adb5 +Author: Victor Seva +Date: Thu Dec 15 09:33:45 2016 +0100 + + dialplan: fix avp values when using PV_IDX_ITR + + manual backport from cc2c3de5e859861b59265cc5a0d41ae968a08149 + +commit ad00a617dec57073a1e9facc64cf3a64904c6592 +Author: Federico Cabiddu +Date: Tue Nov 29 12:10:36 2016 +0100 + + sipcapture: fix captid extraction from hep header for v3 + + (cherry picked from commit 969f4600193139d95b5f876378e0c92d4eab9a7a) + +commit 6291792ecaee0bfb1855bf6ba4560e4d6af09f3e +Author: Federico Cabiddu +Date: Tue Nov 29 11:35:14 2016 +0100 + + sipcapture: perform ntohs on src and dst port when payload is not SIP + + (cherry picked from commit 1fbca28c3a6e90ca478d152e116aca5e64780e9e) + +commit 689d12741b86f101d00b1bcd348c3093f47d5158 +Author: Daniel-Constantin Mierla +Date: Thu Dec 1 12:19:49 2016 +0100 + + tm: fix wrong CRLF position when building local request when reusing received buffer + + - should affect only configs when tm parameters for reparsing request + were changed from their default value + - reported by Helio Okuyama + + (cherry picked from commit 6db0e6b5a0b8ef48250abd7bfaedd15fc4860ddd) + +commit ae7f6d49ed1caf4a133f72012196a876d258e159 +Merge: b1e3d39 973e8ef +Author: Daniel-Constantin Mierla +Date: Wed Nov 30 11:14:08 2016 +0100 + + Merge pull request #869 from giavac/gv/correlation_id_backport + + sipcapture: remove workaround of correlation_id + +commit 973e8ef6e2f0323168f42ff9f77a86862604b51d +Author: Giacomo Vacca +Date: Wed Sep 28 14:49:42 2016 +0200 + + sipcapture: remove workaround of correlation_id + + - Compatible with Asterisk >= 10 + + (cherry picked from commit 6cb0bec7d2491ed3365dc237fc1d8608af246c3a) + +commit b1e3d396bb8ef8989895d9017bc8a98a85ce307f +Author: Daniel-Constantin Mierla +Date: Wed Nov 30 07:39:00 2016 +0100 + + rtjson: fix for replacing to header based on json document + + - reported by GH #868 + + (cherry picked from commit 1d5f39a23f1b92575153c5bb2ba87f15f80fa827) + +commit 91dcaafcc02af38754e8ceab3f7164595975a6d7 +Author: Daniel-Constantin Mierla +Date: Tue Nov 29 15:14:52 2016 +0100 + + kamctl: regenerated database schema + +commit 954b298097dcaba9cc0b26f9020ab585f299dceb +Author: Daniel-Constantin Mierla +Date: Thu Nov 24 17:46:36 2016 +0100 + + lib/srdb1: schema - don't set default value for text/blob columns of topos + + - not allowed by newer versions of mysql + + (cherry picked from commit 0eea31b4b934de45e8bc5091f7ba5a9d486dd16f) + +commit e292e044800611eb3f27a17193af6a3ec66fdd83 +Author: Daniel-Constantin Mierla +Date: Mon Nov 28 19:09:03 2016 +0100 + + pua_dialoginfo: safety check of paramters for __dialog_sendpublish() + + - reported by Davy Van De Moere, GH #865 + + (cherry picked from commit 1d1d2246c8f89aa6eda52bda479014be0a10b937) + +commit c5d3bd8f48bc333dbf63584f463c02e9f546a54b +Author: Kamailio Dev +Date: Fri Nov 11 12:31:18 2016 +0100 + + modules: readme files regenerated - dispatcher ... + +commit c959ae301d6cc771e4d9e24a63ce77794ae6faac +Author: Daniel-Constantin Mierla +Date: Fri Nov 11 12:21:46 2016 +0100 + + dispatcher: docs - removed extra spaces and rephrased sample config text + + (cherry picked from commit 74581f3a500f0f5eca408991a99dc687ad4bf425) + +commit 1d1e7c87c117dae367b3dc476fe1bbe6aa5aeef5 +Author: Daniel-Constantin Mierla +Date: Fri Nov 11 12:15:59 2016 +0100 + + dispatcher: updates to sameple config file + + (cherry picked from commit 0b3d6ad3238d28c1c3aaf8c39052405ffdaa21df) + + ===================== 2016-11-09 Version 4.4.4 Released ===================== ===================== Changes Since Version 4.4.3 =========================== diff --git a/Makefile.defs b/Makefile.defs index 9b45ffbdc..2549eac61 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -101,7 +101,7 @@ INSTALL_FLAVOUR=$(FLAVOUR) # version number VERSION = 4 PATCHLEVEL = 4 -SUBLEVEL = 4 +SUBLEVEL = 5 # memory manager switcher # 0 - f_malloc (fast malloc) diff --git a/autover.h b/autover.h index feb9a1d60..30cc91438 100644 --- a/autover.h +++ b/autover.h @@ -2,6 +2,6 @@ * DO NOT EDIT IT */ -#define REPO_VER "852c47" -#define REPO_HASH "852c47" +#define REPO_VER "f98162" +#define REPO_HASH "f98162" #define REPO_STATE "" diff --git a/lib/srdb1/schema/entities.xml b/lib/srdb1/schema/entities.xml index bb3ddf377..91f062f9c 100644 --- a/lib/srdb1/schema/entities.xml +++ b/lib/srdb1/schema/entities.xml @@ -26,6 +26,6 @@ - + diff --git a/lib/srdb1/schema/topos_d.xml b/lib/srdb1/schema/topos_d.xml index cf628890a..1f7fd35be 100644 --- a/lib/srdb1/schema/topos_d.xml +++ b/lib/srdb1/schema/topos_d.xml @@ -128,21 +128,21 @@ a_rr largetext - + Record route - A side b_rr largetext - + Record route - B side s_rr largetext - + Record route - S side diff --git a/lib/srdb1/schema/topos_t.xml b/lib/srdb1/schema/topos_t.xml index 86fcb2f5f..e3978f09f 100644 --- a/lib/srdb1/schema/topos_t.xml +++ b/lib/srdb1/schema/topos_t.xml @@ -88,7 +88,7 @@ x_via largetext - + Via stack - A or B side @@ -104,21 +104,21 @@ x_rr largetext - + RR stack - incoming A or B side y_rr largetext - + RR stack - the other A or B side s_rr largetext - + RR stack - the S side diff --git a/modules/async/async_mod.c b/modules/async/async_mod.c index bc8f0ce73..4d85f3643 100644 --- a/modules/async/async_mod.c +++ b/modules/async/async_mod.c @@ -106,7 +106,7 @@ static int mod_init(void) return -1; } - register_dummy_timers(async_workers); + register_basic_timers(async_workers); return 0; } @@ -125,7 +125,7 @@ static int child_init(int rank) return 0; for(i=0; is = _dres->colv[col].name.s; - RES_NAMES(_r)[col]->len = _dres->colv[col].name.len; + RES_NAMES(_r)[col]->s = _dres->colv[col]->name.s; + RES_NAMES(_r)[col]->len = _dres->colv[col]->name.len; - switch(_dres->colv[col].type) + switch(_dres->colv[col]->type) { case DB1_STR: case DB1_STRING: @@ -84,12 +84,12 @@ static int dbt_get_columns(db1_res_t* _r, dbt_result_p _dres) case DB1_INT: case DB1_DATETIME: case DB1_DOUBLE: - RES_TYPES(_r)[col] = _dres->colv[col].type; + RES_TYPES(_r)[col] = _dres->colv[col]->type; break; default: LM_WARN("unhandled data type column (%.*s) type id (%d), " "use STR as default\n", RES_NAMES(_r)[col]->len, - RES_NAMES(_r)[col]->s, _dres->colv[col].type); + RES_NAMES(_r)[col]->s, _dres->colv[col]->type); RES_TYPES(_r)[col] = DB1_STR; break; } @@ -173,7 +173,7 @@ static int dbt_convert_row(db1_res_t* _res, db_row_t* _r, dbt_row_p _r1) break; default: - LM_ERR("val type [%d] not supported\n", RES_TYPES(_res)[i]); + LM_ERR("val type [%d] for column %i not supported\n", RES_TYPES(_res)[i], i); return -1; } } @@ -184,25 +184,31 @@ static int dbt_convert_row(db1_res_t* _res, db_row_t* _r, dbt_row_p _r1) /* * Convert rows from internal to db API representation */ -static int dbt_convert_rows(db1_res_t* _r, dbt_result_p _dres) +static int dbt_convert_rows(db1_res_t* _r, dbt_table_p _dres, int offset, int nrows) { - int row; + int row = 0, c = 0; dbt_row_p _rp = NULL; if (!_r || !_dres) { LM_ERR("invalid parameter\n"); return -1; } - RES_ROW_N(_r) = _dres->nrrows; - if (!RES_ROW_N(_r)) { + + if (nrows == 0) { return 0; } + if (db_allocate_rows(_r) < 0) { LM_ERR("could not allocate rows\n"); return -2; } - row = 0; + _rp = _dres->rows; - while(_rp) { + while(_rp && c < offset) { + c++; + _rp = _rp->next; + } + + while(_rp && row < nrows) { if (dbt_convert_row(_r, &(RES_ROWS(_r)[row]), _rp) < 0) { LM_ERR("failed to convert row #%d\n", row); RES_ROW_N(_r) = row; @@ -212,36 +218,76 @@ static int dbt_convert_rows(db1_res_t* _r, dbt_result_p _dres) row++; _rp = _rp->next; } + RES_ROW_N(_r) = row; + RES_LAST_ROW(_r) = c + row; return 0; } +static int dbt_convert_all_rows(db1_res_t* _r, dbt_table_p _dres) +{ + if (!_r || !_dres) { + LM_ERR("invalid parameter\n"); + return -1; + } + RES_ROW_N(_r) = _dres->nrrows; + return dbt_convert_rows(_r, _dres, 0, _dres->nrrows); +} + + /* * Fill the structure with data from database */ -static int dbt_convert_result(db1_res_t* _r, dbt_result_p _dres) +//static int dbt_convert_result(db1_res_t* _r, dbt_table_p _dres) +//{ +// if (!_r || !_dres) { +// LM_ERR("invalid parameter\n"); +// return -1; +// } +// if (dbt_get_columns(_r, _dres) < 0) { +// LM_ERR("failed to get column names\n"); +// return -2; +// } +// +// if (dbt_convert_all_rows(_r, _dres) < 0) { +// LM_ERR("failed to convert rows\n"); +// db_free_columns(_r); +// return -3; +// } +// return 0; +//} + +/* + * Retrieve result set + */ +int dbt_get_result(db1_res_t** _r, dbt_table_p _dres) { - if (!_r || !_dres) { - LM_ERR("invalid parameter\n"); - return -1; + int res = dbt_init_result(_r, _dres); + if ( res != 0) { + return res; } - if (dbt_get_columns(_r, _dres) < 0) { - LM_ERR("failed to get column names\n"); - return -2; + + if (dbt_convert_all_rows(*_r, _dres) < 0) { + LM_ERR("failed to convert rows\n"); + db_free_columns(*_r); + return -3; } - if (dbt_convert_rows(_r, _dres) < 0) { + return 0; +} + +int dbt_get_next_result(db1_res_t** _r, int offset, int rows) +{ + dbt_table_p _dres = (dbt_table_p)(*_r)->ptr; + if (dbt_convert_rows(*_r, _dres, offset, rows) < 0) { LM_ERR("failed to convert rows\n"); - db_free_columns(_r); + db_free_columns(*_r); return -3; } return 0; } -/* - * Retrieve result set - */ -int dbt_get_result(db1_res_t** _r, dbt_result_p _dres) +int dbt_init_result(db1_res_t** _r, dbt_table_p _dres) { if ( !_r) { LM_ERR("invalid parameter value\n"); @@ -262,13 +308,12 @@ int dbt_get_result(db1_res_t** _r, dbt_result_p _dres) return -2; } - if (dbt_convert_result(*_r, _dres) < 0) - { - LM_ERR("failed to convert result\n"); - pkg_free(*_r); - return -4; + if (dbt_get_columns(*_r, _dres) < 0) { + LM_ERR("failed to get column names\n"); + return -2; } - + + RES_NUM_ROWS(*_r) = _dres->nrrows; (*_r)->ptr = _dres; return 0; } diff --git a/modules/db_text/dbt_api.h b/modules/db_text/dbt_api.h index 381a7188b..32becd279 100644 --- a/modules/db_text/dbt_api.h +++ b/modules/db_text/dbt_api.h @@ -34,7 +34,11 @@ /* * Retrieve result set */ -int dbt_get_result(db1_res_t** _r, dbt_result_p _dres); +//int dbt_get_result(db1_res_t** _r, dbt_result_p _dres); +int dbt_get_result(db1_res_t** _r, dbt_table_p _dres); +int dbt_init_result(db1_res_t** _r, dbt_table_p _dres); +int dbt_get_next_result(db1_res_t** _r, int offset, int rows); + int dbt_use_table(db1_con_t* _h, const str* _t); diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index 54a2f3884..f0ad7139e 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -131,7 +131,7 @@ int dbt_free_result(db1_con_t* _h, db1_res_t* _r) if (!_r) return 0; - if(dbt_result_free((dbt_result_p)_r->ptr) < 0) + if(dbt_result_free(_h, (dbt_table_p)_r->ptr) < 0) { LM_ERR("unable to free internal structure\n"); } @@ -145,6 +145,7 @@ int dbt_free_result(db1_con_t* _h, db1_res_t* _r) return 0; } +static dbt_table_p last_temp_table = NULL; /* * Query table for specified rows @@ -157,30 +158,34 @@ int dbt_free_result(db1_con_t* _h, db1_res_t* _r) * _nc: number of columns to return * _o: order by the specified column */ - -int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, +int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, db_key_t* _c, int _n, int _nc, db_key_t _o, db1_res_t** _r) { dbt_table_p _tbc = NULL; + dbt_table_p _tbc_temp = NULL; dbt_row_p _drp = NULL; - dbt_result_p _dres = NULL; + dbt_row_p *_res = NULL; +// dbt_result_p _dres = NULL; int result = 0; - + int counter = 0; + int i=0; + int *lkey=NULL, *lres=NULL; - + db_key_t *_o_k=NULL; /* columns in order-by */ char *_o_op=NULL; /* operators for oder-by */ int _o_n; /* no of elements in order-by */ int *_o_l=NULL; /* column selection for order-by */ - int _o_nc; /* no of elements in _o_l but not lres */ +// int _o_nc; /* no of elements in _o_l but not lres */ - if ((!_h) || (!_r) || !CON_TABLE(_h)) + if(_r) + *_r = NULL; + + if ((!_h) || !CON_TABLE(_h)) { LM_ERR("invalid parameters\n"); return -1; } - *_r = NULL; - if (_o) { @@ -188,11 +193,19 @@ int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, return -1; } + _tbc_temp = dbt_db_get_temp_table(DBT_CON_CONNECTION(_h)); + if(!_tbc_temp) + { + LM_ERR("unable to allocate temp table\n"); + return -1; + } + /* lock database */ _tbc = dbt_db_get_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); if(!_tbc) { LM_ERR("table %.*s does not exist!\n", CON_TABLE(_h)->len, CON_TABLE(_h)->s); + dbt_db_del_table(DBT_CON_CONNECTION(_h), &_tbc_temp->name, 0); return -1; } @@ -220,51 +233,88 @@ int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, if (!_o_l) goto error; /* enlarge select-columns lres by all order-by columns, _o_nc is how many */ - if (dbt_mangle_columnselection(&lres, &_nc, &_o_nc, _o_l, _o_n) < 0) - goto error; +// if (dbt_mangle_columnselection(&lres, &_nc, &_o_nc, _o_l, _o_n) < 0) +// goto error; } +/* LM_DBG("new res with %d cols\n", _nc); _dres = dbt_result_new(_tbc, lres, _nc); - + if(!_dres) goto error; - +*/ + + dbt_column_p pPrevCol = NULL; + _tbc_temp->colv = (dbt_column_p*) shm_malloc(_nc*sizeof(dbt_column_p)); + for(i=0; i < _nc; i++) { + dbt_column_p pCol = dbt_column_new(_tbc->colv[ lres[i] ]->name.s, _tbc->colv[ lres[i] ]->name.len); + pCol->type = _tbc->colv[ lres[i] ]->type; + pCol->flag = _tbc->colv[ lres[i] ]->flag; + if(pPrevCol) + { + pCol->prev = pPrevCol; + pPrevCol->next = pCol; + } + else + _tbc_temp->cols = pCol; + + _tbc_temp->colv[i] = pCol; + pPrevCol = pCol; + _tbc_temp->nrcols++; + } + + _res = (dbt_row_p*) pkg_malloc(_db_text_max_result_rows * sizeof(dbt_row_p)); + if(!_res) { + LM_ERR("no more space to allocate for query rows\n"); + goto error; + } + + _drp = _tbc->rows; - while(_drp) + while(_drp && counter < _db_text_max_result_rows) { if(dbt_row_match(_tbc, _drp, lkey, _op, _v, _n)) { - if(dbt_result_extract_fields(_tbc, _drp, lres, _dres)) - { - LM_ERR("failed to extract result fields!\n"); - goto clean; - } + _res[counter] = _drp; +// if(dbt_result_extract_fields(_tbc, _drp, lres, _dres)) +// { +// LM_ERR("failed to extract result fields!\n"); +// goto clean; +// } + counter++; } _drp = _drp->next; } - dbt_table_update_flags(_tbc, DBT_TBFL_ZERO, DBT_FL_IGN, 1); - - /* unlock database */ - dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); - if (_o_l) { - if (_dres->nrrows > 1) + if (counter > 1) { - if (dbt_sort_result(_dres, _o_l, _o_op, _o_n, lres, _nc) < 0) - goto error_nounlock; + if (dbt_sort_result_temp(_res, counter, _o_l, _o_op, _o_n) < 0) + goto error; } /* last but not least, remove surplus columns */ - if (_o_nc) - dbt_project_result(_dres, _o_nc); +// if (_o_nc) +// dbt_project_result(_dres, _o_nc); } + // copy results to temp table + _tbc_temp->rows = dbt_result_extract_results(_tbc, _res, counter, lres, _nc); + _tbc_temp->nrrows = (_tbc_temp->rows == NULL ? 0 : counter); + + dbt_table_update_flags(_tbc, DBT_TBFL_ZERO, DBT_FL_IGN, 1); + + /* unlock database */ + dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); + +// DBT_CON_TEMP_TABLE(_h) = _tbc_temp; + last_temp_table = _tbc_temp; +// dbt_release_table(DBT_CON_CONNECTION(_h), &_tbc_temp->name); + +// dbt_result_print(_tbc_temp); - /* dbt_result_print(_dres); */ - if(lkey) pkg_free(lkey); if(lres) @@ -275,17 +325,25 @@ int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, pkg_free(_o_op); if(_o_l) pkg_free(_o_l); + if(_res) + pkg_free(_res); - result = dbt_get_result(_r, _dres); - if(result != 0) - dbt_result_free(_dres); + if(_r) { + result = dbt_get_result(_r, _tbc_temp); +// dbt_db_del_table(DBT_CON_CONNECTION(_h), &_tbc_temp->name, 1); + if(result != 0) + dbt_result_free(_h, _tbc_temp); + } return result; error: - /* unlock database */ - dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); -error_nounlock: + /* unlock database */ + dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); + /* delete temp table */ + dbt_db_del_table(DBT_CON_CONNECTION(_h), &_tbc_temp->name, 1); + if(_res) + pkg_free(_res); if(lkey) pkg_free(lkey); if(lres) @@ -296,14 +354,12 @@ error_nounlock: pkg_free(_o_op); if(_o_l) pkg_free(_o_l); - if(_dres) - dbt_result_free(_dres); LM_ERR("failed to query the table!\n"); return -1; +/* clean: - /* unlock database */ dbt_release_table(DBT_CON_CONNECTION(_h), CON_TABLE(_h)); if(lkey) pkg_free(lkey); @@ -315,10 +371,54 @@ clean: pkg_free(_o_op); if(_o_l) pkg_free(_o_l); - if(_dres) - dbt_result_free(_dres); return -1; +*/ +} + + +int dbt_fetch_result(db1_con_t* _h, db1_res_t** _r, const int nrows) +{ + int rows; + + if (!_h || !_r || nrows < 0) { + LM_ERR("Invalid parameter value\n"); + return -1; + } + + /* exit if the fetch count is zero */ + if (nrows == 0) { + dbt_free_result(_h, *_r); + *_r = 0; + return 0; + } + + if(*_r==0) { + /* Allocate a new result structure */ + dbt_init_result(_r, last_temp_table); + } else { + /* free old rows */ + if(RES_ROWS(*_r)!=0) + db_free_rows(*_r); + RES_ROWS(*_r) = 0; + RES_ROW_N(*_r) = 0; + } + + /* determine the number of rows remaining to be processed */ + rows = RES_NUM_ROWS(*_r) - RES_LAST_ROW(*_r); + + /* If there aren't any more rows left to process, exit */ + if(rows<=0) + return 0; + + /* if the fetch count is less than the remaining rows to process */ + /* set the number of rows to process (during this call) equal to the fetch count */ + if(nrows < rows) + rows = nrows; + + RES_ROW_N(*_r) = rows; + + return dbt_get_next_result(_r, RES_LAST_ROW(*_r), rows); } /* diff --git a/modules/db_text/dbt_lib.c b/modules/db_text/dbt_lib.c index 7194b6d6d..a9828f348 100644 --- a/modules/db_text/dbt_lib.c +++ b/modules/db_text/dbt_lib.c @@ -40,6 +40,8 @@ static gen_lock_t *_dbt_cachesem = NULL; static dbt_tbl_cachel_p _dbt_cachetbl = NULL; +extern int is_main; + #define DBT_CACHETBL_SIZE 16 /** @@ -265,6 +267,7 @@ dbt_table_p dbt_db_get_table(dbt_cache_p _dc, const str *_s) hash = core_hash(&_dc->name, _s, DBT_CACHETBL_SIZE); hashidx = hash % DBT_CACHETBL_SIZE; + if(!is_main) lock_get(&_dbt_cachetbl[hashidx].sem); _tbc = _dbt_cachetbl[hashidx].dtp; @@ -380,7 +383,7 @@ int dbt_cache_destroy(void) /** * */ -int dbt_cache_print(int _f) +int dbt_cache_print2(int _f, int _lock) { int i; dbt_table_p _tbc; @@ -390,10 +393,12 @@ int dbt_cache_print(int _f) for(i=0; i< DBT_CACHETBL_SIZE; i++) { - lock_get(&_dbt_cachetbl[i].sem); + if(_lock) + lock_get(&_dbt_cachetbl[i].sem); _tbc = _dbt_cachetbl[i].dtp; while(_tbc) { + if(! (_tbc->flag & DBT_TBFL_TEMP)) { if(_f) fprintf(stdout, "\n--- Database [%.*s]\n", _tbc->dbname.len, _tbc->dbname.s); @@ -412,14 +417,21 @@ int dbt_cache_print(int _f) dbt_table_update_flags(_tbc,DBT_TBFL_MODI, DBT_FL_UNSET, 0); } } + } _tbc = _tbc->next; } - lock_release(&_dbt_cachetbl[i].sem); + if(_lock) + lock_release(&_dbt_cachetbl[i].sem); } return 0; } +int dbt_cache_print(int _f) +{ + return dbt_cache_print2(_f, !is_main); +} + int dbt_is_neq_type(db_type_t _t0, db_type_t _t1) { // LM_DBG("t0=%d t1=%d!\n", _t0, _t1); @@ -461,3 +473,47 @@ int dbt_is_neq_type(db_type_t _t0, db_type_t _t1) return 1; } +static int tmp_table_number = 0; + +dbt_table_p dbt_db_get_temp_table(dbt_cache_p _dc) +{ + dbt_table_p _tbc = NULL; + str _s; + char buf[30]; + int hash; + int hashidx; + + + if(!_dbt_cachetbl || !_dc) { + LM_ERR("invalid parameter\n"); + return NULL; + } + + sprintf(buf, "tmp-%i-%i", my_pid(), ++tmp_table_number); + _s.s = buf; + _s.len = strlen(buf); + + hash = core_hash(&_dc->name, &_s, DBT_CACHETBL_SIZE); + hashidx = hash % DBT_CACHETBL_SIZE; + + lock_get(&_dbt_cachetbl[hashidx].sem); + + _tbc = _dbt_cachetbl[hashidx].dtp; + + + + _tbc = dbt_table_new(&_s, &(_dc->name), NULL); + + _tbc->hash = hash; + _tbc->next = _dbt_cachetbl[hashidx].dtp; + if(_dbt_cachetbl[hashidx].dtp) + _dbt_cachetbl[hashidx].dtp->prev = _tbc; + + _dbt_cachetbl[hashidx].dtp = _tbc; + + dbt_table_update_flags(_tbc, DBT_TBFL_TEMP, DBT_FL_SET, 0); + + + lock_release(&_dbt_cachetbl[hashidx].sem); + return _tbc; +} diff --git a/modules/db_text/dbt_lib.h b/modules/db_text/dbt_lib.h index 7578a9573..ebd96ea01 100644 --- a/modules/db_text/dbt_lib.h +++ b/modules/db_text/dbt_lib.h @@ -35,6 +35,7 @@ #define DBT_TBFL_ZERO 0 #define DBT_TBFL_MODI 1 +#define DBT_TBFL_TEMP 2 #define DBT_FL_IGN -1 #define DBT_FL_SET 0 @@ -50,6 +51,7 @@ extern int db_mode; /* Database usage mode: 0 = no cache, 1 = cache */ extern int empty_string; /* If TRUE, an empty string is an empty string, otherwise NULL */ extern int _db_text_read_buffer_size; /* size of the buffer to allocate when reading file */ +extern int _db_text_max_result_rows; /* max result rows */ typedef db_val_t dbt_val_t, *dbt_val_p; @@ -109,6 +111,7 @@ typedef struct _dbt_cache int dbt_init_cache(void); int dbt_cache_destroy(void); int dbt_cache_print(int); +int dbt_cache_print2(int, int); dbt_cache_p dbt_cache_get_db(str*); int dbt_cache_check_db(str*); @@ -121,12 +124,13 @@ int dbt_cache_free(dbt_cache_p); dbt_column_p dbt_column_new(char*, int); dbt_row_p dbt_row_new(int); dbt_table_p dbt_table_new(const str*, const str*, const char*); +dbt_table_p dbt_db_get_temp_table(dbt_cache_p _dc); int dbt_row_free(dbt_table_p, dbt_row_p); int dbt_column_free(dbt_column_p); int dbt_table_free_rows(dbt_table_p); int dbt_table_free(dbt_table_p); - +int dbt_db_del_table(dbt_cache_p _dc, const str *_s, int sync); int dbt_row_set_val(dbt_row_p, dbt_val_p, int, int); int dbt_row_update_val(dbt_row_p, dbt_val_p, int, int); diff --git a/modules/db_text/dbt_res.c b/modules/db_text/dbt_res.c index 268879b27..11ae64ff8 100644 --- a/modules/db_text/dbt_res.c +++ b/modules/db_text/dbt_res.c @@ -92,7 +92,7 @@ clean: return NULL; } -int dbt_result_free(dbt_result_p _dres) +int _dbt_result_free(dbt_result_p _dres) { dbt_row_p _rp=NULL, _rp0=NULL; int i; @@ -134,6 +134,22 @@ int dbt_result_free(dbt_result_p _dres) return 0; } +int dbt_result_free(db1_con_t* _h, dbt_table_p _dres) +{ + if ((!_h)) + { + LM_ERR("invalid parameter value\n"); + return -1; + } + + if (!_dres) + return 0; + + dbt_db_del_table(DBT_CON_CONNECTION(_h), &_dres->name, 1); + + return 0; +} + int dbt_result_add_row(dbt_result_p _dres, dbt_row_p _drp) { if(!_dres || !_drp) @@ -316,45 +332,48 @@ clean: return -1; } -int dbt_result_print(dbt_result_p _dres) +int dbt_result_print(dbt_table_p _dres) { -#if 0 int i; - FILE *fout = stdout; + FILE *fout = stderr; dbt_row_p rowp = NULL; char *p; - if(!_dres || _dres->nrcols<=0) + if(!_dres || _dres->nrcols<=0) { + LM_INFO("NO PRINT\n"); return -1; + } fprintf(fout, "\nContent of result\n"); for(i=0; i<_dres->nrcols; i++) { - switch(_dres->colv[i].type) + switch(_dres->colv[i]->type) { case DB1_INT: - fprintf(fout, "%.*s(int", _dres->colv[i].name.len, - _dres->colv[i].name.s); - if(_dres->colv[i].flag & DBT_FLAG_NULL) + fprintf(fout, "%.*s(int", _dres->colv[i]->name.len, + _dres->colv[i]->name.s); + if(_dres->colv[i]->flag & DBT_FLAG_NULL) fprintf(fout, ",null"); fprintf(fout, ") "); break; case DB1_DOUBLE: - fprintf(fout, "%.*s(double", _dres->colv[i].name.len, - _dres->colv[i].name.s); - if(_dres->colv[i].flag & DBT_FLAG_NULL) + fprintf(fout, "%.*s(double", _dres->colv[i]->name.len, + _dres->colv[i]->name.s); + if(_dres->colv[i]->flag & DBT_FLAG_NULL) fprintf(fout, ",null"); fprintf(fout, ") "); break; case DB1_STR: - fprintf(fout, "%.*s(str", _dres->colv[i].name.len, - _dres->colv[i].name.s); - if(_dres->colv[i].flag & DBT_FLAG_NULL) + case DB1_STRING: + fprintf(fout, "%.*s(str", _dres->colv[i]->name.len, + _dres->colv[i]->name.s); + if(_dres->colv[i]->flag & DBT_FLAG_NULL) fprintf(fout, ",null"); fprintf(fout, ") "); break; default: + LM_INFO("TYPE NOT HANDLED %i\n", _dres->colv[i]->type); return -1; } } @@ -364,7 +383,7 @@ int dbt_result_print(dbt_result_p _dres) { for(i=0; i<_dres->nrcols; i++) { - switch(_dres->colv[i].type) + switch(_dres->colv[i]->type) { case DB1_INT: if(rowp->fields[i].nul) @@ -381,6 +400,7 @@ int dbt_result_print(dbt_result_p _dres) rowp->fields[i].val.double_val); break; case DB1_STR: + case DB1_STRING: fprintf(fout, "\""); if(!rowp->fields[i].nul) { @@ -423,7 +443,6 @@ int dbt_result_print(dbt_result_p _dres) fprintf(fout, "\n"); rowp = rowp->next; } -#endif return 0; } @@ -526,6 +545,29 @@ dbt_row_p dbt_result_new_row(dbt_result_p _dres) return _drp; } +//dbt_row_p dbt_result_new_rows(dbt_row_p* _res, int rows, int cols) +//{ +// dbt_row_p _drp = NULL; +// if(!_dres || _dres->nrcols<=0) +// return NULL; +// +// _drp = (dbt_row_p)shm_malloc(sizeof(dbt_row_t) * rows); +// if(!_drp) +// return NULL; +// memset(_drp, 0, sizeof(dbt_row_t)); +// _drp->fields = (dbt_val_p)shm_malloc(_dres->nrcols*sizeof(dbt_val_t)); +// if(!_drp->fields) +// { +// shm_free(_drp); +// return NULL; +// } +// memset(_drp->fields, 0, _dres->nrcols*sizeof(dbt_val_t)); +// +// _drp->next = _drp->prev = NULL; +// +// return _drp; +//} + /* The _o clause to query is not really a db_key_t, it is SQL (str). * db_mysql and db_postgres simply paste it into SQL, we need to parse it. */ @@ -824,3 +866,129 @@ void dbt_project_result(dbt_result_p _dres, int _o_nc) _dres->nrcols -= _o_nc; } +/* comparison function for qsort */ +int dbt_qsort_compare_temp(const void *_a, const void *_b) +{ + int _i, _j, _r; + + for (_i=0; _ifields[_j], &(*(dbt_row_p *)_b)->fields[_j]); + if (_r == 0) + continue; /* no result yet, compare next column */ + if (_r == +1 || _r == -1) + return (dbt_sort_o_op[_i] == '<') ? _r : -_r; /* ASC OR DESC */ + /* error */ + longjmp(dbt_sort_jmpenv, _r); + } + + /* no result after comparing all columns, same */ + return 0; +} + +int dbt_sort_result_temp(dbt_row_p *_res, int count, int *_o_l, char *_o_op, int _o_n) +{ + int _i; + + /* set globals */ + dbt_sort_o_l = _o_l; + dbt_sort_o_op = _o_op; + dbt_sort_o_n = _o_n; + _i = setjmp(dbt_sort_jmpenv); /* exception handling */ + if (_i) + { + /* error occured during qsort */ + LM_ERR("qsort aborted\n"); + return _i; + } + + qsort(_res, count, sizeof(dbt_row_p), &dbt_qsort_compare_temp); + + return 0; +} + +dbt_row_p dbt_result_extract_results(dbt_table_p _dtp, dbt_row_p* pRows, int _nrows, int* _lres, int _ncols) +{ + dbt_row_p pRow=NULL; + dbt_row_p pTopRow=NULL; + dbt_row_p pPrvRow=NULL; + int i, n, r; + + if(!_dtp || !pRows || _ncols<=0) + return NULL; + + for(r=0; r < _nrows; r++) { + pRow = dbt_row_new(_ncols); + + for(i=0; i<_ncols; i++) + { + n = _lres[i]; + pRow->fields[i].nul = pRows[r]->fields[n].nul; + if(pRow->fields[i].nul) + { + memset(&(pRow->fields[i].val), 0, sizeof(pRow->fields[i].val)); + continue; + } + + switch(_dtp->colv[n]->type) + { + case DB1_INT: + case DB1_DATETIME: + case DB1_BITMAP: + pRow->fields[i].type = _dtp->colv[n]->type; + pRow->fields[i].val.int_val = pRows[r]->fields[n].val.int_val; + break; + case DB1_DOUBLE: + pRow->fields[i].type = DB1_DOUBLE; + pRow->fields[i].val.double_val=pRows[r]->fields[n].val.double_val; + break; + case DB1_STRING: + case DB1_STR: + case DB1_BLOB: + pRow->fields[i].type = _dtp->colv[n]->type; + pRow->fields[i].val.str_val.len = + pRows[r]->fields[n].val.str_val.len; + pRow->fields[i].val.str_val.s =(char*)shm_malloc(sizeof(char)* + (pRows[r]->fields[n].val.str_val.len+1)); + if(!pRow->fields[i].val.str_val.s) + goto clean; + memcpy(pRow->fields[i].val.str_val.s, + pRows[r]->fields[n].val.str_val.s, + pRows[r]->fields[n].val.str_val.len); + pRow->fields[i].val.str_val.s[pRows[r]->fields[n].val.str_val.len]=0; + break; + default: + goto clean; + } + } + + if(pTopRow == NULL) { + pTopRow = pRow; + } else { + pRow->prev = pPrvRow; + pPrvRow->next = pRow; + } + pPrvRow = pRow; + } + + return pTopRow; + +clean: + LM_DBG("make clean!\n"); + while(i>=0) + { + if((pRow->fields[i].type == DB1_STRING + || pRow->fields[i].type == DB1_STR + || pRow->fields[i].type == DB1_BLOB) + && !pRow->fields[i].nul + && pRow->fields[i].val.str_val.s) + shm_free(pRow->fields[i].val.str_val.s); + + i--; + } + shm_free(pRow->fields); + shm_free(pRow); + + return pTopRow; +} diff --git a/modules/db_text/dbt_res.h b/modules/db_text/dbt_res.h index 7ad26ad30..01a4c7626 100644 --- a/modules/db_text/dbt_res.h +++ b/modules/db_text/dbt_res.h @@ -34,6 +34,7 @@ typedef struct _dbt_result { int nrcols; int nrrows; + int last_row; dbt_column_p colv; dbt_row_p rows; } dbt_result_t, *dbt_result_p; @@ -42,17 +43,22 @@ typedef struct _dbt_con { dbt_cache_p con; int affected; + dbt_table_p last_query; } dbt_con_t, *dbt_con_p; #define DBT_CON_CONNECTION(db_con) (((dbt_con_p)((db_con)->tail))->con) +#define DBT_CON_TEMP_TABLE(db_con) (((dbt_con_p)((db_con)->tail))->last_query) dbt_result_p dbt_result_new(dbt_table_p, int*, int); -int dbt_result_free(dbt_result_p); + +//int dbt_result_free(dbt_result_p); +int dbt_result_free(db1_con_t* _h, dbt_table_p _dres); + int dbt_row_match(dbt_table_p _dtp, dbt_row_p _drp, int* _lkey, db_op_t* _op, db_val_t* _v, int _n); int dbt_result_extract_fields(dbt_table_p _dtp, dbt_row_p _drp, int* lres, dbt_result_p _dres); -int dbt_result_print(dbt_result_p _dres); +int dbt_result_print(dbt_table_p _dres); int* dbt_get_refs(dbt_table_p, db_key_t*, int); int dbt_cmp_val(dbt_val_p _vp, db_val_t* _v); @@ -63,5 +69,9 @@ int dbt_mangle_columnselection(int **_lres, int *_nc, int *_o_nc, int *_o_l, int int dbt_sort_result(dbt_result_p _dres, int *_o_l, char *_o_op, int _o_n, int *_lres, int _nc); void dbt_project_result(dbt_result_p _dres, int _o_nc); +int dbt_qsort_compare_temp(const void *_a, const void *_b); +int dbt_sort_result_temp(dbt_row_p *_res, int count, int *_o_l, char *_o_op, int _o_n); +dbt_row_p dbt_result_extract_results(dbt_table_p _dtp, dbt_row_p* pRows, int _nrows, int* _lres, int _ncols); + #endif diff --git a/modules/db_text/dbt_tb.c b/modules/db_text/dbt_tb.c index b0d6c49ec..f0bfbf668 100644 --- a/modules/db_text/dbt_tb.c +++ b/modules/db_text/dbt_tb.c @@ -137,7 +137,7 @@ dbt_table_p dbt_table_new(const str *_tbname, const str *_dbname, const char *pa { struct stat s; dbt_table_p dtp = NULL; - if(!_tbname || !_dbname || !path) + if(!_tbname || !_dbname) return NULL; dtp = (dbt_table_p)shm_malloc(sizeof(dbt_table_t)); @@ -175,7 +175,7 @@ dbt_table_p dbt_table_new(const str *_tbname, const str *_dbname, const char *pa dtp->nrrows = dtp->nrcols = dtp->auto_val = 0; dtp->auto_col = -1; dtp->mt = 0; - if(stat(path, &s) == 0) + if(path && stat(path, &s) == 0) { dtp->mt = s.st_mtime; LM_DBG("mtime is %d\n", (int)s.st_mtime); diff --git a/modules/db_text/dbtext.c b/modules/db_text/dbtext.c index 5f65e6e53..d77291605 100644 --- a/modules/db_text/dbtext.c +++ b/modules/db_text/dbtext.c @@ -38,6 +38,7 @@ static int mod_init(void); static void destroy(void); #define DEFAULT_DB_TEXT_READ_BUFFER_SIZE 16384 +#define DEFAULT_MAX_RESULT_ROWS 100000; /* * Module parameter variables @@ -45,6 +46,7 @@ static void destroy(void); int db_mode = 0; /* Database usage mode: 0 = cache, 1 = no cache */ int empty_string = 0; /* Treat empty string as "" = 0, 1 = NULL */ int _db_text_read_buffer_size = DEFAULT_DB_TEXT_READ_BUFFER_SIZE; +int _db_text_max_result_rows = DEFAULT_MAX_RESULT_ROWS; int dbt_bind_api(db_func_t *dbb); @@ -64,6 +66,7 @@ static param_export_t params[] = { {"db_mode", INT_PARAM, &db_mode}, {"emptystring", INT_PARAM, &empty_string}, {"file_buffer_size", INT_PARAM, &_db_text_read_buffer_size}, + {"max_result_rows", INT_PARAM, &_db_text_max_result_rows}, {0, 0, 0} }; @@ -108,7 +111,7 @@ static int mod_init(void) static void destroy(void) { LM_DBG("destroy ...\n"); - dbt_cache_print(0); + dbt_cache_print2(0, 0); dbt_cache_destroy(); } @@ -125,6 +128,7 @@ int dbt_bind_api(db_func_t *dbb) dbb->init = dbt_init; dbb->close = dbt_close; dbb->query = (db_query_f)dbt_query; + dbb->fetch_result = (db_fetch_result_f) dbt_fetch_result; dbb->free_result = dbt_free_result; dbb->insert = (db_insert_f)dbt_insert; dbb->delete = (db_delete_f)dbt_delete; @@ -132,7 +136,7 @@ int dbt_bind_api(db_func_t *dbb) dbb->replace = (db_replace_f)dbt_replace; dbb->affected_rows = (db_affected_rows_f) dbt_affected_rows; dbb->raw_query = (db_raw_query_f) dbt_raw_query; - dbb->cap = DB_CAP_ALL | DB_CAP_AFFECTED_ROWS | DB_CAP_RAW_QUERY | DB_CAP_REPLACE; + dbb->cap = DB_CAP_ALL | DB_CAP_AFFECTED_ROWS | DB_CAP_RAW_QUERY | DB_CAP_REPLACE | DB_CAP_FETCH; return 0; } diff --git a/modules/db_text/dbtext.h b/modules/db_text/dbtext.h index 5cbacae18..a64c454f7 100644 --- a/modules/db_text/dbtext.h +++ b/modules/db_text/dbtext.h @@ -56,6 +56,10 @@ int dbt_free_result(db1_con_t* _h, db1_res_t* _r); int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, db_key_t* _c, int _n, int _nc, db_key_t _o, db1_res_t** _r); +/* + * fetch result + */ +int dbt_fetch_result(db1_con_t* _h, db1_res_t** _r, const int nrows); /* * Raw SQL query diff --git a/modules/dialog/dlg_cseq.c b/modules/dialog/dlg_cseq.c index 743a61db2..9dbf5e8ac 100644 --- a/modules/dialog/dlg_cseq.c +++ b/modules/dialog/dlg_cseq.c @@ -40,6 +40,7 @@ #include "../../parser/parse_to.h" #include "../../parser/parse_from.h" #include "../../parser/parse_cseq.h" +#include "../../srapi.h" #include "../../modules/tm/tm_load.h" #include "dlg_handlers.h" @@ -77,25 +78,24 @@ static int dlg_cseq_prepare_msg(sip_msg_t *msg) /* reply to local transaction -- nothing to do */ if (parse_headers(msg, HDR_VIA2_F, 0)==-1 || (msg->via2==0) || (msg->via2->error!=PARSE_OK)) { - LM_DBG("no second via in this message \n"); - return 3; + if(get_cseq(msg)->method_id != METHOD_CANCEL) { + LM_DBG("no second via in this message \n"); + return 3; + } } } - if(parse_from_header(msg)<0) - { + if(parse_from_header(msg)<0) { LM_ERR("cannot parse FROM header\n"); return 3; } - if(parse_to_header(msg)<0 || msg->to==NULL) - { + if(parse_to_header(msg)<0 || msg->to==NULL) { LM_ERR("cannot parse TO header\n"); return 3; } - if(get_to(msg)==NULL) - { + if(get_to(msg)==NULL) { LM_ERR("cannot get TO header\n"); return 3; } @@ -127,6 +127,7 @@ int dlg_cseq_update(sip_msg_t *msg) unsigned int vinc = 0; str nval; str *pval; + sr_cfgenv_t *cenv = NULL; if(dlg_cseq_prepare_msg(msg)!=0) { goto error; @@ -152,6 +153,7 @@ int dlg_cseq_update(sip_msg_t *msg) goto done; } + cenv = sr_cfgenv_get(); ninc = 1; /* take the increment value from dialog */ @@ -185,7 +187,7 @@ int dlg_cseq_update(sip_msg_t *msg) LM_DBG("adding auth cseq header value: %.*s\n", nval.len, nval.s); parse_headers(msg, HDR_EOH_F, 0); - sr_hdr_add_zs(msg, "P-K-Auth-CSeq", &nval); + sr_hdr_add_zs(msg, cenv->uac_cseq_auth.s, &nval); done: if(dlg!=NULL) dlg_release(dlg); @@ -207,6 +209,7 @@ int dlg_cseq_refresh(sip_msg_t *msg, dlg_cell_t *dlg, unsigned int vinc = 0; str nval; str *pval; + sr_cfgenv_t *cenv = NULL; if(dlg_cseq_prepare_msg(msg)!=0) { goto error; @@ -254,7 +257,8 @@ int dlg_cseq_refresh(sip_msg_t *msg, dlg_cell_t *dlg, LM_DBG("adding cseq refresh header value: %.*s\n", nval.len, nval.s); parse_headers(msg, HDR_EOH_F, 0); - sr_hdr_add_zs(msg, "P-K-CSeq-Refresh", &nval); + cenv = sr_cfgenv_get(); + sr_hdr_add_zs(msg, cenv->uac_cseq_refresh.s, &nval); done: return 0; @@ -354,11 +358,13 @@ int dlg_cseq_msg_sent(void *data) int tbuf_len = 0; struct via_body *via; hdr_field_t *hfk = NULL; + sr_cfgenv_t *cenv = NULL; obuf = (str*)data; memset(&msg, 0, sizeof(sip_msg_t)); msg.buf = obuf->s; msg.len = obuf->len; + cenv = sr_cfgenv_get(); if(dlg_cseq_prepare_new_msg(&msg)!=0) { goto done; @@ -394,23 +400,23 @@ int dlg_cseq_msg_sent(void *data) parse_headers(&msg, HDR_EOH_F, 0); /* check if transaction is marked for a new increment */ - if(get_cseq(&msg)->method_id!=METHOD_ACK) { - hfk = sr_hdr_get_z(&msg, "P-K-Auth-CSeq"); - if(hfk!=NULL) { - LM_DBG("new cseq inc requested\n"); - nval = hfk->body; - trim(&nval); - } else { - LM_DBG("new cseq inc not requested\n"); - } + hfk = sr_hdr_get_z(&msg, cenv->uac_cseq_auth.s); + if(hfk!=NULL) { + LM_DBG("new cseq inc requested\n"); + nval = hfk->body; + trim(&nval); + } else { + LM_DBG("new cseq inc not requested\n"); } if(nval.len<=0) { - hfk = sr_hdr_get_z(&msg, "P-K-CSeq-Refresh"); + hfk = sr_hdr_get_z(&msg, cenv->uac_cseq_refresh.s); if(hfk!=NULL) { LM_DBG("cseq refresh requested\n"); nval = hfk->body; trim(&nval); + } else { + LM_DBG("cseq refresh not requested\n"); } } if(nval.len<=0) { diff --git a/modules/dialplan/dp_repl.c b/modules/dialplan/dp_repl.c index bfeda0742..03727fd54 100644 --- a/modules/dialplan/dp_repl.c +++ b/modules/dialplan/dp_repl.c @@ -67,9 +67,10 @@ int dpl_dyn_printf_s(sip_msg_t *msg, const pv_elem_p elem, pv_elem_p e = NULL; pv_elem_p t = NULL; str s = STR_NULL; + str v = STR_NULL; int ret = -1; - if(elem==NULL||avp_elem==NULL||elem_prev==NULL) return -1; + if(elem==NULL||avp_elem==NULL||elem_prev==NULL||vexpr==NULL) return -1; if(str_append(&(avp_elem->text), val, &s)<0) return -1; if(pv_parse_format(&s, &e)<0) { @@ -86,10 +87,18 @@ int dpl_dyn_printf_s(sip_msg_t *msg, const pv_elem_p elem, } if(*elem_prev) (*elem_prev)->next = e; e->next = avp_elem->next; - if(pv_printf_s(msg, e, vexpr)<0){ + if(pv_printf_s(msg, e, &v)<0){ LM_ERR("cannot get avp pcre dynamic expression value\n"); goto clean; } + /* pv_printf_s uses pv_get_buffer() we do need to copy */ + vexpr->len = v.len; + vexpr->s = pkg_malloc(sizeof(char)*(v.len+1)); + if(vexpr->s==NULL) { + PKG_MEM_ERROR; + goto clean; + } + strcpy(vexpr->s, v.s); ret = 0; clean: if(s.s) pkg_free(s.s); @@ -282,7 +291,12 @@ error: } clean: if(elem) pv_elem_free_all(elem); - while(l) { t = l->next; pkg_free(l); l = t;} + while(l) { + t = l->next; + if(l->s.s) pkg_free(l->s.s); + pkg_free(l); + l = t; + } return re_list; } @@ -569,7 +583,7 @@ int translate(sip_msg_t *msg, str input, str *output, dpl_id_p idp, dpl_dyn_pcre_p rt = NULL; if(!input.s || !input.len) { - LM_ERR("invalid input string\n"); + LM_WARN("invalid or empty input string to be matched\n"); return -1; } @@ -621,7 +635,8 @@ search_rule: case DP_EQUAL_OP: LM_DBG("equal operator testing\n"); - if(rulep->match_exp.len != input.len) { + if(rulep->match_exp.s==NULL + || rulep->match_exp.len != input.len) { rez = -1; } else { rez = strncmp(rulep->match_exp.s,input.s,input.len); @@ -631,11 +646,15 @@ search_rule: case DP_FNMATCH_OP: LM_DBG("fnmatch operator testing\n"); - b = input.s[input.len]; - input.s[input.len] = '\0'; - rez = fnmatch(rulep->match_exp.s, input.s, 0); - input.s[input.len] = b; - rez = (rez==0)?0:-1; + if(rulep->match_exp.s!=NULL) { + b = input.s[input.len]; + input.s[input.len] = '\0'; + rez = fnmatch(rulep->match_exp.s, input.s, 0); + input.s[input.len] = b; + rez = (rez==0)?0:-1; + } else { + rez = -1; + } break; default: diff --git a/modules/dispatcher/README b/modules/dispatcher/README index 9ce105770..58b98f79b 100644 --- a/modules/dispatcher/README +++ b/modules/dispatcher/README @@ -959,7 +959,7 @@ ds_select_dst("1", "4", "3"); * "p" and "P" - this has to be used in addition to one of the previous flags - the last destination will be set to probing. This mean the destination will be pinged with SIP OPTIONS requests from - time to time to detect if it is up running or down. + time to time to detect if it is up or down. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. @@ -1299,7 +1299,7 @@ r,opt) 7.2. Kamailio config file - Next picture shows a sample usage of the dispatcher module. + Next listing shows a sample config for using the dispatcher module. Example 1.41. Kamailio config script - sample dispatcher usage ... @@ -1310,9 +1310,9 @@ r,opt) # - no TPC listening # - don't dispatch REGISTER and presence requests # -# Kamailio (OpenSER) SIP Server v3.2 +# Kamailio SIP Server # - web: http://www.kamailio.org -# - git: http://sip-router.org +# - git: http://github.com/kamailio/ # # Direct your questions about this file to: sr-users@lists.sip-router.org # @@ -1329,6 +1329,13 @@ r,opt) #!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio" #!endif +# - flags +# FLT_ - per transaction (message) flags +# FLB_ - per branch flags +#!define FLT_ACC 1 +#!define FLT_ACCMISSED 2 +#!define FLT_ACCFAILED 3 + ####### Global Parameters ######### #!ifdef WITH_DEBUG @@ -1367,8 +1374,8 @@ sip_warning=no ####### Modules Section ######## -#set module path -mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/" +# set module path +mpath="/usr/local/lib/kamailio/modules/" loadmodule "db_mysql.so" loadmodule "mi_fifo.so" @@ -1392,10 +1399,6 @@ loadmodule "dispatcher.so" # ----------------- setting module-specific parameters --------------- -# ----- mi_fifo params ----- -modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo") - - # ----- rr params ----- # add value to ;lr param to cope with most of the UAs modparam("rr", "enable_full_lr", 1) @@ -1404,8 +1407,8 @@ modparam("rr", "append_fromtag", 0) # ----- acc params ----- -modparam("acc", "log_flag", 1) -modparam("acc", "failed_transaction_flag", 3) +modparam("acc", "log_flag", FLT_ACC) +modparam("acc", "failed_transaction_flag", FLT_ACCFAILED) modparam("acc", "log_extra", "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;s rc_ip=$si") @@ -1428,7 +1431,7 @@ modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)") # main request routing logic -route { +request_route { # per request initial checks route(REQINIT); @@ -1446,6 +1449,11 @@ route { exit; } + # handle retransmissions + if(t_precheck_trans()) { + t_check_trans(); + exit; + } t_check_trans(); # record routing for dialog forming requests (in case they are routed) @@ -1455,9 +1463,8 @@ route { record_route(); # account only INVITEs - if (is_method("INVITE")) - { - setflag(1); # do accounting + if (is_method("INVITE")) { + setflag(FLT_ACC); # do accounting } # handle presence related requests @@ -1466,8 +1473,7 @@ route { # handle registrations route(REGISTRAR); - if ($rU==$null) - { + if ($rU==$null) { # request with no Username in RURI sl_send_reply("484","Address Incomplete"); exit; @@ -1492,8 +1498,7 @@ route[REQINIT] { exit; } - if(!sanity_check("1511", "7")) - { + if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; } @@ -1506,8 +1511,9 @@ route[WITHINDLG] { # take the path determined by record-routing if (loose_route()) { if (is_method("BYE")) { - setflag(1); # do accounting ... - setflag(3); # ... even if the transaction fails + setflag(FLT_ACC); # do accounting ... + setflag(FLT_ACCFAILED); # ... even if the transa +ction fails } route(RELAY); } else { @@ -1555,8 +1561,7 @@ route[PRESENCE] { # Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' - if(!ds_select_dst("1", "4")) - { + if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } @@ -1566,17 +1571,15 @@ route[DISPATCH] { exit; } -# Sample failure route +# Try next destionations in failure route failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next DST - only for 500 or local timeout if (t_check_status("500") - or (t_branch_timeout() and !t_branch_replied())) - { - if(ds_next_dst()) - { + or (t_branch_timeout() and !t_branch_replied())) { + if(ds_next_dst()) { t_on_failure("RTF_DISPATCH"); route(RELAY); exit; @@ -1584,8 +1587,6 @@ failure_route[RTF_DISPATCH] { } } - - ... 8. Event routes diff --git a/modules/dispatcher/doc/dispatcher.cfg b/modules/dispatcher/doc/dispatcher.cfg index 08ea285b5..475941d1a 100644 --- a/modules/dispatcher/doc/dispatcher.cfg +++ b/modules/dispatcher/doc/dispatcher.cfg @@ -5,9 +5,9 @@ # - no TPC listening # - don't dispatch REGISTER and presence requests # -# Kamailio (OpenSER) SIP Server v3.2 +# Kamailio SIP Server # - web: http://www.kamailio.org -# - git: http://sip-router.org +# - git: http://github.com/kamailio/ # # Direct your questions about this file to: sr-users@lists.sip-router.org # @@ -16,7 +16,7 @@ # # Several features can be enabled using '#!define WITH_FEATURE' directives: # -# *** To run in debug mode: +# *** To run in debug mode: # - define WITH_DEBUG # @@ -24,6 +24,13 @@ #!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio" #!endif +# - flags +# FLT_ - per transaction (message) flags +# FLB_ - per branch flags +#!define FLT_ACC 1 +#!define FLT_ACCMISSED 2 +#!define FLT_ACCFAILED 3 + ####### Global Parameters ######### #!ifdef WITH_DEBUG @@ -54,7 +61,7 @@ auto_aliases=no port=5060 -/* uncomment and configure the following line if you want Kamailio to +/* uncomment and configure the following line if you want Kamailio to bind on a specific interface/port/proto (default bind on all available) */ # listen=udp:127.0.0.1:5060 @@ -62,8 +69,8 @@ sip_warning=no ####### Modules Section ######## -#set module path -mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/" +# set module path +mpath="/usr/local/lib/kamailio/modules/" loadmodule "db_mysql.so" loadmodule "mi_fifo.so" @@ -87,10 +94,6 @@ loadmodule "dispatcher.so" # ----------------- setting module-specific parameters --------------- -# ----- mi_fifo params ----- -modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo") - - # ----- rr params ----- # add value to ;lr param to cope with most of the UAs modparam("rr", "enable_full_lr", 1) @@ -99,9 +102,9 @@ modparam("rr", "append_fromtag", 0) # ----- acc params ----- -modparam("acc", "log_flag", 1) -modparam("acc", "failed_transaction_flag", 3) -modparam("acc", "log_extra", +modparam("acc", "log_flag", FLT_ACC) +modparam("acc", "failed_transaction_flag", FLT_ACCFAILED) +modparam("acc", "log_extra", "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si") # ----- tm params ----- @@ -122,7 +125,7 @@ modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)") # main request routing logic -route { +request_route { # per request initial checks route(REQINIT); @@ -140,6 +143,11 @@ route { exit; } + # handle retransmissions + if(t_precheck_trans()) { + t_check_trans(); + exit; + } t_check_trans(); # record routing for dialog forming requests (in case they are routed) @@ -149,9 +157,8 @@ route { record_route(); # account only INVITEs - if (is_method("INVITE")) - { - setflag(1); # do accounting + if (is_method("INVITE")) { + setflag(FLT_ACC); # do accounting } # handle presence related requests @@ -160,8 +167,7 @@ route { # handle registrations route(REGISTRAR); - if ($rU==$null) - { + if ($rU==$null) { # request with no Username in RURI sl_send_reply("484","Address Incomplete"); exit; @@ -186,8 +192,7 @@ route[REQINIT] { exit; } - if(!sanity_check("1511", "7")) - { + if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; } @@ -200,8 +205,8 @@ route[WITHINDLG] { # take the path determined by record-routing if (loose_route()) { if (is_method("BYE")) { - setflag(1); # do accounting ... - setflag(3); # ... even if the transaction fails + setflag(FLT_ACC); # do accounting ... + setflag(FLT_ACCFAILED); # ... even if the transaction fails } route(RELAY); } else { @@ -247,8 +252,7 @@ route[PRESENCE] { # Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' - if(!ds_select_dst("1", "4")) - { + if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } @@ -258,22 +262,18 @@ route[DISPATCH] { exit; } -# Sample failure route +# Try next destionations in failure route failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next DST - only for 500 or local timeout if (t_check_status("500") - or (t_branch_timeout() and !t_branch_replied())) - { - if(ds_next_dst()) - { + or (t_branch_timeout() and !t_branch_replied())) { + if(ds_next_dst()) { t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } } - - diff --git a/modules/dispatcher/doc/dispatcher_admin.xml b/modules/dispatcher/doc/dispatcher_admin.xml index b5908c32c..a9fcd688c 100644 --- a/modules/dispatcher/doc/dispatcher_admin.xml +++ b/modules/dispatcher/doc/dispatcher_admin.xml @@ -10,7 +10,7 @@ - + &adminguide;
@@ -29,7 +29,7 @@ It is very lightweight, therefore suitable for handling heavy SIP - traffic. As the module has a small footprint and the ability to load + traffic. As the module has a small footprint and the ability to load balancing rules from a plain text file, it is suitable for embedded systems.
@@ -537,11 +537,11 @@ modparam("dispatcher", "force_dst", 1) ... - +
<varname>ds_ping_from</varname> (string) - With this Method you can define the "From:"-Line for the request, sent to the failed gateways. + With this Method you can define the "From:"-Line for the request, sent to the failed gateways. This method is only available, if compiled with the probing of failed gateways enabled. @@ -557,7 +557,7 @@ modparam("dispatcher", "force_dst", 1) ... -
+
<varname>ds_ping_interval</varname> (int) @@ -580,8 +580,8 @@ modparam("dispatcher", "force_dst", 1) ... -
- + +
<varname>ds_probing_threshold</varname> (int) @@ -640,7 +640,7 @@ modparam("dispatcher", "force_dst", 1) PING-Method are not only the ones generated from the remote servers, but also those that are generated locally. E.g.: setting code=408 or class=400 will never set a backend down even if it is, because internally the Kamailio transaction layer - generates a 408 in the case of no response from the remote server, and this + generates a 408 in the case of no response from the remote server, and this internal code 408 is accepted as valid value. @@ -656,11 +656,11 @@ modparam("dispatcher", "force_dst", 1) ... -
+
<varname>ds_probing_mode</varname> (int) - Controls what gateways are tested to see if they are reachable. + Controls what gateways are tested to see if they are reachable. @@ -827,7 +827,7 @@ modparam("dispatcher", "force_dst", 1) <varname>ds_timer_mode</varname> (int) Specify the timer process to be used by the module for - keepalives and active dialogs tracking. + keepalives and active dialogs tracking. It can be set to: @@ -984,17 +984,17 @@ modparam("dispatcher", "force_dst", 1) 11 - use relative weight based load distribution. You have to set the attribute 'rweight' per each address in - destination set. Active host usage probability is - rweight/(SUM of all active host rweights in destination group). + destination set. Active host usage probability is + rweight/(SUM of all active host rweights in destination group). The major difference from the weight distribution is the - probability recalculation according to rweight value in case of + probability recalculation according to rweight value in case of host enabling/disabling - For example, 100 calls in 3-hosts group with rweight params 1/2/1 - will be distributed as 25/50/25. After third host failing + For example, 100 calls in 3-hosts group with rweight params 1/2/1 + will be distributed as 25/50/25. After third host failing distribution will be changed to 33/67/0. @@ -1122,7 +1122,7 @@ ds_select_dst("1", "4", "3"); addition to one of the previous flags - the last destination will be set to probing. This mean the destination will be pinged with SIP OPTIONS requests from time to time to detect if it is - up running or down. + up or down. @@ -1314,7 +1314,7 @@ onreply_route { ds_set_state - Sets the status for a destination address (can be use to mark the destination + Sets the status for a destination address (can be use to mark the destination as active or inactive). @@ -1325,17 +1325,17 @@ onreply_route { _state_ : state of the destination address a: active - i: inactive - t: trying - d: disabled + i: inactive + t: trying + d: disabled The states a, i or t can be followed by p to set probing mode (e.g. 'ap', 'ip' or 'tp'). - + _group_: destination group id - + _address_: address of the destination in the _group_ @@ -1568,10 +1568,10 @@ onreply_route { sent to that gateways. - 'rweight' - used for relative weight based load - distribution. It must be set to a positive integer value - between 1 and 100 (otherwise host will be excluded from - relative weight distribution type). + 'rweight' - used for relative weight based load + distribution. It must be set to a positive integer value + between 1 and 100 (otherwise host will be excluded from + relative weight distribution type). 'socket' - used to set the sending socket for the gateway. @@ -1615,11 +1615,11 @@ setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attrs(str,opt)
- +
&kamailio; config file - Next picture shows a sample usage of the dispatcher module. + Next listing shows a sample config for using the dispatcher module. &kamailio; config script - sample dispatcher usage diff --git a/modules/jsonrpc-s/README b/modules/jsonrpc-s/README index 6e8339b16..6a4cd997f 100644 --- a/modules/jsonrpc-s/README +++ b/modules/jsonrpc-s/README @@ -41,10 +41,11 @@ Daniel-Constantin Mierla 4.1. jsonrpc_dispatch() 4.2. jsonrpc_exec(cmd) - 5. JSONRPC Transports + 5. JSONRPC Commands + 6. JSONRPC Transports - 5.1. JSONRPC Over HTTP - 5.2. JSONRPC Over FIFO + 6.1. JSONRPC Over HTTP + 6.2. JSONRPC Over FIFO List of Examples @@ -57,8 +58,9 @@ Daniel-Constantin Mierla 1.7. Set fifo_reply_dir parameter 1.8. jsonrpc_dispatch usage 1.9. jsonrpc_exec usage - 1.10. JSONRPC Over Fifo Command - 1.11. JSONRPC Over Fifo Command From Termina + 1.10. JSONRPC Commands - Examples + 1.11. JSONRPC Over Fifo Command + 1.12. JSONRPC Over Fifo Command From Termina Chapter 1. Admin Guide @@ -88,10 +90,11 @@ Chapter 1. Admin Guide 4.1. jsonrpc_dispatch() 4.2. jsonrpc_exec(cmd) - 5. JSONRPC Transports + 5. JSONRPC Commands + 6. JSONRPC Transports - 5.1. JSONRPC Over HTTP - 5.2. JSONRPC Over FIFO + 6.1. JSONRPC Over HTTP + 6.2. JSONRPC Over FIFO 1. Overview @@ -293,17 +296,59 @@ event_route[xhttp:request] { jsonrpc_exec({"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'); ... -5. JSONRPC Transports +5. JSONRPC Commands - 5.1. JSONRPC Over HTTP - 5.2. JSONRPC Over FIFO + Here are some examples of RPC commands with the equivalent of running + them with kamcmd and the corresponding JSON document for them. It is + important to be aware that the name of the parameters doesn't matter, + only the order of the values must be the one expected by Kamailio RPC + command. + + Example 1.10. JSONRPC Commands - Examples +... +# kamcmd core.psx + +{ + "jsonrpc": "2.0", + "method": "core.psx", + "id": 1 +} +... +## - prototype: kamcmd dispatcher.set_state _state_ _group_ _address_ +# kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080 + +{ + "jsonrpc": "2.0", + "method": "dispatcher.set_state", + "params": ["ip", 2, "sip:127.0.0.1:5080"], + "id": 1 +} + +## - or: + +{ + "jsonrpc": "2.0", + "method": "dispatcher.set_state", + "params": { + "state": "ip", + "grpup": 2, + "address": "sip:127.0.0.1:5080" + }, + "id": 1 +} +... + +6. JSONRPC Transports + + 6.1. JSONRPC Over HTTP + 6.2. JSONRPC Over FIFO JSONRPC specifications do not enforce a specific transport to carry the JSON documents. Very common is JSONRPC over HTTP or HTTPS, and they are supported by Kamailio. In addition, Kamailio supports receiving JSON documents via a local FIFO file. -5.1. JSONRPC Over HTTP +6.1. JSONRPC Over HTTP It requires that XHTTP module is loaded. HTTPS can be used if you enable TLS for Kamailio. The JSONRPC requests have to be sent to the @@ -313,7 +358,7 @@ jsonrpc_exec({"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'); The format of the JSON document must follow the JSONRPC specifications. -5.2. JSONRPC Over FIFO +6.2. JSONRPC Over FIFO This module can retrive JSONRPC requests via a local FIFO file. To enable this feature, 'fifo_name' parameter must be set and 'transport' @@ -326,7 +371,7 @@ jsonrpc_exec({"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'); 'fifo_reply_dir'. Next is an example showing a JSONRPC command to be sent via FIFO transport. - Example 1.10. JSONRPC Over Fifo Command + Example 1.11. JSONRPC Over Fifo Command ... { "jsonrpc": "2.0", @@ -339,7 +384,7 @@ jsonrpc_exec({"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'); Next is an example of how to test it from a terminal, assuming that the parameter 'fifo_name' is set to '/tmp/kamailio_jsonrpc_fifo'. - Example 1.11. JSONRPC Over Fifo Command From Termina + Example 1.12. JSONRPC Over Fifo Command From Termina ... mkfifo /tmp/kamailio_jsonrpc_reply_fifo cat /tmp/kamailio_jsonrpc_reply_fifo & diff --git a/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml b/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml index 6c9ef1cb2..7f1efe7c5 100644 --- a/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml +++ b/modules/jsonrpc-s/doc/jsonrpc-s_admin.xml @@ -10,9 +10,9 @@ - + &adminguide; - +
Overview @@ -85,7 +85,7 @@
<varname>pretty_format</varname> (int) - Pretty format for JSON-RPC response document. + Pretty format for JSON-RPC response document. @@ -137,7 +137,7 @@ modparam("jsonrpc-s", "transport", 1)
<varname>fifo_name</varname> (str) - The name of the FIFO file to be created for listening and + The name of the FIFO file to be created for listening and reading external commands. If the given path is not absolute, the fifo file is created relative to run_dir (global parameter). @@ -159,7 +159,7 @@ modparam("jsonrpc-s", "fifo_name", "/tmp/kamailio_jsonrpc_fifo")
<varname>fifo_mode</varname> (int) - Permission to be used for creating the listening FIFO file. It + Permission to be used for creating the listening FIFO file. It follows the UNIX conventions. @@ -321,13 +321,61 @@ jsonrpc_exec({"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}');
+
+ JSONRPC Commands + + Here are some examples of RPC commands with the equivalent of running them + with &kamcmd; and the corresponding JSON document for them. It is important + to be aware that the name of the parameters doesn't matter, only the order + of the values must be the one expected by &kamailio; RPC command. + + + JSONRPC Commands - Examples + +... +# kamcmd core.psx + +{ + "jsonrpc": "2.0", + "method": "core.psx", + "id": 1 +} +... +## - prototype: kamcmd dispatcher.set_state _state_ _group_ _address_ +# kamcmd dispatcher.set_state ip 2 sip:127.0.0.1:5080 + +{ + "jsonrpc": "2.0", + "method": "dispatcher.set_state", + "params": ["ip", 2, "sip:127.0.0.1:5080"], + "id": 1 +} + +## - or: + +{ + "jsonrpc": "2.0", + "method": "dispatcher.set_state", + "params": { + "state": "ip", + "grpup": 2, + "address": "sip:127.0.0.1:5080" + }, + "id": 1 +} +... + + + +
+
JSONRPC Transports JSONRPC specifications do not enforce a specific transport to carry the JSON documents. Very common is JSONRPC over HTTP or HTTPS, and they are supported by &kamailio;. In addition, &kamailio; supports receiving JSON - documents via a local FIFO file. + documents via a local FIFO file.
JSONRPC Over HTTP diff --git a/modules/kazoo/kz_amqp.c b/modules/kazoo/kz_amqp.c index e4c07799a..2b8a5e905 100644 --- a/modules/kazoo/kz_amqp.c +++ b/modules/kazoo/kz_amqp.c @@ -424,6 +424,7 @@ kz_amqp_zone_ptr kz_amqp_get_primary_zone() { strcpy(kz_primary_zone->zone, dbk_primary_zone_name.s); kz_primary_zone->zone[dbk_primary_zone_name.len] = '\0'; kz_primary_zone->servers = (kz_amqp_servers_ptr) shm_malloc(sizeof(kz_amqp_servers)); + memset(kz_primary_zone->servers, 0, sizeof(kz_amqp_servers)); } return kz_primary_zone; } @@ -451,6 +452,7 @@ kz_amqp_zone_ptr kz_amqp_add_zone(char* zone) { strcpy(zone_ptr->zone, zone); zone_ptr->zone[strlen(zone)] = '\0'; zone_ptr->servers = (kz_amqp_servers_ptr) shm_malloc(sizeof(kz_amqp_servers)); + memset(zone_ptr->servers, 0, sizeof(kz_amqp_servers)); kz_zones->tail->next = zone_ptr; kz_zones->tail = zone_ptr; return zone_ptr; @@ -657,7 +659,7 @@ int kz_amqp_add_connection(modparam_t type, void* val) url = ++ptr; } else { - zone_ptr = kz_amqp_get_primary_zone(); + zone_ptr = kz_amqp_get_zones(); } diff --git a/modules/kazoo/kz_hash.c b/modules/kazoo/kz_hash.c index 29da9bb21..bb939e865 100644 --- a/modules/kazoo/kz_hash.c +++ b/modules/kazoo/kz_hash.c @@ -153,7 +153,7 @@ kz_amqp_cmd_ptr kz_cmd_retrieve(str* message_id) p = kz_search_cmd_table(message_id, hash_code); if(p== NULL) { - LM_DBG("command pointer hash entry not found\n"); + LM_DBG("command pointer hash entry not found - %s\n", message_id->s); lock_release(&kz_cmd_htable[hash_code].lock); return NULL; } @@ -167,7 +167,7 @@ kz_amqp_cmd_ptr kz_cmd_retrieve(str* message_id) } if(prev_p->next== NULL) { - LM_ERR("command pointer not found\n"); + LM_ERR("command pointer not found - %s\n", message_id->s); lock_release(&kz_cmd_htable[hash_code].lock); return NULL; } diff --git a/modules/lcr/README b/modules/lcr/README index e7d92eb98..3cca8cdd9 100644 --- a/modules/lcr/README +++ b/modules/lcr/README @@ -61,7 +61,7 @@ Juha Heinanen 3.34. defunct_gw_avp (AVP string) 3.35. lcr_rule_hash_size (integer) 3.36. lcr_gw_count (integer) - 3.37. dont_strip_or_tag_flag (integer) + 3.37. dont_strip_or_prefix_flag (integer) 3.38. priority_ordering (integer) 3.39. fetch_rows (integer) 3.40. ping_interval (integer) @@ -128,7 +128,7 @@ Juha Heinanen 1.34. Setting defunct_gw_avp module parameter 1.35. Setting lcr_rule_hash_size module parameter 1.36. Setting lcr_gw_count module parameter - 1.37. Setting dont_strip_or_tag_flag module parameter + 1.37. Setting dont_strip_or_prefix_flag module parameter 1.38. Setting priority_ordering module parameter 1.39. Set fetch_rows parameter 1.40. Set ping_interval parameter @@ -198,7 +198,7 @@ Chapter 1. Admin Guide 3.34. defunct_gw_avp (AVP string) 3.35. lcr_rule_hash_size (integer) 3.36. lcr_gw_count (integer) - 3.37. dont_strip_or_tag_flag (integer) + 3.37. dont_strip_or_prefix_flag (integer) 3.38. priority_ordering (integer) 3.39. fetch_rows (integer) 3.40. ping_interval (integer) @@ -280,8 +280,8 @@ Chapter 1. Admin Guide be done with command 'kamctl eval_weights'. The function next_gw() can then be used to select one gateway at a time - for forwarding. Upon each call, unless "dont_strip_or_tag_flag" flag is - set, user part of the original Request-URI is first stripped by the + for forwarding. Upon each call, unless "dont_strip_or_prefix_flag" flag + is set, user part of the original Request-URI is first stripped by the number of characters as specified by the gateway's strip count and then prefixed by the gateway's prefix. Upon each call, if a gateway's hostname is NULL, Request-URI will be rewritten based on gateway's URI @@ -356,7 +356,7 @@ Chapter 1. Admin Guide 3.34. defunct_gw_avp (AVP string) 3.35. lcr_rule_hash_size (integer) 3.36. lcr_gw_count (integer) - 3.37. dont_strip_or_tag_flag (integer) + 3.37. dont_strip_or_prefix_flag (integer) 3.38. priority_ordering (integer) 3.39. fetch_rows (integer) 3.40. ping_interval (integer) @@ -793,16 +793,16 @@ modparam("lcr", "lcr_rule_hash_size", 1024) modparam("lcr", "lcr_gw_count", 1024) ... -3.37. dont_strip_or_tag_flag (integer) +3.37. dont_strip_or_prefix_flag (integer) Defines the flag number used to tell if stripping and tagging is done for the selected gateway. Default value is -1 meaning that the flag is not defined. - Example 1.37. Setting dont_strip_or_tag_flag module parameter + Example 1.37. Setting dont_strip_or_prefix_flag module parameter ... -modparam("lcr", "dont_strip_or_tag_flag", 10) +modparam("lcr", "dont_strip_or_prefix_flag", 10) ... 3.38. priority_ordering (integer) diff --git a/modules/lcr/doc/lcr_admin.xml b/modules/lcr/doc/lcr_admin.xml index 3a4746642..61cb828ee 100644 --- a/modules/lcr/doc/lcr_admin.xml +++ b/modules/lcr/doc/lcr_admin.xml @@ -99,7 +99,7 @@ The function next_gw() can then be used to select one gateway at a - time for forwarding. Upon each call, unless "dont_strip_or_tag_flag" + time for forwarding. Upon each call, unless "dont_strip_or_prefix_flag" flag is set, user part of the original Request-URI is first stripped by the number of characters as specified by the gateway's strip count and then prefixed by @@ -961,7 +961,7 @@ modparam("lcr", "lcr_gw_count", 1024)
- <varname>dont_strip_or_tag_flag</varname> (integer) + <varname>dont_strip_or_prefix_flag</varname> (integer) Defines the flag number used to tell if stripping and tagging is done for the selected gateway. @@ -974,12 +974,12 @@ modparam("lcr", "lcr_gw_count", 1024) - Setting <varname>dont_strip_or_tag_flag</varname> module + Setting <varname>dont_strip_or_prefix_flag</varname> module parameter ... -modparam("lcr", "dont_strip_or_tag_flag", 10) +modparam("lcr", "dont_strip_or_prefix_flag", 10) ... diff --git a/modules/memcached/mcd_var.c b/modules/memcached/mcd_var.c index 849a6682e..a1b3932ed 100644 --- a/modules/memcached/mcd_var.c +++ b/modules/memcached/mcd_var.c @@ -258,13 +258,13 @@ errout: if (pv_mcd_key_check(msg, param, &key, &expiry) < 0) return -1; - if (val == NULL) { + if (val == NULL || val->flags&PV_VAL_NULL) { if (memcached_delete(memcached_h, key.s, key.len, 0) != MEMCACHED_SUCCESS) { LM_ERR("could not delete key %.*s\n", param->pvn.u.isname.name.s.len, param->pvn.u.isname.name.s.s); return -1; } - LM_WARN("delete key %.*s\n", key.len, key.s); + LM_DBG("delete key %.*s\n", key.len, key.s); return 0; } diff --git a/modules/mohqueue/mohq.c b/modules/mohqueue/mohq.c index 55a85ea83..ba740026a 100644 --- a/modules/mohqueue/mohq.c +++ b/modules/mohqueue/mohq.c @@ -449,7 +449,7 @@ if(rtplen != prtpstat->len) LM_ERR ("Unable to find RTPSTAT pv!\n"); goto initerr; } -prtp_pv = pv_cache_get (&prtpstat); +prtp_pv = pv_cache_get (prtpstat); if(!prtp_pv) { LM_ERR ("Unable to find pv spec for RTPSTAT!\n"); @@ -479,4 +479,4 @@ if (pmod_data->pcall_lock->plock) shm_free (pmod_data); pmod_data = NULL; return -1; -} \ No newline at end of file +} diff --git a/modules/presence/notify.c b/modules/presence/notify.c index b9d948bf3..04ee88f12 100644 --- a/modules/presence/notify.c +++ b/modules/presence/notify.c @@ -1264,7 +1264,7 @@ error: int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, str* rules_doc) { - str *notify_body = NULL, *aux_body = NULL; + str *notify_body = NULL; subs_t* subs_array= NULL, *s= NULL; int ret_code= -1; @@ -1291,22 +1291,13 @@ int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, str while(s) { s->auth_rules_doc= rules_doc; - if (p->event->aux_body_processing) { - aux_body = p->event->aux_body_processing(s, notify_body?notify_body:body); - } - if(notify(s, NULL, aux_body?aux_body:(notify_body?notify_body:body), 0)< 0 ) + if(notify(s, NULL, notify_body?notify_body:body, 0, p->event->aux_body_processing)< 0 ) { LM_ERR("Could not send notify for %.*s\n", p->event->name.len, p->event->name.s); } - if(aux_body!=NULL) { - if(aux_body->s) { - p->event->aux_free_body(aux_body->s); - } - pkg_free(aux_body); - } s= s->next; } ret_code= 0; @@ -1454,7 +1445,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs ) aux_body = event->aux_body_processing(s, notify_body); } - if(notify(s, watcher_subs, aux_body?aux_body:notify_body, 0)< 0 ) + if(notify(s, watcher_subs, aux_body?aux_body:notify_body, 0, 0)< 0 ) { LM_ERR("Could not send notify for [event]=%.*s\n", event->name.len, event->name.s); @@ -1667,8 +1658,11 @@ error: } -int notify(subs_t* subs, subs_t * watcher_subs,str* n_body,int force_null_body) +int notify(subs_t* subs, subs_t * watcher_subs,str* n_body,int force_null_body, aux_body_processing_t* aux_body_processing) { + + str* aux_body = NULL; + /* update first in hash table and the send Notify */ if(subs->expires!= 0 && subs->status != TERMINATED_STATUS) { @@ -1705,11 +1699,29 @@ int notify(subs_t* subs, subs_t * watcher_subs,str* n_body,int force_null_body) force_null_body = 1; } - if(send_notify_request(subs, watcher_subs, n_body, force_null_body)< 0) + if (!force_null_body && aux_body_processing) + { + aux_body = aux_body_processing(subs, n_body); + } + + if(send_notify_request(subs, watcher_subs, aux_body?aux_body:n_body, force_null_body)< 0) { LM_ERR("sending Notify not successful\n"); + if(aux_body!=NULL) { + if(aux_body->s) { + subs->event->aux_free_body(aux_body->s); + } + pkg_free(aux_body); + } return -1; } + + if(aux_body!=NULL) { + if(aux_body->s) { + subs->event->aux_free_body(aux_body->s); + } + pkg_free(aux_body); + } return 0; } @@ -2731,7 +2743,7 @@ static int notifier_notify(subs_t *sub, int *updated, int *end_transaction) goto done; } - if (notify(sub, NULL, nbody, 0) < 0) + if (notify(sub, NULL, nbody, 0, 0) < 0) { LM_ERR("could not send notify\n"); goto error; diff --git a/modules/presence/notify.h b/modules/presence/notify.h index 368ae7191..ef4dfbe42 100644 --- a/modules/presence/notify.h +++ b/modules/presence/notify.h @@ -116,7 +116,7 @@ int publ_notify_notifier(str pres_uri, pres_ev_t *event); int set_updated(subs_t *sub); int set_wipeer_subs_updated(str *pres_uri, pres_ev_t *event, int full); -int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body); +int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body, aux_body_processing_t* aux_body_processing); int send_notify_request(subs_t* subs, subs_t * watcher_subs, str* n_body,int force_null_body); diff --git a/modules/presence/presence.c b/modules/presence/presence.c index 0b50e728e..ca4b8fb3a 100644 --- a/modules/presence/presence.c +++ b/modules/presence/presence.c @@ -1171,7 +1171,7 @@ send_notify: while(s) { - if(notify(s, NULL, NULL, 0)< 0) + if(notify(s, NULL, NULL, 0, 0)< 0) { LM_ERR( "sending Notify request\n"); goto done; diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c index 5ef17854d..7fda9a9d5 100644 --- a/modules/presence/subscribe.c +++ b/modules/presence/subscribe.c @@ -610,7 +610,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int to_tag_gen, *sent_reply= 1; } - if(notify(subs, NULL, NULL, 0)< 0) + if(notify(subs, NULL, NULL, 0, 0)< 0) { LM_ERR("Could not send notify\n"); goto error; @@ -697,7 +697,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int to_tag_gen, } if(subs->send_on_cback== 0) { - if(notify(subs, NULL, NULL, 0)< 0) + if(notify(subs, NULL, NULL, 0, 0)< 0) { LM_ERR("Could not send notify\n"); goto error; @@ -706,7 +706,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int to_tag_gen, } else { - if(send_fast_notify && (notify(subs, NULL, NULL, 0)< 0)) + if(send_fast_notify && (notify(subs, NULL, NULL, 0, 0)< 0)) { LM_ERR("Could not send notify\n"); goto error; @@ -724,7 +724,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int to_tag_gen, } *sent_reply= 1; - if(send_fast_notify && (notify(subs, NULL, NULL, 0 )< 0)) + if(send_fast_notify && (notify(subs, NULL, NULL, 0, 0)< 0)) { LM_ERR("sending notify request\n"); goto error; diff --git a/modules/pua_dialoginfo/pua_dialoginfo.c b/modules/pua_dialoginfo/pua_dialoginfo.c index 2e050d38b..085d2654d 100644 --- a/modules/pua_dialoginfo/pua_dialoginfo.c +++ b/modules/pua_dialoginfo/pua_dialoginfo.c @@ -254,10 +254,15 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para str tag = {0,0}; str uri = {0,0}; str target = {0,0}; + struct dlginfo_cell *dlginfo = NULL; + dlginfo = (struct dlginfo_cell*)*_params->param; - struct dlginfo_cell *dlginfo = (struct dlginfo_cell*)*_params->param; - + if(dlg==NULL || dlginfo==NULL) { + LM_WARN("execution with null parameters - type %d, dlg %p, info %p\n", + type, dlg, dlginfo); + return; + } if(include_req_uri) { uri = dlginfo->req_uri; } else { diff --git a/modules/ratelimit/ratelimit.c b/modules/ratelimit/ratelimit.c index 69fcd74fa..b8a053ef7 100644 --- a/modules/ratelimit/ratelimit.c +++ b/modules/ratelimit/ratelimit.c @@ -359,9 +359,6 @@ static int get_cpuload(double * load) vload = ((double)d_idle) / (double)d_total; - /* divide by numbers of cpu */ - ncpu = get_num_cpus(); - vload = vload/ncpu; vload = 1.0 - vload; if(vload<0.0) vload = 0.0; else if (vload>1.0) vload = 1.0; diff --git a/modules/rtjson/rtjson_routing.c b/modules/rtjson/rtjson_routing.c index 5542e63e1..5a21599c2 100644 --- a/modules/rtjson/rtjson_routing.c +++ b/modules/rtjson/rtjson_routing.c @@ -318,6 +318,7 @@ int rtjson_init_serial(sip_msg_t *msg, srjson_doc_t *jdoc, sr_xavp_t *iavp) str val; unsigned int bflags = 0; unsigned int old_bflags = 0; + struct socket_info* fsocket = NULL; tj = srjson_GetObjectItem(jdoc, jdoc->root, "routes"); if(tj==NULL || tj->type!=srjson_Array || tj->child==NULL) { @@ -370,6 +371,17 @@ int rtjson_init_serial(sip_msg_t *msg, srjson_doc_t *jdoc, sr_xavp_t *iavp) } } + rj = srjson_GetObjectItem(jdoc, nj, "socket"); + if(rj!=NULL && rj->type==srjson_String && rj->valuestring!=NULL) { + val.s = rj->valuestring; + val.len = strlen(val.s); + LM_DBG("trying to set send socket to: [%.*s]\n", val.len, val.s); + fsocket = lookup_local_socket(&val); + if(fsocket) { + set_force_socket(msg, fsocket); + } + } + rj = srjson_GetObjectItem(jdoc, nj, "branch_flags"); if(rj!=NULL && rj->type==srjson_Number && SRJSON_GET_UINT(rj)!=0) { bflags = SRJSON_GET_UINT(rj); @@ -481,7 +493,7 @@ int rtjson_prepare_branch(sip_msg_t *msg, srjson_doc_t *jdoc, srjson_t *nj) xuri.len = strlen(xuri.s); } if(xdsp.len>0 || xuri.len>0) { - uacb.replace_from(msg, &xdsp, &xuri); + uacb.replace_to(msg, &xdsp, &xuri); } } } @@ -498,6 +510,7 @@ int rtjson_append_branch(sip_msg_t *msg, srjson_doc_t *jdoc, srjson_t *nj) str uri = {0}; str duri = {0}; str path = {0}; + str socket = {0}; struct socket_info* fsocket = NULL; unsigned int bflags = 0; @@ -519,7 +532,12 @@ int rtjson_append_branch(sip_msg_t *msg, srjson_doc_t *jdoc, srjson_t *nj) path.s = rj->valuestring; path.len = strlen(path.s); } - + rj = srjson_GetObjectItem(jdoc, nj, "socket"); + if(rj!=NULL && rj->type==srjson_String && rj->valuestring!=NULL) { + socket.s = rj->valuestring; + socket.len = strlen(socket.s); + fsocket = lookup_local_socket(&socket); + } if (append_branch(msg, &uri, &duri, &path, 0, bflags, fsocket, 0 /*instance*/, 0, 0, 0) <0) { diff --git a/modules/rtpengine/README b/modules/rtpengine/README index df6d7ff73..9e19f488b 100644 --- a/modules/rtpengine/README +++ b/modules/rtpengine/README @@ -965,8 +965,12 @@ rtpengine_delete(); with internal flag FL_SDP_BODY to know that the 1xx and 2xx are for rtpengine_answer() * If ACK with SDP, then do rtpengine_answer() - * If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do - rtpengine_delete() + * If BYE or CANCEL, or called within a FAILURE_ROUTE[], then call + rtpengine_delete(). Be careful with calling this function after + resuming a suspended transaction (e.g., after t_continue()), + because the context of executed route is FAILURE ROUTE (in other + words, rtpengine_manage() in the route block of t_continue() does + the same as in failure_route). * If reply to INVITE with code >= 300 do rtpengine_delete() * If reply with SDP to INVITE having code 1xx and 2xx, then do rtpengine_answer() if the request had SDP or tm is not loaded, diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 6875e5fa3..c4174c46f 100644 --- a/modules/rtpengine/doc/rtpengine_admin.xml +++ b/modules/rtpengine/doc/rtpengine_admin.xml @@ -1080,7 +1080,12 @@ rtpengine_delete(); - If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do rtpengine_delete() + If BYE or CANCEL, or called within a FAILURE_ROUTE[], then call + rtpengine_delete(). Be careful with calling + this function after resuming a suspended transaction (e.g., after + t_continue()), because the context of executed route is FAILURE + ROUTE (in other words, rtpengine_manage() in the route block of + t_continue() does the same as in failure_route). diff --git a/modules/rtpproxy/README b/modules/rtpproxy/README index ff027f399..fe4e0057f 100644 --- a/modules/rtpproxy/README +++ b/modules/rtpproxy/README @@ -640,8 +640,12 @@ rtpproxy_destroy(); with internal flag FL_SDP_BODY to know that the 1xx and 2xx are for rtpproxy_answer() * If ACK with SDP, then do rtpproxy_answer() - * If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do - unforce_rtpproxy() + * If BYE or CANCEL, or called within a FAILURE_ROUTE[], then call + unforce_rtpproxy(). Be careful with calling this function after + resuming a suspended transaction (e.g., after t_continue()), + because the context of executed route is FAILURE ROUTE (in other + words, rtpproxy_manage() in the route block of t_continue() does + the same as in failure_route). * If reply to INVITE with code >= 300 do unforce_rtpproxy() * If reply with SDP to INVITE having code 1xx and 2xx, then do rtpproxy_answer() if the request had SDP or tm is not loaded, diff --git a/modules/rtpproxy/doc/rtpproxy_admin.xml b/modules/rtpproxy/doc/rtpproxy_admin.xml index 49edff786..fcbab3a81 100644 --- a/modules/rtpproxy/doc/rtpproxy_admin.xml +++ b/modules/rtpproxy/doc/rtpproxy_admin.xml @@ -680,7 +680,12 @@ rtpproxy_destroy(); - If BYE or CANCEL, or called within a FAILURE_ROUTE[], then do unforce_rtpproxy() + If BYE or CANCEL, or called within a FAILURE_ROUTE[], then call + unforce_rtpproxy(). Be careful with calling + this function after resuming a suspended transaction (e.g., after + t_continue()), because the context of executed route is FAILURE + ROUTE (in other words, rtpproxy_manage() in the route block of + t_continue() does the same as in failure_route). diff --git a/modules/sipcapture/hep.c b/modules/sipcapture/hep.c index bbafa5a4b..3c0485602 100644 --- a/modules/sipcapture/hep.c +++ b/modules/sipcapture/hep.c @@ -38,12 +38,13 @@ static int count = 0; -struct hep_timehdr* heptime; +struct hep_timeinfo* heptime; /* HEPv2 HEPv3 */ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri); int hepv3_received(char *buf, unsigned int len, struct receive_info *ri); int parsing_hepv3_message(char *buf, unsigned int len); + /** * HEP message */ @@ -100,7 +101,7 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){ struct hep_iphdr *hepiph = NULL; struct hep_timehdr* heptime_tmp = NULL; - memset(heptime, 0, sizeof(struct hep_timehdr)); + memset(heptime, 0, sizeof(struct hep_timeinfo)); struct hep_ip6hdr *hepip6h = NULL; @@ -139,7 +140,7 @@ int hepv2_received(char *buf, unsigned int len, struct receive_info *ri){ else if(heph->hp_p == IPPROTO_SCTP) ri->proto=PROTO_SCTP; #endif else { - LOG(L_ERR, "ERROR: sipcapture:hep_msg_received: unknow protocol [%d]\n",heph->hp_p); + LOG(L_ERR, "ERROR: sipcapture:hep_msg_received: unknown protocol [%d]\n",heph->hp_p); ri->proto = PROTO_NONE; } @@ -262,7 +263,7 @@ int parsing_hepv3_message(char *buf, unsigned int len) { memset(hg, 0, sizeof(struct hep_generic_recv)); - memset(heptime, 0, sizeof(struct hep_timehdr)); + memset(heptime, 0, sizeof(struct hep_timeinfo)); /* HEADER */ @@ -394,7 +395,7 @@ int parsing_hepv3_message(char *buf, unsigned int len) { case 12: hg->capt_id = (hep_chunk_uint32_t *) (tmp); i+=chunk_length; - heptime->captid = ntohs(hg->capt_id->data); + heptime->captid = ntohl(hg->capt_id->data); totelem++; break; @@ -486,7 +487,7 @@ int parsing_hepv3_message(char *buf, unsigned int len) { /*TIME*/ heptime->tv_sec = hg->time_sec->data; heptime->tv_usec = hg->time_usec->data; - heptime->captid = ntohs(hg->capt_id->data); + heptime->captid = ntohl(hg->capt_id->data); if(payload != NULL ) { @@ -514,6 +515,3 @@ error: } - - - diff --git a/modules/sipcapture/hep.h b/modules/sipcapture/hep.h index c2433db99..65f525b7b 100644 --- a/modules/sipcapture/hep.h +++ b/modules/sipcapture/hep.h @@ -61,6 +61,12 @@ struct hep_timehdr{ u_int16_t captid; /* Capture ID node */ }; +struct hep_timeinfo{ + u_int32_t tv_sec; /* seconds */ + u_int32_t tv_usec; /* useconds */ + u_int32_t captid; /* Capture ID node */ +}; + struct hep_ip6hdr { struct in6_addr hp6_src; /* source address */ struct in6_addr hp6_dst; /* destination address */ diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c index 425a79b66..fb999360a 100644 --- a/modules/sipcapture/sipcapture.c +++ b/modules/sipcapture/sipcapture.c @@ -1606,7 +1606,7 @@ static int sip_capture(struct sip_msg *msg, str *_table, _capture_mode_data_t * if(heptime && heptime->tv_sec != 0) { sco.tmstamp = (unsigned long long)heptime->tv_sec*1000000+heptime->tv_usec; /* micro ts */ - snprintf(tmp_node, 100, "%.*s:%i", capture_node.len, capture_node.s, heptime->captid); + snprintf(tmp_node, 100, "%.*s:%lu", capture_node.len, capture_node.s, (unsigned long)heptime->captid); sco.node.s = tmp_node; sco.node.len = strlen(tmp_node); } @@ -2285,15 +2285,15 @@ int receive_logging_json_msg(char * buf, unsigned int len, struct hep_generic_re /*source ip*/ sco.source_ip.s = ipstr_src; sco.source_ip.len = strlen(ipstr_src); - sco.source_port = hg->src_port->data; + sco.source_port = ntohs(hg->src_port->data); sco.destination_ip.s = ipstr_dst; sco.destination_ip.len = strlen(ipstr_dst); - sco.destination_port = hg->dst_port->data; + sco.destination_port = ntohs(hg->dst_port->data); if(heptime && heptime->tv_sec != 0) { sco.tmstamp = (unsigned long long)heptime->tv_sec*1000000+heptime->tv_usec; /* micro ts */ - snprintf(tmp_node, 100, "%.*s:%i", capture_node.len, capture_node.s, heptime->captid); + snprintf(tmp_node, 100, "%.*s:%lu", capture_node.len, capture_node.s, (unsigned long)heptime->captid); sco.node.s = tmp_node; sco.node.len = strlen(tmp_node); epoch_time_as_time_t = heptime->tv_sec;; @@ -2307,7 +2307,6 @@ int receive_logging_json_msg(char * buf, unsigned int len, struct hep_generic_re if(correlation_id) { corrtmp.s = correlation_id; corrtmp.len = strlen(correlation_id); - if(!strncmp(log_table, "rtcp_capture",12)) corrtmp.len--; } db_keys[0] = &date_column; @@ -2464,7 +2463,7 @@ static int report_capture(struct sip_msg *msg, str *_table, str* _corr, str *_d if(heptime && heptime->tv_sec != 0) { sco.tmstamp = (unsigned long long)heptime->tv_sec*1000000+heptime->tv_usec; /* micro ts */ - snprintf(tmp_node, 100, "%.*s:%i", capture_node.len, capture_node.s, heptime->captid); + snprintf(tmp_node, 100, "%.*s:%lu", capture_node.len, capture_node.s, (unsigned long)heptime->captid); sco.node.s = tmp_node; sco.node.len = strlen(tmp_node); epoch_time_as_time_t = heptime->tv_sec;; @@ -2482,7 +2481,6 @@ static int report_capture(struct sip_msg *msg, str *_table, str* _corr, str *_d else if(correlation_id) { corrtmp.s = correlation_id; corrtmp.len = strlen(correlation_id); - if(!strncmp(_table->s, "rtcp_capture",12)) corrtmp.len--; } db_keys[0] = &date_column; diff --git a/modules/statsd/statsd.c b/modules/statsd/statsd.c index 6b956582c..12da08173 100644 --- a/modules/statsd/statsd.c +++ b/modules/statsd/statsd.c @@ -3,7 +3,7 @@ #include #include "../../sr_module.h" -#include "../../usr_avp.c" +#include "../../usr_avp.h" #include "../../pvar.h" #include "../../lvalue.h" #include "lib_statsd.h" diff --git a/modules/tm/t_msgbuilder.c b/modules/tm/t_msgbuilder.c index 09bb6dcd4..90623dcd5 100644 --- a/modules/tm/t_msgbuilder.c +++ b/modules/tm/t_msgbuilder.c @@ -37,6 +37,7 @@ #include "../../ut.h" #include "../../parser/msg_parser.h" #include "../../parser/contact/parse_contact.h" +#include "../../srapi.h" #include "lw_parser.h" #include "t_msgbuilder.h" #include "uac.h" @@ -198,8 +199,8 @@ char *build_local(struct cell *Trans,unsigned int branch, append_str( p, Trans->cseq_n.s, Trans->cseq_n.len ); append_str( p, " ", 1 ); append_str( p, method, method_len ); - append_str( p, MAXFWD_HEADER, MAXFWD_HEADER_LEN ); append_str( p, CRLF, CRLF_LEN ); + append_str( p, MAXFWD_HEADER, MAXFWD_HEADER_LEN ); if (!is_local(Trans)) { for ( hdr=Trans->uas.request->headers ; hdr ; hdr=hdr->next ) @@ -279,6 +280,8 @@ char *build_local_reparse(struct cell *Trans,unsigned int branch, int reason_len, code_len; struct hdr_field *reas1, *reas_last, *hdr; #endif /* CANCEL_REASON_SUPPORT */ + int hadded = 0; + sr_cfgenv_t *cenv = NULL; invite_buf = Trans->uac[branch].request.buffer; invite_len = Trans->uac[branch].request.buffer_len; @@ -356,6 +359,8 @@ char *build_local_reparse(struct cell *Trans,unsigned int branch, s = eat_line(s, invite_buf_end - s); append_str(d, s1, s - s1); + cenv = sr_cfgenv_get(); + /* check every header field name, we must exclude and modify some of the headers */ first_via = 1; @@ -473,15 +478,35 @@ char *build_local_reparse(struct cell *Trans,unsigned int branch, default: s = lw_next_line(s, invite_buf_end); + hadded = 0; + + /* uac auth headers */ + if(Trans->uas.request && + (Trans->uas.request->msg_flags & FL_UAC_AUTH)) { + if(s1 + cenv->uac_cseq_auth.len + 2 < invite_buf_end) { + if(s1[cenv->uac_cseq_auth.len]==':' + && strncmp(s1, cenv->uac_cseq_auth.s, + cenv->uac_cseq_auth.len)==0) { + hadded = 1; + append_str(d, s1, s - s1); + } else if(s1[cenv->uac_cseq_refresh.len]==':' + && strncmp(s1, cenv->uac_cseq_refresh.s, + cenv->uac_cseq_refresh.len)==0) { + hadded = 1; + append_str(d, s1, s - s1); + } + } + } - if (cfg_get(tm, tm_cfg, ac_extra_hdrs).len - && (s1 + cfg_get(tm, tm_cfg, ac_extra_hdrs).len < invite_buf_end) - && (strncasecmp(s1, - cfg_get(tm, tm_cfg, ac_extra_hdrs).s, - cfg_get(tm, tm_cfg, ac_extra_hdrs).len) == 0) - ) { - append_str(d, s1, s - s1); - } /* else skip this line */ + if(likely(hadded==0)) { + if (cfg_get(tm, tm_cfg, ac_extra_hdrs).len + && (s1 + cfg_get(tm, tm_cfg, ac_extra_hdrs).len < invite_buf_end) + && (strncasecmp(s1, + cfg_get(tm, tm_cfg, ac_extra_hdrs).s, + cfg_get(tm, tm_cfg, ac_extra_hdrs).len) == 0)) { + append_str(d, s1, s - s1); + } + } break; } } @@ -1467,11 +1492,20 @@ char* build_uac_req(str* method, str* headers, str* body, dlg_t* dialog, int bra str content_length, cseq, via; unsigned int maxfwd_len; int tbracket, fbracket; + str fromtag = STR_NULL; + str loc_tag = STR_NULL; if (!method || !dialog) { LOG(L_ERR, "build_uac_req(): Invalid parameter value\n"); return 0; } + + if (dialog->id.loc_tag.len<=0) { + /* From Tag is mandatory in RFC3261 - generate one if not provided */ + generate_fromtag(&fromtag, &dialog->id.call_id); + loc_tag = dialog->id.loc_tag; + dialog->id.loc_tag = fromtag; + } if (print_content_length(&content_length, body) < 0) { LOG(L_ERR, "build_uac_req(): Error while printing content-length\n"); return 0; @@ -1552,6 +1586,9 @@ char* build_uac_req(str* method, str* headers, str* body, dlg_t* dialog, int bra memapp(w, via.s, via.len); /* Top-most Via */ w = print_to(w, dialog, t, tbracket); /* To */ w = print_from(w, dialog, t, fbracket); /* From */ + if(fromtag.len>0) { + dialog->id.loc_tag = loc_tag; + } w = print_cseq(w, &cseq, method, t); /* CSeq */ w = print_callid(w, dialog, t); /* Call-ID */ w = print_routeset(w, dialog); /* Route set */ diff --git a/modules/tmx/README b/modules/tmx/README index 961a54047..45dbc97c2 100644 --- a/modules/tmx/README +++ b/modules/tmx/README @@ -381,12 +381,21 @@ if(t_suspend()) * rtname - the name of the route block to execute. Can be a static string value or a dynamic string with pseudo-variables. + Important note: the route[rtname] is executed in the context of a + failure (same behaviour for functions as they were used in a + failure_route block). + This function can be used in ANY_ROUTE. Example 1.11. t_continue usage ... t_continue('123', '456', 'MYROUTE'); ... +route[MYROUTE] { + xlog("executed by t continue\n"); + ... +} +... 4.11. t_reuse_branch() diff --git a/modules/tmx/doc/tmx_admin.xml b/modules/tmx/doc/tmx_admin.xml index b3a756e1e..95c38f6d7 100644 --- a/modules/tmx/doc/tmx_admin.xml +++ b/modules/tmx/doc/tmx_admin.xml @@ -379,6 +379,11 @@ if(t_suspend()) pseudo-variables. + + Important note: the route[rtname] is executed in the context of + a failure (same behaviour for functions as they were used in a + failure_route block). + This function can be used in ANY_ROUTE. @@ -388,6 +393,11 @@ if(t_suspend()) ... t_continue('123', '456', 'MYROUTE'); ... +route[MYROUTE] { + xlog("executed by t continue\n"); + ... +} +...
diff --git a/modules/xmlrpc/xmlrpc.c b/modules/xmlrpc/xmlrpc.c index 98835f9d9..c8da2ba0d 100644 --- a/modules/xmlrpc/xmlrpc.c +++ b/modules/xmlrpc/xmlrpc.c @@ -907,6 +907,7 @@ static void rpc_fault(rpc_ctx_t* ctx, int code, char* fmt, ...) static char buf[REASON_BUF_LEN]; va_list ap; + fix_delayed_reply_ctx(ctx); ctx->reply.code = code; va_start(ap, fmt); vsnprintf(buf, REASON_BUF_LEN, fmt, ap); diff --git a/pkg/kamailio/centos/6/kamailio.spec b/pkg/kamailio/centos/6/kamailio.spec index c61e7cc9c..36cd3757b 100644 --- a/pkg/kamailio/centos/6/kamailio.spec +++ b/pkg/kamailio/centos/6/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0.0%{dist} diff --git a/pkg/kamailio/deb/debian/changelog b/pkg/kamailio/deb/debian/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/debian/changelog +++ b/pkg/kamailio/deb/debian/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/jessie/changelog b/pkg/kamailio/deb/jessie/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/jessie/changelog +++ b/pkg/kamailio/deb/jessie/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/precise/changelog b/pkg/kamailio/deb/precise/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/precise/changelog +++ b/pkg/kamailio/deb/precise/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/sid/changelog b/pkg/kamailio/deb/sid/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/sid/changelog +++ b/pkg/kamailio/deb/sid/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/squeeze/changelog b/pkg/kamailio/deb/squeeze/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/squeeze/changelog +++ b/pkg/kamailio/deb/squeeze/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/stretch/changelog b/pkg/kamailio/deb/stretch/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/stretch/changelog +++ b/pkg/kamailio/deb/stretch/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/trusty/changelog b/pkg/kamailio/deb/trusty/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/trusty/changelog +++ b/pkg/kamailio/deb/trusty/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/wheezy/changelog b/pkg/kamailio/deb/wheezy/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/wheezy/changelog +++ b/pkg/kamailio/deb/wheezy/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/deb/xenial/changelog b/pkg/kamailio/deb/xenial/changelog index e5a15da0e..263271d89 100644 --- a/pkg/kamailio/deb/xenial/changelog +++ b/pkg/kamailio/deb/xenial/changelog @@ -1,3 +1,9 @@ +kamailio (4.4.5) unstable; urgency=medium + + * version set to 4.4.5 + + -- Victor Seva Wed, 18 Jan 2017 15:09:42 +0100 + kamailio (4.4.4) unstable; urgency=medium * version set to 4.4.4 diff --git a/pkg/kamailio/fedora/17/kamailio.spec b/pkg/kamailio/fedora/17/kamailio.spec index 91a417a7e..65f81528d 100644 --- a/pkg/kamailio/fedora/17/kamailio.spec +++ b/pkg/kamailio/fedora/17/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0%{dist} diff --git a/pkg/kamailio/oracle/el6/kamailio.spec b/pkg/kamailio/oracle/el6/kamailio.spec index 399f85556..23b881322 100644 --- a/pkg/kamailio/oracle/el6/kamailio.spec +++ b/pkg/kamailio/oracle/el6/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/oracle/el7/kamailio.spec b/pkg/kamailio/oracle/el7/kamailio.spec index 9c7548173..670b9c127 100644 --- a/pkg/kamailio/oracle/el7/kamailio.spec +++ b/pkg/kamailio/oracle/el7/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/rpm/kamailio.spec-4.1 b/pkg/kamailio/rpm/kamailio.spec-4.1 index 1bb031684..4f0e4c7d3 100644 --- a/pkg/kamailio/rpm/kamailio.spec-4.1 +++ b/pkg/kamailio/rpm/kamailio.spec-4.1 @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc diff --git a/pkg/kamailio/rpm/kamailio.spec.CenOS b/pkg/kamailio/rpm/kamailio.spec.CenOS index 2b4f43748..533b62bb6 100644 --- a/pkg/kamailio/rpm/kamailio.spec.CenOS +++ b/pkg/kamailio/rpm/kamailio.spec.CenOS @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/rpm/kamailio.spec.SuSE b/pkg/kamailio/rpm/kamailio.spec.SuSE index bec54a73c..91e8fbd35 100644 --- a/pkg/kamailio/rpm/kamailio.spec.SuSE +++ b/pkg/kamailio/rpm/kamailio.spec.SuSE @@ -1,5 +1,5 @@ %define name kamailio -%define ver 4.4.4 +%define ver 4.4.5 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops diff --git a/srapi.c b/srapi.c index e01659b15..2a2b7ecc1 100644 --- a/srapi.c +++ b/srapi.c @@ -56,6 +56,10 @@ static sr_cfgenv_t _sr_cfgenv; void sr_cfgenv_init(void) { memset(&_sr_cfgenv, 0, sizeof(sr_cfgenv_t)); + _sr_cfgenv.uac_cseq_auth.s = "P-K-CSeq-Auth"; + _sr_cfgenv.uac_cseq_auth.len = strlen(_sr_cfgenv.uac_cseq_auth.s); + _sr_cfgenv.uac_cseq_refresh.s = "P-K-CSeq-Refresh"; + _sr_cfgenv.uac_cseq_refresh.len = strlen(_sr_cfgenv.uac_cseq_refresh.s); } /** diff --git a/srapi.h b/srapi.h index d480fbfa2..e41553723 100644 --- a/srapi.h +++ b/srapi.h @@ -31,6 +31,8 @@ sr_generate_callid_f sr_get_callid_func(void); typedef int (*sr_cseq_update_f)(sip_msg_t*); typedef struct sr_cfgenv { sr_cseq_update_f cb_cseq_update; + str uac_cseq_auth; + str uac_cseq_refresh; } sr_cfgenv_t; void sr_cfgenv_init(void); diff --git a/utils/kamctl/db_berkeley/kamailio/aliases b/utils/kamctl/db_berkeley/kamailio/aliases index 947d7bd88..3c1c773ab 100644 --- a/utils/kamctl/db_berkeley/kamailio/aliases +++ b/utils/kamctl/db_berkeley/kamailio/aliases @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|NULL|''|NULL|NULL|'2030-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'1900-01-01 00:00:01'|0|0|''|NULL|NULL|NULL|0|0|0|0|0 +NIL|''|''|NULL|''|NULL|NULL|'2030-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'2000-01-01 00:00:01'|0|0|''|NULL|NULL|NULL|0|0|0|0|0 diff --git a/utils/kamctl/db_berkeley/kamailio/domain b/utils/kamctl/db_berkeley/kamailio/domain index 75b07c277..9ae31cf2d 100644 --- a/utils/kamctl/db_berkeley/kamailio/domain +++ b/utils/kamctl/db_berkeley/kamailio/domain @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|NIL|NULL|'1900-01-01 00:00:01' +NIL|NIL|NULL|'2000-01-01 00:00:01' diff --git a/utils/kamctl/db_berkeley/kamailio/domain_attrs b/utils/kamctl/db_berkeley/kamailio/domain_attrs index 853d5626e..f9056f27a 100644 --- a/utils/kamctl/db_berkeley/kamailio/domain_attrs +++ b/utils/kamctl/db_berkeley/kamailio/domain_attrs @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|NIL|NIL|NIL|NIL|'1900-01-01 00:00:01' +NIL|NIL|NIL|NIL|NIL|'2000-01-01 00:00:01' diff --git a/utils/kamctl/db_berkeley/kamailio/grp b/utils/kamctl/db_berkeley/kamailio/grp index 4815e0480..adff9eaf8 100644 --- a/utils/kamctl/db_berkeley/kamailio/grp +++ b/utils/kamctl/db_berkeley/kamailio/grp @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|''|'1900-01-01 00:00:01' +NIL|''|''|''|'2000-01-01 00:00:01' diff --git a/utils/kamctl/db_berkeley/kamailio/location b/utils/kamctl/db_berkeley/kamailio/location index 947d7bd88..3c1c773ab 100644 --- a/utils/kamctl/db_berkeley/kamailio/location +++ b/utils/kamctl/db_berkeley/kamailio/location @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|NULL|''|NULL|NULL|'2030-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'1900-01-01 00:00:01'|0|0|''|NULL|NULL|NULL|0|0|0|0|0 +NIL|''|''|NULL|''|NULL|NULL|'2030-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'2000-01-01 00:00:01'|0|0|''|NULL|NULL|NULL|0|0|0|0|0 diff --git a/utils/kamctl/db_berkeley/kamailio/location_attrs b/utils/kamctl/db_berkeley/kamailio/location_attrs index 923e4cc68..c7ef80c2a 100644 --- a/utils/kamctl/db_berkeley/kamailio/location_attrs +++ b/utils/kamctl/db_berkeley/kamailio/location_attrs @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|NULL|''|0|''|'1900-01-01 00:00:01' +NIL|''|''|NULL|''|0|''|'2000-01-01 00:00:01' diff --git a/utils/kamctl/db_berkeley/kamailio/sip_trace b/utils/kamctl/db_berkeley/kamailio/sip_trace index d07568ecd..dfb918799 100644 --- a/utils/kamctl/db_berkeley/kamailio/sip_trace +++ b/utils/kamctl/db_berkeley/kamailio/sip_trace @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|'1900-01-01 00:00:01'|0|''|''|NIL|''|''|''|''|''|''|'' +NIL|'2000-01-01 00:00:01'|0|''|''|NIL|''|''|''|''|''|''|'' diff --git a/utils/kamctl/db_berkeley/kamailio/topos_d b/utils/kamctl/db_berkeley/kamailio/topos_d index 557f3810c..5cfb4ab63 100644 --- a/utils/kamctl/db_berkeley/kamailio/topos_d +++ b/utils/kamctl/db_berkeley/kamailio/topos_d @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|NIL|''|''|''|''|''|''|''|''|''|''|''|''|''|''|0|''|''|''|''|''|''|'' +NIL|NIL|''|''|''|''|''|''|''|''|''|''|''|NIL|NIL|NIL|0|''|''|''|''|''|''|'' diff --git a/utils/kamctl/db_berkeley/kamailio/topos_t b/utils/kamctl/db_berkeley/kamailio/topos_t index 7e1164c4d..ff197134c 100644 --- a/utils/kamctl/db_berkeley/kamailio/topos_t +++ b/utils/kamctl/db_berkeley/kamailio/topos_t @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|NIL|''|''|''|''|''|0|''|''|''|''|''|''|''|''|''|''|''|''|''|''|''|''|'' +NIL|NIL|''|''|''|''|''|0|NIL|''|NIL|NIL|NIL|''|''|''|''|''|''|''|''|''|''|''|'' diff --git a/utils/kamctl/db_berkeley/kamailio/uri b/utils/kamctl/db_berkeley/kamailio/uri index 6bc8be852..ae00c5f0c 100644 --- a/utils/kamctl/db_berkeley/kamailio/uri +++ b/utils/kamctl/db_berkeley/kamailio/uri @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|''|'1900-01-01 00:00:01' +NIL|''|''|''|'2000-01-01 00:00:01' diff --git a/utils/kamctl/db_berkeley/kamailio/usr_preferences b/utils/kamctl/db_berkeley/kamailio/usr_preferences index 02de0f36c..8df7dbb5e 100644 --- a/utils/kamctl/db_berkeley/kamailio/usr_preferences +++ b/utils/kamctl/db_berkeley/kamailio/usr_preferences @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|0|''|''|0|''|'1900-01-01 00:00:01' +NIL|''|0|''|''|0|''|'2000-01-01 00:00:01' diff --git a/utils/kamctl/db_sqlite/avpops-create.sql b/utils/kamctl/db_sqlite/avpops-create.sql index a92c2059e..2fdc52939 100644 --- a/utils/kamctl/db_sqlite/avpops-create.sql +++ b/utils/kamctl/db_sqlite/avpops-create.sql @@ -6,7 +6,7 @@ CREATE TABLE usr_preferences ( attribute VARCHAR(32) DEFAULT '' NOT NULL, type INTEGER DEFAULT 0 NOT NULL, value VARCHAR(128) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL ); CREATE INDEX usr_preferences_ua_idx ON usr_preferences (uuid, attribute); diff --git a/utils/kamctl/db_sqlite/domain-create.sql b/utils/kamctl/db_sqlite/domain-create.sql index ad17359f7..5586eeeb7 100644 --- a/utils/kamctl/db_sqlite/domain-create.sql +++ b/utils/kamctl/db_sqlite/domain-create.sql @@ -2,7 +2,7 @@ CREATE TABLE domain ( id INTEGER PRIMARY KEY NOT NULL, domain VARCHAR(64) NOT NULL, did VARCHAR(64) DEFAULT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT domain_domain_idx UNIQUE (domain) ); @@ -14,7 +14,7 @@ CREATE TABLE domain_attrs ( name VARCHAR(32) NOT NULL, type INTEGER NOT NULL, value VARCHAR(255) NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT domain_attrs_domain_attrs_idx UNIQUE (did, name, value) ); diff --git a/utils/kamctl/db_sqlite/group-create.sql b/utils/kamctl/db_sqlite/group-create.sql index 8383f5e00..801e1f34f 100644 --- a/utils/kamctl/db_sqlite/group-create.sql +++ b/utils/kamctl/db_sqlite/group-create.sql @@ -3,7 +3,7 @@ CREATE TABLE grp ( username VARCHAR(64) DEFAULT '' NOT NULL, domain VARCHAR(64) DEFAULT '' NOT NULL, grp VARCHAR(64) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT grp_account_group_idx UNIQUE (username, domain, grp) ); diff --git a/utils/kamctl/db_sqlite/registrar-create.sql b/utils/kamctl/db_sqlite/registrar-create.sql index 0040b343e..bcf9351a1 100644 --- a/utils/kamctl/db_sqlite/registrar-create.sql +++ b/utils/kamctl/db_sqlite/registrar-create.sql @@ -10,7 +10,7 @@ CREATE TABLE aliases ( q REAL DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, cseq INTEGER DEFAULT 1 NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, flags INTEGER DEFAULT 0 NOT NULL, cflags INTEGER DEFAULT 0 NOT NULL, user_agent VARCHAR(255) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/db_sqlite/siptrace-create.sql b/utils/kamctl/db_sqlite/siptrace-create.sql index 90eb1ba71..aa4350a80 100644 --- a/utils/kamctl/db_sqlite/siptrace-create.sql +++ b/utils/kamctl/db_sqlite/siptrace-create.sql @@ -1,6 +1,6 @@ CREATE TABLE sip_trace ( id INTEGER PRIMARY KEY NOT NULL, - time_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + time_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, time_us INTEGER DEFAULT 0 NOT NULL, callid VARCHAR(255) DEFAULT '' NOT NULL, traced_user VARCHAR(128) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/db_sqlite/topos-create.sql b/utils/kamctl/db_sqlite/topos-create.sql index a74c81758..d36c5b62a 100644 --- a/utils/kamctl/db_sqlite/topos-create.sql +++ b/utils/kamctl/db_sqlite/topos-create.sql @@ -12,9 +12,9 @@ CREATE TABLE topos_d ( bs_contact VARCHAR(128) DEFAULT '' NOT NULL, a_tag VARCHAR(255) DEFAULT '' NOT NULL, b_tag VARCHAR(255) DEFAULT '' NOT NULL, - a_rr TEXT DEFAULT '' NOT NULL, - b_rr TEXT DEFAULT '' NOT NULL, - s_rr TEXT DEFAULT '' NOT NULL, + a_rr TEXT, + b_rr TEXT, + s_rr TEXT, iflags INTEGER DEFAULT 0 NOT NULL, a_uri VARCHAR(128) DEFAULT '' NOT NULL, b_uri VARCHAR(128) DEFAULT '' NOT NULL, @@ -39,11 +39,11 @@ CREATE TABLE topos_t ( a_uuid VARCHAR(255) DEFAULT '' NOT NULL, b_uuid VARCHAR(255) DEFAULT '' NOT NULL, direction INTEGER DEFAULT 0 NOT NULL, - x_via TEXT DEFAULT '' NOT NULL, + x_via TEXT, x_vbranch VARCHAR(255) DEFAULT '' NOT NULL, - x_rr TEXT DEFAULT '' NOT NULL, - y_rr TEXT DEFAULT '' NOT NULL, - s_rr TEXT DEFAULT '' NOT NULL, + x_rr TEXT, + y_rr TEXT, + s_rr TEXT, x_uri VARCHAR(128) DEFAULT '' NOT NULL, a_contact VARCHAR(128) DEFAULT '' NOT NULL, b_contact VARCHAR(128) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/db_sqlite/uri_db-create.sql b/utils/kamctl/db_sqlite/uri_db-create.sql index 076c99c94..c70b130d3 100644 --- a/utils/kamctl/db_sqlite/uri_db-create.sql +++ b/utils/kamctl/db_sqlite/uri_db-create.sql @@ -3,7 +3,7 @@ CREATE TABLE uri ( username VARCHAR(64) DEFAULT '' NOT NULL, domain VARCHAR(64) DEFAULT '' NOT NULL, uri_user VARCHAR(64) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT uri_account_idx UNIQUE (username, domain, uri_user) ); diff --git a/utils/kamctl/db_sqlite/usrloc-create.sql b/utils/kamctl/db_sqlite/usrloc-create.sql index 6cbfbdd21..14bb83682 100644 --- a/utils/kamctl/db_sqlite/usrloc-create.sql +++ b/utils/kamctl/db_sqlite/usrloc-create.sql @@ -10,7 +10,7 @@ CREATE TABLE location ( q REAL DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, cseq INTEGER DEFAULT 1 NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, flags INTEGER DEFAULT 0 NOT NULL, cflags INTEGER DEFAULT 0 NOT NULL, user_agent VARCHAR(255) DEFAULT '' NOT NULL, @@ -39,7 +39,7 @@ CREATE TABLE location_attrs ( aname VARCHAR(64) DEFAULT '' NOT NULL, atype INTEGER DEFAULT 0 NOT NULL, avalue VARCHAR(255) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL ); CREATE INDEX location_attrs_account_record_idx ON location_attrs (username, domain, ruid); diff --git a/utils/kamctl/dbtext/kamailio/topos_d b/utils/kamctl/dbtext/kamailio/topos_d index ff0cb58b6..aa4edb0ac 100644 --- a/utils/kamctl/dbtext/kamailio/topos_d +++ b/utils/kamctl/dbtext/kamailio/topos_d @@ -1 +1 @@ -id(int,auto) rectime(int) s_method(string) s_cseq(string) a_callid(string) a_uuid(string) b_uuid(string) a_contact(string) b_contact(string) as_contact(string) bs_contact(string) a_tag(string) b_tag(string) a_rr(string) b_rr(string) s_rr(string) iflags(int) a_uri(string) b_uri(string) r_uri(string) a_srcaddr(string) b_srcaddr(string) a_socket(string) b_socket(string) +id(int,auto) rectime(int) s_method(string) s_cseq(string) a_callid(string) a_uuid(string) b_uuid(string) a_contact(string) b_contact(string) as_contact(string) bs_contact(string) a_tag(string) b_tag(string) a_rr(string,null) b_rr(string,null) s_rr(string,null) iflags(int) a_uri(string) b_uri(string) r_uri(string) a_srcaddr(string) b_srcaddr(string) a_socket(string) b_socket(string) diff --git a/utils/kamctl/dbtext/kamailio/topos_t b/utils/kamctl/dbtext/kamailio/topos_t index dbb28aa61..c74edbb62 100644 --- a/utils/kamctl/dbtext/kamailio/topos_t +++ b/utils/kamctl/dbtext/kamailio/topos_t @@ -1 +1 @@ -id(int,auto) rectime(int) s_method(string) s_cseq(string) a_callid(string) a_uuid(string) b_uuid(string) direction(int) x_via(string) x_vbranch(string) x_rr(string) y_rr(string) s_rr(string) x_uri(string) a_contact(string) b_contact(string) as_contact(string) bs_contact(string) x_tag(string) a_tag(string) b_tag(string) a_srcaddr(string) b_srcaddr(string) a_socket(string) b_socket(string) +id(int,auto) rectime(int) s_method(string) s_cseq(string) a_callid(string) a_uuid(string) b_uuid(string) direction(int) x_via(string,null) x_vbranch(string) x_rr(string,null) y_rr(string,null) s_rr(string,null) x_uri(string) a_contact(string) b_contact(string) as_contact(string) bs_contact(string) x_tag(string) a_tag(string) b_tag(string) a_srcaddr(string) b_srcaddr(string) a_socket(string) b_socket(string) diff --git a/utils/kamctl/mysql/avpops-create.sql b/utils/kamctl/mysql/avpops-create.sql index 6700196b2..d9fafe2cd 100644 --- a/utils/kamctl/mysql/avpops-create.sql +++ b/utils/kamctl/mysql/avpops-create.sql @@ -6,7 +6,7 @@ CREATE TABLE `usr_preferences` ( `attribute` VARCHAR(32) DEFAULT '' NOT NULL, `type` INT(11) DEFAULT 0 NOT NULL, `value` VARCHAR(128) DEFAULT '' NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL ); CREATE INDEX ua_idx ON usr_preferences (`uuid`, `attribute`); diff --git a/utils/kamctl/mysql/domain-create.sql b/utils/kamctl/mysql/domain-create.sql index b614f2533..393fdabc4 100644 --- a/utils/kamctl/mysql/domain-create.sql +++ b/utils/kamctl/mysql/domain-create.sql @@ -2,7 +2,7 @@ CREATE TABLE `domain` ( `id` INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, `domain` VARCHAR(64) NOT NULL, `did` VARCHAR(64) DEFAULT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT domain_idx UNIQUE (`domain`) ); @@ -14,7 +14,7 @@ CREATE TABLE `domain_attrs` ( `name` VARCHAR(32) NOT NULL, `type` INT UNSIGNED NOT NULL, `value` VARCHAR(255) NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT domain_attrs_idx UNIQUE (`did`, `name`, `value`) ); diff --git a/utils/kamctl/mysql/group-create.sql b/utils/kamctl/mysql/group-create.sql index ef1fc0f2d..4ab2e3d06 100644 --- a/utils/kamctl/mysql/group-create.sql +++ b/utils/kamctl/mysql/group-create.sql @@ -3,7 +3,7 @@ CREATE TABLE `grp` ( `username` VARCHAR(64) DEFAULT '' NOT NULL, `domain` VARCHAR(64) DEFAULT '' NOT NULL, `grp` VARCHAR(64) DEFAULT '' NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT account_group_idx UNIQUE (`username`, `domain`, `grp`) ); diff --git a/utils/kamctl/mysql/registrar-create.sql b/utils/kamctl/mysql/registrar-create.sql index 2dfb193e9..e24bf71d6 100644 --- a/utils/kamctl/mysql/registrar-create.sql +++ b/utils/kamctl/mysql/registrar-create.sql @@ -10,7 +10,7 @@ CREATE TABLE `aliases` ( `q` FLOAT(10,2) DEFAULT 1.0 NOT NULL, `callid` VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, `cseq` INT(11) DEFAULT 1 NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, `flags` INT(11) DEFAULT 0 NOT NULL, `cflags` INT(11) DEFAULT 0 NOT NULL, `user_agent` VARCHAR(255) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/mysql/siptrace-create.sql b/utils/kamctl/mysql/siptrace-create.sql index 50e16b85c..d4386f184 100644 --- a/utils/kamctl/mysql/siptrace-create.sql +++ b/utils/kamctl/mysql/siptrace-create.sql @@ -1,6 +1,6 @@ CREATE TABLE `sip_trace` ( `id` INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, - `time_stamp` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `time_stamp` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, `time_us` INT UNSIGNED DEFAULT 0 NOT NULL, `callid` VARCHAR(255) DEFAULT '' NOT NULL, `traced_user` VARCHAR(128) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/mysql/topos-create.sql b/utils/kamctl/mysql/topos-create.sql index b3a61d3c6..db305752c 100644 --- a/utils/kamctl/mysql/topos-create.sql +++ b/utils/kamctl/mysql/topos-create.sql @@ -12,9 +12,9 @@ CREATE TABLE `topos_d` ( `bs_contact` VARCHAR(128) DEFAULT '' NOT NULL, `a_tag` VARCHAR(255) DEFAULT '' NOT NULL, `b_tag` VARCHAR(255) DEFAULT '' NOT NULL, - `a_rr` MEDIUMTEXT DEFAULT '' NOT NULL, - `b_rr` MEDIUMTEXT DEFAULT '' NOT NULL, - `s_rr` MEDIUMTEXT DEFAULT '' NOT NULL, + `a_rr` MEDIUMTEXT, + `b_rr` MEDIUMTEXT, + `s_rr` MEDIUMTEXT, `iflags` INT(10) UNSIGNED DEFAULT 0 NOT NULL, `a_uri` VARCHAR(128) DEFAULT '' NOT NULL, `b_uri` VARCHAR(128) DEFAULT '' NOT NULL, @@ -39,11 +39,11 @@ CREATE TABLE `topos_t` ( `a_uuid` VARCHAR(255) DEFAULT '' NOT NULL, `b_uuid` VARCHAR(255) DEFAULT '' NOT NULL, `direction` INT DEFAULT 0 NOT NULL, - `x_via` MEDIUMTEXT DEFAULT '' NOT NULL, + `x_via` MEDIUMTEXT, `x_vbranch` VARCHAR(255) DEFAULT '' NOT NULL, - `x_rr` MEDIUMTEXT DEFAULT '' NOT NULL, - `y_rr` MEDIUMTEXT DEFAULT '' NOT NULL, - `s_rr` MEDIUMTEXT DEFAULT '' NOT NULL, + `x_rr` MEDIUMTEXT, + `y_rr` MEDIUMTEXT, + `s_rr` MEDIUMTEXT, `x_uri` VARCHAR(128) DEFAULT '' NOT NULL, `a_contact` VARCHAR(128) DEFAULT '' NOT NULL, `b_contact` VARCHAR(128) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/mysql/uri_db-create.sql b/utils/kamctl/mysql/uri_db-create.sql index 9e15af813..b34bb1325 100644 --- a/utils/kamctl/mysql/uri_db-create.sql +++ b/utils/kamctl/mysql/uri_db-create.sql @@ -3,7 +3,7 @@ CREATE TABLE `uri` ( `username` VARCHAR(64) DEFAULT '' NOT NULL, `domain` VARCHAR(64) DEFAULT '' NOT NULL, `uri_user` VARCHAR(64) DEFAULT '' NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT account_idx UNIQUE (`username`, `domain`, `uri_user`) ); diff --git a/utils/kamctl/mysql/usrloc-create.sql b/utils/kamctl/mysql/usrloc-create.sql index a300661f9..d26859a98 100644 --- a/utils/kamctl/mysql/usrloc-create.sql +++ b/utils/kamctl/mysql/usrloc-create.sql @@ -10,7 +10,7 @@ CREATE TABLE `location` ( `q` FLOAT(10,2) DEFAULT 1.0 NOT NULL, `callid` VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, `cseq` INT(11) DEFAULT 1 NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL, + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL, `flags` INT(11) DEFAULT 0 NOT NULL, `cflags` INT(11) DEFAULT 0 NOT NULL, `user_agent` VARCHAR(255) DEFAULT '' NOT NULL, @@ -39,7 +39,7 @@ CREATE TABLE `location_attrs` ( `aname` VARCHAR(64) DEFAULT '' NOT NULL, `atype` INT(11) DEFAULT 0 NOT NULL, `avalue` VARCHAR(255) DEFAULT '' NOT NULL, - `last_modified` DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL + `last_modified` DATETIME DEFAULT '2000-01-01 00:00:01' NOT NULL ); CREATE INDEX account_record_idx ON location_attrs (`username`, `domain`, `ruid`); diff --git a/utils/kamctl/oracle/avpops-create.sql b/utils/kamctl/oracle/avpops-create.sql index 13abf993b..e590e8971 100644 --- a/utils/kamctl/oracle/avpops-create.sql +++ b/utils/kamctl/oracle/avpops-create.sql @@ -6,7 +6,7 @@ CREATE TABLE usr_preferences ( attribute VARCHAR2(32) DEFAULT '', type NUMBER(10) DEFAULT 0 NOT NULL, value VARCHAR2(128) DEFAULT '', - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss') + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss') ); CREATE OR REPLACE TRIGGER usr_preferences_tr diff --git a/utils/kamctl/oracle/domain-create.sql b/utils/kamctl/oracle/domain-create.sql index 411fc034a..ee1fe9995 100644 --- a/utils/kamctl/oracle/domain-create.sql +++ b/utils/kamctl/oracle/domain-create.sql @@ -2,7 +2,7 @@ CREATE TABLE domain ( id NUMBER(10) PRIMARY KEY, domain VARCHAR2(64), did VARCHAR2(64) DEFAULT NULL, - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), CONSTRAINT domain_domain_idx UNIQUE (domain) ); @@ -22,7 +22,7 @@ CREATE TABLE domain_attrs ( name VARCHAR2(32), type NUMBER(10), value VARCHAR2(255), - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), CONSTRAINT domain_attrs_domain_attrs_idx UNIQUE (did, name, value) ); diff --git a/utils/kamctl/oracle/group-create.sql b/utils/kamctl/oracle/group-create.sql index faa9051b9..692a69c92 100644 --- a/utils/kamctl/oracle/group-create.sql +++ b/utils/kamctl/oracle/group-create.sql @@ -3,7 +3,7 @@ CREATE TABLE grp ( username VARCHAR2(64) DEFAULT '', domain VARCHAR2(64) DEFAULT '', grp VARCHAR2(64) DEFAULT '', - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), CONSTRAINT grp_account_group_idx UNIQUE (username, domain, grp) ); diff --git a/utils/kamctl/oracle/registrar-create.sql b/utils/kamctl/oracle/registrar-create.sql index 425c42b6b..1971c4833 100644 --- a/utils/kamctl/oracle/registrar-create.sql +++ b/utils/kamctl/oracle/registrar-create.sql @@ -10,7 +10,7 @@ CREATE TABLE aliases ( q NUMBER(10,2) DEFAULT 1.0 NOT NULL, callid VARCHAR2(255) DEFAULT 'Default-Call-ID', cseq NUMBER(10) DEFAULT 1 NOT NULL, - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), flags NUMBER(10) DEFAULT 0 NOT NULL, cflags NUMBER(10) DEFAULT 0 NOT NULL, user_agent VARCHAR2(255) DEFAULT '', diff --git a/utils/kamctl/oracle/siptrace-create.sql b/utils/kamctl/oracle/siptrace-create.sql index 5b9e4b2f5..0cacd0e22 100644 --- a/utils/kamctl/oracle/siptrace-create.sql +++ b/utils/kamctl/oracle/siptrace-create.sql @@ -1,6 +1,6 @@ CREATE TABLE sip_trace ( id NUMBER(10) PRIMARY KEY, - time_stamp DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + time_stamp DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), time_us NUMBER(10) DEFAULT 0 NOT NULL, callid VARCHAR2(255) DEFAULT '', traced_user VARCHAR2(128) DEFAULT '', diff --git a/utils/kamctl/oracle/topos-create.sql b/utils/kamctl/oracle/topos-create.sql index 5ad40c326..b0f0aa47d 100644 --- a/utils/kamctl/oracle/topos-create.sql +++ b/utils/kamctl/oracle/topos-create.sql @@ -12,9 +12,9 @@ CREATE TABLE topos_d ( bs_contact VARCHAR2(128) DEFAULT '', a_tag VARCHAR2(255) DEFAULT '', b_tag VARCHAR2(255) DEFAULT '', - a_rr CLOB DEFAULT '', - b_rr CLOB DEFAULT '', - s_rr CLOB DEFAULT '', + a_rr CLOB, + b_rr CLOB, + s_rr CLOB, iflags NUMBER(10) DEFAULT 0 NOT NULL, a_uri VARCHAR2(128) DEFAULT '', b_uri VARCHAR2(128) DEFAULT '', @@ -47,11 +47,11 @@ CREATE TABLE topos_t ( a_uuid VARCHAR2(255) DEFAULT '', b_uuid VARCHAR2(255) DEFAULT '', direction NUMBER(10) DEFAULT 0 NOT NULL, - x_via CLOB DEFAULT '', + x_via CLOB, x_vbranch VARCHAR2(255) DEFAULT '', - x_rr CLOB DEFAULT '', - y_rr CLOB DEFAULT '', - s_rr CLOB DEFAULT '', + x_rr CLOB, + y_rr CLOB, + s_rr CLOB, x_uri VARCHAR2(128) DEFAULT '', a_contact VARCHAR2(128) DEFAULT '', b_contact VARCHAR2(128) DEFAULT '', diff --git a/utils/kamctl/oracle/uri_db-create.sql b/utils/kamctl/oracle/uri_db-create.sql index e05ffb8c9..d84f1ad8d 100644 --- a/utils/kamctl/oracle/uri_db-create.sql +++ b/utils/kamctl/oracle/uri_db-create.sql @@ -3,7 +3,7 @@ CREATE TABLE uri ( username VARCHAR2(64) DEFAULT '', domain VARCHAR2(64) DEFAULT '', uri_user VARCHAR2(64) DEFAULT '', - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), CONSTRAINT uri_account_idx UNIQUE (username, domain, uri_user) ); diff --git a/utils/kamctl/oracle/usrloc-create.sql b/utils/kamctl/oracle/usrloc-create.sql index 792322963..d574102e9 100644 --- a/utils/kamctl/oracle/usrloc-create.sql +++ b/utils/kamctl/oracle/usrloc-create.sql @@ -10,7 +10,7 @@ CREATE TABLE location ( q NUMBER(10,2) DEFAULT 1.0 NOT NULL, callid VARCHAR2(255) DEFAULT 'Default-Call-ID', cseq NUMBER(10) DEFAULT 1 NOT NULL, - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'), flags NUMBER(10) DEFAULT 0 NOT NULL, cflags NUMBER(10) DEFAULT 0 NOT NULL, user_agent VARCHAR2(255) DEFAULT '', @@ -47,7 +47,7 @@ CREATE TABLE location_attrs ( aname VARCHAR2(64) DEFAULT '', atype NUMBER(10) DEFAULT 0 NOT NULL, avalue VARCHAR2(255) DEFAULT '', - last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss') + last_modified DATE DEFAULT to_date('2000-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss') ); CREATE OR REPLACE TRIGGER location_attrs_tr diff --git a/utils/kamctl/postgres/avpops-create.sql b/utils/kamctl/postgres/avpops-create.sql index ad096f761..e5ff7338e 100644 --- a/utils/kamctl/postgres/avpops-create.sql +++ b/utils/kamctl/postgres/avpops-create.sql @@ -6,7 +6,7 @@ CREATE TABLE usr_preferences ( attribute VARCHAR(32) DEFAULT '' NOT NULL, type INTEGER DEFAULT 0 NOT NULL, value VARCHAR(128) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL ); CREATE INDEX usr_preferences_ua_idx ON usr_preferences (uuid, attribute); diff --git a/utils/kamctl/postgres/domain-create.sql b/utils/kamctl/postgres/domain-create.sql index 7031fa451..c358bdf67 100644 --- a/utils/kamctl/postgres/domain-create.sql +++ b/utils/kamctl/postgres/domain-create.sql @@ -2,7 +2,7 @@ CREATE TABLE domain ( id SERIAL PRIMARY KEY NOT NULL, domain VARCHAR(64) NOT NULL, did VARCHAR(64) DEFAULT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT domain_domain_idx UNIQUE (domain) ); @@ -14,7 +14,7 @@ CREATE TABLE domain_attrs ( name VARCHAR(32) NOT NULL, type INTEGER NOT NULL, value VARCHAR(255) NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT domain_attrs_domain_attrs_idx UNIQUE (did, name, value) ); diff --git a/utils/kamctl/postgres/group-create.sql b/utils/kamctl/postgres/group-create.sql index a65c343c8..ff5016a3d 100644 --- a/utils/kamctl/postgres/group-create.sql +++ b/utils/kamctl/postgres/group-create.sql @@ -3,7 +3,7 @@ CREATE TABLE grp ( username VARCHAR(64) DEFAULT '' NOT NULL, domain VARCHAR(64) DEFAULT '' NOT NULL, grp VARCHAR(64) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT grp_account_group_idx UNIQUE (username, domain, grp) ); diff --git a/utils/kamctl/postgres/registrar-create.sql b/utils/kamctl/postgres/registrar-create.sql index 170aa61a5..137d81e16 100644 --- a/utils/kamctl/postgres/registrar-create.sql +++ b/utils/kamctl/postgres/registrar-create.sql @@ -10,7 +10,7 @@ CREATE TABLE aliases ( q REAL DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, cseq INTEGER DEFAULT 1 NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, flags INTEGER DEFAULT 0 NOT NULL, cflags INTEGER DEFAULT 0 NOT NULL, user_agent VARCHAR(255) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/postgres/siptrace-create.sql b/utils/kamctl/postgres/siptrace-create.sql index b1fc7f48f..ad03dbd08 100644 --- a/utils/kamctl/postgres/siptrace-create.sql +++ b/utils/kamctl/postgres/siptrace-create.sql @@ -1,6 +1,6 @@ CREATE TABLE sip_trace ( id SERIAL PRIMARY KEY NOT NULL, - time_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + time_stamp TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, time_us INTEGER DEFAULT 0 NOT NULL, callid VARCHAR(255) DEFAULT '' NOT NULL, traced_user VARCHAR(128) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/postgres/topos-create.sql b/utils/kamctl/postgres/topos-create.sql index 1a52b33f8..d98dda3fa 100644 --- a/utils/kamctl/postgres/topos-create.sql +++ b/utils/kamctl/postgres/topos-create.sql @@ -12,9 +12,9 @@ CREATE TABLE topos_d ( bs_contact VARCHAR(128) DEFAULT '' NOT NULL, a_tag VARCHAR(255) DEFAULT '' NOT NULL, b_tag VARCHAR(255) DEFAULT '' NOT NULL, - a_rr TEXT DEFAULT '' NOT NULL, - b_rr TEXT DEFAULT '' NOT NULL, - s_rr TEXT DEFAULT '' NOT NULL, + a_rr TEXT, + b_rr TEXT, + s_rr TEXT, iflags INTEGER DEFAULT 0 NOT NULL, a_uri VARCHAR(128) DEFAULT '' NOT NULL, b_uri VARCHAR(128) DEFAULT '' NOT NULL, @@ -39,11 +39,11 @@ CREATE TABLE topos_t ( a_uuid VARCHAR(255) DEFAULT '' NOT NULL, b_uuid VARCHAR(255) DEFAULT '' NOT NULL, direction INTEGER DEFAULT 0 NOT NULL, - x_via TEXT DEFAULT '' NOT NULL, + x_via TEXT, x_vbranch VARCHAR(255) DEFAULT '' NOT NULL, - x_rr TEXT DEFAULT '' NOT NULL, - y_rr TEXT DEFAULT '' NOT NULL, - s_rr TEXT DEFAULT '' NOT NULL, + x_rr TEXT, + y_rr TEXT, + s_rr TEXT, x_uri VARCHAR(128) DEFAULT '' NOT NULL, a_contact VARCHAR(128) DEFAULT '' NOT NULL, b_contact VARCHAR(128) DEFAULT '' NOT NULL, diff --git a/utils/kamctl/postgres/uri_db-create.sql b/utils/kamctl/postgres/uri_db-create.sql index 8f431d494..4a6c7347f 100644 --- a/utils/kamctl/postgres/uri_db-create.sql +++ b/utils/kamctl/postgres/uri_db-create.sql @@ -3,7 +3,7 @@ CREATE TABLE uri ( username VARCHAR(64) DEFAULT '' NOT NULL, domain VARCHAR(64) DEFAULT '' NOT NULL, uri_user VARCHAR(64) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, CONSTRAINT uri_account_idx UNIQUE (username, domain, uri_user) ); diff --git a/utils/kamctl/postgres/usrloc-create.sql b/utils/kamctl/postgres/usrloc-create.sql index 9a56326d7..746780461 100644 --- a/utils/kamctl/postgres/usrloc-create.sql +++ b/utils/kamctl/postgres/usrloc-create.sql @@ -10,7 +10,7 @@ CREATE TABLE location ( q REAL DEFAULT 1.0 NOT NULL, callid VARCHAR(255) DEFAULT 'Default-Call-ID' NOT NULL, cseq INTEGER DEFAULT 1 NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL, + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL, flags INTEGER DEFAULT 0 NOT NULL, cflags INTEGER DEFAULT 0 NOT NULL, user_agent VARCHAR(255) DEFAULT '' NOT NULL, @@ -39,7 +39,7 @@ CREATE TABLE location_attrs ( aname VARCHAR(64) DEFAULT '' NOT NULL, atype INTEGER DEFAULT 0 NOT NULL, avalue VARCHAR(255) DEFAULT '' NOT NULL, - last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL + last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '2000-01-01 00:00:01' NOT NULL ); CREATE INDEX location_attrs_account_record_idx ON location_attrs (username, domain, ruid); diff --git a/utils/kamctl/xhttp_pi/pi_framework.xml b/utils/kamctl/xhttp_pi/pi_framework.xml index ddf2b2e36..bb5ba7e1b 100644 --- a/utils/kamctl/xhttp_pi/pi_framework.xml +++ b/utils/kamctl/xhttp_pi/pi_framework.xml @@ -679,7 +679,6 @@ urlDB1_STR weightDB1_INT disabledDB1_INT - stampDB1_DATETIME @@ -3620,7 +3619,6 @@ url weight disabled - stamp add @@ -3631,7 +3629,6 @@ url weight disabled - stamp