From 87b30e26b7583e9ad586243f3547212c55e55741 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Mon, 4 Feb 2019 11:14:38 +0100 Subject: [PATCH] New upstream version 5.1.7 --- ChangeLog | 1225 +++++++++++++++++ .../examples/kemi/kamailio-basic-kemi-lua.lua | 2 +- .../kemi/kamailio-basic-kemi-python.py | 2 +- pkg/kamailio/Makefile | 2 +- pkg/kamailio/alpine/APKBUILD | 4 +- pkg/kamailio/centos/6/kamailio.spec | 2 +- pkg/kamailio/centos/7/kamailio.spec | 2 +- pkg/kamailio/deb/buster/changelog | 6 + 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/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/freebsd/Makefile | 2 +- pkg/kamailio/obs/kamailio.service | 2 +- pkg/kamailio/obs/kamailio.spec | 121 +- pkg/kamailio/obs/kamailio.tmpfiles | 2 +- pkg/kamailio/obs/meta | 25 +- pkg/kamailio/openbsd/Makefile | 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 +- pkg/kamailio/solaris/pkginfo | 2 +- src/Makefile.defs | 2 +- src/core/action.c | 3 + src/core/autover.h | 4 +- src/core/cfg.lex | 16 +- src/core/cfg.y | 22 +- src/core/cfg/cfg_script.c | 22 +- src/core/cfg/cfg_select.c | 7 +- src/core/dns_cache.c | 2 +- src/core/flags.c | 5 + src/core/flags.h | 1 + src/core/fmsg.c | 7 +- src/core/fmsg.h | 1 + src/core/msg_translator.c | 8 +- src/core/parser/parse_body.c | 6 +- src/lib/srdb1/db.c | 11 +- src/main.c | 8 +- src/modules/acc/README | 4 +- src/modules/acc/acc.c | 12 +- src/modules/acc/acc_logic.c | 9 +- src/modules/acc_diameter/acc_diameter_mod.c | 4 +- src/modules/acc_radius/acc_radius_mod.c | 4 +- src/modules/app_jsdt/README | 25 +- src/modules/app_lua/README | 41 +- src/modules/app_python/README | 85 +- src/modules/async/README | 16 +- src/modules/async/async_mod.c | 16 + src/modules/auth_db/auth_db_mod.c | 3 +- src/modules/auth_xkeys/README | 2 +- src/modules/auth_xkeys/auth_xkeys.c | 11 +- src/modules/benchmark/README | 34 +- src/modules/blst/README | 4 + src/modules/carrierroute/README | 209 +-- src/modules/cdp/diameter_msg.c | 2 +- src/modules/cdp/receiver.c | 27 +- src/modules/cfgt/README | 2 +- src/modules/cfgutils/cfgutils.c | 4 +- src/modules/cnxcc/README | 160 ++- src/modules/cnxcc/cnxcc_redis.c | 6 +- src/modules/cplc/cpl_run.c | 2 +- src/modules/db_berkeley/db_berkeley.c | 2 +- src/modules/db_perlvdb/README | 13 +- src/modules/db_postgres/README | 16 + .../db_postgres/doc/db_postgres_admin.xml | 19 + src/modules/db_postgres/km_pg_con.c | 13 + src/modules/db_postgres/pg_mod.c | 2 + src/modules/db_unixodbc/README | 4 +- src/modules/dialog/README | 728 +++++----- src/modules/dialog/dialog.c | 4 +- src/modules/dialog/dlg_db_handler.c | 4 +- src/modules/dialog/dlg_handlers.c | 18 +- src/modules/dialog/dlg_hash.c | 23 +- src/modules/dialog/dlg_req_within.c | 30 +- src/modules/dialog/doc/dialog_admin.xml | 13 +- src/modules/dialplan/README | 7 +- src/modules/dialplan/dialplan.c | 2 +- src/modules/dialplan/doc/dialplan_admin.xml | 7 +- src/modules/drouting/README | 96 +- src/modules/evapi/evapi_dispatch.c | 2 +- src/modules/htable/README | 63 +- src/modules/http_async_client/README | 4 +- src/modules/ims_charging/README | 15 +- .../ims_charging/doc/ims_charging_admin.xml | 7 +- src/modules/ims_isc/checker.c | 5 + src/modules/json/README | 6 + src/modules/jsonrpcs/README | 1 + src/modules/kazoo/kz_amqp.c | 18 +- src/modules/kazoo/kz_json.c | 4 +- src/modules/kex/README | 4 +- src/modules/mqueue/README | 2 +- src/modules/msilo/README | 6 - src/modules/nathelper/README | 3 +- src/modules/p_usrloc/README | 4 +- src/modules/pdb/common.h | 3 +- src/modules/pdb/pdb.c | 5 +- src/modules/phonenum/README | 27 +- src/modules/pipelimit/README | 39 +- src/modules/presence/presentity.c | 19 +- src/modules/pv/pv_trans.c | 45 +- src/modules/rabbitmq/rabbitmq.c | 86 +- src/modules/regex/doc/regex_admin.xml | 64 +- src/modules/regex/regex_mod.c | 2 +- src/modules/rr/README | 22 +- src/modules/rtpengine/README | 29 +- src/modules/rtpengine/rtpengine.c | 8 +- src/modules/rtpproxy/README | 2 +- src/modules/sanity/README | 6 +- src/modules/sctp/README | 3 + src/modules/siptrace/siptrace.c | 5 +- src/modules/siputils/README | 8 +- src/modules/speeddial/README | 4 +- src/modules/textops/README | 19 +- src/modules/textopsx/README | 4 +- src/modules/tm/README | 16 + src/modules/tm/t_lookup.c | 5 + src/modules/tm/t_reply.c | 56 +- src/modules/tm/t_serial.c | 12 +- src/modules/tm/tm.c | 3 + src/modules/tmx/t_var.c | 7 +- src/modules/tmx/tmx_mod.c | 6 + src/modules/topoh/th_msg.c | 9 +- src/modules/topoh/topoh_mod.c | 6 + src/modules/topos/README | 12 +- src/modules/topos/doc/topos_admin.xml | 4 +- src/modules/topos/topos_mod.c | 6 + src/modules/topos/tps_msg.c | 14 +- src/modules/topos/tps_storage.c | 12 + src/modules/topos_redis/topos_redis_storage.c | 5 + src/modules/tsilo/README | 2 +- src/modules/tsilo/doc/tsilo_admin.xml | 2 +- src/modules/tsilo/ts_store.c | 5 + src/modules/uac/README | 7 +- src/modules/uac/auth_alg.c | 8 +- src/modules/uac_redirect/README | 6 +- src/modules/uri_db/README | 2 +- src/modules/usrloc/README | 305 ++-- src/modules/websocket/README | 52 +- src/modules/websocket/doc/websocket_admin.xml | 50 +- src/modules/websocket/websocket.c | 40 +- src/modules/websocket/ws_conn.c | 232 +++- src/modules/websocket/ws_conn.h | 16 +- src/modules/websocket/ws_frame.c | 32 +- src/modules/xcap_client/README | 26 +- src/modules/xcap_server/README | 6 +- utils/kamcmd/kamcmd.8 | 8 + utils/kamctl/kamctl.8 | 4 + utils/kamctl/kamctl.base | 2 +- utils/kamctl/kamctl.pgsql | 4 +- utils/kamctl/kamdbctl.base | 30 +- 157 files changed, 3368 insertions(+), 1457 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c19f5cba..a23b4d818 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,1228 @@ +===================== 2019-01-31 Version 5.1.7 Released ================== + +===================== Changes Since Version 5.1.6 =========================== + +commit 5c51f70229b193abbf4fe00515cbc67e3fe9e245 +Author: Daniel-Constantin Mierla +Date: Thu Jan 31 10:24:10 2019 +0100 + + Makefile.defs: version set to 5.1.7 + +commit 745bfe69a6f42ee882f4dcd37fef7c78a02120e8 +Author: Victor Seva +Date: Thu Jan 31 10:16:03 2019 +0100 + + pkg/kamailio/deb: version set to 5.1.7 + +commit 295a2e86a7339d5bf07077cbfb0269bae3a0bcfb +Author: Daniel-Constantin Mierla +Date: Thu Jan 31 10:15:04 2019 +0100 + + pkg: version set to 5.1.7 for rpm and other specs + +commit eb29671e9b68fafdeea0849b6f7340e88beb0949 +Author: Daniel-Constantin Mierla +Date: Thu Jan 31 09:25:28 2019 +0100 + + websocket: put the ws connection after keepalive + + - c&p error of last commits resulted in doing get op instead + + (cherry picked from commit a975bca1702ea2f3db47f834f7e4da2786ced201) + (cherry picked from commit b3567878dd8b43f22bd7ce88db7611cf6ca029ff) + +commit e131f95f234ce0e4e7dc7752f796e7c42620ce82 +Author: Kamailio Dev +Date: Mon Jan 28 21:01:28 2019 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit f727b05ad76c1b22ddba8b3aed311084c260c588 +Author: Federico Cabiddu +Date: Mon Jan 28 20:56:55 2019 +0100 + + tsilo: fixed ts_append example in the doc + + (cherry picked from commit 18ef9da4c029fefd5089aed484cd8f32ddb0fb17) + +commit 505884a9ad1575e7fea88ff026641442822688fb +Author: Kamailio Dev +Date: Mon Jan 28 15:01:35 2019 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit f9e7ea0a35d4115f2437d285a8e27aceaf74a5fd +Author: Victor Seva +Date: Wed Jan 9 17:44:09 2019 +0100 + + tsilo: add check for empty aor + + Fix: #1775 + (cherry picked from commit 5a5d742eb459249995114eb6a3642f99c6770496) + (cherry picked from commit 23a5c07e924a2feb5f09b727f4ad0faf6c5af349) + +commit 3720283674cc783bceb64987ec8f27a54a1e1d47 +Author: Daniel-Constantin Mierla +Date: Wed Jan 9 14:15:37 2019 +0100 + + dialog: do not require dlg_flag parameter to be set + + - using dlg_manage() should be enough for tracking dialogs + + (cherry picked from commit 404f403786478a917637186446bb285e8e32cc59) + (cherry picked from commit 563f1d6af3123485ed25cc58bb3badd68e7793a4) + +commit aadd286fe15ddd121580f2770c3c29f56fab36ec +Author: Daniel-Constantin Mierla +Date: Wed Jan 9 09:50:12 2019 +0100 + + dialog: docs - more info about using the flag and dlg_manage() + + (cherry picked from commit e4dfe3587943d69d556b15df3492cf38c3b21a5f) + (cherry picked from commit 3dd154faeead29f54145843d14367c5b28a4fb7b) + +commit 6d7a6e1ccebf57cd8be791d44d797c9feeb96adf +Author: Daniel-Constantin Mierla +Date: Sat Dec 29 17:43:18 2018 +0100 + + ims_isc: free variable in case of errors + + (cherry picked from commit e7d684ad22d17f3aca58dd66c555e43877d9320a) + (cherry picked from commit 83597d2fc2922921e66edeca184b3d59354407cf) + +commit d498c3ca48ad2e0538d29e13eb283f480a352916 +Author: Daniel-Constantin Mierla +Date: Wed Dec 26 12:04:59 2018 +0100 + + auth_db: print db table name when version check fails + + (cherry picked from commit a8de371e90ddc8a6921b5bf7464961865804cc06) + (cherry picked from commit f62c3cb67c9c2be10393bdeec684eb3dc9325dd6) + +commit d2459f195398199b3968351d9edabae85fdea521 +Author: Daniel-Constantin Mierla +Date: Wed Dec 26 09:44:21 2018 +0100 + + cdp: init pointer to avoid warning on uninitialized use + + (cherry picked from commit 7873a653a43070f891dc6cde5c188c81bf5de25d) + (cherry picked from commit 5bb811d8d7c09c7792206831326c8f650eb30f66) + +commit 16e8c6856cfa0f6af426fc33779843555d9b4b9d +Author: Daniel-Constantin Mierla +Date: Thu Dec 20 13:13:32 2018 +0100 + + websocket: removed static from declaration of ws_rm_delay_interval + + - it is used as external in another source file + - GH #1771 + + (cherry picked from commit d5e40d5f05795f3902e5ae51bf4c57345e945a9c) + (cherry picked from commit 42821df5cf64d71b9b837e2e5c55b2d91392a250) + +commit 19f585b4a32673ee15a9fe50f2edc1211bee44c5 +Author: Daniel-Constantin Mierla +Date: Thu Dec 20 08:09:36 2018 +0100 + + dialog: only write debug messages in case cseq or contact fields are empty + + (cherry picked from commit ae4087ef615c1de5b67c8406eab8316300282d8b) + (cherry picked from commit 5067fe22cc16af943126ea88a9ddd35281ca8636) + +commit 6d28f85378eed7a7da05079be68139c7c7fcbef6 +Author: Victor Seva +Date: Thu Dec 20 00:16:25 2018 +0100 + + cnxcc: fix compilation warnings + + > warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat] + + (cherry picked from commit 89e89e023d923d2dbec694509b9f958bbed6d3ad) + (cherry picked from commit 92d7bec4b5dddad2d08b6434ab6b561b230ee466) + +commit 89cc9d794ca867de1b60d2239e990d09e22cdca7 +Author: Daniel-Constantin Mierla +Date: Wed Dec 19 14:11:51 2018 +0100 + + websocket: docs for timer_interval and rm_delay_interval params + + (cherry picked from commit 3a20bb1ad27b8a85ec932975e14bcec12237437b) + (cherry picked from commit bc602ee8662a440d0fec47a5ec6b66021a13d4fa) + +commit f85e6bada0ebd2597cd016111f96c9fc0133bc08 +Author: Daniel-Constantin Mierla +Date: Wed Dec 19 14:06:56 2018 +0100 + + websocket: destroy ws connections in dedicated timer process + + - avoid races/invalid access when sending data failed and the connection + was removed + - added parameter to control the timer process: interval or running and + delay interval for removing + + (cherry picked from commit af09e224dba0c57c23fd58a7f83a24d2ffbaa07c) + (cherry picked from commit 281d6fa15abc3b5f60c9dfc7cab272fca4e50d44) + +commit 9059f23474bf9ec35e7001f715860ca1e7729ca1 +Author: Daniel-Constantin Mierla +Date: Wed Dec 19 13:15:36 2018 +0100 + + websocket: fetch ws connections based on keepalive process index + + - get the ones with id that matches the index when doing modulo over the + number of keepalive process in order to spread the load of doing the + ping-pong + + (cherry picked from commit 71517152e7de26d6c47fd037c25dc854aa37734f) + (cherry picked from commit 049473bce13cc6994cbde1080d75bb25565ad5bc) + +commit 206cdd921b3fcce9e89691a3c5b915405cb4e9c1 +Author: Daniel-Constantin Mierla +Date: Tue Dec 18 13:20:51 2018 +0100 + + websocket: use the list with ids for ws connections to do ping-pong + + - avoid using pointers to ws connections, they can get closed + + (cherry picked from commit b5253b62090feb70f08885fb530d894d0bd6ad90) + (cherry picked from commit e25b66962ba51e2749a093f96e0cdaac8df33a4f) + +commit 91763e1661c575db1f0ffb1916188a370a8fc143 +Author: Daniel-Constantin Mierla +Date: Mon Jan 7 12:01:21 2019 +0100 + + topoh: aded debug message for knowing the reason of no decoding rr + + (cherry picked from commit cee4941daf56985d9734263c4b99c33f9ef3a149) + (cherry picked from commit 3a78d068a3678471efe0a7e7f4ea0e7c9bc18675) + +commit ab850a6ad3373dea409eed96fe87da305fda09b7 +Author: Balajee +Date: Sun Dec 23 23:27:49 2018 +0530 + + topoh: fixed unmask route issue, if maksing fails for one of the routes + + (cherry picked from commit d57f70127c44fd74c459aefc8d2655978b9cb48b) + (cherry picked from commit 4fe56123b424638a5967832f4ac05d3e63a13577) + +commit 44666e217420dda4bda31ae7ffb46ca8fc63d455 +Author: Daniel-Constantin Mierla +Date: Mon Dec 17 20:34:35 2018 +0100 + + cplc: init var to avoid compile warning + + (cherry picked from commit 0f1b970ae7f47478649b61a8dc43fe42714b2a95) + (cherry picked from commit 2dc84951b8f0e2503ee4c551b8693de36b36ef77) + +commit 0d62a374cef1f21ca87d2e2d9ca6b2533638177d +Author: Daniel-Constantin Mierla +Date: Mon Dec 17 20:31:59 2018 +0100 + + regex: init var to avoid compile warning + + (cherry picked from commit dfb872b311cd0acd4a40c810f612c8a23e7c9aca) + (cherry picked from commit fc6232f7f9d1c65f436e7ca0db505c6e1114145d) + +commit 4942d5cecc310f516d20594f58bc7b83eec67028 +Author: Daniel-Constantin Mierla +Date: Thu Dec 13 10:22:35 2018 +0100 + + tm: error log message about new final reply made info + + - can happen due to races of packets on the network + + (cherry picked from commit 3d43f546ddff613c50068c9d47521a15b42f1c7b) + (cherry picked from commit 9ccbcc089e70001dd94136eadb68d2711669142f) + +commit e3eb15272e5940222ceb40c0119e1f7897d3054b +Author: Daniel-Constantin Mierla +Date: Sat Dec 8 08:12:49 2018 +0100 + + pv: {param.count} accept static string "," as delimiter + + (cherry picked from commit 80b3c37557d446bfe9ca5a5f469a42af60648280) + (cherry picked from commit cb98198e595c776ccbf2cd8777e178eb81e85b58) + +commit 67657f5ceef6528fab2371bfea386d3a9fb3cfb8 +Author: Daniel-Constantin Mierla +Date: Wed Dec 5 12:40:16 2018 +0100 + + dialog: store call-id, r-uri, f-uri and t-uri with 0-ending char + + - can simplify matching with standard string comparison and regexp + + (cherry picked from commit f1ab32ee4a0bf64017a0b05f2013b81d37d50208) + (cherry picked from commit 2e81abf1262784e390eb31efa95c5f437bd7051e) + +commit 3e6f951c070291b0b2e9df6cde3f287625995aac +Author: Daniel-Constantin Mierla +Date: Tue Dec 4 11:16:57 2018 +0100 + + auth_xkeys: clone value before inserting the lump inside auth_xkeys_add() + + (cherry picked from commit 01f5ecbc45c236daea62d6638a02c168720c8479) + (cherry picked from commit 3a2d9921dc8a3c8133e7e3bacfba94468f9bbeb6) + +commit 26173d8999d31c8847d915cd26d164ce3832be49 +Author: Daniel-Constantin Mierla +Date: Fri Nov 30 16:05:30 2018 +0100 + + tm: reply_received() - simplify locking for processing sip response + + - leverage the recursive mutex and skip several zones of unlock/lock, + which can lead to races on delayed processing or fast reply + retransmissions + - related to GH #1613 #1744 + + (cherry picked from commit 39b89a18a8c357151a173ab02dc95dff1f02715d) + (cherry picked from commit cc51d6c7170ad289c8f521a05470a2eacd05f565) + +commit 3bf230b75b181dd213b08a7cc133fe188b5fcfa5 +Author: Daniel-Constantin Mierla +Date: Fri Nov 30 09:19:16 2018 +0100 + + lib/srdb1: memset db connection structure earlier in db_bind_mod() + + (cherry picked from commit 1b014d65e26a99f9f5d4aea1b27949776f083c2d) + (cherry picked from commit 1133f818461cf2ed6c8bd755543f93b366a02683) + +commit 8a21170c3a5283b84e0ff3cbc6db8c72413dec05 +Author: Federico Cabiddu +Date: Wed Jan 16 16:35:15 2019 +0100 + + siptrace: don't calculate message source socket if already set + + (cherry picked from commit 929a24f08aeef6b72999ac9b188ffeded40759a9) + +commit 440ba8f9b37c61a6f631a5a8a0552a2215128fad +Author: Hugh Waite +Date: Fri Jan 4 16:02:09 2019 +0000 + + tm: Add fixup for PVS in fixup_t_check_status + - Allows PVs including $avp(...) to be passed to t_check_status + +commit 74b8fbf0fc820d48a0203b81d2cd41f6e84dc5c5 +Author: Daniel-Constantin Mierla +Date: Tue Jan 8 12:24:27 2019 +0100 + + topos_redis: check the branch value to avoid using uninitialized fields + + - GH #1784 + + (cherry picked from commit cfc89db53c087382c29d809dc0bc56f7351af2d1) + (cherry picked from commit 7c551812960dd1cfc2901a7a46bbf3010df47cd7) + +commit 3c343cecbfaaeb8f92c9c026c818c03f95219760 +Author: Henning Westerholt +Date: Sun Jan 6 14:46:34 2019 +0100 + + kamdbctl: Merged patch from alpine packaging (#1786) + + - kamdbctl: Merged patch from alpine packaging (#1786) + - add proper quoting for DB table and module definitions + - manual backport from c6e62f932495af + + (cherry picked from commit 6e79c6304823301a2dde8a2dd5e169525db6cd9b) + +commit b66ebc658b22b992c4b0c6ecad7915b217b344a1 +Author: Daniel-Constantin Mierla +Date: Wed Dec 19 11:56:06 2018 +0100 + + dialog: check for cseq value only when getting it for caller/request + + (cherry picked from commit 740bc8ce88da612ac30a73db0145908355cab192) + +commit b5f12075497cf2ab6bcfc71ab2550198065e7e87 +Author: Henning Westerholt +Date: Sun Dec 30 00:15:46 2018 +0100 + + cdp: fix two errors from coverty scan (missing check, var initialization) + + - remove library call can fail, test for the error and log it + - initialize the msghdr variable with a memset + + (cherry picked from commit 7d52bf6ce7188eaa57690766c231e55b5509db4f) + +commit 977057fb98ecd72844a0441e1f890378369e4862 +Author: Henning Westerholt +Date: Sun Dec 30 00:42:31 2018 +0100 + + cdp: fix three coverity errors (ressource leaks and error checks) + + - fix an ressource leak related to library call getaddrinfo + - add missing error checks for setsockopts and fcntl calls + + (cherry picked from commit 967a71687aa63a253d495ba49351ae916713a452) + +commit 5d738714cb95edbf119462553d16be547117355e +Author: Henning Westerholt +Date: Sun Dec 30 00:52:18 2018 +0100 + + core: check for optarg before passing it to external library (coverity report) + + (cherry picked from commit 7eb1eae615a4c3ef710e9931b101ddc4db07aff2) + +commit b075e6fcb7435d168241bc9bc83e87b70b4d08d4 +Author: Henning Westerholt +Date: Sun Dec 30 01:17:15 2018 +0100 + + core: fix an error in check_via_address, reported from Mojtaba, mespio at gmail dot com + + - fix an error in check_via_address, reported from Mojtaba, mespio at gmail dot com + - use the same logic for IPv4 string comparison as for IPv6 + - the old comparison could return true for e.g. via="192.168.1.1", src="192.1.1.100" + - the new logic is also faster for the trivial case with different string length + + (cherry picked from commit 98ee014a88ca951d82a0389f0be119078ba525f7) + +commit 6995925d2ddd0618fea1bd75cfee562e008d6075 +Author: Sergey Safarov +Date: Wed Dec 5 21:31:53 2018 +0000 + + pkg/kamailio/obs: Fixed warning about not existen kamailio group [skip ci] + + (cherry picked from commit 5c6e3570c68c6a0eb74a808865f26b0f895c722c) + +commit 52af0594dc602bfe207c7a629fe6ea71f01840b6 +Author: Nacho Garcia Segovia +Date: Fri Dec 7 11:19:52 2018 +0100 + + core: fixed segmentation fault when handling multipart bodies + + Function check_boundaries() in msg_translator.c not handling property the length of the buffers when it needs to repair the boundary, getting a negative lenght and causing a segmentation fault. + + (cherry picked from commit 18e485a3172055fa5c808c2423629d5bbd10b37e) + +commit 9d301849a145e89d2c82a7195234232e032fb8fb +Author: Kamailio Dev +Date: Tue Dec 4 09:46:31 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 893562c7e698e001f6fe883ea7e5497e67c6eee7 +Author: Daniel-Constantin Mierla +Date: Fri Nov 30 16:31:22 2018 +0100 + + dialog: safety checks for local cseq and contact vars + + - avoid crash on systems not printing null string of length 0 + - GH #1717 + + (cherry picked from commit 46401e465d88495d510d2cb36dc36ec86978c53e) + (cherry picked from commit 79946bbb6d1731f503fc378ae38311b630e55999) + +commit 732f1b9c037f22c0d9932c2565ba9bf6bfc25538 +Author: Yasin CANER <12412027+ycaner06@users.noreply.github.com> +Date: Wed Nov 28 16:02:25 2018 +0300 + + ims_charging : doc is fixed + + ims_charging : doc is fixed + + (cherry picked from commit 37dae368667fc82bc2f60639d722354e6528ec7f) + (cherry picked from commit 2375d07b774aa2d820bbeb155698305576e2ba74) + +commit 24064631d8de14a9af89ad0748eff9939c16da03 +Author: Daniel-Constantin Mierla +Date: Thu Nov 29 20:04:08 2018 +0100 + + core: parse body - debug instead of error log message when mime mismatch + + - GH #1746 + + (cherry picked from commit 08820db104c7dbfce36af0f59dfcc28f97cffbd0) + (cherry picked from commit 81f328095f6c06b5ca7cb18b6cdcfad430fb7359) + +commit 03c971d27b235b71d343e2771b87a34d9c397b11 +Author: Daniel-Constantin Mierla +Date: Wed Nov 28 12:49:58 2018 +0100 + + presence: test if event is dialog when attempting to delete old records + + (cherry picked from commit 55c7f781be7cc40d0cd161640a47244aad60c0e7) + (cherry picked from commit 8b6665b5d27fa8c36764078b9ae615075486a4b3) + +commit 7409c34169e8f9976a435bae2ec782aede669a54 +Author: Daniel-Constantin Mierla +Date: Fri Nov 23 09:06:57 2018 +0100 + + topos: proper condition to detect 3xx redirect for contact updates + + - GH #1720 + + (cherry picked from commit 1f02ee62951523f001899d12d1750046f1ba53b6) + (cherry picked from commit 6c768803e544cf8cf060b4099c601a9df0c1b7b8) + +commit 4b9aef025073a850822a22d1359f657840cfaf37 +Author: Daniel-Constantin Mierla +Date: Fri Nov 23 08:51:18 2018 +0100 + + topos: safety checks for couple of mandatory headers + + - first via and call-id + + (cherry picked from commit 93e40d5b7fb66d33f31c46dfaea5425062505127) + (cherry picked from commit 69a34ef19e9365c810ecd2ea91a3d47076eed33a) + +commit 6e1c4b6807e2b31e8e7400bc358a7b689989c8d8 +Author: Daniel-Constantin Mierla +Date: Fri Nov 23 08:46:54 2018 +0100 + + topoh: safety checks for couple of mandatory headers + + - first via and call-id + - GH #1735 + + (cherry picked from commit 97da6b1a5f656db4a91c8909167706fc8ec3d932) + (cherry picked from commit 01828ecdff3e048845ee0cee58cfe1ffbceb761f) + +commit 9c1e900ea4913dc4e2d7989dc89925160ed874b3 +Author: Joonas Keskitalo +Date: Thu Nov 22 15:43:37 2018 +0200 + + misc/examples/kemi: Added 'msg' argument to ksr_route_relay + + (cherry picked from commit a35503b3837cfc804f30c7493fbd13573c1a55e1) + (cherry picked from commit 7dbeb45fd481d77a4ddee2432193eb7c1f1a937d) + +commit fa33d2be1321bba3238f536f1a4eeb40e60b6b71 +Author: Daniel-Constantin Mierla +Date: Wed Nov 21 10:42:02 2018 +0100 + + topos: do not add contact header in outgoing 1xx responses if not present + + - GH #1720 + + (cherry picked from commit dcf9ee88dbf68eeaf0f64d203ce831eb6f536a85) + (cherry picked from commit 3e3b51b3989c02b97b825e6e8b8285d4d2b99ca3) + +commit 1a6dc025088f5a74e0f8593f930b5362f57441a5 +Author: Surendra Tiwari +Date: Wed Nov 21 09:30:06 2018 +0100 + + rtpengine: print command in log message on timeout + + - few indentation fixes + - GH #1732 + + (cherry picked from commit 9d1e8e256e49968776f7abb740a6d02739547ec2) + (cherry picked from commit e9320c09738766d80fae2fe2b1704facbce6221a) + +commit 42865170f9acddd0b3c2e14de8019d2075a69e43 +Author: Daniel-Constantin Mierla +Date: Tue Nov 20 12:49:24 2018 +0100 + + tmx: do no suspend faked request + + (cherry picked from commit 6f6a0d136dfefe98631264092177344ed8d173a8) + (cherry picked from commit eb661d2284d2d004b7affbcf0728ff6d32862283) + +commit 3b44a67b2d0910a0f5e92801a918a083f1a17d21 +Author: Daniel-Constantin Mierla +Date: Tue Nov 20 12:48:48 2018 +0100 + + tm: info log message if attempting to create transaction for faked request + + (cherry picked from commit 4dd53abf13f9a98272af625f2a6591669730b374) + (cherry picked from commit 156706c03a29a7aed5b8f73fab8216e4630c1f15) + +commit bd234545b018512ae0adb04c27686f8f0dbda4d5 +Author: Daniel-Constantin Mierla +Date: Tue Nov 20 08:11:18 2018 +0100 + + topos: allow various replies for INVITE without contact + + - GH #1720 + + (cherry picked from commit 416d79b462986317f2c3a3ed8aa30a502d116095) + (cherry picked from commit 3b586d554740ae578283024c1508e91b6ad886a2) + +commit 8b5b0466ab5524a9493d04bee89c903bde56e8f8 +Author: Daniel-Constantin Mierla +Date: Mon Nov 19 15:28:16 2018 +0100 + + async: return error if trying to execute for faked message + + - GH #1727 + + (cherry picked from commit 8b71c46ba0db05051ee24bf88491f00387e1ca8b) + (cherry picked from commit 652180a88a549a6f2d91c39b053efce6b508c2ec) + +commit 2820a9620e31de907185d33de272773e62df770c +Author: Daniel-Constantin Mierla +Date: Mon Nov 19 15:22:35 2018 +0100 + + core: function to test if a msg structure is faked request + + (cherry picked from commit ab72c5e7188266baef0da70f1aa7d7d28b6d077c) + (cherry picked from commit e2ffc481a3f6673debf45f45abb7914e679c9f1b) + +commit f876ce5b5aba544495abb982f56fb009fb8eedd1 +Author: Yasin CANER +Date: Mon Nov 19 10:00:40 2018 +0300 + + core : add word to log get_boundary function + + added word to log for more understanding + + (cherry picked from commit 2daa351dd0cf716284ff90cd57d2241ee97f165d) + (cherry picked from commit a1a95ab27911ce0ff02c3a7ec7c9286cfee82894) + +commit 792847b2a1b003f72caadf9334581f6fd12534a0 +Author: Daniel-Constantin Mierla +Date: Mon Nov 19 09:24:39 2018 +0100 + + tm: t_serial - safety check for searched xavps + + (cherry picked from commit 372993c82d2ebdafe9f7e1a672a3e3141a8ae2f5) + (cherry picked from commit 0532b6fec0fecf5a6262b04a0e2e31d6b2cc315f) + +commit 35204e8eec1f5830b89a331dac274b45e2ce3933 +Author: Daniel-Constantin Mierla +Date: Fri Nov 16 10:37:19 2018 +0100 + + websocket: aligned example statements + + - few more details about return code of handshake process + + (cherry picked from commit d33ee59bc807acf95b07838d24b888b14a286ddd) + (cherry picked from commit 0327674281bcd27ef72bf617215f8e6e8f85a0a4) + +commit 9883fbc438da48ea399d0f107e4bdc846ff16818 +Author: Daniel-Constantin Mierla +Date: Tue Nov 13 08:59:43 2018 +0100 + + tmx: use branch index for $T_rpl() cache invalidation + + (cherry picked from commit e2ca5516ae086cf33c61dbb9e653a5484cca2074) + (cherry picked from commit 0305e2773a07472f442ab8cf4fbecdc0bffaf32b) + +commit 0c2ddea18d6c5a7d309cfffce4163d491fd05e83 +Author: Daniel-Constantin Mierla +Date: Thu Nov 8 08:24:59 2018 +0100 + + cfgutils: error log message mentioning the param lock_set_size + + (cherry picked from commit 55347626b189cd009c29b0e058949ed7671ae0d0) + (cherry picked from commit 9374328bb2c05955658042fbf31807bd060a04de) + +commit 34da446f129153c2254275f4cad1f5fe74bef1cc +Author: Victor Seva +Date: Wed Nov 14 10:53:06 2018 +0100 + + kazoo: fix compilation warnings + + > kz_amqp.c:1884:5: warning: variable 'binding' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] + > if(bind == NULL) { + > ^~~~~~~~~~~~ + > kz_amqp.c:1919:5: note: uninitialized use occurs here + > if(binding != NULL) + > ^~~~~~~ + > kz_amqp.c:1884:2: note: remove the 'if' if its condition is always false + > if(bind == NULL) { + > ^~~~~~~~~~~~~~~~~~ + > kz_amqp.c:1896:2: note: variable 'binding' is declared here + > kz_amqp_binding_ptr binding = shm_malloc(sizeof(kz_amqp_binding)); + > ^ + > kz_amqp.c:1965:5: warning: variable 'binding' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] + > if(bind == NULL) { + > ^~~~~~~~~~~~ + > kz_amqp.c:1992:8: note: uninitialized use occurs here + > if(binding != NULL) + > ^~~~~~~ + > kz_amqp.c:1965:2: note: remove the 'if' if its condition is always false + > if(bind == NULL) { + > ^~~~~~~~~~~~~~~~~~ + > kz_amqp.c:1972:2: note: variable 'binding' is declared here + > kz_amqp_binding_ptr binding = shm_malloc(sizeof(kz_amqp_binding)); + > ^ + > kz_amqp.c:2875:5: warning: variable 'json_obj' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] + > if(payload == NULL) { + > ^~~~~~~~~~~~~~~ + > kz_amqp.c:2927:5: note: uninitialized use occurs here + > if(json_obj) + > ^~~~~~~~ + > kz_amqp.c:2875:2: note: remove the 'if' if its condition is always false + > if(payload == NULL) { + > ^~~~~~~~~~~~~~~~~~~~~ + > kz_amqp.c:2880:2: note: variable 'json_obj' is declared here + > json_obj_ptr json_obj = kz_json_parse(payload ); + > ^ + > 3 warnings generated. + + (cherry picked from commit 232e8400caf7173e73229627af0270a704824f62) + (cherry picked from commit b2b8bc03d0658b0786a72e1e589b8b129ee7599e) + +commit cb997ba65ffe5c159e9480f45b1b7f39197bf889 +Author: Victor Seva +Date: Wed Nov 14 10:41:08 2018 +0100 + + db_berkeley: fix compilation warning + + > CC (clang) [M db_berkeley.so] db_berkeley.o + > db_berkeley.c:916:5: warning: variable 'dbcp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] + > if((ret = bdb_get_columns(_tp, _r, 0, 0)) != 0) { + > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + > db_berkeley.c:966:5: note: uninitialized use occurs here + > if(dbcp) + > ^~~~ + > db_berkeley.c:916:2: note: remove the 'if' if its condition is always false + > if((ret = bdb_get_columns(_tp, _r, 0, 0)) != 0) { + > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + > db_berkeley.c:901:6: warning: variable 'dbcp' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] + > if(!lkey) { + > ^~~~~ + > db_berkeley.c:966:5: note: uninitialized use occurs here + > if(dbcp) + > ^~~~ + > db_berkeley.c:901:3: note: remove the 'if' if its condition is always false + > if(!lkey) { + > ^~~~~~~~~~~ + > db_berkeley.c:875:11: note: initialize the variable 'dbcp' to silence this warning + > DBC *dbcp; + > ^ + > = NULL + > 2 warnings generated. + + (cherry picked from commit 93e0b7e7bcefa900e8686e7e60f1a59cc32f9b39) + (cherry picked from commit e377ec1fb2ce841b0b96c7f9c4cea935ad6f10f6) + +commit afa6eecd1587d4fc566aaa29dc7f902def771a55 +Author: Daniel-Constantin Mierla +Date: Mon Nov 5 12:53:06 2018 +0100 + + regex: fixed section ids for functions + + - removed trailing whitespaces + + (cherry picked from commit e8aec6d15bcef95f628108398e682571763464c5) + +commit b43dea08aed9ba24485e5851cce16dd08bae9fa9 +Author: Daniel-Constantin Mierla +Date: Mon Nov 5 10:20:02 2018 +0100 + + rabbitmq: call function to release the amqp buffers + + (cherry picked from commit 88ebe33b6f8a21df6fa0720fef62dabe6b089c87) + +commit 57193ad2783cb3b170caa93aa10752581220fbd0 +Author: Daniel-Constantin Mierla +Date: Mon Nov 5 09:29:01 2018 +0100 + + rabbitmq: renamed global variable, same name being used in some functions + + - global variables made static + + (cherry picked from commit 4f303b6fd548e89c59b074db94656f58aaff6adf) + +commit 921f1771d2bfd7d2f06bd6822b4b7ba9119518c2 +Author: Daniel-Constantin Mierla +Date: Sat Nov 3 08:17:01 2018 +0100 + + misc/examples: check return code for has_totag() in kemi lua script + + (cherry picked from commit 0d869c90eff536aea0f42c7e368535fec344f2f2) + +commit aded9a07fdecaed51fb0af40db7ca2d7ff9e7035 +Author: Henning Westerholt +Date: Thu Nov 1 22:51:39 2018 +0100 + + kazoo: add kz prefix to str_split utility function + + - add kz prefix to str_split utility function, to prevent overlapping with a + function with similar name in the json module + + (cherry picked from commit e8b905006e1a768cd8e328bd836ac43e5a2bc2f2) + +commit 348ede7e461e3482e93be161e4b98c84d196f17d +Author: Sebastian Kemper +Date: Fri Nov 2 10:10:38 2018 +0100 + + dialplan: fix dp_replace() in cmd_export_t struct + + In the struct 'int param_no' is set to '2'. But dp_replace() has actually three + parameters (dpid, inval, outvar), so kamailio's cfg parser fails when + dp_replace() is called: + + yyparse(): cfg. parser: failed to find command dp_replace (params 3) + yyerror_at(): parse error in config file /etc/kamailio/kamailio.cfg, line 366, column 45: unknown command, missing loadmodule? + + This commit fixes 'int param_no' to address this. + + Signed-off-by: Sebastian Kemper + (cherry picked from commit cbff35909edccffe778d04f3871d880195d82b7a) + +commit d3676df7e414aa995447488ba0977b7a43b63f43 +Author: Henning Westerholt +Date: Thu Nov 1 21:22:53 2018 +0100 + + acc_radius: fix generating duplicates for missed calls + + - fix generating duplicates for missed calls (#GH1674) + - patch from Julien Chavanton jchavanton at gmail dot com + + (cherry picked from commit 8cce4f243bc00f243671da7349edd3a11d5dc2ec) + +commit 54d00e9c4dfd8a30dd5f12930720bf7c1121e443 +Author: Henning Westerholt +Date: Thu Nov 1 21:22:26 2018 +0100 + + acc_diameter: fix generating duplicates for missed calls + + - fix generating duplicates for missed calls (#GH1674) + - patch from Julien Chavanton jchavanton at gmail dot com + + (cherry picked from commit 3a471af738c6b8f7e717b7f2f4c6f9c579a2d9c8) + +commit f8ebc379063e316badf09faf368bd9a373a82822 +Author: Henning Westerholt +Date: Thu Nov 1 21:21:28 2018 +0100 + + acc: fix generating duplicates for missed calls + + - fix generating duplicates for missed calls (#GH1674) + - patch from Julien Chavanton jchavanton at gmail dot com + + (cherry picked from commit a7525829309427fbb9357e0104b9dba1016f6777) + +commit d2b805d335c283ef5570c6cb5d61bd561e0de996 +Author: Henning Westerholt +Date: Thu Nov 1 21:19:41 2018 +0100 + + core: add helper function for flag reset + + - add helper function for flag reset (needed for bugfix in #GH1674) + - patch from: Julien Chavanton jchavanton at gmail dot com + + (cherry picked from commit 253d35c84bc1886c9eae774a731452f5d2f521cd) + +commit 5ca5ee2beed67efd5ab8a973367e754d23883db7 +Author: Lucian Balaceanu +Date: Mon Oct 29 11:54:45 2018 +0200 + + pdb: fix SIGABRT in case of too long uris + + buf in pdb_msg_dbg should correctly accomodate for pdb_bdy size + pdb_hdr + pdb_bdy should add to pdb_hdr.length (max 255) + + (cherry picked from commit 783763e8accef47aa563cd17d1e170250268751c) + +commit cd36828b3abb49ccb541e38f634e6a54e6a90403 +Author: Daniel-Constantin Mierla +Date: Tue Oct 30 07:21:48 2018 +0100 + + rabbitmq: use fixup spve all + + - allow tracking parameter number + - prefix to avoid conflict of common name function + + (cherry picked from commit 6745a6c784218130a28896cbfa4ea520047d8fc6) + +commit 9bad6f16ce9b21b3f298eb03bb6c8ef1911d6fc2 +Author: Daniel-Constantin Mierla +Date: Mon Oct 29 07:27:58 2018 +0100 + + dialog: handle alias in contact address for local bye only when no route headers + + - GH #1689 + + (cherry picked from commit 810d84981b4ed83b11e4090740a36653ec10ef16) + +commit 64afdf27e7ea8e2ef38211af1233d780102ab4c3 +Author: Daniel-Constantin Mierla +Date: Fri Oct 26 09:21:57 2018 +0200 + + uac: test if qop field has a list of values for remote auth challenge + + - GH #1684 + + (cherry picked from commit 6e6a2f442e06a23aa180f07c2a954068dfc58843) + +commit 00720d55c2f838486a68b799e8f92abcebf8dba0 +Author: mtirpak +Date: Thu Oct 25 13:43:36 2018 +0200 + + core: variables declared in the config file could cause memory corruption + + The config variables that are declared in the config file were recorded + in the reverse order as their padding was calculated, which could cause + the allocated memory block to be smaller as required at the end. + + Credits go to vinesinha. + + (cherry picked from commit 2ecf601c472bb81b9cf4ffd5b1ac17c4dfd742f2) + +commit d2a6728c6d7fd39d009150ddfa4c5980e8142cab +Author: dnadares +Date: Wed Oct 24 22:28:12 2018 -0300 + + evapi: minor fix in tag length compare + + It was assigning the length instead of comparing it. + + (cherry picked from commit 3da3aa0c9ee3fcd5aadd3924ee883666d2a15ac6) + +commit 1c506f448216e366d6a06ff5c1713f2be65609c2 +Author: Daniel-Constantin Mierla +Date: Wed Oct 24 14:49:10 2018 +0200 + + topos: docs - replaced c&p topoh with topos + + (cherry picked from commit 56c40ebefcbe0954c5c40470b22d4f26e163a2d0) + +commit 083c21b2070625e07fcd1eab4f9e2935b51e5566 +Author: Daniel-Constantin Mierla +Date: Fri Oct 19 11:33:18 2018 +0200 + + core: cfg select - safety check accessing vars before initialization + + (cherry picked from commit 97855a1766edf4ecc2cc4e38f3cc0d3cea3190db) + +commit 4ffe23dc473b170ec21ba9c6c32acfbc8b09016e +Author: Claudiu Boriga +Date: Fri Feb 23 16:12:42 2018 +0200 + + presence: test if event is dialog to avoid unnecessary xml parsing + + (cherry picked from commit 6d0f8994611b50faa7ef7d1299acf0c390a2eed1) + +commit 54c904e4dc9dae3cd82e547e2328cad9381e48ec +Author: Victor Seva +Date: Mon Dec 3 12:07:53 2018 +0100 + + utils/kamctl: [pgsql] add missing options for pgsql_ro_query() + + Thanks Andreas Maus + + fix #1750 + + (cherry picked from commit 1894b378f975e7129024f6f10640c6c642e30a1b) + +commit 4317b3c6b88b0d7ae7c034a2fdfb1bf7ee7c297b +Author: Kamailio Dev +Date: Fri Oct 19 08:46:32 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 111d23eef719054e7a1a63a44453b4054bd5fc5b +Author: Kamailio Dev +Date: Thu Oct 4 09:46:43 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 3cb04f02a2d47c747268f6a1716c58375d131beb +Author: Kamailio Dev +Date: Mon Oct 1 20:46:39 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 2f96f64f25533c48e494dcca0b1b6727f557f458 +Author: Kamailio Dev +Date: Fri Sep 7 15:31:52 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit ed8857dd2eb5b9e0c4558a987121d5dc3a2cec4f +Author: Kamailio Dev +Date: Fri Aug 17 21:46:39 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 37d5880dd2b70662f9b033671bc9f9504b804c9b +Author: Kamailio Dev +Date: Mon Jul 23 23:01:43 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 023f42e3001a5e61dadb59d88b2ddf17c4ab42e2 +Author: Kamailio Dev +Date: Fri Jul 13 11:31:47 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit a3c674031974744a1c22f4c242c7188d8ef3c3fe +Author: Kamailio Dev +Date: Thu Jun 7 17:46:56 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 18d4a1e519ac4ba1ab39b6830d29cfa6392d065d +Author: Kamailio Dev +Date: Thu May 31 10:01:42 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit f6e2441e95d0f7797893d8e6cd69c62aaecd8473 +Author: Kamailio Dev +Date: Wed May 9 12:16:47 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 953b2e6d1b6cbb7687a264f8592c97ce170bab28 +Author: Kamailio Dev +Date: Sun Apr 22 08:46:49 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit 5fef50e6c148fe257e50f4c43466945320aae2a8 +Author: Kamailio Dev +Date: Wed Apr 18 08:46:56 2018 +0200 + + modules: readme files regenerated - modules ... [skip ci] + +commit ca910bf6b75fee4dfe5629733d52e410a42560d1 +Author: Kamailio Dev +Date: Wed Mar 14 11:31:52 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 837258b410ad5fd7313d4c9c74b554db744b8d11 +Author: Kamailio Dev +Date: Thu Mar 1 16:01:27 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit f937feec42660cb9a7c0f3b852e7ffde88550624 +Author: Kamailio Dev +Date: Tue Feb 27 13:16:49 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 71237ef80465dfb239bfdaa5c470dae20a2fd980 +Author: Kamailio Dev +Date: Thu Feb 22 10:46:26 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 976f923489a08480b3de39220dd91be86c77759b +Author: Kamailio Dev +Date: Fri Feb 2 20:16:24 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit f62d0e1ddab891d38ab1d9e6dffb6487189c61eb +Author: Kamailio Dev +Date: Fri Jan 19 10:16:59 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 68653fad1c3beef137a10f1416666cdc8ad9c790 +Author: Kamailio Dev +Date: Mon Jan 15 15:31:27 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 84aedfc45ac752189f23509512ed1d24f89d24ba +Author: Kamailio Dev +Date: Tue Jan 2 18:01:30 2018 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit f47698feee205af4be362c5178c6d4e1f61a14f5 +Author: Kamailio Dev +Date: Thu Dec 7 15:16:33 2017 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit f36203d229704ee2e04a0de015dbacd2c77c3633 +Author: Kamailio Dev +Date: Mon Nov 27 09:46:41 2017 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 86cc5340df85809c935e7468fd73e7a85da00519 +Author: Kamailio Dev +Date: Fri Nov 24 10:01:46 2017 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 515d918657fe0ff5131351ea358c222eda2e1647 +Author: Kamailio Dev +Date: Tue Nov 21 12:16:29 2017 +0100 + + modules: readme files regenerated - modules ... [skip ci] + +commit 7fd9d125ef3d0ee41fc054176e3eb56c2e1a4094 +Author: Dmitri Savolainen +Date: Tue Nov 20 12:42:05 2018 +0300 + + dialog: fix typo in warn message (#1731) + + - GH #1731 + + (cherry picked from commit df6152fd69469eb340078535a3cf8b28e901ea7d) + +commit 84f004689c4f78260592a38009665a591cc117df +Merge: e178b8c62 094f58490 +Author: Daniel-Constantin Mierla +Date: Tue Nov 6 16:19:09 2018 +0100 + + Merge pull request #1708 from sergey-safarov/spec_update10 + + RPM spec update for 5.1 branch + +commit 094f584901ff4a4c60b6119b3fd7563472b2f88f +Author: Sergey Safarov +Date: Sun Nov 4 08:49:23 2018 +0000 + + pkg/kamailio/obs: Fixed bdb module build on fedora dists + + (cherry picked from commit 2c077b0434037f1b0f6b37d6026235b206ddbbb2) + +commit 18bf0d3a34794606f06e9740d881badca50cfd5a +Author: Sergey Safarov +Date: Sat Nov 3 22:15:26 2018 +0000 + + pkg/kamailio/ops: Added MongoDB rpm package + + (cherry picked from commit 702bfff175efaf25202e1644e39d143886ce7886) + +commit 8f6d085cda34dc6d9edb043f8c8eb548af0090cb +Author: Sergey Safarov +Date: Sun Nov 4 00:00:44 2018 +0000 + + pkg/kamailio/obs: Updated obs meta + + (cherry picked from commit 3c9547334166d43aa1e2cba8b9dab6e78dfed66a) + +commit 8ebb8932c43ccbe1693062058bf779591eb84360 +Author: Sergey Safarov +Date: Sun Nov 4 00:13:14 2018 +0000 + + pkg/kamailio/obs: Removed end of life dist + + (cherry picked from commit 9aa98b12b3b7f3841facc20fee4873d8b3dc5fff) + +commit e178b8c620c991635d74c01e14b837e0080b1eea +Author: Daniel-Constantin Mierla +Date: Thu Oct 18 08:34:32 2018 +0200 + + core: init cfg framework before executing event_route[core:worker-one-init] + + (cherry picked from commit a4b6a5cb1dda7576b265a23c91321b7f2a034658) + +commit 552d90b8a0c649917eedf7a6af47f03980b7b77f +Author: Daniel-Constantin Mierla +Date: Fri Oct 19 08:20:54 2018 +0200 + + core: fake msg - added sip schema to From/To URIs + + (cherry picked from commit 044cdefcadf5c7949945544dce30becb2d84c56e) + +commit 2a5255880fb9b22bcc5d1615546935476facc787 +Author: Daniel-Constantin Mierla +Date: Thu Oct 18 18:10:33 2018 +0200 + + core: dns_cache - NAPTR rr_preference set to number for rpc output + + - it was set to string, causing a crash + - reported by GH #1680 + + (cherry picked from commit b29f333ab118c88d35fa51298cd7ef99857dbba7) + +commit df62658bb3af88b69c4dc4d019b4814967f9f8e3 +Author: Daniel-Constantin Mierla +Date: Thu Oct 18 10:13:08 2018 +0200 + + core: info log at startup with number of precesses, pkg and shm sizes + + - useful to see if needed to troubleshoot by analyzing log messages + + (cherry picked from commit f057e844ba407333ad8d876daa1f6ee49bd41c86) + +commit df1f0cc707255e848e8b5defd4c3ec43a7eab3f7 +Author: Daniel-Constantin Mierla +Date: Mon Oct 15 12:20:23 2018 +0200 + + kamctl: man page - note about prefixing number params with 's:' to enforce string + + (cherry picked from commit 48048b0e372eabdde14460cb539b3e1ecbc13ae5) + +commit 3733918a287af1f9aa323b0b4e454c2db409ac9a +Author: Daniel-Constantin Mierla +Date: Mon Oct 15 12:03:43 2018 +0200 + + utils/kamcmd: man page - note about the suto-conversion of number parameters + + (cherry picked from commit c998a7cc2d265d6e3c0e10facc280866495d827e) + +commit 3d203d97f28e8d5eefb5ea63c0f3ff12b3cb9d2f +Author: Daniel-Constantin Mierla +Date: Mon Oct 15 08:23:23 2018 +0200 + + dialplan: note and example for prefixing string param with s: for rpc dialplan.translate + + (cherry picked from commit a169b298018f08a57da8e7a8c116560ee4fff006) + +commit 18ab2fbe8d7d24d2cb88b3bee9d9a1bf1eede5d5 +Author: Daniel-Constantin Mierla +Date: Fri Oct 12 02:12:18 2018 +0200 + + db_postgres: docs for bytea_output_escape + + (cherry picked from commit 99368909cdfc5140a1948525c5c734252f998efb) + +commit c7250e725d1c2c32f579cf4803619c41e52cf825 +Author: Daniel-Constantin Mierla +Date: Fri Oct 12 02:09:21 2018 +0200 + + db_postgres: new parameter bytea_output_escape + + - control escaping output for bytea fields + - default 1 (do the escape) + + (cherry picked from commit 861205b8aeed19fe8693e21fe5f1856f1dcb08c5) + +commit 039bc39162e93db6719452ab60465cd7ee166f72 +Author: Sergey Safarov +Date: Sun Oct 7 21:06:59 2018 +0000 + + db_postgres: Fixed blob hex encoding (#1255) + + (cherry picked from commit 5557a441a4969994c2a82a89d53dec710164a034) + +commit b43fbb18acb86b97ff86bd867ab46c25747b2cf0 +Author: Sebastian Kemper +Date: Sun Oct 7 18:54:39 2018 +0200 + + kamctl: make jsonrpc filter portable + + The filter has a regex looking for a literal '{' in the beginning of a + line. Some awk implementations interpret this as a meta character, so + the regex is deemed broken. Example with busybox awk (POSIX): + + root@hank2:~# kamctl ps + awk: bad regex '^{.+"id"[ ]*:[ ]*[0-9]+[ ]*}$': Invalid contents of {} + root@hank2:~# + + To fix this enclose the character in square brackets. This always + matches for a literal '{' and is portable. + + Signed-off-by: Sebastian Kemper + (cherry picked from commit 59d287586f502a8df71c2e91899fde49594e072e) + +commit 85b5f07694b30bdddcb36591b7306fef4385ecc2 +Author: Victor Seva +Date: Wed Oct 17 12:07:53 2018 +0200 + + core: [cfg] reset routename properly + + solution for #1536 was not working + + fix #1668 + + (cherry picked from commit 6d1bf58d468e8ee62da2b1a2e50a57feb7c576c6) + +commit d078160a018171e856eb0ed90db3019a02a5253c +Author: Sergey Safarov +Date: Sun Oct 14 15:51:35 2018 +0000 + + pkg/kamailio: Fixed db_redis RPM packaging after ee95675177466a7ae5f9575db300df32e42661f2 + Please look ticket #1676 + + (cherry picked from commit c70c4c5486831b0b8e87450869fee091ecfbda04) + + ===================== 2018-10-04 Version 5.1.6 Released ================== ===================== Changes Since Version 5.1.5 =========================== diff --git a/misc/examples/kemi/kamailio-basic-kemi-lua.lua b/misc/examples/kemi/kamailio-basic-kemi-lua.lua index 295d502aa..3c67942cf 100644 --- a/misc/examples/kemi/kamailio-basic-kemi-lua.lua +++ b/misc/examples/kemi/kamailio-basic-kemi-lua.lua @@ -299,7 +299,7 @@ function ksr_route_natmanage() KSR.rtpproxy.rtpproxy_manage("co"); if KSR.siputils.is_request()>0 then - if not KSR.siputils.has_totag() then + if KSR.siputils.has_totag()<0 then if KSR.tmx.t_is_branch_route()>0 then KSR.rr.add_rr_param(";nat=yes"); end diff --git a/misc/examples/kemi/kamailio-basic-kemi-python.py b/misc/examples/kemi/kamailio-basic-kemi-python.py index 7d952e413..611a20408 100644 --- a/misc/examples/kemi/kamailio-basic-kemi-python.py +++ b/misc/examples/kemi/kamailio-basic-kemi-python.py @@ -62,7 +62,7 @@ class kamailio: # CANCEL processing if KSR.pv.get("$rm") == "CANCEL" : if KSR.tm.t_check_trans()>0 : - self.ksr_route_relay(); + self.ksr_route_relay(msg); return 1; # handle requests within SIP dialogs diff --git a/pkg/kamailio/Makefile b/pkg/kamailio/Makefile index 86f826a78..63c024c15 100644 --- a/pkg/kamailio/Makefile +++ b/pkg/kamailio/Makefile @@ -40,7 +40,7 @@ src.rpm: tar mv ../../kamailio-$(RELEASE)_src.tar.gz ${RPMBUILD_TOP}/SOURCES/${DIST_ARCHIVE} sed -i -e 's/setup -n %{name}-%{ver}/setup -n kamailio-$(RELEASE)/' obs/kamailio.spec rpmbuild ${RPMBUILD_OPT} -bs obs/kamailio.spec - mv ${RPMBUILD_TOP}/SRPMS/kamailio-$(RELEASE).*.src.rpm ../.. + mv ${RPMBUILD_TOP}/SRPMS/kamailio-$(RELEASE)*.src.rpm ../.. rm -Rf ${RPMBUILD_TOP} # build rpm packages diff --git a/pkg/kamailio/alpine/APKBUILD b/pkg/kamailio/alpine/APKBUILD index 524f0de04..a7afdec85 100644 --- a/pkg/kamailio/alpine/APKBUILD +++ b/pkg/kamailio/alpine/APKBUILD @@ -4,7 +4,7 @@ # Maintainer: Nathan Angelacos pkgname=kamailio -pkgver=5.1.6 +pkgver=5.1.7 pkgrel=0 # If building from a git snapshot, specify the gitcommit @@ -246,7 +246,6 @@ for _i in db postgres sqlite dbtext mysql \ done source="${pkgname}-${pkgver}${_suffix}.tar.gz::https://github.com/kamailio/$pkgname/archive/$_gitcommit.tar.gz - 0001-kamdbctl.base.patch 0004-src_core_tcp_read_c.patch kamailio.initd " @@ -546,6 +545,5 @@ sipdump() { } sha512sums="51ea5fccd27a9d3d1783cfc5596eb28ab27e34faeec3268600363f43c48a3634c3c584c479ba874fdb53b85766a0ce8fe7df0e20954c9c6514b1d9d41d9237e6 kamailio-5.1.0.20171125-991fe9b.tar.gz -6badfb611c02ffcb4c2e9937731162ea1a4b737f042ed52120e2f96ebb80b5b7d240b5612c9ca565e693eec9b8c52c1ee5db04dfc47d204501021f984b4b11db 0001-kamdbctl.base.patch af8362201957eae6b66baf7368c9ca884024209a396d77c5c52180c9aabe13772e9c6513e59721d39503e5bb7a8c1030f5c10301ea9055bddafb7f01ee2f3076 0004-src_core_tcp_read_c.patch cd6e3b677d803cd78561ad14d9b2589fd35ad0096f48047fdcb4ddc7d9103871357efba3b350946844cb53dbb081210746421fc420c22ac845b90251168a628e kamailio.initd" diff --git a/pkg/kamailio/centos/6/kamailio.spec b/pkg/kamailio/centos/6/kamailio.spec index 306ac5458..937f1e020 100644 --- a/pkg/kamailio/centos/6/kamailio.spec +++ b/pkg/kamailio/centos/6/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel 0%{dist} diff --git a/pkg/kamailio/centos/7/kamailio.spec b/pkg/kamailio/centos/7/kamailio.spec index 923f7ab68..1f7fd3125 100644 --- a/pkg/kamailio/centos/7/kamailio.spec +++ b/pkg/kamailio/centos/7/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel dev6%{dist} %bcond_with dnssec diff --git a/pkg/kamailio/deb/buster/changelog b/pkg/kamailio/deb/buster/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/buster/changelog +++ b/pkg/kamailio/deb/buster/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/debian/changelog b/pkg/kamailio/deb/debian/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/debian/changelog +++ b/pkg/kamailio/deb/debian/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/jessie/changelog b/pkg/kamailio/deb/jessie/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/jessie/changelog +++ b/pkg/kamailio/deb/jessie/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/precise/changelog b/pkg/kamailio/deb/precise/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/precise/changelog +++ b/pkg/kamailio/deb/precise/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/sid/changelog b/pkg/kamailio/deb/sid/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/sid/changelog +++ b/pkg/kamailio/deb/sid/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/stretch/changelog b/pkg/kamailio/deb/stretch/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/stretch/changelog +++ b/pkg/kamailio/deb/stretch/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/trusty/changelog b/pkg/kamailio/deb/trusty/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/trusty/changelog +++ b/pkg/kamailio/deb/trusty/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/wheezy/changelog b/pkg/kamailio/deb/wheezy/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/wheezy/changelog +++ b/pkg/kamailio/deb/wheezy/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/deb/xenial/changelog b/pkg/kamailio/deb/xenial/changelog index 1bf0e11ca..ba5d29653 100644 --- a/pkg/kamailio/deb/xenial/changelog +++ b/pkg/kamailio/deb/xenial/changelog @@ -1,3 +1,9 @@ +kamailio (5.1.7) unstable; urgency=medium + + * version set to 5.1.7 + + -- Victor Seva Thu, 31 Jan 2019 10:15:30 +0100 + kamailio (5.1.6) unstable; urgency=medium * version set to 5.1.6 diff --git a/pkg/kamailio/fedora/17/kamailio.spec b/pkg/kamailio/fedora/17/kamailio.spec index 3191baaec..384839c1a 100644 --- a/pkg/kamailio/fedora/17/kamailio.spec +++ b/pkg/kamailio/fedora/17/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel 0%{dist} diff --git a/pkg/kamailio/freebsd/Makefile b/pkg/kamailio/freebsd/Makefile index 1ea164854..5a016b063 100644 --- a/pkg/kamailio/freebsd/Makefile +++ b/pkg/kamailio/freebsd/Makefile @@ -6,7 +6,7 @@ # PORTNAME= kamailio -PORTVERSION= 5.1.6 +PORTVERSION= 5.1.7 CATEGORIES= net MASTER_SITES= http://kamailio.org/pub/kamailio/${PORTVERSION}/src/ DISTNAME= ${PORTNAME}-${PORTVERSION}-tls_src diff --git a/pkg/kamailio/obs/kamailio.service b/pkg/kamailio/obs/kamailio.service index 0be0dc0e6..ce8e55f95 100644 --- a/pkg/kamailio/obs/kamailio.service +++ b/pkg/kamailio/obs/kamailio.service @@ -5,7 +5,7 @@ After=network.target [Service] Type=simple User=kamailio -Group=daemon +Group=kamailio Environment='CFGFILE=/etc/kamailio/kamailio.cfg' Environment='SHM_MEMORY=64' Environment='PKG_MEMORY=4' diff --git a/pkg/kamailio/obs/kamailio.spec b/pkg/kamailio/obs/kamailio.spec index 8d6c134f1..2998872e6 100644 --- a/pkg/kamailio/obs/kamailio.spec +++ b/pkg/kamailio/obs/kamailio.spec @@ -1,47 +1,7 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel 0%{dist} -%if 0%{?fedora} == 25 -%define dist_name fedora -%define dist_version %{?fedora} -%bcond_without cnxcc -%bcond_with dnssec -%bcond_without geoip -%bcond_without http_async_client -%bcond_without jansson -%bcond_without json -%bcond_without lua -%bcond_without kazoo -%bcond_without memcached -%bcond_without perl -%bcond_without rebbitmq -%bcond_without redis -%bcond_without sctp -%bcond_without websocket -%bcond_without xmlrpc -%endif - -%if 0%{?fedora} == 26 -%define dist_name fedora -%define dist_version %{?fedora} -%bcond_without cnxcc -%bcond_with dnssec -%bcond_without geoip -%bcond_without http_async_client -%bcond_without jansson -%bcond_without json -%bcond_without lua -%bcond_without kazoo -%bcond_without memcached -%bcond_without perl -%bcond_without rebbitmq -%bcond_without redis -%bcond_without sctp -%bcond_without websocket -%bcond_without xmlrpc -%endif - %if 0%{?fedora} == 27 %define dist_name fedora %define dist_version %{?fedora} @@ -54,6 +14,7 @@ %bcond_without lua %bcond_without kazoo %bcond_without memcached +%bcond_without mongodb %bcond_without perl %bcond_without rebbitmq %bcond_without redis @@ -74,6 +35,7 @@ %bcond_without lua %bcond_without kazoo %bcond_without memcached +%bcond_without mongodb %bcond_without perl %bcond_without rabbitmq %bcond_without redis @@ -94,6 +56,7 @@ %bcond_without lua %bcond_without kazoo %bcond_without memcached +%bcond_without mongodb %bcond_without perl %bcond_without rabbitmq %bcond_without redis @@ -114,6 +77,7 @@ %bcond_without lua %bcond_with kazoo %bcond_without memcached +%bcond_with mongodb %bcond_without perl %bcond_with rebbitmq %bcond_with redis @@ -135,6 +99,7 @@ %bcond_without lua %bcond_without kazoo %bcond_without memcached +%bcond_without mongodb %bcond_without perl %bcond_without rebbitmq %bcond_without redis @@ -155,6 +120,7 @@ %bcond_without lua %bcond_with kazoo %bcond_without memcached +%bcond_with mongodb %bcond_without perl %bcond_with rebbitmq %bcond_without redis @@ -175,6 +141,7 @@ %bcond_with lua %bcond_with kazoo %bcond_with memcached +%bcond_with mongodb %bcond_with perl %bcond_with rebbitmq %bcond_with redis @@ -195,6 +162,7 @@ %bcond_with lua %bcond_with kazoo %bcond_with memcached +%bcond_without mongodb %bcond_without perl %bcond_without rebbitmq %bcond_without redis @@ -227,7 +195,7 @@ Conflicts: kamailio-ims < %ver, kamailio-java < %ver, kamailio-json < %ver Conflicts: kamailio-lcr < %ver, kamailio-ldap < %ver, kamailio-lua < %ver Conflicts: kamailio-kazoo < %ver Conflicts: kamailio-rabbitmq < %ver -Conflicts: kamailio-memcached < %ver, kamailio-mysql < %ver +Conflicts: kamailio-memcached < %ver, kamailio-mongodb < %ver, kamailio-mysql < %ver Conflicts: kamailio-outbound < %ver, kamailio-perl < %ver Conflicts: kamailio-postgresql < %ver, kamailio-presence < %ver Conflicts: kamailio-python < %ver @@ -244,6 +212,12 @@ BuildRequires: bison, flex %if 0%{?suse_version} BuildRequires: systemd-mini, shadow %endif +%if 0%{?fedora} == 27 +BuildRequires: python3-devel +%endif +%if 0%{?fedora} == 28 +BuildRequires: python3-devel +%endif %description Kamailio (former OpenSER) is an Open Source SIP Server released under GPL, able @@ -285,8 +259,13 @@ Requires: kamailio = %ver Requires: libdb-4_8 BuildRequires: libdb-4_8-devel %else +%if 0%{?rhel} == 6 Requires: db4 BuildRequires: db4-devel +%else +Requires: libdb +BuildRequires: libdb-devel +%endif %endif %description bdb @@ -570,6 +549,19 @@ Memcached configuration file support for Kamailio. %endif +%if %{with mongodb} +%package mongodb +Summary: MongoDB database connectivity for Kamailio +Group: System Environment/Daemons +Requires: kamailio = %ver +Requires: mongo-c-driver +BuildRequires: mongo-c-driver-devel + +%description mongodb +MongoDB database connectivity for Kamailio. +%endif + + %package mysql Summary: MySQL database connectivity for Kamailio Group: System Environment/Daemons @@ -944,19 +936,14 @@ UUID module for Kamailio. %prep %setup -n %{name}-%{ver} -ln -s ../obs pkg/kamailio/fedora/24 -ln -s ../obs pkg/kamailio/fedora/25 -ln -s ../obs pkg/kamailio/fedora/26 ln -s ../obs pkg/kamailio/fedora/27 ln -s ../obs pkg/kamailio/fedora/28 ln -s ../obs pkg/kamailio/fedora/29 -mkdir -p pkg/kamailio/rhel ln -s ../obs pkg/kamailio/rhel/6 ln -s ../obs pkg/kamailio/rhel/7 -mkdir -p pkg/kamailio/opensuse ln -s ../obs pkg/kamailio/opensuse/1315 ln -s ../obs pkg/kamailio/opensuse/1330 -mkdir -p pkg/kamailio/centos +ln -s ../obs pkg/kamailio/opensuse/1550 ln -s ../obs pkg/kamailio/centos/6 ln -s ../obs pkg/kamailio/centos/7 @@ -965,7 +952,11 @@ ln -s ../obs pkg/kamailio/centos/7 %if 0%{?fedora} || 0%{?suse_version} export FREERADIUS=1 %endif -make cfg prefix=/usr basedir=%{buildroot} cfg_prefix=%{buildroot} doc_prefix=%{buildroot} \ +make cfg prefix=/usr \ + basedir=%{buildroot} \ + cfg_prefix=%{buildroot} \ + doc_prefix=%{buildroot} \ + share_prefix=%{_prefix} \ doc_dir=%{_docdir}/kamailio/ \ cfg_target=%{_sysconfdir}/kamailio/ modules_dirs="modules" make @@ -1012,6 +1003,9 @@ make every-module skip_modules="app_mono db_cassandra db_oracle iptrtpproxy \ %endif %if %{with xmlrpc} kmi_xmlrpc \ +%endif +%if %{with mongodb} + kmongodb \ %endif kmysql koutbound \ %if %{with perl} @@ -1081,6 +1075,9 @@ make install-modules-all skip_modules="app_mono db_cassandra db_oracle \ %endif %if %{with xmlrpc} kmi_xmlrpc \ +%endif +%if %{with mongodb} + kmongodb \ %endif kmysql koutbound \ %if %{with perl} @@ -1135,18 +1132,20 @@ install -m644 pkg/kamailio/%{dist_name}/%{dist_version}/sipcapture.sysconfig \ %if 0%{?suse_version} %py_compile -O %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb %endif +%if 0%{?fedora} +%py_byte_compile %{__python2} %{buildroot}%{_libdir}/kamailio/kamctl/dbtextdb +%endif # Removing devel files rm -f %{buildroot}%{_libdir}/kamailio/lib*.so %pre -%if 0%{?suse_version} == 1330 -if ! /usr/bin/getent group daemon &>/dev/null; then - /usr/sbin/groupadd --gid 2 daemon &> /dev/null -fi -%endif if ! /usr/bin/id kamailio &>/dev/null; then - /usr/sbin/useradd -r -g daemon -s /bin/false -c "Kamailio daemon" -d %{_libdir}/kamailio kamailio || \ + /usr/sbin/useradd --system \ + --user-group \ + --shell /bin/false \ + --comment "Kamailio SIP Server" \ + --home-dir %{_rundir}/kamailio kamailio || \ %logmsg "Unexpected error adding user \"kamailio\". Aborting installation." fi @@ -1679,6 +1678,16 @@ fi %endif +%if %{with mongodb} +%files mongodb +%defattr(-,root,root) +%doc %{_docdir}/kamailio/modules/README.db_mongodb +%doc %{_docdir}/kamailio/modules/README.ndb_mongodb +%{_libdir}/kamailio/modules/db_mongodb.so +%{_libdir}/kamailio/modules/ndb_mongodb.so +%endif + + %files mysql %defattr(-,root,root) %doc %{_docdir}/kamailio/modules/README.db_mysql @@ -1955,6 +1964,8 @@ fi %changelog +* Sun Nov 04 2018 Sergey Safarov + - removed packaging for Fedora 25, 26 as End Of Life * Sat Sep 02 2017 Sergey Safarov - added packaging for Fedora 26 and openSUSE Leap 42.3 - removed packaging for Fedora 24 and openSUSE Leap 42.1 as End Of Life diff --git a/pkg/kamailio/obs/kamailio.tmpfiles b/pkg/kamailio/obs/kamailio.tmpfiles index 6c3cc0bc5..dd2c42484 100644 --- a/pkg/kamailio/obs/kamailio.tmpfiles +++ b/pkg/kamailio/obs/kamailio.tmpfiles @@ -1 +1 @@ -D /run/kamailio 0700 kamailio daemon - +D /run/kamailio 0700 kamailio kamailio - diff --git a/pkg/kamailio/obs/meta b/pkg/kamailio/obs/meta index 32e9e9ffb..452d5d764 100644 --- a/pkg/kamailio/obs/meta +++ b/pkg/kamailio/obs/meta @@ -1,6 +1,6 @@ - - RPM Packages for Kamailio v5.0.x - RPM Packages for Kamailio v5.0.x + + RPM Packages for Kamailio v5.1.x + RPM Packages for Kamailio v5.1.x @@ -24,20 +24,19 @@ x86_64 - - - + + + x86_64 - - - + + + x86_64 - - - - i586 + + + x86_64 diff --git a/pkg/kamailio/openbsd/Makefile b/pkg/kamailio/openbsd/Makefile index e82959a4e..2b1c04be8 100644 --- a/pkg/kamailio/openbsd/Makefile +++ b/pkg/kamailio/openbsd/Makefile @@ -12,7 +12,7 @@ COMMENT-carrierroute = kamailio carrierroute module COMMENT-snmpstats = kamailio snmpstats module COMMENT-perl = kamailio perl modules -VERSION = 5.1.6 +VERSION = 5.1.7 DISTNAME = kamailio-${VERSION} PKGNAME-main = kamailio-${VERSION} PKGNAME-mysql = kamailio-mysql-${VERSION} diff --git a/pkg/kamailio/oracle/el6/kamailio.spec b/pkg/kamailio/oracle/el6/kamailio.spec index a83286b3f..33f81b10e 100644 --- a/pkg/kamailio/oracle/el6/kamailio.spec +++ b/pkg/kamailio/oracle/el6/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/oracle/el7/kamailio.spec b/pkg/kamailio/oracle/el7/kamailio.spec index 73a6a744c..0f53877b0 100644 --- a/pkg/kamailio/oracle/el7/kamailio.spec +++ b/pkg/kamailio/oracle/el7/kamailio.spec @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %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 80314af43..246ac696e 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 5.1.6 +%define ver 5.1.7 %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 78a554cdb..ab34254d0 100644 --- a/pkg/kamailio/rpm/kamailio.spec.CenOS +++ b/pkg/kamailio/rpm/kamailio.spec.CenOS @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/rpm/kamailio.spec.SuSE b/pkg/kamailio/rpm/kamailio.spec.SuSE index 0e0a0f6e1..5d88474d3 100644 --- a/pkg/kamailio/rpm/kamailio.spec.SuSE +++ b/pkg/kamailio/rpm/kamailio.spec.SuSE @@ -1,5 +1,5 @@ %define name kamailio -%define ver 5.1.6 +%define ver 5.1.7 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops diff --git a/pkg/kamailio/solaris/pkginfo b/pkg/kamailio/solaris/pkginfo index 6b2c19d05..d729b2353 100644 --- a/pkg/kamailio/solaris/pkginfo +++ b/pkg/kamailio/solaris/pkginfo @@ -1,6 +1,6 @@ PKG=Kamailio ARCH=sparc -VERSION=5.1.6 +VERSION=5.1.7 CATEGORY=application EMAIL=miconda@gmail.com NAME=Kamailio is a very fast and flexible SIP (RFC3261) proxy server diff --git a/src/Makefile.defs b/src/Makefile.defs index 7c1c40988..35b6b0233 100644 --- a/src/Makefile.defs +++ b/src/Makefile.defs @@ -106,7 +106,7 @@ INSTALL_FLAVOUR=$(FLAVOUR) # version number VERSION = 5 PATCHLEVEL = 1 -SUBLEVEL = 6 +SUBLEVEL = 7 EXTRAVERSION = # memory manager switcher diff --git a/src/core/action.c b/src/core/action.c index f7d3aaf46..374ba756a 100644 --- a/src/core/action.c +++ b/src/core/action.c @@ -1671,6 +1671,9 @@ int run_child_one_init_route(void) rt = route_get(&event_rt, "core:worker-one-init"); if(rt>=0 && event_rt.rlist[rt]!=NULL) { LM_DBG("executing event_route[core:worker-one-init] (%d)\n", rt); + if (cfg_child_init()) { + return -1; + } if(faked_msg_init()<0) return -1; fmsg = faked_msg_next(); diff --git a/src/core/autover.h b/src/core/autover.h index df1732365..9b68683e3 100644 --- a/src/core/autover.h +++ b/src/core/autover.h @@ -2,6 +2,6 @@ * DO NOT EDIT IT */ -#define REPO_VER "7d1964" -#define REPO_HASH "7d1964" +#define REPO_VER "567df3" +#define REPO_HASH "567df3" #define REPO_STATE "" diff --git a/src/core/cfg.lex b/src/core/cfg.lex index 4d3931d41..cd6808d06 100644 --- a/src/core/cfg.lex +++ b/src/core/cfg.lex @@ -562,23 +562,23 @@ IMPORTFILE "import_file" {ISAVPFLAGSET} { count(); yylval.strval=yytext; return ISAVPFLAGSET; } {AVPFLAGS_DECL} { count(); yylval.strval=yytext; return AVPFLAGS_DECL; } {MSGLEN} { count(); yylval.strval=yytext; return MSGLEN; } -{ROUTE} { count(); routename=0; default_routename="DEFAULT_ROUTE"; +{ROUTE} { count(); default_routename="DEFAULT_ROUTE"; yylval.strval=yytext; return ROUTE; } -{ROUTE_REQUEST} { count(); routename=0; default_routename="DEFAULT_ROUTE"; +{ROUTE_REQUEST} { count(); default_routename="DEFAULT_ROUTE"; yylval.strval=yytext; return ROUTE_REQUEST; } -{ROUTE_ONREPLY} { count(); routename=0; default_routename="DEFAULT_ONREPLY"; +{ROUTE_ONREPLY} { count(); default_routename="DEFAULT_ONREPLY"; yylval.strval=yytext; return ROUTE_ONREPLY; } -{ROUTE_REPLY} { count(); routename=0; default_routename="DEFAULT_ONREPLY"; +{ROUTE_REPLY} { count(); default_routename="DEFAULT_ONREPLY"; yylval.strval=yytext; return ROUTE_REPLY; } -{ROUTE_FAILURE} { count(); routename=0; default_routename="DEFAULT_FAILURE"; +{ROUTE_FAILURE} { count(); default_routename="DEFAULT_FAILURE"; yylval.strval=yytext; return ROUTE_FAILURE; } -{ROUTE_BRANCH} { count(); routename=0; default_routename="DEFAULT_BRANCH"; +{ROUTE_BRANCH} { count(); default_routename="DEFAULT_BRANCH"; yylval.strval=yytext; return ROUTE_BRANCH; } -{ROUTE_SEND} { count(); routename=0; default_routename="DEFAULT_SEND"; +{ROUTE_SEND} { count(); default_routename="DEFAULT_SEND"; yylval.strval=yytext; return ROUTE_SEND; } -{ROUTE_EVENT} { count(); routename=0; default_routename="DEFAULT_EVENT"; +{ROUTE_EVENT} { count(); default_routename="DEFAULT_EVENT"; yylval.strval=yytext; state=EVRT_NAME_S; BEGIN(EVRTNAME); return ROUTE_EVENT; } diff --git a/src/core/cfg.y b/src/core/cfg.y index 85105120b..8a5cd8162 100644 --- a/src/core/cfg.y +++ b/src/core/cfg.y @@ -1828,8 +1828,11 @@ route_stm: | ROUTE error { yyerror("invalid route statement"); } | ROUTE_REQUEST error { yyerror("invalid request_route statement"); } ; + +failure_route_main: ROUTE_FAILURE { routename=NULL; } +; failure_route_stm: - ROUTE_FAILURE LBRACE actions RBRACE { + failure_route_main LBRACE actions RBRACE { #ifdef SHM_MEM if (!shm_initialized() && init_shm()<0) { yyerror("Can't initialize shared memory"); @@ -1906,8 +1909,11 @@ onreply_route_stm: yyerror("invalid onreply_route statement"); } ; + +branch_route_main: ROUTE_BRANCH { routename=NULL; } +; branch_route_stm: - ROUTE_BRANCH LBRACE actions RBRACE { + branch_route_main LBRACE actions RBRACE { #ifdef SHM_MEM if (!shm_initialized() && init_shm()<0) { yyerror("Can't initialize shared memory"); @@ -1936,7 +1942,11 @@ branch_route_stm: } | ROUTE_BRANCH error { yyerror("invalid branch_route statement"); } ; -send_route_stm: ROUTE_SEND LBRACE actions RBRACE { + +send_route_main: ROUTE_SEND { routename=NULL; } +; +send_route_stm: + send_route_main LBRACE actions RBRACE { #ifdef SHM_MEM if (!shm_initialized() && init_shm()<0) { yyerror("Can't initialize shared memory"); @@ -1965,7 +1975,11 @@ send_route_stm: ROUTE_SEND LBRACE actions RBRACE { } | ROUTE_SEND error { yyerror("invalid onsend_route statement"); } ; -event_route_stm: ROUTE_EVENT LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE { + +event_route_main: ROUTE_EVENT { routename=NULL; } +; +event_route_stm: + event_route_main LBRACK EVENT_RT_NAME RBRACK LBRACE actions RBRACE { #ifdef SHM_MEM if (!shm_initialized() && init_shm()<0) { yyerror("Can't initialize shared memory"); diff --git a/src/core/cfg/cfg_script.c b/src/core/cfg/cfg_script.c index b85d10369..9873f7040 100644 --- a/src/core/cfg/cfg_script.c +++ b/src/core/cfg/cfg_script.c @@ -35,7 +35,7 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type char *descr) { cfg_group_t *group; - cfg_script_var_t *var; + cfg_script_var_t *var, **last_var; int gname_len, vname_len, descr_len; LM_DBG("declaring %s.%s\n", gname, vname); @@ -112,9 +112,15 @@ cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type memset(var, 0, sizeof(cfg_script_var_t)); var->type = type; - /* add the variable to the group */ - var->next = (cfg_script_var_t *)(void *)group->vars; - group->vars = (char *)(void *)var; + /* Add the variable to the end of the group. + * The order is important because the padding depends on that. + * The list will be travelled later again, which must be done in + * the same order. */ + last_var = (cfg_script_var_t **)(void **)&group->vars; + while ((*last_var)) + last_var = &((*last_var)->next); + *last_var = var; + var->next = NULL; /* clone the name of the variable */ var->name = (char *)pkg_malloc(sizeof(char) * (vname_len + 1)); @@ -282,6 +288,14 @@ int cfg_script_fixup(cfg_group_t *group, unsigned char *block) } } + /* Sanity check for the group size, make sure that the + * newly calculated size equals the already calculated + * group size. */ + if (offset != group->size) { + LM_ERR("BUG: incorrect group size: %d; previously calculated value: %d \n", offset, group->size); + goto error; + } + /* allocate a handle even if it will not be used to directly access the variable, like handle->variable cfg_get_* functions access the memory block via the handle diff --git a/src/core/cfg/cfg_select.c b/src/core/cfg/cfg_select.c index b8b5d265a..175c6bd58 100644 --- a/src/core/cfg/cfg_select.c +++ b/src/core/cfg/cfg_select.c @@ -220,7 +220,12 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg *msg) break; case CFG_VAR_STR: - memcpy(res, p, sizeof(str)); + if(p) { + memcpy(res, p, sizeof(str)); + } else { + res->s = 0; + res->len = 0; + } break; default: diff --git a/src/core/dns_cache.c b/src/core/dns_cache.c index ab91a2077..6363cefe3 100644 --- a/src/core/dns_cache.c +++ b/src/core/dns_cache.c @@ -3882,7 +3882,7 @@ int dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e) } break; case T_NAPTR: - if(rpc->struct_add(sh, "ds", + if(rpc->struct_add(sh, "dd", "rr_order", ((struct naptr_rdata*)(rr->rdata))->order, "rr_preference", ((struct naptr_rdata*)(rr->rdata))->pref) <0) { diff --git a/src/core/flags.c b/src/core/flags.c index 5dbdd4ffb..7dacd469f 100644 --- a/src/core/flags.c +++ b/src/core/flags.c @@ -51,6 +51,11 @@ int resetflag( struct sip_msg* msg, flag_t flag ) { return 1; } +int resetflags( struct sip_msg* msg, flag_t flags ) { + msg->flags &= ~ flags; + return 1; +} + int isflagset( struct sip_msg* msg, flag_t flag ) { return (msg->flags & (1<;tag=123\r\nTo: \r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n" +#define FAKED_SIP_MSG "OPTIONS sip:you@kamailio.org SIP/2.0\r\nVia: SIP/2.0/UDP 127.0.0.1\r\nFrom: ;tag=123\r\nTo: \r\nCall-ID: 123\r\nCSeq: 1 OPTIONS\r\nContent-Length: 0\r\n\r\n" #define FAKED_SIP_MSG_LEN (sizeof(FAKED_SIP_MSG)-1) static char _faked_sip_buf[FAKED_SIP_MSG_LEN+1]; static struct sip_msg _faked_msg; @@ -103,3 +103,8 @@ sip_msg_t* faked_msg_get_next_clear(void) } return faked_msg_next_clear(); } + +int faked_msg_match(sip_msg_t *tmsg) +{ + return ( tmsg == &_faked_msg ) ? 1 : 0; +} diff --git a/src/core/fmsg.h b/src/core/fmsg.h index b27910026..99eb9f61b 100644 --- a/src/core/fmsg.h +++ b/src/core/fmsg.h @@ -29,5 +29,6 @@ sip_msg_t* faked_msg_next(void); sip_msg_t* faked_msg_get_next(void); sip_msg_t* faked_msg_next_clear(void); sip_msg_t* faked_msg_get_next_clear(void); +int faked_msg_match(sip_msg_t *tmsg); #endif diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index 50e670f47..f34637b6f 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -176,7 +176,7 @@ static int check_via_address(struct ip_addr* ip, str *name, LM_CRIT("invalid Via host name\n"); return -1; } - if (strncmp(name->s, s, name->len)==0) + if (len==name->len&&(strncmp(name->s, s, name->len)==0)) return 0; } }else{ @@ -1710,7 +1710,7 @@ int get_boundary(struct sip_msg* msg, str* boundary) msg->content_type->body.len); if (params.s == NULL) { - LM_INFO("Content-Type hdr has no params <%.*s>\n", + LM_INFO("Content-Type hdr has no boundary params <%.*s>\n", msg->content_type->body.len, msg->content_type->body.s); return -1; } @@ -1835,10 +1835,10 @@ int check_boundaries(struct sip_msg *msg, struct dest_info *send_info) tmp.len = get_line(lb_t->s); if(tmp.len!=b.len || strncmp(b.s, tmp.s, b.len)!=0) { - LM_DBG("malformed bondary in the middle\n"); + LM_DBG("malformed boundary in the middle\n"); memcpy(pb, b.s, b.len); body.len = body.len + b.len; pb = pb + b.len; - t = lb_t->s.s - (lb_t->s.s + tmp.len); + t = lb_t->next->s.s - (lb_t->s.s + tmp.len); memcpy(pb, lb_t->s.s+tmp.len, t); pb = pb + t; /*LM_DBG("new chunk[%d][%.*s]\n", t, t, pb-t);*/ } diff --git a/src/core/parser/parse_body.c b/src/core/parser/parse_body.c index 9333114ff..482ceb2a5 100644 --- a/src/core/parser/parse_body.c +++ b/src/core/parser/parse_body.c @@ -510,7 +510,11 @@ int part_multipart_headers_cmp (char *buffer, } if (error < 0) { - LM_ERR("part_multipart_headers_cmp. error. \"%i\". \"%s\".\n", error, error_msg); + if(error == -2) { + LM_DBG("result code: \"%i\" text: \"%s\".\n", error, error_msg); + } else { + LM_ERR("error code: \"%i\" error text: \"%s\".\n", error, error_msg); + } return 0; } else { return found; diff --git a/src/lib/srdb1/db.c b/src/lib/srdb1/db.c index 305543c93..100707fb5 100644 --- a/src/lib/srdb1/db.c +++ b/src/lib/srdb1/db.c @@ -163,6 +163,12 @@ int db_bind_mod(const str* mod, db_func_t* mydbf) LM_CRIT("null dbf parameter\n"); return -1; } + + /* for safety we initialize mydbf with 0 (this will cause + * a segfault immediately if someone tries to call a function + * from it without checking the return code from bind_dbmod */ + memset((void*)mydbf, 0, sizeof(db_func_t)); + if (mod->len > MAX_URL_LENGTH) { LM_ERR("SQL URL too long\n"); @@ -178,11 +184,6 @@ int db_bind_mod(const str* mod, db_func_t* mydbf) memcpy(name+3, mod->s, mod->len); name[mod->len+3] = 0; - /* for safety we initialize mydbf with 0 (this will cause - * a segfault immediately if someone tries to call a function - * from it without checking the return code from bind_dbmod */ - memset((void*)mydbf, 0, sizeof(db_func_t)); - p = strchr(name, ':'); if (p) { len = p - name; diff --git a/src/main.c b/src/main.c index ee8239801..f26aea856 100644 --- a/src/main.c +++ b/src/main.c @@ -1887,6 +1887,10 @@ int main(int argc, char** argv) log_color=1; break; case 'M': + if (optarg == NULL) { + fprintf(stderr, "bad private mem size\n"); + goto error; + } pkg_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024; if (tmp &&(*tmp)){ fprintf(stderr, "bad private mem size number: -M %s\n", @@ -2608,8 +2612,8 @@ try_again: * function being called before this point may rely on the * number of processes ! */ - LM_DBG("Expect (at least) %d kamailio processes in your process list\n", - get_max_procs()); + LM_INFO("processes (at least): %d - shm size: %lu - pkg size: %lu\n", + get_max_procs(), shm_mem_size, pkg_mem_size); #if defined USE_DNS_CACHE && defined USE_DNS_CACHE_STATS if (init_dns_cache_stats(get_max_procs())<0){ diff --git a/src/modules/acc/README b/src/modules/acc/README index b707806d6..fbe9d0801 100644 --- a/src/modules/acc/README +++ b/src/modules/acc/README @@ -1246,9 +1246,9 @@ modparam("acc", "cdrs_table", "acc_cdrs") * 1 - save seconds in time_attr and microseconds in time_exten. * 2 - save seconds.milliseconds in time_attr. * 3 - save formatted time according to time_format parameter, using - the output of localtime(). + the output of localtime(). Used for cdr entries too. * 4 - save formatted time according to time_format parameter, using - the output of gmtime(). + the output of gmtime(). Used for cdr entries too. Example 1.44. time_mode example ... diff --git a/src/modules/acc/acc.c b/src/modules/acc/acc.c index 24d26304e..9879e697f 100644 --- a/src/modules/acc/acc.c +++ b/src/modules/acc/acc.c @@ -526,7 +526,7 @@ int is_eng_acc_on(sip_msg_t *msg) } while(e) { if(e->flags & 1) { - if(msg->flags & e->acc_flag) { + if(isflagset(msg, e->acc_flag) == 1) { return 1; } } @@ -549,7 +549,7 @@ int is_eng_mc_on(sip_msg_t *msg) } while(e) { if(e->flags & 1) { - if(msg->flags & e->missed_flag) { + if(isflagset(msg, e->missed_flag) == 1) { return 1; } } @@ -579,15 +579,15 @@ int acc_run_engines(struct sip_msg *msg, int type, int *reset) inf.leg_info = leg_info; while(e) { if(e->flags & 1) { - if((type==0) && (msg->flags&(e->acc_flag))) { + if((type==0) && isflagset(msg, e->acc_flag) == 1) { LM_DBG("acc event for engine: %s\n", e->name); e->acc_req(msg, &inf); - if(reset) *reset |= e->acc_flag; + if(reset) *reset |= 1 << e->acc_flag; } - if((type==1) && (msg->flags&(e->missed_flag))) { + if((type==1) && isflagset(msg, e->missed_flag) == 1) { LM_DBG("missed event for engine: %s\n", e->name); e->acc_req(msg, &inf); - if(reset) *reset |= e->missed_flag; + if(reset) *reset |= 1 << e->missed_flag; } } e = e->next; diff --git a/src/modules/acc/acc_logic.c b/src/modules/acc/acc_logic.c index e0443ce90..cc66bc67d 100644 --- a/src/modules/acc/acc_logic.c +++ b/src/modules/acc/acc_logic.c @@ -55,7 +55,6 @@ struct acc_enviroment acc_env; #define is_acc_flag_set(_rq,_flag) (((_flag) != -1) && (isflagset((_rq), (_flag)) == 1)) -#define reset_acc_flag(_rq,_flag) (resetflag((_rq), (_flag))) #define is_failed_acc_on(_rq) is_acc_flag_set(_rq,failed_transaction_flag) @@ -465,7 +464,6 @@ static inline void acc_onreply_in(struct cell *t, struct sip_msg *req, } - /* initiate a report if we previously enabled MC accounting for this t */ static inline void on_missed(struct cell *t, struct sip_msg *req, struct sip_msg *reply, int code) @@ -501,11 +499,10 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, * forwarding attempt fails; we do not wish to * report on every attempt; so we clear the flags; */ - if (is_log_mc_on(req)) { env_set_text( ACC_MISSED, ACC_MISSED_LEN); acc_log_request( req ); - flags_to_reset |= log_missed_flag; + flags_to_reset |= 1 << log_missed_flag; } if (is_db_mc_on(req)) { if(acc_db_set_table_name(req, db_table_mc_data, &db_table_mc)<0) { @@ -513,7 +510,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, return; } acc_db_request( req ); - flags_to_reset |= db_missed_flag; + flags_to_reset |= 1 << db_missed_flag; } /* run extra acc engines */ @@ -523,7 +520,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, * These can't be reset in the blocks above, because * it would skip accounting if the flags are identical */ - reset_acc_flag( req, flags_to_reset ); + resetflags(req, flags_to_reset); if (new_uri_bk.len>=0) { req->new_uri = new_uri_bk; diff --git a/src/modules/acc_diameter/acc_diameter_mod.c b/src/modules/acc_diameter/acc_diameter_mod.c index d82e541b0..8957affd2 100644 --- a/src/modules/acc_diameter/acc_diameter_mod.c +++ b/src/modules/acc_diameter/acc_diameter_mod.c @@ -145,9 +145,9 @@ static int mod_init( void ) memset(&_acc_diameter_engine, 0, sizeof(acc_engine_t)); if(diameter_flag != -1) - _acc_diameter_engine.acc_flag = 1<s); @@ -287,6 +298,11 @@ int ki_async_task_route(sip_msg_t *msg, str *rn) int ri; sr_kemi_eng_t *keng = NULL; + if(faked_msg_match(msg)) { + LM_ERR("invalid usage for faked message\n"); + return -1; + } + keng = sr_kemi_eng_get(); if(keng == NULL) { ri = route_lookup(&main_rt, rn->s); diff --git a/src/modules/auth_db/auth_db_mod.c b/src/modules/auth_db/auth_db_mod.c index 0e088ac43..27d0b3a18 100644 --- a/src/modules/auth_db/auth_db_mod.c +++ b/src/modules/auth_db/auth_db_mod.c @@ -305,7 +305,8 @@ static int auth_fixup(void** param, int param_no) if(version_table_check!=0 && db_check_table_version(&auth_dbf, dbh, &name, TABLE_VERSION) < 0) { - LM_ERR("error during table version check.\n"); + LM_ERR("error during version check for db table: %.*s.\n", + name.len, name.s); auth_dbf.close(dbh); return -1; } diff --git a/src/modules/auth_xkeys/README b/src/modules/auth_xkeys/README index 71050b31f..b633e8660 100644 --- a/src/modules/auth_xkeys/README +++ b/src/modules/auth_xkeys/README @@ -171,7 +171,7 @@ auth_xkeys_add("X-My-Key", "abc", "sha256", "$Ri:$fu:$ru:$hdr(CSeq)"); Example 1.3. auth_xkeys_check usage ... -if(!auth_xkeys_add("X-My-Key", "abc", "sha256", "$si:$fu:$ru:$hdr(CSeq)")) { +if(!auth_xkeys_check("X-My-Key", "abc", "sha256", "$si:$fu:$ru:$hdr(CSeq)")) { send_reply("403", "Forbidden"); exit; } diff --git a/src/modules/auth_xkeys/auth_xkeys.c b/src/modules/auth_xkeys/auth_xkeys.c index ad3bed70d..aa8a0402b 100644 --- a/src/modules/auth_xkeys/auth_xkeys.c +++ b/src/modules/auth_xkeys/auth_xkeys.c @@ -202,6 +202,7 @@ int auth_xkeys_add(sip_msg_t* msg, str *hdr, str *key, auth_xkey_t *itc; char xout[SHA512_DIGEST_STRING_LENGTH]; struct lump* anchor; + char *p; if(_auth_xkeys_list==NULL || *_auth_xkeys_list==NULL) { LM_ERR("no stored keys\n"); @@ -266,8 +267,16 @@ int auth_xkeys_add(sip_msg_t* msg, str *hdr, str *key, LM_ERR("can't get anchor\n"); return -1; } - if (insert_new_lump_before(anchor, xdata.s, xdata.len, 0) == 0) { + p = (char*)pkg_malloc(xdata.len+1); + if(p==NULL) { + LM_ERR("no more pkg memory\n"); + return -2; + } + memcpy(p, xdata.s, xdata.len); + p[xdata.len] = '\0'; + if (insert_new_lump_before(anchor, p, xdata.len, 0) == 0) { LM_ERR("cannot insert the new header [%.*s]\n", hdr->len, hdr->s); + pkg_free(p); return -1; } return 0; diff --git a/src/modules/benchmark/README b/src/modules/benchmark/README index 6f38bcdbf..30ac60e6d 100644 --- a/src/modules/benchmark/README +++ b/src/modules/benchmark/README @@ -35,6 +35,7 @@ Bastian Friedrich 3.1. enable (int) 3.2. granularity (int) 3.3. loglevel (int) + 3.4. register (str) 4. Functions @@ -69,10 +70,11 @@ Bastian Friedrich 1.1. Set enable parameter 1.2. Set granularity parameter 1.3. Set loglevel parameter - 1.4. bm_start_timer usage - 1.5. bm_log_timer usage - 1.6. Enabling a timer - 1.7. benchmark usage + 1.4. Set register parameter + 1.5. bm_start_timer usage + 1.6. bm_log_timer usage + 1.7. Enabling a timer + 1.8. benchmark usage 2.1. Using the benchmark module's API from another module Chapter 1. Admin Guide @@ -90,6 +92,7 @@ Chapter 1. Admin Guide 3.1. enable (int) 3.2. granularity (int) 3.3. loglevel (int) + 3.4. register (str) 4. Functions @@ -140,6 +143,7 @@ Chapter 1. Admin Guide 3.1. enable (int) 3.2. granularity (int) 3.3. loglevel (int) + 3.4. register (str) 3.1. enable (int) @@ -193,6 +197,20 @@ modparam("benchmark", "loglevel", 4) This will set the logging level to L_DBG. +3.4. register (str) + + Register a timer id at startup. Required when using the start/log + functions via Kemi framework. This parameter can be set many times to + register several timer ids. + + Default value is “NONE”. + + Example 1.4. Set register parameter +... +modparam("benchmark", "register", "test") +modparam("benchmark", "register", "auth") +... + 4. Functions 4.1. bm_start_timer(name) @@ -202,7 +220,7 @@ modparam("benchmark", "loglevel", 4) Start timer “name”. A later call to “bm_log_timer()” logs this timer.. - Example 1.4. bm_start_timer usage + Example 1.5. bm_start_timer usage ... bm_start_timer("test"); ... @@ -235,7 +253,7 @@ bm_start_timer("test"); * Global avg possibly the most interesting value. - Example 1.5. bm_log_timer usage + Example 1.6. bm_log_timer usage ... bm_log_timer("test"); ... @@ -269,7 +287,7 @@ bm_log_timer("test"); Enable or disable a single timer. The following example enables timer "test" (the second parameter must be 0 to disable): - Example 1.6. Enabling a timer + Example 1.7. Enabling a timer ... kamcmd benchmark.enable_timer test 1 ... @@ -286,7 +304,7 @@ kamcmd benchmark.enable_timer test 1 Measure the duration of user location lookup. - Example 1.7. benchmark usage + Example 1.8. benchmark usage ... bm_start_timer("usrloc-lookup"); lookup("location"); diff --git a/src/modules/blst/README b/src/modules/blst/README index 87e6aba63..62e645508 100644 --- a/src/modules/blst/README +++ b/src/modules/blst/README @@ -147,7 +147,9 @@ Note the message that caused the connection establishment. Example 1.5. blst_set_ignore usage +... blst_set_ignore(6); # ignore send and connect errors +... 2.6. blst_rpl_set_ignore([flags]) @@ -161,7 +163,9 @@ Note See also blst_set_ignore. Example 1.6. blst_clear_ignore usage +... blst_clear_ignore(4); # ignore connect errors +... 2.8. blst_rpl_clear_ignore([flags]) diff --git a/src/modules/carrierroute/README b/src/modules/carrierroute/README index 633c63e0d..d905ccb8e 100644 --- a/src/modules/carrierroute/README +++ b/src/modules/carrierroute/README @@ -56,22 +56,12 @@ Lucian Balaceanu 5.1. cr.reload_routes 5.2. cr.dump_routes - 6. MI Commands + 6. Configuration examples + 7. Installation and Running - 6.1. cr_reload_routes - 6.2. cr_dump_routes - 6.3. cr_replace_host - 6.4. cr_deactivate_host - 6.5. cr_activate_host - 6.6. cr_add_host - 6.7. cr_delete_host - - 7. Configuration examples - 8. Installation and Running - - 8.1. Database setup - 8.2. Database examples - 8.3. User specific routing + 7.1. Database setup + 7.2. Database examples + 7.3. User specific routing 2. Module parameter for database access. @@ -122,20 +112,15 @@ Lucian Balaceanu 1.11. Unset db_load_description parameter 1.12. Set match_mode parameter 1.13. Set avoid_failed_destinations parameter - 1.14. cr_replace_host usage - 1.15. cr_deactivate_host usage - 1.16. cr_activate_host usage - 1.17. cr_add_host usage - 1.18. cr_delete_host usage - 1.19. Configuration example - Routing to default tree - 1.20. Configuration example - Routing to user tree - 1.21. Configuration example - module configuration - 1.22. Example database content - carrierroute table - 1.23. Example database content - simple carrierfailureroute table - 1.24. Example database content - more complex carrierfailureroute table - 1.25. Example database content - carrier_name table - 1.26. Example database content - domain_name table - 1.27. Necessary extensions for the user table + 1.14. Configuration example - Routing to default tree + 1.15. Configuration example - Routing to user tree + 1.16. Configuration example - module configuration + 1.17. Example database content - carrierroute table + 1.18. Example database content - simple carrierfailureroute table + 1.19. Example database content - more complex carrierfailureroute table + 1.20. Example database content - carrier_name table + 1.21. Example database content - domain_name table + 1.22. Necessary extensions for the user table 2.1. Set db_url parameter 2.2. Set carrierroute_table parameter 2.3. Set carrierroute_id_col parameter @@ -210,22 +195,12 @@ Chapter 1. Admin Guide 5.1. cr.reload_routes 5.2. cr.dump_routes - 6. MI Commands - - 6.1. cr_reload_routes - 6.2. cr_dump_routes - 6.3. cr_replace_host - 6.4. cr_deactivate_host - 6.5. cr_activate_host - 6.6. cr_add_host - 6.7. cr_delete_host + 6. Configuration examples + 7. Installation and Running - 7. Configuration examples - 8. Installation and Running - - 8.1. Database setup - 8.2. Database examples - 8.3. User specific routing + 7.1. Database setup + 7.2. Database examples + 7.3. User specific routing 1. Overview @@ -683,121 +658,9 @@ dstavp) Parameters: * none -6. MI Commands - - 6.1. cr_reload_routes - 6.2. cr_dump_routes - 6.3. cr_replace_host - 6.4. cr_deactivate_host - 6.5. cr_activate_host - 6.6. cr_add_host - 6.7. cr_delete_host - - All commands understand the "-?" parameter to print a short help - message. The options have to be quoted as one string to be passed to MI - interface. Each option except host and new host can be wildcarded by * - (but only * and not things like "-d prox*"). - -6.1. cr_reload_routes - -6.2. cr_dump_routes - -6.3. cr_replace_host - - This command can replace the rewrite_host of a route rule, it is only - usable in file mode. Following options are possible: - * -d - the domain containing the host - * -p - the prefix containing the host - * -h - the host to be replaced - * -t - the new host - - Use the "null" prefix to specify an empty prefix. - - Example 1.14. cr_replace_host usage -... -kamctl fifo cr_replace_host "-d proxy -p 49 -h proxy1 -t proxy2" -... - -6.4. cr_deactivate_host - - This command deactivates the specified host, i.e. it sets its status to - 0. It is only usable in file mode. Following options are possible: - * -d - the domain containing the host - * -p - the prefix containing the host - * -h - the host to be deactivated - * -t - the new host used as backup - - When -t (new_host) is specified, the portion of traffic for the - deactivated host is routed to the host given by -t. This is indicated - in the output of dump_routes. The backup route is deactivated if the - host is activated again. - - Use the "null" prefix to specify an empty prefix. - - Example 1.15. cr_deactivate_host usage -... -kamctl fifo cr_deactivate_host "-d proxy -p 49 -h proxy1" -... - -6.5. cr_activate_host - - This command activates the specified host, i.e. it sets its status to - 1. It is only usable in file mode. Following options are possible: - * -d - the domain containing the host - * -p - the prefix containing the host - * -h - the host to be activated - - Use the "null" prefix to specify an empty prefix. - - Example 1.16. cr_activate_host usage -... -kamctl fifo cr_activate_host "-d proxy -p 49 -h proxy1" -... - -6.6. cr_add_host - - This command adds a route rule, it is only usable in file mode. - Following options are possible: - * -d - the domain containing the host - * -p - the prefix containing the host - * -h - the host to be added - * -w - the weight of the rule - * -P - an optional rewrite prefix - * -S - an optional rewrite suffix - * -i - an optional hash index - * -s - an optional strip value - - Use the "null" prefix to specify an empty prefix. - - Example 1.17. cr_add_host usage -... -kamctl fifo cr_add_host "-d proxy -p 49 -h proxy1 -w 0.25" -... - -6.7. cr_delete_host - - This command delete the specified hosts or rules, i.e. remove them from - the route tree. It is only usable in file mode. Following options are - possible: - * -d - the domain containing the host - * -p - the prefix containing the host - * -h - the host to be added - * -w - the weight of the rule - * -P - an optional rewrite prefix - * -S - an optional rewrite suffix - * -i - an optional hash index - * -s - an optional strip value - - Use the "null" prefix to specify an empty prefix. - - Example 1.18. cr_delete_host usage -... -kamctl fifo cr_delete_host "-d proxy -p 49 -h proxy1 -w 0.25" -... - -7. Configuration examples +6. Configuration examples - Example 1.19. Configuration example - Routing to default tree + Example 1.14. Configuration example - Routing to default tree ... route { # route calls based on hash over callid @@ -831,7 +694,7 @@ failure_route[2] { # further processing } - Example 1.20. Configuration example - Routing to user tree + Example 1.15. Configuration example - Routing to user tree ... route[1] { cr_user_carrier("$fU", "$fd", "$avp(s:carrier)"); @@ -873,7 +736,7 @@ failure_route[1] { } ... - Example 1.21. Configuration example - module configuration + Example 1.16. Configuration example - module configuration The following config file specifies within the default carrier two domains, each with an prefix that contains two hosts. It is not @@ -929,13 +792,13 @@ domain register { } ... -8. Installation and Running +7. Installation and Running - 8.1. Database setup - 8.2. Database examples - 8.3. User specific routing + 7.1. Database setup + 7.2. Database examples + 7.3. User specific routing -8.1. Database setup +7.1. Database setup Before running Kamailio with carrierroute, you have to setup the database table where the module will store the routing data. For that, @@ -954,9 +817,9 @@ domain register { For a minimal configuration either use the config file given above, or insert some data into the tables of the module. -8.2. Database examples +7.2. Database examples - Example 1.22. Example database content - carrierroute table + Example 1.17. Example database content - carrierroute table ... +----+---------+--------+-------------+-------+------+---------------+ | id | carrier | domain | scan_prefix | flags | prob | rewrite_host | @@ -993,7 +856,7 @@ domain register { flags are not set, the other two rules are used. The “strip”, “mask” and “comment” colums are omitted for brevity. - Example 1.23. Example database content - simple carrierfailureroute + Example 1.18. Example database content - simple carrierfailureroute table ... +----+---------+--------+---------------+------------+-------------+ @@ -1015,7 +878,7 @@ domain register { entry in the carrierroute table, otherwise the module will not load the routing data. - Example 1.24. Example database content - more complex + Example 1.19. Example database content - more complex carrierfailureroute table ... +----+---------+-----------+------------+--------+-----+-------------+ @@ -1042,7 +905,7 @@ domain register { that holds domain entries for this routing rules. Not all table colums are show here for brevity. - Example 1.25. Example database content - carrier_name table + Example 1.20. Example database content - carrier_name table ... +----+----------+ | id | carrier | @@ -1055,7 +918,7 @@ domain register { This table contains the mapping of the carrier id to actual names. - Example 1.26. Example database content - domain_name table + Example 1.21. Example database content - domain_name table ... +----+----------+ | id | domain | @@ -1068,14 +931,14 @@ domain register { This table contains the mapping of the domain id to actual names. -8.3. User specific routing +7.3. User specific routing For a functional routing the “cr_preferred_carrier” column must be added to the subscriber table (or to the table and column that you specified as modul parameter) to choose the actual carrier for the users. - Example 1.27. Necessary extensions for the user table + Example 1.22. Necessary extensions for the user table Suggested changes: ... diff --git a/src/modules/cdp/diameter_msg.c b/src/modules/cdp/diameter_msg.c index 3630d40f1..81074418f 100644 --- a/src/modules/cdp/diameter_msg.c +++ b/src/modules/cdp/diameter_msg.c @@ -459,7 +459,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen, int attach_buf) { unsigned char *ptr; - AAAMessage *msg; + AAAMessage *msg = 0; unsigned char version; unsigned int msg_len; AAA_AVP *avp; diff --git a/src/modules/cdp/receiver.c b/src/modules/cdp/receiver.c index 0ff2fe15a..2710387d2 100644 --- a/src/modules/cdp/receiver.c +++ b/src/modules/cdp/receiver.c @@ -157,10 +157,14 @@ static int make_send_pipe(serviced_peer_t *sp) */ static void close_send_pipe(serviced_peer_t *sp) { + int tmp; if (sp->send_pipe_name.s) { close(sp->send_pipe_fd); close(sp->send_pipe_fd_out); - remove(sp->send_pipe_name.s); + tmp = remove(sp->send_pipe_name.s); + if (tmp == -1) { + LM_ERR("could not remove send pipe\n"); + } shm_free(sp->send_pipe_name.s); sp->send_pipe_name.s=0; sp->send_pipe_name.len=0; @@ -269,6 +273,7 @@ static int send_fd(int pipe_fd,int fd, peer *p) struct iovec iov[1]; int ret; int *tmp = NULL; + memset(&msg, 0, sizeof(struct msghdr)); #ifdef HAVE_MSGHDR_MSG_CONTROL struct cmsghdr* cmsg; @@ -839,6 +844,7 @@ drop_peer: int peer_connect(peer *p) { int sock; + int tmp = 0; unsigned int option = 1; struct addrinfo *ainfo=0,*res=0,*sainfo=0,hints; @@ -930,10 +936,21 @@ int peer_connect(peer *p) } x=fcntl(sock,F_GETFL,0); - fcntl(sock,F_SETFL,x & (~O_NONBLOCK)); + if (x == -1) { + LM_ERR("error during first fcntl operation\n"); + goto error; + } + tmp = fcntl(sock,F_SETFL,x & (~O_NONBLOCK)); + if (tmp == -1) { + LM_ERR("error during second fcntl operation\n"); + goto error; + } + } + tmp = setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&option,sizeof(option)); + if (tmp == -1) { + LM_ERR("could not set socket options\n"); + goto error; } - setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&option,sizeof(option)); - LM_INFO("peer_connect(): Peer %.*s:%d connected\n",p->fqdn.len,p->fqdn.s,p->port); if (!send_fd(p->fd_exchange_pipe,sock,p)){ @@ -943,10 +960,12 @@ int peer_connect(peer *p) } if (res) freeaddrinfo(res); + if (sainfo) freeaddrinfo(sainfo); return sock; } error: if (res) freeaddrinfo(res); + if (sainfo) freeaddrinfo(sainfo); return -1; } diff --git a/src/modules/cfgt/README b/src/modules/cfgt/README index 8a098a69d..03c3bbd61 100644 --- a/src/modules/cfgt/README +++ b/src/modules/cfgt/README @@ -74,7 +74,7 @@ Chapter 1. Admin Guide 2.1. Kamailio Modules The following modules must be loaded before this module: - * None. + * pv. 2.2. External Libraries or Applications diff --git a/src/modules/cfgutils/cfgutils.c b/src/modules/cfgutils/cfgutils.c index c0872ec33..0dbfdb4b5 100644 --- a/src/modules/cfgutils/cfgutils.c +++ b/src/modules/cfgutils/cfgutils.c @@ -705,7 +705,8 @@ static int cfg_lock_helper(str *lkey, int mode) unsigned int pos; if(_cfg_lock_set==NULL) { - LM_ERR("lock set not initialized (attempt to do op: %d on: %.*s)\n", + LM_ERR("lock set not initialized (attempt to do op: %d on: %.*s) -" + " see param lock_set_size\n", mode, lkey->len, lkey->s); return -1; } @@ -900,6 +901,7 @@ static void mod_destroy(void) { lock_set_destroy(_cfg_lock_set); lock_set_dealloc(_cfg_lock_set); + _cfg_lock_set = NULL; } } diff --git a/src/modules/cnxcc/README b/src/modules/cnxcc/README index f2bd975e5..2fe7f9d21 100644 --- a/src/modules/cnxcc/README +++ b/src/modules/cnxcc/README @@ -26,11 +26,13 @@ Carlos Ruiz Díaz 4. Functions - 4.1. cnxcc_set_max_credit() - 4.2. cnxcc_set_max_time() - 4.3. cnxcc_update_max_time() - 4.4. cnxcc_set_max_channel() - 4.5. cnxcc_terminate_all() + 4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, + fpulse) + + 4.2. cnxcc_set_max_time(customer, maxtime) + 4.3. cnxcc_update_max_time(customer, maxtime) + 4.4. cnxcc_set_max_channel(customer, maxchan) + 4.5. cnxcc_terminate_all(customer) 5. RPC Commands @@ -45,8 +47,8 @@ Carlos Ruiz Díaz List of Examples - 1.1. - 1.2. credit_check_period + 1.1. redis parameter + 1.2. credit_check_period parameter 1.3. cnxcc_set_max_credit() 1.4. cnxcc_set_max_time() 1.5. cnxcc_update_max_time() @@ -71,11 +73,13 @@ Chapter 1. Admin Guide 4. Functions - 4.1. cnxcc_set_max_credit() - 4.2. cnxcc_set_max_time() - 4.3. cnxcc_update_max_time() - 4.4. cnxcc_set_max_channel() - 4.5. cnxcc_terminate_all() + 4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, + fpulse) + + 4.2. cnxcc_set_max_time(customer, maxtime) + 4.3. cnxcc_update_max_time(customer, maxtime) + 4.4. cnxcc_set_max_channel(customer, maxchan) + 4.5. cnxcc_terminate_all(customer) 5. RPC Commands @@ -142,7 +146,7 @@ Chapter 1. Admin Guide Redis datasource connection information - Example 1.1. + Example 1.1. redis parameter ... modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1") ... @@ -156,24 +160,34 @@ modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1") Values greater than 1 leads to precision lost but less CPU consumption. - Example 1.2. credit_check_period + Example 1.2. credit_check_period parameter ... modparam("cnxcc", "credit_check_period", 1) ... 4. Functions - 4.1. cnxcc_set_max_credit() - 4.2. cnxcc_set_max_time() - 4.3. cnxcc_update_max_time() - 4.4. cnxcc_set_max_channel() - 4.5. cnxcc_terminate_all() + 4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, fpulse) + 4.2. cnxcc_set_max_time(customer, maxtime) + 4.3. cnxcc_update_max_time(customer, maxtime) + 4.4. cnxcc_set_max_channel(customer, maxchan) + 4.5. cnxcc_terminate_all(customer) + +4.1. cnxcc_set_max_credit(customer, maxcredit, cps, ipulse, fpulse) + + Associates the call with a customer id and sets the max credit, cost + per second, initial pulse and final pulse. The discount is calculated + in pulses (30/6, 1/1, etc) and sustracted from the pool of credit. -4.1. cnxcc_set_max_credit() + The customer value can be provided as a string or a variable holding a + string. - Specifies the initial pulse, final pulse, max credit and cost per - second of a call. The discount is calculated in pulses (30/6, 1/1, etc) - and sustracted from the pool of credit. + The maxcredit and cps can be double (float) or integer values, they + have to be provided as static string values of variables holding string + values. + + The ipulse and fpulse values are integer values, they can be also given + via variables holding integers. Return code: * 1 - successful @@ -182,59 +196,75 @@ modparam("cnxcc", "credit_check_period", 1) Example 1.3. cnxcc_set_max_credit() ... -$var(customer) = "john-doe-123-premium"; -$var(credit) = "100"; -$var(cps) = "2.00"; # cost per second -$var(initial_p) = "030"; # intial pulse -$var(final_p) = "006"; # final pulse - -cnxcc_set_max_credit("$var(customer)", "$var(credit)", "$var(cps)", "$var(initia -l_p)", "$var(final_p)"); +cnxcc_set_max_credit("john-doe", "100.5", "0.5", "20", "10"); +... +$var(customer) = "john-doe-premium"; # customer id +$var(credit) = "100"; # max credit +$var(cps) = "2.00"; # cost per second +$var(initial_p) = 30; # intial pulse +$var(final_p) = 6; # final pulse +cnxcc_set_max_credit("$var(customer)", "$var(credit)", "$var(cps)", + "$var(initial_p)", "$var(final_p)"); ... -4.2. cnxcc_set_max_time() +4.2. cnxcc_set_max_time(customer, maxtime) Specifies the amount of time the call should last at most. + The customer value can be provided as a string or a variable holding a + string. + + The maxtime value is an integer values, it can be also given via a + variable holding an integer. + Return code: * 1 - successful * -1 - failed, error logged Example 1.4. cnxcc_set_max_time() ... -$var(customer) = "john-doe-123-basic"; +$var(customer) = "john-doe-basic"; $var(max_time) = 120; - cnxcc_set_max_time("$var(customer)", "$var(max_time)"); ... -4.3. cnxcc_update_max_time() +4.3. cnxcc_update_max_time(customer, maxtime) Updates max-time of an established and monitored call. This can be used to grant minimum values and to update them every short periods on time as a mean to prevent frauds and/or to mimic requested/granted units of time of Credit Control Application behavior. + The customer value can be provided as a string or a variable holding a + string. + + The maxtime value is an integer values, it can be also given via a + variable holding an integer. + Return code: * 1 - successful * -1 - failed, error logged Example 1.5. cnxcc_update_max_time() ... - $var(update_time) = 5; - $var(client) = "john-doe-123-basic"; +$var(client) = "john-doe-basic"; +$var(update_time) = 5; - if (!cnxcc_update_max_time("$var(client)", - "$var(update_time)")) { - xlog("Error updating max-time"); - return; +if (!cnxcc_update_max_time("$var(client)", "$var(update_time)")) { + xlog("Error updating max-time"); + return; } - ... -4.4. cnxcc_set_max_channel() +4.4. cnxcc_set_max_channel(customer, maxchan) - Specifies a limit for the number of simultaneous calls + Specifies a limit for the number of simultaneous calls. + + The customer value can be provided as a string or a variable holding a + string. + + The maxchan value is an integer values, it can be also given via a + variable holding an integer. Return code: * 1 - successful @@ -265,12 +295,14 @@ if ($var(retcode) < -1) { exit; } - ... -4.5. cnxcc_terminate_all() +4.5. cnxcc_terminate_all(customer) + + Terminates all calls of the specified customer/profile. - Terminates all calls of the specified customer/profile + The customer value can be provided as a string or a variable holding a + string. Return code: * 1 - successful @@ -299,7 +331,9 @@ if (!cnxcc_terminate_all("$var(customer)")) { Parameters: none Example: - kamcmd cnxcc.active_clients +... +kamcmd cnxcc.active_clients +... 5.2. cnxcc.check_client @@ -308,7 +342,9 @@ if (!cnxcc_terminate_all("$var(customer)")) { Parameters: client/customer identifier Example: - kamcmd cnxcc.check_client john-doe-123-premium +... +kamcmd cnxcc.check_client john-doe-premium +... 5.3. cnxcc.kill_call @@ -317,7 +353,9 @@ if (!cnxcc_terminate_all("$var(customer)")) { Parameters: Call-ID Example: - kamcmd cnxcc.kill_call qumojlaahitafih@carlosrdcnx-laptop.site +.... +kamcmd cnxcc.kill_call test@carlosrdcnx-laptop.site +... 5.4. cnxcc.stats @@ -326,7 +364,9 @@ if (!cnxcc_terminate_all("$var(customer)")) { Parameters: none Example: - kamcmd cnxcc.stats +... +kamcmd cnxcc.stats +... 6. Events @@ -360,25 +400,23 @@ event_route[cnxcc:call-shutdown] ... route[CNXCC] { - $var(client) = "test-client-0-123-01"; + $var(client) = "test-client"; $var(credit) = "50"; $var(cost_per_sec) = "0.5"; - $var(i_pulse) = "30"; - $var(f_pulse) = "6"; + $var(i_pulse) = 30; + $var(f_pulse) = 6; if (!cnxcc_set_max_credit("$var(client)", - "$var(credit)", - "$var(cost_per_sec)", - "$var(i_pulse)", - "$var(f_pulse)")) { - xlog("Error setting up credit control"); + "$var(credit)", + "$var(cost_per_sec)", + "$var(i_pulse)", + "$var(f_pulse)")) { + xlog("Error setting up credit control"); } } event_route[cnxcc:call-shutdown] { xlog("L_INFO", "[$ci]: call killed"); - - } ... diff --git a/src/modules/cnxcc/cnxcc_redis.c b/src/modules/cnxcc/cnxcc_redis.c index 4aad3b48a..2b9d803ad 100644 --- a/src/modules/cnxcc/cnxcc_redis.c +++ b/src/modules/cnxcc/cnxcc_redis.c @@ -233,7 +233,7 @@ static int __redis_select_db(redisContext *ctxt, int db) if(!rpl) LM_ERR("%s\n", ctxt->errstr); else { - LM_ERR("%.*s\n", rpl->len, rpl->str); + LM_ERR("%.*s\n", (int)rpl->len, rpl->str); freeReplyObject(rpl); } return -1; @@ -254,7 +254,7 @@ static int __redis_exec( if(!*rpl) LM_ERR("%s\n", _data.redis->ctxt->errstr); else { - LM_ERR("%.*s\n", (*rpl)->len, (*rpl)->str); + LM_ERR("%.*s\n", (int)(*rpl)->len, (*rpl)->str); freeReplyObject(*rpl); } @@ -384,7 +384,7 @@ int redis_get_str(credit_data_t *credit_data, const char *instruction, } if(rpl->len <= 0) { - LM_ERR("RPL len is equal to %d\n", rpl->len); + LM_ERR("RPL len is equal to %d\n", (int)rpl->len); goto done; } diff --git a/src/modules/cplc/cpl_run.c b/src/modules/cplc/cpl_run.c index dd82d9868..768f6b3d4 100644 --- a/src/modules/cplc/cpl_run.c +++ b/src/modules/cplc/cpl_run.c @@ -413,7 +413,7 @@ static inline char *run_remove_location( struct cpl_interpreter *intr ) unsigned short attr_name; unsigned short n; char *p; - str url; + str url = STR_NULL; int i; url.s = (char*)UNDEF_CHAR; diff --git a/src/modules/db_berkeley/db_berkeley.c b/src/modules/db_berkeley/db_berkeley.c index e5cf28496..443b482c2 100644 --- a/src/modules/db_berkeley/db_berkeley.c +++ b/src/modules/db_berkeley/db_berkeley.c @@ -874,7 +874,7 @@ int _bdb_delete_cursor( int ret, klen = MAX_ROW_SIZE; DBT key, data; DB *db; - DBC *dbcp; + DBC *dbcp = NULL; int *lkey = NULL; ret = 0; diff --git a/src/modules/db_perlvdb/README b/src/modules/db_perlvdb/README index 653e9d8da..f7025b15d 100644 --- a/src/modules/db_perlvdb/README +++ b/src/modules/db_perlvdb/README @@ -69,12 +69,12 @@ Chapter 1. Admin Guide database access. Relaying of insert, update, query and delete operations is supported. - Modules can be configured to use the perlvdb module as database backend - using the db_url_parameter: + Modules can be configured to use the db_perlvdb module as database + backend using the db_url_parameter: modparam("acc", "db_url", "perlvdb:Kamailio::VDB::Adapter::AccountingSIPtrace") This configuration options tells acc module that it should use the - perlvdb module which will in turn use the Perl class + db_perlvdb module which will in turn use the Perl class Kamailio::VDB::Adapter::AccountingSIPtrace to relay the database requests. @@ -86,13 +86,14 @@ modparam("acc", "db_url", "perlvdb:Kamailio::VDB::Adapter::AccountingSIPtrace") 2.1. Kamailio Modules The following modules must be loaded before this module: - * perl -- Perl module + * app_perl -- Perl Application module 2.2. External Libraries or Applications The following libraries or applications must be installed before running Kamailio with this module loaded: - * None (Besides the ones mentioned in the perl module documentation). + * None (Besides the ones mentioned in the app_perl module + documentation). 3. Parameters @@ -136,7 +137,7 @@ Chapter 2. Developer Guide 2. Base class Kamailio::VDB - A client module has to be configured to use the perlvdb module in + A client module has to be configured to use the db_perlvdb module in conjunction with a Perl class to provide the functions. The configured class needs to inherit from the base class Kamailio::VDB. diff --git a/src/modules/db_postgres/README b/src/modules/db_postgres/README index 7640f36c1..b2d11e8b8 100644 --- a/src/modules/db_postgres/README +++ b/src/modules/db_postgres/README @@ -27,6 +27,7 @@ Greg Fausak 3.2. timeout (integer) 3.3. tcp_keepalive (integer) 3.4. lockset (integer) + 3.5. bytea_output_escape (integer) 4. Functions @@ -36,6 +37,7 @@ Greg Fausak 1.2. Set timeout parameter 1.3. Set tcp_keepalive parameter 1.4. Set lockset parameter + 1.5. Set bytea_output_escape parameter Chapter 1. Admin Guide @@ -53,6 +55,7 @@ Chapter 1. Admin Guide 3.2. timeout (integer) 3.3. tcp_keepalive (integer) 3.4. lockset (integer) + 3.5. bytea_output_escape (integer) 4. Functions @@ -85,6 +88,7 @@ Chapter 1. Admin Guide 3.2. timeout (integer) 3.3. tcp_keepalive (integer) 3.4. lockset (integer) + 3.5. bytea_output_escape (integer) 3.1. retries (integer) @@ -143,6 +147,18 @@ modparam("db_postgres", "tcp_keepalive", 600) modparam("db_postgres", "lockset", 6) ... +3.5. bytea_output_escape (integer) + + Control if the module should request escaping the output for bytea + fields. + + Default value is 1 (do the escape). + + Example 1.5. Set bytea_output_escape parameter +... +modparam("db_postgres", "bytea_output_escape", 0) +... + 4. Functions NONE diff --git a/src/modules/db_postgres/doc/db_postgres_admin.xml b/src/modules/db_postgres/doc/db_postgres_admin.xml index e21829473..bc4d326dc 100644 --- a/src/modules/db_postgres/doc/db_postgres_admin.xml +++ b/src/modules/db_postgres/doc/db_postgres_admin.xml @@ -151,6 +151,25 @@ modparam("db_postgres", "lockset", 6) +
+ <varname>bytea_output_escape</varname> (integer) + + Control if the module should request escaping the output for + bytea fields. + + + Default value is 1 (do the escape). + + + Set <varname>bytea_output_escape</varname> parameter + +... +modparam("db_postgres", "bytea_output_escape", 0) +... + + +
+
diff --git a/src/modules/db_postgres/km_pg_con.c b/src/modules/db_postgres/km_pg_con.c index 5a7225cef..f6a2b8c8e 100644 --- a/src/modules/db_postgres/km_pg_con.c +++ b/src/modules/db_postgres/km_pg_con.c @@ -37,6 +37,8 @@ #include +extern int pg_bytea_output_escape; + /*! * \brief Create a new connection * @@ -52,6 +54,7 @@ struct pg_con *db_postgres_new_connection(struct db_id *id) int i = 0; const char *keywords[10], *values[10]; char to[16]; + PGresult *res = NULL; LM_DBG("db_id = %p\n", id); @@ -141,6 +144,16 @@ struct pg_con *db_postgres_new_connection(struct db_id *id) } #endif + if(pg_bytea_output_escape!=0) { + res = PQexec(ptr->con, "SET bytea_output=escape"); + if (PQresultStatus(res) != PGRES_COMMAND_OK) + { + LM_ERR("cannot set blob output escaping format\n"); + PQclear(res); + goto err; + } + PQclear(res); + } return ptr; err: diff --git a/src/modules/db_postgres/pg_mod.c b/src/modules/db_postgres/pg_mod.c index be70e911e..4d5849a29 100644 --- a/src/modules/db_postgres/pg_mod.c +++ b/src/modules/db_postgres/pg_mod.c @@ -58,6 +58,7 @@ int pg_retries = int pg_lockset = 4; int pg_timeout = 0; /* default = no timeout */ int pg_keepalive = 0; +int pg_bytea_output_escape = 1; /* * Postgres module interface @@ -91,6 +92,7 @@ static param_export_t params[] = { {"lockset", PARAM_INT, &pg_lockset}, {"timeout", PARAM_INT, &pg_timeout}, {"tcp_keepalive", PARAM_INT, &pg_keepalive}, + {"bytea_output_escape", PARAM_INT, &pg_bytea_output_escape}, {0, 0, 0} }; diff --git a/src/modules/db_unixodbc/README b/src/modules/db_unixodbc/README index eae1e116f..1f3faf2e0 100644 --- a/src/modules/db_unixodbc/README +++ b/src/modules/db_unixodbc/README @@ -186,7 +186,7 @@ modparam("db_unixodbc", "quote_char", "`") 5.2. Configuring and Running - In the openser.conf file, add the line: + In the Kamailio.cfg file, add the line: .... loadmodule "/usr/local/lib/kamailio/modules/db_unixodbc.so" .... @@ -204,7 +204,7 @@ modparam("auth_db", "password_column", "password") url adding this line: .... modparam("usrloc|auth_db", "db_url", - "unixodbc://openser:openserrw@localhost/my_dsn") + "unixodbc://kamailio:kamailiorw@localhost/my_dsn") .... replacing my_dsn with the correct value. diff --git a/src/modules/dialog/README b/src/modules/dialog/README index 0b4e3c1ac..dd788194f 100644 --- a/src/modules/dialog/README +++ b/src/modules/dialog/README @@ -56,56 +56,57 @@ Olle E. Johansson 6.6. default_timeout (integer) 6.7. early_timeout (integer) 6.8. noack_timeout (integer) - 6.9. dlg_extra_hdrs (string) - 6.10. dlg_match_mode (integer) - 6.11. detect_spirals (integer) - 6.12. db_url (string) - 6.13. db_mode (integer) - 6.14. db_update_period (integer) - 6.15. db_fetch_rows (integer) - 6.16. db_skip_load (integer) - 6.17. table_name (string) - 6.18. call_id_column (string) - 6.19. from_uri_column (string) - 6.20. from_tag_column (string) - 6.21. to_uri_column (string) - 6.22. to_tag_column (string) - 6.23. from_cseq_column (string) - 6.24. to_cseq_column (string) - 6.25. from_route_column (string) - 6.26. to_route_column (string) - 6.27. from_contact_column (string) - 6.28. to_contact_column (string) - 6.29. from_sock_column (string) - 6.30. to_sock_column (string) - 6.31. h_id_column (string) - 6.32. h_entry_column (string) - 6.33. state_column (string) - 6.34. start_time_column (string) - 6.35. timeout_column (string) - 6.36. sflags_column (string) - 6.37. toroute_name_column (string) - 6.38. vars_table_name (string) - 6.39. vars_h_id_column (string) - 6.40. vars_h_entry_column (string) - 6.41. vars_key_column (string) - 6.42. vars_value_column (string) - 6.43. profiles_with_value (string) - 6.44. profiles_no_value (string) - 6.45. bridge_controller (string) - 6.46. bridge_contact (string) - 6.47. initial_cbs_inscript (int) - 6.48. send_bye (int) - 6.49. wait_ack (int) - 6.50. ka_timer (int) - 6.51. ka_interval (int) - 6.52. ka_failed_limit (int) - 6.53. timeout_noreset (int) - 6.54. timer_procs (int) - 6.55. enable_dmq (int) - 6.56. track_cseq_updates (int) - 6.57. lreq_callee_headers (string) - 6.58. event_callback (str) + 6.9. end_timeout (integer) + 6.10. dlg_extra_hdrs (string) + 6.11. dlg_match_mode (integer) + 6.12. detect_spirals (integer) + 6.13. db_url (string) + 6.14. db_mode (integer) + 6.15. db_update_period (integer) + 6.16. db_fetch_rows (integer) + 6.17. db_skip_load (integer) + 6.18. table_name (string) + 6.19. call_id_column (string) + 6.20. from_uri_column (string) + 6.21. from_tag_column (string) + 6.22. to_uri_column (string) + 6.23. to_tag_column (string) + 6.24. from_cseq_column (string) + 6.25. to_cseq_column (string) + 6.26. from_route_column (string) + 6.27. to_route_column (string) + 6.28. from_contact_column (string) + 6.29. to_contact_column (string) + 6.30. from_sock_column (string) + 6.31. to_sock_column (string) + 6.32. h_id_column (string) + 6.33. h_entry_column (string) + 6.34. state_column (string) + 6.35. start_time_column (string) + 6.36. timeout_column (string) + 6.37. sflags_column (string) + 6.38. toroute_name_column (string) + 6.39. vars_table_name (string) + 6.40. vars_h_id_column (string) + 6.41. vars_h_entry_column (string) + 6.42. vars_key_column (string) + 6.43. vars_value_column (string) + 6.44. profiles_with_value (string) + 6.45. profiles_no_value (string) + 6.46. bridge_controller (string) + 6.47. bridge_contact (string) + 6.48. initial_cbs_inscript (int) + 6.49. send_bye (int) + 6.50. wait_ack (int) + 6.51. ka_timer (int) + 6.52. ka_interval (int) + 6.53. ka_failed_limit (int) + 6.54. timeout_noreset (int) + 6.55. timer_procs (int) + 6.56. enable_dmq (int) + 6.57. track_cseq_updates (int) + 6.58. lreq_callee_headers (string) + 6.59. event_callback (str) 7. Functions @@ -183,74 +184,75 @@ Olle E. Johansson 1.6. Set default_timeout parameter 1.7. Set early_timeout parameter 1.8. Set noack_timeout parameter - 1.9. Set dlf_extra_hdrs parameter - 1.10. Set dlg_match_mode parameter - 1.11. Set detect_spirals parameter - 1.12. Set db_url parameter - 1.13. Set db_mode parameter - 1.14. Set db_update_period parameter - 1.15. Set db_fetch_rows parameter - 1.16. Set db_skip_load parameter - 1.17. Set table_name parameter - 1.18. Set call_id_column parameter - 1.19. Set from_uri_column parameter - 1.20. Set from_tag_column parameter - 1.21. Set to_uri_column parameter - 1.22. Set to_tag_column parameter - 1.23. Set from_cseq_column parameter - 1.24. Set to_cseq_column parameter - 1.25. Set from_route_column parameter - 1.26. Set to_route_column parameter - 1.27. Set from_contact_column parameter - 1.28. Set to_contact_column parameter - 1.29. Set from_sock_column parameter - 1.30. Set to_sock_column parameter - 1.31. Set h_id_column parameter - 1.32. Set h_entry_column parameter - 1.33. Set state_column parameter - 1.34. Set start_time_column parameter - 1.35. Set timeout_column parameter - 1.36. Set sflags_column parameter - 1.37. Set toroute_name_column parameter - 1.38. Set vars_table_name parameter - 1.39. Set vars_h_id_column parameter - 1.40. Set vars_h_entry_column parameter - 1.41. Set vars_key_column parameter - 1.42. Set vars_value_column parameter - 1.43. Set profiles_with_value parameter - 1.44. Set profiles_no_value parameter - 1.45. Set bridge_controller parameter - 1.46. Set bridge_contact parameter - 1.47. Set initial_cbs_inscript parameter - 1.48. Set send_bye parameter - 1.49. Set wait_ack parameter - 1.50. Set ka_timer parameter - 1.51. Set ka_interval parameter - 1.52. Set ka_failed_limit parameter - 1.53. Set timeout_noreset parameter - 1.54. Set timer_procs parameter - 1.55. Set enable_dmq parameter - 1.56. Set track_cseq_updates parameter - 1.57. Set lreq_callee_headers parameter - 1.58. Set event_callback parameter - 1.59. set_dlg_profile usage - 1.60. unset_dlg_profile usage - 1.61. is_in_profile usage - 1.62. get_profile_size usage - 1.63. dlg_isflagset usage - 1.64. dlg_setflag usage - 1.65. dlg_resetflag usage - 1.66. dlg_bye usage - 1.67. dlg_refer usage - 1.68. dlg_manage usage - 1.69. dlg_bridge usage - 1.70. dlg_get usage - 1.71. is_known_dlg() usage - 1.72. dlg_set_timeout usage - 1.73. dlg_set_timeout_by_profile usage - 1.74. dlg_set_property usage - 1.75. dlg_remote_profile usage - 1.76. dlg_set_ruri() usage + 1.9. Set end_timeout parameter + 1.10. Set dlf_extra_hdrs parameter + 1.11. Set dlg_match_mode parameter + 1.12. Set detect_spirals parameter + 1.13. Set db_url parameter + 1.14. Set db_mode parameter + 1.15. Set db_update_period parameter + 1.16. Set db_fetch_rows parameter + 1.17. Set db_skip_load parameter + 1.18. Set table_name parameter + 1.19. Set call_id_column parameter + 1.20. Set from_uri_column parameter + 1.21. Set from_tag_column parameter + 1.22. Set to_uri_column parameter + 1.23. Set to_tag_column parameter + 1.24. Set from_cseq_column parameter + 1.25. Set to_cseq_column parameter + 1.26. Set from_route_column parameter + 1.27. Set to_route_column parameter + 1.28. Set from_contact_column parameter + 1.29. Set to_contact_column parameter + 1.30. Set from_sock_column parameter + 1.31. Set to_sock_column parameter + 1.32. Set h_id_column parameter + 1.33. Set h_entry_column parameter + 1.34. Set state_column parameter + 1.35. Set start_time_column parameter + 1.36. Set timeout_column parameter + 1.37. Set sflags_column parameter + 1.38. Set toroute_name_column parameter + 1.39. Set vars_table_name parameter + 1.40. Set vars_h_id_column parameter + 1.41. Set vars_h_entry_column parameter + 1.42. Set vars_key_column parameter + 1.43. Set vars_value_column parameter + 1.44. Set profiles_with_value parameter + 1.45. Set profiles_no_value parameter + 1.46. Set bridge_controller parameter + 1.47. Set bridge_contact parameter + 1.48. Set initial_cbs_inscript parameter + 1.49. Set send_bye parameter + 1.50. Set wait_ack parameter + 1.51. Set ka_timer parameter + 1.52. Set ka_interval parameter + 1.53. Set ka_failed_limit parameter + 1.54. Set timeout_noreset parameter + 1.55. Set timer_procs parameter + 1.56. Set enable_dmq parameter + 1.57. Set track_cseq_updates parameter + 1.58. Set lreq_callee_headers parameter + 1.59. Set event_callback parameter + 1.60. set_dlg_profile usage + 1.61. unset_dlg_profile usage + 1.62. is_in_profile usage + 1.63. get_profile_size usage + 1.64. dlg_isflagset usage + 1.65. dlg_setflag usage + 1.66. dlg_resetflag usage + 1.67. dlg_bye usage + 1.68. dlg_refer usage + 1.69. dlg_manage usage + 1.70. dlg_bridge usage + 1.71. dlg_get usage + 1.72. is_known_dlg() usage + 1.73. dlg_set_timeout usage + 1.74. dlg_set_timeout_by_profile usage + 1.75. dlg_set_property usage + 1.76. dlg_remote_profile usage + 1.77. dlg_set_ruri() usage Chapter 1. Admin Guide @@ -275,56 +277,57 @@ Chapter 1. Admin Guide 6.6. default_timeout (integer) 6.7. early_timeout (integer) 6.8. noack_timeout (integer) - 6.9. dlg_extra_hdrs (string) - 6.10. dlg_match_mode (integer) - 6.11. detect_spirals (integer) - 6.12. db_url (string) - 6.13. db_mode (integer) - 6.14. db_update_period (integer) - 6.15. db_fetch_rows (integer) - 6.16. db_skip_load (integer) - 6.17. table_name (string) - 6.18. call_id_column (string) - 6.19. from_uri_column (string) - 6.20. from_tag_column (string) - 6.21. to_uri_column (string) - 6.22. to_tag_column (string) - 6.23. from_cseq_column (string) - 6.24. to_cseq_column (string) - 6.25. from_route_column (string) - 6.26. to_route_column (string) - 6.27. from_contact_column (string) - 6.28. to_contact_column (string) - 6.29. from_sock_column (string) - 6.30. to_sock_column (string) - 6.31. h_id_column (string) - 6.32. h_entry_column (string) - 6.33. state_column (string) - 6.34. start_time_column (string) - 6.35. timeout_column (string) - 6.36. sflags_column (string) - 6.37. toroute_name_column (string) - 6.38. vars_table_name (string) - 6.39. vars_h_id_column (string) - 6.40. vars_h_entry_column (string) - 6.41. vars_key_column (string) - 6.42. vars_value_column (string) - 6.43. profiles_with_value (string) - 6.44. profiles_no_value (string) - 6.45. bridge_controller (string) - 6.46. bridge_contact (string) - 6.47. initial_cbs_inscript (int) - 6.48. send_bye (int) - 6.49. wait_ack (int) - 6.50. ka_timer (int) - 6.51. ka_interval (int) - 6.52. ka_failed_limit (int) - 6.53. timeout_noreset (int) - 6.54. timer_procs (int) - 6.55. enable_dmq (int) - 6.56. track_cseq_updates (int) - 6.57. lreq_callee_headers (string) - 6.58. event_callback (str) + 6.9. end_timeout (integer) + 6.10. dlg_extra_hdrs (string) + 6.11. dlg_match_mode (integer) + 6.12. detect_spirals (integer) + 6.13. db_url (string) + 6.14. db_mode (integer) + 6.15. db_update_period (integer) + 6.16. db_fetch_rows (integer) + 6.17. db_skip_load (integer) + 6.18. table_name (string) + 6.19. call_id_column (string) + 6.20. from_uri_column (string) + 6.21. from_tag_column (string) + 6.22. to_uri_column (string) + 6.23. to_tag_column (string) + 6.24. from_cseq_column (string) + 6.25. to_cseq_column (string) + 6.26. from_route_column (string) + 6.27. to_route_column (string) + 6.28. from_contact_column (string) + 6.29. to_contact_column (string) + 6.30. from_sock_column (string) + 6.31. to_sock_column (string) + 6.32. h_id_column (string) + 6.33. h_entry_column (string) + 6.34. state_column (string) + 6.35. start_time_column (string) + 6.36. timeout_column (string) + 6.37. sflags_column (string) + 6.38. toroute_name_column (string) + 6.39. vars_table_name (string) + 6.40. vars_h_id_column (string) + 6.41. vars_h_entry_column (string) + 6.42. vars_key_column (string) + 6.43. vars_value_column (string) + 6.44. profiles_with_value (string) + 6.45. profiles_no_value (string) + 6.46. bridge_controller (string) + 6.47. bridge_contact (string) + 6.48. initial_cbs_inscript (int) + 6.49. send_bye (int) + 6.50. wait_ack (int) + 6.51. ka_timer (int) + 6.52. ka_interval (int) + 6.53. ka_failed_limit (int) + 6.54. timeout_noreset (int) + 6.55. timer_procs (int) + 6.56. enable_dmq (int) + 6.57. track_cseq_updates (int) + 6.58. lreq_callee_headers (string) + 6.59. event_callback (str) 7. Functions @@ -409,9 +412,10 @@ Chapter 1. Admin Guide 2. How it works - To create the dialog associated with an initial request, the flag - “dlg_flag” (Section 6.4, “dlg_flag (integer)”) must be set before - creating the corresponding transaction. + To create the dialog associated with an initial INVITE request, execute + the function “dlg_manage()” or set the flag specified by parameter + “dlg_flag” (Section 6.4, “dlg_flag (integer)”) before creating the + corresponding transaction. The dialog is automatically destroyed when a “BYE” is received. In case of no “BYE”, the dialog lifetime is controlled via the default timeout @@ -491,56 +495,57 @@ Chapter 1. Admin Guide 6.6. default_timeout (integer) 6.7. early_timeout (integer) 6.8. noack_timeout (integer) - 6.9. dlg_extra_hdrs (string) - 6.10. dlg_match_mode (integer) - 6.11. detect_spirals (integer) - 6.12. db_url (string) - 6.13. db_mode (integer) - 6.14. db_update_period (integer) - 6.15. db_fetch_rows (integer) - 6.16. db_skip_load (integer) - 6.17. table_name (string) - 6.18. call_id_column (string) - 6.19. from_uri_column (string) - 6.20. from_tag_column (string) - 6.21. to_uri_column (string) - 6.22. to_tag_column (string) - 6.23. from_cseq_column (string) - 6.24. to_cseq_column (string) - 6.25. from_route_column (string) - 6.26. to_route_column (string) - 6.27. from_contact_column (string) - 6.28. to_contact_column (string) - 6.29. from_sock_column (string) - 6.30. to_sock_column (string) - 6.31. h_id_column (string) - 6.32. h_entry_column (string) - 6.33. state_column (string) - 6.34. start_time_column (string) - 6.35. timeout_column (string) - 6.36. sflags_column (string) - 6.37. toroute_name_column (string) - 6.38. vars_table_name (string) - 6.39. vars_h_id_column (string) - 6.40. vars_h_entry_column (string) - 6.41. vars_key_column (string) - 6.42. vars_value_column (string) - 6.43. profiles_with_value (string) - 6.44. profiles_no_value (string) - 6.45. bridge_controller (string) - 6.46. bridge_contact (string) - 6.47. initial_cbs_inscript (int) - 6.48. send_bye (int) - 6.49. wait_ack (int) - 6.50. ka_timer (int) - 6.51. ka_interval (int) - 6.52. ka_failed_limit (int) - 6.53. timeout_noreset (int) - 6.54. timer_procs (int) - 6.55. enable_dmq (int) - 6.56. track_cseq_updates (int) - 6.57. lreq_callee_headers (string) - 6.58. event_callback (str) + 6.9. end_timeout (integer) + 6.10. dlg_extra_hdrs (string) + 6.11. dlg_match_mode (integer) + 6.12. detect_spirals (integer) + 6.13. db_url (string) + 6.14. db_mode (integer) + 6.15. db_update_period (integer) + 6.16. db_fetch_rows (integer) + 6.17. db_skip_load (integer) + 6.18. table_name (string) + 6.19. call_id_column (string) + 6.20. from_uri_column (string) + 6.21. from_tag_column (string) + 6.22. to_uri_column (string) + 6.23. to_tag_column (string) + 6.24. from_cseq_column (string) + 6.25. to_cseq_column (string) + 6.26. from_route_column (string) + 6.27. to_route_column (string) + 6.28. from_contact_column (string) + 6.29. to_contact_column (string) + 6.30. from_sock_column (string) + 6.31. to_sock_column (string) + 6.32. h_id_column (string) + 6.33. h_entry_column (string) + 6.34. state_column (string) + 6.35. start_time_column (string) + 6.36. timeout_column (string) + 6.37. sflags_column (string) + 6.38. toroute_name_column (string) + 6.39. vars_table_name (string) + 6.40. vars_h_id_column (string) + 6.41. vars_h_entry_column (string) + 6.42. vars_key_column (string) + 6.43. vars_value_column (string) + 6.44. profiles_with_value (string) + 6.45. profiles_no_value (string) + 6.46. bridge_controller (string) + 6.47. bridge_contact (string) + 6.48. initial_cbs_inscript (int) + 6.49. send_bye (int) + 6.50. wait_ack (int) + 6.51. ka_timer (int) + 6.52. ka_interval (int) + 6.53. ka_failed_limit (int) + 6.54. timeout_noreset (int) + 6.55. timer_procs (int) + 6.56. enable_dmq (int) + 6.57. track_cseq_updates (int) + 6.58. lreq_callee_headers (string) + 6.59. event_callback (str) 6.1. enable_stats (integer) @@ -591,6 +596,10 @@ modparam("dialog", "rr_param", "xyz") Flag to be used for marking if a dialog should be constructed for the current request (this make sense only for initial requests). + Note: it is not needed to set this parameter and its corresponding flag + for initial request in case the “dlg_manage()” function is used. In + other words, using “dlg_manage()” alone is enough. + Default value is “none”. Example 1.4. Set dlg_flag parameter @@ -648,19 +657,31 @@ modparam("dialog", "early_timeout", 180) modparam("dialog", "noack_timeout", 90) ... -6.9. dlg_extra_hdrs (string) +6.9. end_timeout (integer) + + The timeout (in seconds) after which the dialogs in terminated state + are destroyed. + + Default value is “300 (5 minutes)”. + + Example 1.9. Set end_timeout parameter +... +modparam("dialog", "end_timeout", 180) +... + +6.10. dlg_extra_hdrs (string) A string containing the extra headers (full format, with EOH) to be added to requests generated locally by the module (like BYEs). Default value is “NULL”. - Example 1.9. Set dlf_extra_hdrs parameter + Example 1.10. Set dlf_extra_hdrs parameter ... modparam("dialog", "dlg_extra_hdrs", "Hint: credit expired\r\n") ... -6.10. dlg_match_mode (integer) +6.11. dlg_match_mode (integer) How the sequential requests should be matched against the known dialogs. The modes are a combination of matching based on a cookie @@ -686,12 +707,12 @@ modparam("dialog", "dlg_extra_hdrs", "Hint: credit expired\r\n") Default value is “0 (DID_ONLY)”. - Example 1.10. Set dlg_match_mode parameter + Example 1.11. Set dlg_match_mode parameter ... modparam("dialog", "dlg_match_mode", 1) ... -6.11. detect_spirals (integer) +6.12. detect_spirals (integer) Whether spirals (i.e., messages routed through the proxy multiple times) should be detected. @@ -703,24 +724,24 @@ modparam("dialog", "dlg_match_mode", 1) Default value is 1. - Example 1.11. Set detect_spirals parameter + Example 1.12. Set detect_spirals parameter ... modparam("dialog", "detect_spirals", 1) ... -6.12. db_url (string) +6.13. db_url (string) In order to store information about dialogs in a database, a database URL must be specified. Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”. - Example 1.12. Set db_url parameter + Example 1.13. Set db_url parameter ... modparam("dialog", "db_url", "dbdriver://username:password@dbhost/dbname") ... -6.13. db_mode (integer) +6.14. db_mode (integer) Mode of synchronisation of dialog information from memory to an underlying database (if desired): @@ -736,12 +757,12 @@ modparam("dialog", "db_url", "dbdriver://username:password@dbhost/dbname") Default value is “0”. - Example 1.13. Set db_mode parameter + Example 1.14. Set db_mode parameter ... modparam("dialog", "db_mode", 1) ... -6.14. db_update_period (integer) +6.15. db_update_period (integer) The interval (seconds) at which to update dialogs' information, if the server is configured to store the dialog information at a given @@ -751,12 +772,12 @@ modparam("dialog", "db_mode", 1) Default value is “60” seconds. - Example 1.14. Set db_update_period parameter + Example 1.15. Set db_update_period parameter ... modparam("dialog", "db_update_period", 120) ... -6.15. db_fetch_rows (integer) +6.16. db_fetch_rows (integer) The number of the rows to be fetched at once from database when loading the dialog records at startup from the database. This value can be used @@ -767,373 +788,373 @@ modparam("dialog", "db_update_period", 120) Default value is “200”. - Example 1.15. Set db_fetch_rows parameter + Example 1.16. Set db_fetch_rows parameter ... modparam("dialog", "db_fetch_rows", 500) ... -6.16. db_skip_load (integer) +6.17. db_skip_load (integer) Set db_skip_load to 1, to skip the loading of dialog data from the database. Default value is “0” ( not skipped ). - Example 1.16. Set db_skip_load parameter + Example 1.17. Set db_skip_load parameter ... modparam("dialog", "db_skip_load", 1) ... -6.17. table_name (string) +6.18. table_name (string) Database table name used for storing dialog information. Default value is “dialog”. - Example 1.17. Set table_name parameter + Example 1.18. Set table_name parameter ... modparam("dialog", "table_name", "my_dialog") ... -6.18. call_id_column (string) +6.19. call_id_column (string) The column name in the database to store the dialog call-id. Default value is “callid”. - Example 1.18. Set call_id_column parameter + Example 1.19. Set call_id_column parameter ... modparam("dialog", "call_id_column", "callid_c_name") ... -6.19. from_uri_column (string) +6.20. from_uri_column (string) The column name in the database to store the caller's SIP address (URI). Default value is “from_uri”. - Example 1.19. Set from_uri_column parameter + Example 1.20. Set from_uri_column parameter ... modparam("dialog", "from_uri_column", "from_uri_c_name") ... -6.20. from_tag_column (string) +6.21. from_tag_column (string) The column name in the database to store the From header tag from the INVITE request. Default value is “from_tag”. - Example 1.20. Set from_tag_column parameter + Example 1.21. Set from_tag_column parameter ... modparam("dialog", "from_tag_column", "from_tag_c_name") ... -6.21. to_uri_column (string) +6.22. to_uri_column (string) The column name in the database to store the callee's SIP address (URI). Default value is “to_uri”. - Example 1.21. Set to_uri_column parameter + Example 1.22. Set to_uri_column parameter ... modparam("dialog", "to_uri_column", "to_uri_c_name") ... -6.22. to_tag_column (string) +6.23. to_tag_column (string) The column name in the database to store the To header tag from the 200 OK response to the INVITE request, if present. Default value is “to_tag”. - Example 1.22. Set to_tag_column parameter + Example 1.23. Set to_tag_column parameter ... modparam("dialog", "to_tag_column", "to_tag_c_name") ... -6.23. from_cseq_column (string) +6.24. from_cseq_column (string) The column name in the database to store the Cseq from caller side. Default value is “caller_cseq”. - Example 1.23. Set from_cseq_column parameter + Example 1.24. Set from_cseq_column parameter ... modparam("dialog", "from_cseq_column", "from_cseq") ... -6.24. to_cseq_column (string) +6.25. to_cseq_column (string) The column name in the database to store the cseq from callee side. Default value is “callee_cseq”. - Example 1.24. Set to_cseq_column parameter + Example 1.25. Set to_cseq_column parameter ... modparam("dialog", "to_cseq_column", "to_cseq") ... -6.25. from_route_column (string) +6.26. from_route_column (string) The column name in the database to store the route records from caller side (proxy to caller). Default value is “caller_route_set”. - Example 1.25. Set from_route_column parameter + Example 1.26. Set from_route_column parameter ... modparam("dialog", "from_route_column", "rroute_from") ... -6.26. to_route_column (string) +6.27. to_route_column (string) The column name in the database to store the route records from callee side (proxy to callee). Default value is “callee_route_set”. - Example 1.26. Set to_route_column parameter + Example 1.27. Set to_route_column parameter ... modparam("dialog", "to_route_column", "rroute_to") ... -6.27. from_contact_column (string) +6.28. from_contact_column (string) The column name in the database to store the caller's contact uri. Default value is “caller_contact”. - Example 1.27. Set from_contact_column parameter + Example 1.28. Set from_contact_column parameter ... modparam("dialog", "from_contact_column", "from_contact_uri") ... -6.28. to_contact_column (string) +6.29. to_contact_column (string) The column name in the database to store the callee's contact uri. Default value is “callee_contact”. - Example 1.28. Set to_contact_column parameter + Example 1.29. Set to_contact_column parameter ... modparam("dialog", "to_contact_column", "to_contact_uri") ... -6.29. from_sock_column (string) +6.30. from_sock_column (string) The column name in the database to store the information about the local interface receiving the traffic from caller. Default value is “caller_sock”. - Example 1.29. Set from_sock_column parameter + Example 1.30. Set from_sock_column parameter ... modparam("dialog", "from_sock_column", "socket_from") ... -6.30. to_sock_column (string) +6.31. to_sock_column (string) The column name in the database to store information about the local interface receiving the traffic from callee. Default value is “callee_sock”. - Example 1.30. Set to_sock_column parameter + Example 1.31. Set to_sock_column parameter ... modparam("dialog", "to_sock_column", "socket_to") ... -6.31. h_id_column (string) +6.32. h_id_column (string) The column name in the database to store the dialogs' hash id information. Default value is “hash_id”. - Example 1.31. Set h_id_column parameter + Example 1.32. Set h_id_column parameter ... modparam("dialog", "h_id_column", "hash_id_c_name") ... -6.32. h_entry_column (string) +6.33. h_entry_column (string) The column name in the database to store the dialog's hash entry information. Default value is “hash_entry”. - Example 1.32. Set h_entry_column parameter + Example 1.33. Set h_entry_column parameter ... modparam("dialog", "h_entry_column", "h_entry_c_name") ... -6.33. state_column (string) +6.34. state_column (string) The column name in the database to store the dialog's state information. Default value is “state”. - Example 1.33. Set state_column parameter + Example 1.34. Set state_column parameter ... modparam("dialog", "state_column", "state_c_name") ... -6.34. start_time_column (string) +6.35. start_time_column (string) The column name in the database to store the dialog's start time information. Default value is “start_time”. - Example 1.34. Set start_time_column parameter + Example 1.35. Set start_time_column parameter ... modparam("dialog", "start_time_column", "start_time_c_name") ... -6.35. timeout_column (string) +6.36. timeout_column (string) The column name in the database to store the dialog's timeout. Default value is “timeout”. - Example 1.35. Set timeout_column parameter + Example 1.36. Set timeout_column parameter ... modparam("dialog", "timeout_column", "timeout_c_name") ... -6.36. sflags_column (string) +6.37. sflags_column (string) The column name in the database to store the dialog script flags. Default value is “sflags”. - Example 1.36. Set sflags_column parameter + Example 1.37. Set sflags_column parameter ... modparam("dialog", "sflags_column", "s_flags") ... -6.37. toroute_name_column (string) +6.38. toroute_name_column (string) The column name in the database to store the index of the route to be executed at timeout. Default value is “toroute_name”. - Example 1.37. Set toroute_name_column parameter + Example 1.38. Set toroute_name_column parameter ... modparam("dialog", "toroute_name_column", "timeout_route") ... -6.38. vars_table_name (string) +6.39. vars_table_name (string) If you want to store the dialog variables (“$dlg_var(name)”) for a dialog in a database a table name must be specified. Default value is “dialog_vars”. - Example 1.38. Set vars_table_name parameter + Example 1.39. Set vars_table_name parameter ... modparam("dialog", "vars_table_name", "my_dialog_vars") ... -6.39. vars_h_id_column (string) +6.40. vars_h_id_column (string) The column name in the database to store the dialog's hash id information (as a reference to the dialog table). Default value is “hash_id”. - Example 1.39. Set vars_h_id_column parameter + Example 1.40. Set vars_h_id_column parameter ... modparam("dialog", "vars_h_id_column", "vars_h_id_name") ... -6.40. vars_h_entry_column (string) +6.41. vars_h_entry_column (string) The column name in the database to store the dialog's hash entry information (as a reference to the dialog table). Default value is “hash_entry”. - Example 1.40. Set vars_h_entry_column parameter + Example 1.41. Set vars_h_entry_column parameter ... modparam("dialog", "vars_h_entry_column", "vars_h_entry_name") ... -6.41. vars_key_column (string) +6.42. vars_key_column (string) The column name in the database to store the names (keys) of a dialog variable. Default value is “dialog_key”. - Example 1.41. Set vars_key_column parameter + Example 1.42. Set vars_key_column parameter ... modparam("dialog", "vars_key_column", "vars_key_name") ... -6.42. vars_value_column (string) +6.43. vars_value_column (string) The column name in the database to store the values of a dialog variable. Default value is “dialog_value”. - Example 1.42. Set vars_value_column parameter + Example 1.43. Set vars_value_column parameter ... modparam("dialog", "vars_value_column", "vars_value_name") ... -6.43. profiles_with_value (string) +6.44. profiles_with_value (string) List of names for profiles with values, separated with semi-colon ";". Default value is “empty”. - Example 1.43. Set profiles_with_value parameter + Example 1.44. Set profiles_with_value parameter ... modparam("dialog", "profiles_with_value", "caller ; my_profile") ... -6.44. profiles_no_value (string) +6.45. profiles_no_value (string) List of names for profiles without values, separated with semi-colon ";". Default value is “empty”. - Example 1.44. Set profiles_no_value parameter + Example 1.45. Set profiles_no_value parameter ... modparam("dialog", "profiles_no_value", "inbound ; outbound") ... -6.45. bridge_controller (string) +6.46. bridge_controller (string) SIP address to be used in From header when initiating a call bridge. Default value is “sip:controller@kamailio.org”. - Example 1.45. Set bridge_controller parameter + Example 1.46. Set bridge_controller parameter ... modparam("dialog", "bridge_controller", "sip:ctd@kamailio.org") ... -6.46. bridge_contact (string) +6.47. bridge_contact (string) SIP address to be used in Contact header when doing a call bridge. Default value is “sip:controller@kamailio.org:5060”. - Example 1.46. Set bridge_contact parameter + Example 1.47. Set bridge_contact parameter ... modparam("dialog", "bridge_contact", "sip:ctd@127.0.0.1:5060") ... -6.47. initial_cbs_inscript (int) +6.48. initial_cbs_inscript (int) If the initial dialog callbacks (i.e., DLGCB_CREATED and DLGCB_SPIRALED) should be executed in-script or post-script. If @@ -1151,24 +1172,24 @@ modparam("dialog", "bridge_contact", "sip:ctd@127.0.0.1:5060") Default value is “1”. - Example 1.47. Set initial_cbs_inscript parameter + Example 1.48. Set initial_cbs_inscript parameter ... modparam("dialog", "initial_cbs_inscript", 0) ... -6.48. send_bye (int) +6.49. send_bye (int) If set to 1, BYE requests will be sent out for each dialog that timed out. It is an alternative to $dlg_ctx(timeout_bye)=1 for all dialogs. Default value is “0”. - Example 1.48. Set send_bye parameter + Example 1.49. Set send_bye parameter ... modparam("dialog", "send_bye", 1) ... -6.49. wait_ack (int) +6.50. wait_ack (int) If set to 1, dialog will be keept a bit longer in memory in order to absorb the ACK negative replies of initial INVITE. If not, the dialog @@ -1177,12 +1198,12 @@ modparam("dialog", "send_bye", 1) Default value is “1”. - Example 1.49. Set wait_ack parameter + Example 1.50. Set wait_ack parameter ... modparam("dialog", "wait_ack", 0) ... -6.50. ka_timer (int) +6.51. ka_timer (int) Keep-alive timer step - how often to execute the callback to send dialog keep alives (SIP OPTIONS requests within dialog). The value @@ -1190,12 +1211,12 @@ modparam("dialog", "wait_ack", 0) Default value is “0” (no keep alive). - Example 1.50. Set ka_timer parameter + Example 1.51. Set ka_timer parameter ... modparam("dialog", "ka_timer", 10) ... -6.51. ka_interval (int) +6.52. ka_interval (int) The interval between keep alives within dialog (SIP OPTIONS requests), sent to caller or callee. The keep alive request will be sent by the @@ -1211,24 +1232,24 @@ modparam("dialog", "ka_timer", 10) Default value is “0” (no keep alive). The lowest settable interval is 30 seconds. - Example 1.51. Set ka_interval parameter + Example 1.52. Set ka_interval parameter ... modparam("dialog", "ka_interval", 300) ... -6.52. ka_failed_limit (int) +6.53. ka_failed_limit (int) The number of failed keep-alive requests that is accepted before generating a dialog timeout. Default value is “1”. - Example 1.52. Set ka_failed_limit parameter + Example 1.53. Set ka_failed_limit parameter ... modparam("dialog", "ka_failed_limit", 5) ... -6.53. timeout_noreset (int) +6.54. timeout_noreset (int) If set to 1, the dialog timeout won't be reset each time a sequential request is processed. It is an alternative to @@ -1236,12 +1257,12 @@ modparam("dialog", "ka_failed_limit", 5) Default value is “0”. - Example 1.53. Set timeout_noreset parameter + Example 1.54. Set timeout_noreset parameter ... modparam("dialog", "timeout_noreset", 1) ... -6.54. timer_procs (int) +6.55. timer_procs (int) If set to 1, the dialog module will start a separate dialog timer process to execute dialog timeout tasks. The default is to use the core @@ -1249,12 +1270,12 @@ modparam("dialog", "timeout_noreset", 1) Default value is “0” (use core timer process). - Example 1.54. Set timer_procs parameter + Example 1.55. Set timer_procs parameter ... modparam("dialog", "timer_procs", 1) ... -6.55. enable_dmq (int) +6.56. enable_dmq (int) If set to 1, the dialog will be synced via dmq. For now, only very basic dialog info is shared, just enough to have synced profiles. @@ -1263,12 +1284,12 @@ modparam("dialog", "timer_procs", 1) Default value is “0”. - Example 1.55. Set enable_dmq parameter + Example 1.56. Set enable_dmq parameter ... modparam("dialog", "enable_dmq", 1) ... -6.56. track_cseq_updates (int) +6.57. track_cseq_updates (int) Enable the callbacks for tracking if CSeq number needs to be updated. It is the case when the INVITE has to be authenticated to downstream @@ -1280,12 +1301,12 @@ modparam("dialog", "enable_dmq", 1) Default value is “0” (disabled). - Example 1.56. Set track_cseq_updates parameter + Example 1.57. Set track_cseq_updates parameter ... modparam("dialog", "track_cseq_updates", 1) ... -6.57. lreq_callee_headers (string) +6.58. lreq_callee_headers (string) SIP headers to be added when sending local generated requests (e.g., BYE) to callee. It can be useful when you use topoh module with call-id @@ -1293,12 +1314,12 @@ modparam("dialog", "track_cseq_updates", 1) Default value is “null”. - Example 1.57. Set lreq_callee_headers parameter + Example 1.58. Set lreq_callee_headers parameter ... modparam("dialog", "lreq_callee_headers", "TH: dlh\r\n") ... -6.58. event_callback (str) +6.59. event_callback (str) The name of the function in the kemi configuration file (embedded scripting language such as Lua, Python, ...) to be executed instead of @@ -1311,7 +1332,7 @@ modparam("dialog", "lreq_callee_headers", "TH: dlh\r\n") Default value is 'empty' (no function is executed for events). - Example 1.58. Set event_callback parameter + Example 1.59. Set event_callback parameter ... modparam("dialog", "event_callback", "ksr_dialog_event") ... @@ -1359,7 +1380,7 @@ end This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. - Example 1.59. set_dlg_profile usage + Example 1.60. set_dlg_profile usage ... set_dlg_profile("inbound_call"); set_dlg_profile("caller","$fu"); @@ -1378,7 +1399,7 @@ set_dlg_profile("caller","$fu"); This function can be used from BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. - Example 1.60. unset_dlg_profile usage + Example 1.61. unset_dlg_profile usage ... unset_dlg_profile("inbound_call"); unset_dlg_profile("caller","$fu"); @@ -1386,22 +1407,22 @@ unset_dlg_profile("caller","$fu"); 7.3. is_in_profile(profile,[value]) - Checks if the current dialog belongs to a profile. If the profile - supports values, the check can be reinforced to take into account a - specific value, if the dialog was inserted into the profile for a - specific value. If no value is passed, only the membership of the - dialog in the profile per se is checked. Note that if the profile does - not support values, the value parameter will be silently discarded. + Checks if the current dialog belongs to a profile. If the profile is + defined with values, then the check is also matching with the specific + value provided as parameter. + + Note that if the profile is not defined with support for values, the + value parameter will be silently discarded. Meaning of the parameters is as follows: * profile - name of the profile to be checked against; - * value (optional) - string value to further restrict the check. + * value (optional) - string value to be matched during the check. Pseudo-variables are supported. This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. - Example 1.61. is_in_profile usage + Example 1.62. is_in_profile usage ... if (is_in_profile("inbound_call")) { log("this request belongs to a inbound call\n"); @@ -1430,7 +1451,7 @@ if (is_in_profile("caller","XX")) { This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. - Example 1.62. get_profile_size usage + Example 1.63. get_profile_size usage ... if(get_profile_size("inbound_call","$avp(size)")) xlog("currently there are $avp(size) inbound calls\n"); @@ -1449,7 +1470,7 @@ if(get_profile_size("caller","$fu","$avp(size)")) This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. - Example 1.63. dlg_isflagset usage + Example 1.64. dlg_isflagset usage ... if(dlg_isflagset("1")) { @@ -1467,7 +1488,7 @@ if(dlg_isflagset("1")) This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. - Example 1.64. dlg_setflag usage + Example 1.65. dlg_setflag usage ... dlg_setflag("1"); ... @@ -1482,7 +1503,7 @@ dlg_setflag("1"); This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. - Example 1.65. dlg_resetflag usage + Example 1.66. dlg_resetflag usage ... redlg_setflag("1"); ... @@ -1497,7 +1518,7 @@ redlg_setflag("1"); This function can be used from ANY_ROUTE. - Example 1.66. dlg_bye usage + Example 1.67. dlg_bye usage ... dlg_bye("all"); ... @@ -1514,7 +1535,7 @@ dlg_bye("all"); This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. - Example 1.67. dlg_refer usage + Example 1.68. dlg_refer usage ... dlg_refer("caller", "sip:announcement@kamailio.org"); ... @@ -1527,7 +1548,7 @@ dlg_refer("caller", "sip:announcement@kamailio.org"); This function can be used from REQUEST_ROUTE. - Example 1.68. dlg_manage usage + Example 1.69. dlg_manage usage ... modparam("dialog", "default_timeout", 100) ... @@ -1555,7 +1576,7 @@ request_route { This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. - Example 1.69. dlg_bridge usage + Example 1.70. dlg_bridge usage ... dlg_bridge("sip:user@kamailio.org", "sip:annoucement@kamailio.org", "sip:kamailio.org:5080"); @@ -1574,7 +1595,7 @@ dlg_bridge("sip:user@kamailio.org", "sip:annoucement@kamailio.org", This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. - Example 1.70. dlg_get usage + Example 1.71. dlg_get usage ... if(dlg_get("abcdef", "123", "456")) { @@ -1598,7 +1619,7 @@ if(dlg_get("abcdef", "123", "456")) This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. - Example 1.71. is_known_dlg() usage + Example 1.72. is_known_dlg() usage ... if(!uri == myself) { if(is_known_dlg()) { @@ -1622,7 +1643,7 @@ if(!uri == myself) { This function can be used from ANY_ROUTE. - Example 1.72. dlg_set_timeout usage + Example 1.73. dlg_set_timeout usage ... if(dlg_set_timeout("180", "123", "456")) { @@ -1644,7 +1665,7 @@ if(dlg_set_timeout("180", "123", "456")) This function can be used from ANY_ROUTE. - Example 1.73. dlg_set_timeout_by_profile usage + Example 1.74. dlg_set_timeout_by_profile usage ... # All dialogs belonging to user abc123 (tracked via set_dlg_profile()) # will be timed out in 3 seconds. @@ -1676,7 +1697,7 @@ dlg_set_timeout_by_profile("users", "abc123", "3"); This function can be used from ANY_ROUTE. - Example 1.74. dlg_set_property usage + Example 1.75. dlg_set_property usage ... dlg_set_property("ka-src"); dlg_set_property("ka-dst"); @@ -1704,7 +1725,7 @@ dlg_set_property("timeout-noreset"); This function can be used from ANY_ROUTE. - Example 1.75. dlg_remote_profile usage + Example 1.76. dlg_remote_profile usage ... $var(exp) = 3600 + $Ts; dlg_remote_profile("add", "caller", "test", "$sruid", "$var(exp)"); @@ -1717,7 +1738,7 @@ dlg_remote_profile("add", "caller", "test", "$sruid", "$var(exp)"); This function can be used from ANY_ROUTE. - Example 1.76. dlg_set_ruri() usage + Example 1.77. dlg_set_ruri() usage ... if(has_totag() and is_present_hf("Route") and uri==myself ) { if(dlg_set_ruri()) { @@ -1836,12 +1857,12 @@ kamcmd dlg.list_ctx abcdrssfrs122444@192.168.1.1 Parameters: * callid - callid of dialog to be terminated * from_tag - from tag of the dialog to terminated - * totag - to tag of the dialog to terminated + * to_tag - to tag of the dialog to terminated The command works only for confirmed dialogs. RPC Command Format: - kamcmd dlg.dlg_terminate_dlg callid12345 fromtag123 totag123 + kamcmd dlg.terminate_dlg callid12345 fromtag123 totag123 9.6. dlg.end_dlg @@ -1913,8 +1934,15 @@ kamcmd dlg.profile_list inbound_calls Parameters: * from - SIP address to initiate the call * to - SIP address to refer 'from' to - * op (optional) - outbound proxy SIP address - * body (optional) - SDP body for initial INVITE + * op (optional) - outbound proxy SIP address. If its value is set to + '.' (dot), then it is ignored (like it would not have been + provided). + * body (optional) - SDP body for initial INVITE. If its value is set + to '.' (dot), then it is ignored (like it would not have been + provided). If body is not set via RPC command parameter, then an + internal generated SDP with G711a and G711u is used. If its value + is set to '' (empty string) or '_' (underline), then the INVITE is + sent without an SDP body. RPC Command Format: ... diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c index 0ab01e2a8..f1f1efa7b 100644 --- a/src/modules/dialog/dialog.c +++ b/src/modules/dialog/dialog.c @@ -494,8 +494,8 @@ static int mod_init(void) return -1; /* param checkings */ - if (dlg_flag>MAX_FLAG) { - LM_ERR("invalid dlg flag %d!!\n",dlg_flag); + if (dlg_flag!=-1 && dlg_flag>MAX_FLAG) { + LM_ERR("invalid dlg flag %d!!\n", dlg_flag); return -1; } diff --git a/src/modules/dialog/dlg_db_handler.c b/src/modules/dialog/dlg_db_handler.c index 0b9d77ce8..8e8b5b088 100644 --- a/src/modules/dialog/dlg_db_handler.c +++ b/src/modules/dialog/dlg_db_handler.c @@ -565,11 +565,11 @@ static int load_dialog_vars_from_db(int fetch_num_rows) } dlg = dlg->next; if (!dlg) { - LM_WARN("insonsistent data: the dialog h_entry/h_id does not exist!\n"); + LM_WARN("inconsistent data: the dialog h_entry/h_id does not exist!\n"); } } } else { - LM_WARN("insonsistent data: the h_entry in the DB does not exist!\n"); + LM_WARN("inconsistent data: the h_entry in the DB does not exist!\n"); } } diff --git a/src/modules/dialog/dlg_handlers.c b/src/modules/dialog/dlg_handlers.c index b6ce4d2bb..c80ca7d59 100644 --- a/src/modules/dialog/dlg_handlers.c +++ b/src/modules/dialog/dlg_handlers.c @@ -200,7 +200,7 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, if (leg==DLG_CALLER_LEG) { if((!msg->cseq && (parse_headers(msg,HDR_CSEQ_F,0)<0 || !msg->cseq)) || !msg->cseq->parsed){ - LM_ERR("bad sip message or missing CSeq hdr :-/\n"); + LM_ERR("bad sip message or missing CSeq hdr\n"); goto error0; } cseq = (get_cseq(msg))->number; @@ -208,6 +208,9 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, /* use the same as in request */ cseq = dlg->cseq[DLG_CALLEE_LEG]; } + if ((leg==DLG_CALLER_LEG) && (cseq.s==NULL || cseq.len<=0)) { + LM_DBG("empty CSeq number (leg: %d)\n", leg); + } /* extract the contact address */ if (!msg->contact&&(parse_headers(msg,HDR_CONTACT_F,0)<0||!msg->contact)){ @@ -221,6 +224,9 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, goto error0; } contact = ((contact_body_t *)msg->contact->parsed)->contacts->uri; + if(contact.s==NULL || contact.len<=0) { + LM_DBG("empty contact uri (leg: %d)\n", leg); + } /* extract the record-route addresses */ if (leg==DLG_CALLER_LEG) { @@ -250,10 +256,10 @@ int populate_leg_info( struct dlg_cell *dlg, struct sip_msg *msg, LM_DBG("leg(%d) route_set [%.*s], contact [%.*s], cseq [%.*s]" " and bind_addr [%.*s]\n", - leg, rr_set.len, rr_set.s, contact.len, contact.s, - cseq.len, cseq.s, + leg, rr_set.len, ZSW(rr_set.s), contact.len, ZSW(contact.s), + cseq.len, ZSW(cseq.s), msg->rcv.bind_address->sock_str.len, - msg->rcv.bind_address->sock_str.s); + ZSW(msg->rcv.bind_address->sock_str.s)); if (dlg_set_leg_info( dlg, tag, &rr_set, &contact, &cseq, leg)!=0) { LM_ERR("dlg_set_leg_info failed (leg %d)\n", leg); @@ -755,8 +761,10 @@ void dlg_onreq(struct cell* t, int type, struct tmcb_params *param) } } if (dlg==NULL) { - if((req->flags&dlg_flag_mask)!=dlg_flag_mask) + if((dlg_flag_mask==0) || (req->flags&dlg_flag_mask)!=dlg_flag_mask) { + LM_DBG("flag not set for creating a new dialog\n"); return; + } LM_DBG("dialog creation on config flag\n"); dlg_new_dialog(req, t, 1); dlg = dlg_get_ctx_dialog(); diff --git a/src/modules/dialog/dlg_hash.c b/src/modules/dialog/dlg_hash.c index 65225e024..0718c50f6 100644 --- a/src/modules/dialog/dlg_hash.c +++ b/src/modules/dialog/dlg_hash.c @@ -450,15 +450,16 @@ struct dlg_cell* build_new_dlg( str *callid, str *from_uri, str *to_uri, int len; char *p; - len = sizeof(struct dlg_cell) + callid->len + from_uri->len + - to_uri->len + req_uri->len; + /* space for dialog structure and values with 0-ending char */ + len = sizeof(struct dlg_cell) + callid->len + 1 + from_uri->len + 1 + + to_uri->len + 1 + req_uri->len + 1; dlg = (struct dlg_cell*)shm_malloc( len ); if (dlg==0) { LM_ERR("no more shm mem (%d)\n",len); return 0; } - memset( dlg, 0, len); + memset(dlg, 0, len); dlg->state = DLG_STATE_UNCONFIRMED; dlg->init_ts = (unsigned int)time(NULL); @@ -469,23 +470,23 @@ struct dlg_cell* build_new_dlg( str *callid, str *from_uri, str *to_uri, dlg->callid.s = p; dlg->callid.len = callid->len; - memcpy( p, callid->s, callid->len); - p += callid->len; + memcpy(p, callid->s, callid->len); + p += callid->len + 1; dlg->from_uri.s = p; dlg->from_uri.len = from_uri->len; - memcpy( p, from_uri->s, from_uri->len); - p += from_uri->len; + memcpy(p, from_uri->s, from_uri->len); + p += from_uri->len + 1; dlg->to_uri.s = p; dlg->to_uri.len = to_uri->len; - memcpy( p, to_uri->s, to_uri->len); - p += to_uri->len; + memcpy(p, to_uri->s, to_uri->len); + p += to_uri->len + 1; dlg->req_uri.s = p; dlg->req_uri.len = req_uri->len; - memcpy( p, req_uri->s, req_uri->len); - p += req_uri->len; + memcpy(p, req_uri->s, req_uri->len); + p += req_uri->len + 1; if ( p!=(((char*)dlg)+len) ) { LM_CRIT("buffer overflow\n"); diff --git a/src/modules/dialog/dlg_req_within.c b/src/modules/dialog/dlg_req_within.c index d37bbbf51..62693808c 100644 --- a/src/modules/dialog/dlg_req_within.c +++ b/src/modules/dialog/dlg_req_within.c @@ -77,8 +77,8 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ unsigned int loc_seq; char nbuf[MAX_URI_SIZE]; char dbuf[80]; - str nuri; - str duri; + str nuri = STR_NULL; + str duri = STR_NULL; size_t sz; char *p; @@ -87,14 +87,16 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ LM_ERR("no contact available\n"); goto error; } - /*restore alias parameter*/ - nuri.s = nbuf; - nuri.len = MAX_URI_SIZE; - duri.s = dbuf; - duri.len = 80; - if(uri_restore_rcv_alias(&cell->contact[dir], &nuri, &duri)<0) { - nuri.len = 0; - duri.len = 0; + if(cell->route_set[dir].s==NULL || cell->route_set[dir].len<=0){ + /*try to restore alias parameter if no route set */ + nuri.s = nbuf; + nuri.len = MAX_URI_SIZE; + duri.s = dbuf; + duri.len = 80; + if(uri_restore_rcv_alias(&cell->contact[dir], &nuri, &duri)<0) { + nuri.len = 0; + duri.len = 0; + } } if(nuri.len>0 && duri.len>0) { sz = sizeof(dlg_t) + (nuri.len+duri.len+2)*sizeof(char); @@ -103,7 +105,6 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ } td = (dlg_t*)pkg_malloc(sz); if(!td){ - LM_ERR("out of pkg memory\n"); return NULL; } @@ -122,13 +123,12 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ /*route set*/ if( cell->route_set[dir].s && cell->route_set[dir].len){ - - if( parse_rr_body(cell->route_set[dir].s, cell->route_set[dir].len, + if( parse_rr_body(cell->route_set[dir].s, cell->route_set[dir].len, &td->route_set) !=0){ LM_ERR("failed to parse route set\n"); goto error; } - } + } if(nuri.len>0 && duri.len>0) { /* req uri */ @@ -153,7 +153,7 @@ dlg_t * build_dlg_t(struct dlg_cell * cell, int dir){ td->id.rem_tag = cell->tag[dir]; td->id.loc_tag = (dir == DLG_CALLER_LEG) ? cell->tag[DLG_CALLEE_LEG]: cell->tag[DLG_CALLER_LEG]; - + td->state= DLG_CONFIRMED; td->send_sock = cell->bind_addr[dir]; diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml index 5ed7b96bd..f77ace630 100644 --- a/src/modules/dialog/doc/dialog_admin.xml +++ b/src/modules/dialog/doc/dialog_admin.xml @@ -45,9 +45,10 @@
How it works - To create the dialog associated with an initial request, the flag - dlg_flag () must be set before - creating the corresponding transaction. + To create the dialog associated with an initial INVITE request, execute + the function dlg_manage() or set the flag specified by + parameter dlg_flag () + before creating the corresponding transaction. The dialog is automatically destroyed when a BYE is @@ -256,6 +257,12 @@ modparam("dialog", "rr_param", "xyz") current request (this make sense only for initial requests). + Note: it is not needed to set this parameter and its corresponding flag + for initial request in case the dlg_manage() function + is used. In other words, using dlg_manage() alone is + enough. + + Default value is none. diff --git a/src/modules/dialplan/README b/src/modules/dialplan/README index cde96e214..a63e4bfc7 100644 --- a/src/modules/dialplan/README +++ b/src/modules/dialplan/README @@ -550,11 +550,14 @@ xlog("translated to var $var(y) \n"); Name: dialplan.translate Parameters: 2 - * Dial plan ID - * Input String + * Dial plan ID (number) + * Input string (string) - it can be prefixed with 's:' to avoid + auto-conversion when the command is executed with CLI apps such as + kamcmd. Example: kamcmd dialplan.translate 1 "abcdxyz" + kamcmd dialplan.translate 1 s:123456789 8. Installation diff --git a/src/modules/dialplan/dialplan.c b/src/modules/dialplan/dialplan.c index 85dc0d652..75219b53d 100644 --- a/src/modules/dialplan/dialplan.c +++ b/src/modules/dialplan/dialplan.c @@ -115,7 +115,7 @@ static cmd_export_t cmds[]={ ANY_ROUTE}, {"dp_match",(cmd_function)w_dp_match, 2, fixup_igp_spve, fixup_free_igp_spve, ANY_ROUTE}, - {"dp_replace",(cmd_function)w_dp_replace, 2, dp_replace_fixup, + {"dp_replace",(cmd_function)w_dp_replace, 3, dp_replace_fixup, dp_replace_fixup_free, ANY_ROUTE}, {0,0,0,0,0,0} }; diff --git a/src/modules/dialplan/doc/dialplan_admin.xml b/src/modules/dialplan/doc/dialplan_admin.xml index e9f8f9535..ed8bad4fa 100644 --- a/src/modules/dialplan/doc/dialplan_admin.xml +++ b/src/modules/dialplan/doc/dialplan_admin.xml @@ -682,10 +682,12 @@ xlog("translated to var $var(y) \n"); Parameters: 2 - Dial plan ID + Dial plan ID (number) - Input String + Input string (string) - it + can be prefixed with 's:' to avoid auto-conversion when + the command is executed with CLI apps such as &kamcmd;. @@ -693,6 +695,7 @@ xlog("translated to var $var(y) \n"); &kamcmd; dialplan.translate 1 "abcdxyz" + &kamcmd; dialplan.translate 1 s:123456789
diff --git a/src/modules/drouting/README b/src/modules/drouting/README index 8e45c5ecf..218609b6b 100644 --- a/src/modules/drouting/README +++ b/src/modules/drouting/README @@ -55,11 +55,11 @@ Anca-Maria Vamanu 4. Functions - 4.1. do_routing("[groupID]") - 4.2. use_next_gw()/next_routing() - 4.3. goes_to_gw([type]) - 4.4. is_from_gw([type]) - 4.5. is_from_gw( type, [flag]) + 4.1. do_routing([groupID]) + 4.2. next_routing() + 4.3. use_next_gw() + 4.4. goes_to_gw([type]) + 4.5. is_from_gw([ type, [flag] ]) 5. RPC Commands @@ -95,10 +95,9 @@ Anca-Maria Vamanu 1.14. Set force_dns parameter 1.15. Set enable_keepalive parameter 1.16. do_routing usage - 1.17. use_next_gw usage + 1.17. next_routing usage 1.18. goes_to_gw usage 1.19. is_from_gw usage - 1.20. is_from_gw usage Chapter 1. Admin Guide @@ -142,11 +141,11 @@ Chapter 1. Admin Guide 4. Functions - 4.1. do_routing("[groupID]") - 4.2. use_next_gw()/next_routing() - 4.3. goes_to_gw([type]) - 4.4. is_from_gw([type]) - 4.5. is_from_gw( type, [flag]) + 4.1. do_routing([groupID]) + 4.2. next_routing() + 4.3. use_next_gw() + 4.4. goes_to_gw([type]) + 4.5. is_from_gw([ type, [flag] ]) 5. RPC Commands @@ -295,7 +294,8 @@ Chapter 1. Admin Guide Each user must be member of only one routing group. It must be specified in user's profile. b. prefix column - Destination URI must start with prefix value to match the rule. + Destination URI must start with prefix value to match the rule. The + prefix value can contain only digits (0..9), '+', '*' or '#'. c. time rec column A date-time expression that defines the time recurrence to match for current rule. Time recurrences are based closely on the @@ -709,13 +709,13 @@ modparam("drouting", "enable_keepalive", 1) 4. Functions - 4.1. do_routing("[groupID]") - 4.2. use_next_gw()/next_routing() - 4.3. goes_to_gw([type]) - 4.4. is_from_gw([type]) - 4.5. is_from_gw( type, [flag]) + 4.1. do_routing([groupID]) + 4.2. next_routing() + 4.3. use_next_gw() + 4.4. goes_to_gw([type]) + 4.5. is_from_gw([ type, [flag] ]) -4.1. do_routing("[groupID]") +4.1. do_routing([groupID]) Function to trigger routing of the message according to the rules in the database table and the configured parameters. @@ -723,9 +723,10 @@ modparam("drouting", "enable_keepalive", 1) This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. The module can take one optional parameter: the routing group the - caller belongs to - this may be a static numerical value or an AVP - specification. If none specified, the function will automatically try - to query the dr_group table to get this information. + caller belongs to - this may be a static int value or a variable + holding an int. If none specified, the function will automatically try + to query the dr_group table to get the group id associated with the + user in From URI. Example 1.16. do_routing usage ... @@ -735,7 +736,7 @@ do_routing("0"); ... do_routing("$avp(i:10)"); -4.2. use_next_gw()/next_routing() +4.2. next_routing() The function takes the next available destination (set by do_routing, as alternative destinations) and push it into RURI. Note that the @@ -750,26 +751,32 @@ do_routing("$avp(i:10)"); is no other alternative destinations are found or in case of internal processing error. - Example 1.17. use_next_gw usage + Example 1.17. next_routing usage ... -if (use_next_gw()) { +if (next_routing()) { t_relay(); exit; } ... -4.3. goes_to_gw([type]) +4.3. use_next_gw() + + Same as next_routing(). + +4.4. goes_to_gw([type]) Function returns true if the destination of the current request (destination URI or Request URI) points (as IP) to one of the gateways. - There no DNS lookups done if the domain part of the URI is not an IP. + There is no DNS lookups done if the domain part of the URI is not an + IP. This function does not change anything in the message. - This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE and + ONREPLY_ROUTE. - The function can take one optional parameter: - * type (optional) - GW/destination type to be checked + The function can take two optional parameters: + * type - GW/destination type to be checked Example 1.18. goes_to_gw usage ... @@ -779,38 +786,23 @@ if (goes_to_gw("1")) { } ... -4.4. is_from_gw([type]) +4.5. is_from_gw([ type, [flag] ]) The function checks if the sender of the message is a gateway from a - certain group. + group in drouting rules. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE and - ONREPLY_ROUTE - - The function can take one optional parameter: - * type (optional) - GW/destination type to be checked - * flags - if message is a request and the GW has a STRIP defined, - then apply it if GW is source. - - Example 1.19. is_from_gw usage -... -if (is_from_gw("1") { -} -... - -4.5. is_from_gw( type, [flag]) - - The function checks if the sender of the message is a gateway from a - certain group. - - This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. + ONREPLY_ROUTE. The function can take two parameters: * type (mandatory) - GW/destination type to be checked * flags (optional) - if message is a request and the GW has a STRIP defined, then apply it if GW is source. - Example 1.20. is_from_gw usage + Example 1.19. is_from_gw usage +... +if (is_from_gw("1") { +} ... if (is_from_gw("3","1") { } diff --git a/src/modules/evapi/evapi_dispatch.c b/src/modules/evapi/evapi_dispatch.c index fee0cc8c2..5b7d534d0 100644 --- a/src/modules/evapi/evapi_dispatch.c +++ b/src/modules/evapi/evapi_dispatch.c @@ -289,7 +289,7 @@ int evapi_dispatch_notify(evapi_msg_t *emsg) n = 0; for(i=0; i=0) { - if(emsg->tag.s==NULL || (emsg->tag.len = _evapi_clients[i].stag.len + if(emsg->tag.s==NULL || (emsg->tag.len == _evapi_clients[i].stag.len && strncmp(_evapi_clients[i].stag.s, emsg->tag.s, emsg->tag.len)==0)) { wlen = write(_evapi_clients[i].sock, emsg->data.s, diff --git a/src/modules/htable/README b/src/modules/htable/README index fffa45a21..d906e2951 100644 --- a/src/modules/htable/README +++ b/src/modules/htable/README @@ -53,6 +53,7 @@ Ovidiu Sas 3.12. enable_dmq (integer) 3.13. timer_procs (integer) 3.14. event_callback (str) + 3.15. event_callback_mode (int) 4. Functions @@ -104,17 +105,18 @@ Ovidiu Sas 1.15. Set enable_dmq parameter 1.16. Set timer_procs parameter 1.17. Set event_callback parameter - 1.18. sht_print usage - 1.19. sht_rm_name_re usage - 1.20. sht_rm_value_re usage - 1.21. sht_rm_name usage - 1.22. sht_rm_value usage - 1.23. sht_reset usage - 1.24. sht_lock usage - 1.25. sht_unlock usage - 1.26. sht_iterator_start usage - 1.27. sht_iterator_end usage - 1.28. sht_iterator_next usage + 1.18. Set event_callback_mode parameter + 1.19. sht_print usage + 1.20. sht_rm_name_re usage + 1.21. sht_rm_value_re usage + 1.22. sht_rm_name usage + 1.23. sht_rm_value usage + 1.24. sht_reset usage + 1.25. sht_lock usage + 1.26. sht_unlock usage + 1.27. sht_iterator_start usage + 1.28. sht_iterator_end usage + 1.29. sht_iterator_next usage Chapter 1. Admin Guide @@ -143,6 +145,7 @@ Chapter 1. Admin Guide 3.12. enable_dmq (integer) 3.13. timer_procs (integer) 3.14. event_callback (str) + 3.15. event_callback_mode (int) 4. Functions @@ -412,6 +415,7 @@ $ kamcmd htable.dump htable 3.12. enable_dmq (integer) 3.13. timer_procs (integer) 3.14. event_callback (str) + 3.15. event_callback_mode (int) 3.1. htable (str) @@ -643,6 +647,21 @@ function ksr_htable_event(evname) end ... +3.15. event_callback_mode (int) + + Control when event_route[htable:init] is executed: 0 - after all + modules were initialized; 1 - in first worker process. + + Set it to 1 if used in a KEMI script or when needing to use database + (e.g., via sqlops) inside event_route[htable:init]. + + Default value is 0. + + Example 1.18. Set event_callback_mode parameter +... +modparam("htable", "event_callback_mode", 1) +... + 4. Functions 4.1. sht_print() @@ -665,7 +684,7 @@ end This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE. - Example 1.18. sht_print usage + Example 1.19. sht_print usage ... sht_print(); ... @@ -678,7 +697,7 @@ sht_print(); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE. - Example 1.19. sht_rm_name_re usage + Example 1.20. sht_rm_name_re usage ... sht_rm_name_re("ha=>.*"); ... @@ -691,7 +710,7 @@ sht_rm_name_re("ha=>.*"); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE. - Example 1.20. sht_rm_value_re usage + Example 1.21. sht_rm_value_re usage ... sht_rm_value_re("ha=>.*"); ... @@ -709,7 +728,7 @@ sht_rm_value_re("ha=>.*"); This function can be used from ANY_ROUTE. - Example 1.21. sht_rm_name usage + Example 1.22. sht_rm_name usage ... sht_rm_name("ha", "re", ".*"); ... @@ -727,7 +746,7 @@ sht_rm_name("ha", "re", ".*"); This function can be used from ANY_ROUTE. - Example 1.22. sht_rm_value usage + Example 1.23. sht_rm_value usage ... sht_rm_value("ha", "re", ".*"); ... @@ -739,7 +758,7 @@ sht_rm_value("ha", "re", ".*"); This function can be used from ANY_ROUTE. - Example 1.23. sht_reset usage + Example 1.24. sht_reset usage ... sht_reset("ha$var(x)"); ... @@ -752,7 +771,7 @@ sht_reset("ha$var(x)"); This function can be used from ANY_ROUTE. - Example 1.24. sht_lock usage + Example 1.25. sht_lock usage ... sht_lock("ha=>test"); ... @@ -765,7 +784,7 @@ sht_lock("ha=>test"); This function can be used from ANY_ROUTE. - Example 1.25. sht_unlock usage + Example 1.26. sht_unlock usage ... sht_lock("ha=>test"); $sht(ha=>test) = $sht(ha=>test) + 10; @@ -787,7 +806,7 @@ sht_unlock("ha=>test"); This function can be used from ANY_ROUTE. - Example 1.26. sht_iterator_start usage + Example 1.27. sht_iterator_start usage ... sht_iterator_start("i1", "h1"); ... @@ -802,7 +821,7 @@ sht_iterator_start("i1", "h1"); This function can be used from ANY_ROUTE. - Example 1.27. sht_iterator_end usage + Example 1.28. sht_iterator_end usage ... sht_iterator_end("i1"); ... @@ -824,7 +843,7 @@ sht_iterator_end("i1"); This function can be used from ANY_ROUTE. - Example 1.28. sht_iterator_next usage + Example 1.29. sht_iterator_next usage ... sht_iterator_start("i1", "h1"); while(sht_iterator_next("i1")) { diff --git a/src/modules/http_async_client/README b/src/modules/http_async_client/README index d61ae9c30..9e7ba1faf 100644 --- a/src/modules/http_async_client/README +++ b/src/modules/http_async_client/README @@ -358,10 +358,10 @@ $http_req(suspend) = 0; http_async_query("https://example.com/test.php", "HTTP_REPLY"); -xlog("L_INFO", "Query id: $http_query_id"); +xlog("L_INFO", "Query id: $http_req_id"); ... route[HTTP_REPLY] { -xlog("L_INFO", "received reply for query $http_query_id\n"); +xlog("L_INFO", "received reply for query $http_req_id\n"); } ... diff --git a/src/modules/ims_charging/README b/src/modules/ims_charging/README index 2d26fbaa4..15941a0df 100644 --- a/src/modules/ims_charging/README +++ b/src/modules/ims_charging/README @@ -66,7 +66,7 @@ Carlos Ruiz Diaz 5. Functions 5.1. Ro_CCR(route_name, direction, reservation_units, - domain, incoming_trunk_id, outgoing_trunk_id + incoming_trunk_id, outgoing_trunk_id) 5.2. Ro_set_session_id_avp() @@ -163,8 +163,8 @@ Chapter 1. Admin Guide 5. Functions - 5.1. Ro_CCR(route_name, direction, reservation_units, domain, - incoming_trunk_id, outgoing_trunk_id + 5.1. Ro_CCR(route_name, direction, reservation_units, + incoming_trunk_id, outgoing_trunk_id) 5.2. Ro_set_session_id_avp() @@ -689,13 +689,13 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)") 5. Functions - 5.1. Ro_CCR(route_name, direction, reservation_units, domain, - incoming_trunk_id, outgoing_trunk_id + 5.1. Ro_CCR(route_name, direction, reservation_units, + incoming_trunk_id, outgoing_trunk_id) 5.2. Ro_set_session_id_avp() -5.1. Ro_CCR(route_name, direction, reservation_units, domain, -incoming_trunk_id, outgoing_trunk_id +5.1. Ro_CCR(route_name, direction, reservation_units, incoming_trunk_id, +outgoing_trunk_id) Perform a CCR on Diameter Ro interface for Charging @@ -704,7 +704,6 @@ incoming_trunk_id, outgoing_trunk_id * direction "orig"inating or "term"inating * reservation_units how many units (at the moment seconds) should be reservated at the moment. - * domain Logical domain within registrar. * incoming_trunk_id Identifies the trunk group from which this originates. * outgoing_trunk_id Identifies the trunk group where this will be diff --git a/src/modules/ims_charging/doc/ims_charging_admin.xml b/src/modules/ims_charging/doc/ims_charging_admin.xml index b2a4ae423..f5dfe6e60 100644 --- a/src/modules/ims_charging/doc/ims_charging_admin.xml +++ b/src/modules/ims_charging/doc/ims_charging_admin.xml @@ -762,7 +762,7 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
<function moreinfo="none">Ro_CCR(route_name, direction, - reservation_units, domain, incoming_trunk_id, outgoing_trunk_id</function> + reservation_units, incoming_trunk_id, outgoing_trunk_id)</function> Perform a CCR on Diameter Ro interface for Charging @@ -784,11 +784,6 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)") reservation_units how many units (at the moment seconds) should be reservated at the moment. - - - domain Logical domain within - registrar. - incoming_trunk_id Identifies the trunk group diff --git a/src/modules/ims_isc/checker.c b/src/modules/ims_isc/checker.c index 44611822a..f02cf98ba 100644 --- a/src/modules/ims_isc/checker.c +++ b/src/modules/ims_isc/checker.c @@ -369,6 +369,7 @@ static inline isc_match* isc_new_match(ims_filter_criteria *fc, int index) { if (!r->server_name.s) { LM_ERR("isc_new_match(): error allocating %d bytes\n", fc->application_server.server_name.len); + pkg_free(r); return 0; } r->server_name.len = fc->application_server.server_name.len; @@ -381,6 +382,10 @@ static inline isc_match* isc_new_match(ims_filter_criteria *fc, int index) { if (!r->service_info.s) { LM_ERR("isc_new_match(): error allocating %d bytes\n", fc->application_server.service_info.len); + if (r->server_name.s) { + pkg_free(r->server_name.s); + } + pkg_free(r); return 0; } r->service_info.len = fc->application_server.service_info.len; diff --git a/src/modules/json/README b/src/modules/json/README index 2f3e6dc7a..9cf2da617 100644 --- a/src/modules/json/README +++ b/src/modules/json/README @@ -77,6 +77,12 @@ Chapter 1. Admin Guide Copy field 'field_name' from json object 'json_string' and store it in pvar 'destination'. + Note that the result is the string representation of that JSON filed. + For example, if you want to retrieve a field that has a string value, + then the result is the value enclosed in quotes. If the field value is + a structure, then the result is the string-formatted representation of + that structure. + Example 1.1. json_get_field usage ... json_get_field("{'foo':'bar'}", "foo", "$var(foo)"); diff --git a/src/modules/jsonrpcs/README b/src/modules/jsonrpcs/README index d615babde..57c8e1e69 100644 --- a/src/modules/jsonrpcs/README +++ b/src/modules/jsonrpcs/README @@ -397,6 +397,7 @@ event_route[xhttp:request] { Example 1.15. jsonrpc_exec usage ... jsonrpc_exec('{"jsonrpc": "2.0", "method": "dispatcher.reload", "id": 1}'); +xlog("jsonrpc response code: $jsonrpl(code) - the body is: $jsonrpl(body)\n"); ... 6. JSONRPC Commands diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c index 36e7ea084..00c8f3fb7 100644 --- a/src/modules/kazoo/kz_amqp.c +++ b/src/modules/kazoo/kz_amqp.c @@ -1802,10 +1802,10 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload) str* event_key = NULL; str* event_subkey = NULL; - - json_obj_ptr json_obj = NULL; struct json_object* tmpObj = NULL; + kz_amqp_bind_ptr bind = NULL; + kz_amqp_binding_ptr binding = NULL; if (fixup_get_svalue(msg, (gparam_p)payload, &payload_s) != 0) { LM_ERR("cannot get payload value\n"); @@ -1880,7 +1880,7 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload) } queue = kz_amqp_queue_from_json(&queue_s, tmpObj); - kz_amqp_bind_ptr bind = kz_amqp_bind_alloc(exchange, exchange_binding, queue, routing, event_key, event_subkey); + bind = kz_amqp_bind_alloc(exchange, exchange_binding, queue, routing, event_key, event_subkey); if(bind == NULL) { LM_ERR("Could not allocate bind struct\n"); goto error; @@ -1893,7 +1893,7 @@ int kz_amqp_subscribe(struct sip_msg* msg, char* payload) bind->consistent_worker_key = consistent_worker_key; - kz_amqp_binding_ptr binding = shm_malloc(sizeof(kz_amqp_binding)); + binding = shm_malloc(sizeof(kz_amqp_binding)); if(binding == NULL) { LM_ERR("Could not allocate binding struct\n"); goto error; @@ -1935,7 +1935,8 @@ int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange kz_amqp_exchange_ptr exchange_ptr = NULL; kz_amqp_queue_ptr queue_ptr = NULL; kz_amqp_routings_ptr routing_ptr = NULL; - + kz_amqp_bind_ptr bind = NULL; + kz_amqp_binding_ptr binding = NULL; if (fixup_get_svalue(msg, (gparam_p)exchange, &exchange_s) != 0) { LM_ERR("cannot get exchange string value\n"); @@ -1961,7 +1962,7 @@ int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange queue_ptr = kz_amqp_queue_new(&queue_s); routing_ptr = kz_amqp_routing_new(routing_key_s.s); - kz_amqp_bind_ptr bind = kz_amqp_bind_alloc(exchange_ptr, NULL, queue_ptr, routing_ptr, NULL, NULL); + bind = kz_amqp_bind_alloc(exchange_ptr, NULL, queue_ptr, routing_ptr, NULL, NULL); if(bind == NULL) { LM_ERR("Could not allocate bind struct\n"); goto error; @@ -1969,7 +1970,7 @@ int kz_amqp_subscribe_simple(struct sip_msg* msg, char* exchange, char* exchange bind->no_ack = 1; - kz_amqp_binding_ptr binding = shm_malloc(sizeof(kz_amqp_binding)); + binding = shm_malloc(sizeof(kz_amqp_binding)); if(binding == NULL) { LM_ERR("Could not allocate binding struct\n"); goto error; @@ -2870,6 +2871,7 @@ void kz_send_targeted_cmd(int server_id, amqp_bytes_t body) char* server_id_str = NULL; kz_amqp_cmd_ptr cmd = NULL; json_object* JObj = NULL; + json_obj_ptr json_obj = NULL; char* payload = kz_local_amqp_bytes_dup(body); if(payload == NULL) { @@ -2877,7 +2879,7 @@ void kz_send_targeted_cmd(int server_id, amqp_bytes_t body) goto error; } - json_obj_ptr json_obj = kz_json_parse(payload ); + json_obj = kz_json_parse(payload ); if (json_obj == NULL) { LM_ERR("error parsing json payload\n"); goto error; diff --git a/src/modules/kazoo/kz_json.c b/src/modules/kazoo/kz_json.c index 4fd30998f..5ab8f68c7 100644 --- a/src/modules/kazoo/kz_json.c +++ b/src/modules/kazoo/kz_json.c @@ -49,7 +49,7 @@ enum json_type kz_json_get_type(struct json_object *jso) typedef str* json_key; typedef json_key* json_keys; -json_keys str_split(char* a_str, const char a_delim, int* c) +json_keys kz_str_split(char* a_str, const char a_delim, int* c) { json_keys result = 0; int count = 0; @@ -145,7 +145,7 @@ struct json_object * kz_json_get_field_object(str* json, str* field) dup = pkg_malloc(field->len+1); memcpy(dup, field->s, field->len); dup[field->len] = '\0'; - keys = str_split(dup, '.', &parts); + keys = kz_str_split(dup, '.', &parts); pkg_free(dup); if (keys) diff --git a/src/modules/kex/README b/src/modules/kex/README index 30aeea29e..cfce43b6f 100644 --- a/src/modules/kex/README +++ b/src/modules/kex/README @@ -376,7 +376,9 @@ pv_printf("$avp(x)", "From: $fU - To: $tU"); 3.11. is_myself(uri) Check if the parameter matches the 'myself' condition (i.e., is a local - IP or domain). + IP or domain). Note that if the port is missing in the URI, then no + port matching is done (in other words, port matching is skipped -- it + does not use default SIP ports 5060 or 5061 for matching). Meaning of the parameters is as follows: * uri - Valid SIP URI or IP address to check against the list of diff --git a/src/modules/mqueue/README b/src/modules/mqueue/README index 7615f9038..19e079888 100644 --- a/src/modules/mqueue/README +++ b/src/modules/mqueue/README @@ -200,7 +200,7 @@ xlog("L_INFO", "Size of queue is: $var(q_size)\n"); 5. Exported Variables - * $mqv(mqueue) - the most recent item key fetched from the specified + * $mqk(mqueue) - the most recent item key fetched from the specified mqueue * $mqv(mqueue) - the most recent item value fetched from the specified mqueue diff --git a/src/modules/msilo/README b/src/modules/msilo/README index 5d4ff2146..456e53085 100644 --- a/src/modules/msilo/README +++ b/src/modules/msilo/README @@ -775,12 +775,6 @@ n") modparam("msilo","content_type_hdr","Content-Type: text/plain\r\n") modparam("msilo","offline_message","*** User $rU is offline!") -# -- tm params -- - -modparam("tm", "fr_timer", 10 ) -modparam("tm", "fr_inv_timer", 15 ) -modparam("tm", "wt_timer", 10 ) - route{ if ( !mf_process_maxfwd_header("10") ) diff --git a/src/modules/nathelper/README b/src/modules/nathelper/README index 7649b9552..55a124505 100644 --- a/src/modules/nathelper/README +++ b/src/modules/nathelper/README @@ -613,7 +613,8 @@ if(is_rfc1918("$rd")) { Adds an “;alias=ip~port~transport” parameter to the contact URI containing either received ip, port, and transport protocol or those given as parameters. If called without parameters, “;alias” parameter - is only added if received ip and port differ from those in contact URI. + is only added if received ip, port, or transport protocol differs from + that in contact URI. This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, BRANCH_ROUTE, and LOCAL_ROUTE. diff --git a/src/modules/p_usrloc/README b/src/modules/p_usrloc/README index 97f7d37f6..3f6bb6fbc 100644 --- a/src/modules/p_usrloc/README +++ b/src/modules/p_usrloc/README @@ -687,8 +687,8 @@ modparam("p_usrloc", "db_mode", 2) databases. For that, if the table was not created by the installation script or you choose to install everything by yourself you can use the p_usrloc-create.sql SQL script in the database directories in the - openser/scripts folder as template. Database and table name can be set - with module parameters so they can be changed, but the name of the + utils/kamctl/mysql/ folder as template. Database and table name can be + set with module parameters so they can be changed, but the name of the columns must be as they are in the SQL script. You can also find the complete database documentation on the project webpage, https://www.kamailio.org/docs/db-tables/kamailio-db-devel.html. diff --git a/src/modules/pdb/common.h b/src/modules/pdb/common.h index 1ba16cdf9..7c52c97ce 100644 --- a/src/modules/pdb/common.h +++ b/src/modules/pdb/common.h @@ -35,7 +35,8 @@ #define OTHER_CARRIERID 1000 #define MAX_CARRIERID 1000 #define NULL_CARRIERID -1001 -#define PAYLOADSIZE 256 +/* hdr size + PAYLOADSIZE must add to 255 (uint8_t pdb_hdr.length) */ +#define PAYLOADSIZE 249 #define IS_VALID_PDB_CARRIERID(id) ((id>=MIN_PDB_CARRIERID) && (id<=MAX_PDB_CARRIERID)) diff --git a/src/modules/pdb/pdb.c b/src/modules/pdb/pdb.c index e4ef6758d..3a67f45a1 100644 --- a/src/modules/pdb/pdb.c +++ b/src/modules/pdb/pdb.c @@ -147,7 +147,7 @@ static struct server_list_t *server_list; /* debug function for the new client <-> server protocol */ static void pdb_msg_dbg(struct pdb_msg msg, char *dbg_msg) { int i; - char buf[PAYLOADSIZE]; + char buf[PAYLOADSIZE * 3 + 1]; char *ptr = buf; for (i = 0; i < msg.hdr.length - sizeof(msg.hdr); i++) { @@ -267,7 +267,7 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t *_number, struct /* prepare request */ reqlen = number.len + 1; /* include null termination */ - if (reqlen > sizeof(struct pdb_bdy)) { + if (reqlen > PAYLOADSIZE) { LM_ERR("number too long '%.*s'.\n", number.len, number.s); return -1; } @@ -307,6 +307,7 @@ static int pdb_query(struct sip_msg *_msg, struct multiparam_t *_number, struct break; } + memset(&msg, 0, sizeof(struct pdb_msg)); /* wait for response */ for (;;) { if (gettimeofday(&tnow, NULL) != 0) { diff --git a/src/modules/phonenum/README b/src/modules/phonenum/README index 82aece96b..711a532e6 100644 --- a/src/modules/phonenum/README +++ b/src/modules/phonenum/README @@ -10,7 +10,7 @@ Daniel-Constantin Mierla - Copyright 2017 Daniel-Constantin Mierla (asipto.com) + Copyright © 2017 Daniel-Constantin Mierla (asipto.com) __________________________________________________________________ Table of Contents @@ -97,7 +97,7 @@ Chapter 1. Admin Guide Phone number search mode. - Default value is "0". + Default value is “0”. Example 1.1. Set smode parameter ... @@ -108,7 +108,7 @@ modparam("phonenum", "smode", 0) 4.1. phonenum_match(num, pvc) -4.1. phonenum_match(num, pvc) +4.1. phonenum_match(num, pvc) Match num against the libphonenumber and set the attributes inside the pvc container. The function has to be called before accessing a key @@ -120,8 +120,13 @@ modparam("phonenum", "smode", 0) Example 1.2. phonenum_match usage ... -if(phonenum_match("1-484-555-8888", "src")) - xlog("number normalized to: $phn(src=>num)\n"); +if(phonenum_match("1-484-555-8888", "src")) { + if($phn(src=>valid)==1) { + xlog("number normalized to: $phn(src=>normalized)\n"); + } else { + xlog("number normalization error: $phn(src=>error)\n"); + } +} ... 5. Pseudo Variables @@ -129,10 +134,14 @@ if(phonenum_match("1-484-555-8888", "src")) * $phn(pvc=>key) - pvc is an identifier for this query result; it is designated by the second parameter of phonenum_match(). The key can be one of the following: - + number - normalized phone number - + country - country for phone number - + region - region for phone number - + operator - operator for phone number + + number - phone number that is matched + + valid - 1 if the matched number has a valid result; 0 + otherwise + + normalized - normalized phone number + + cctel - country code for phone number + + ltype - local network type + + ndesc - phone number description + + error - error string if phone number matching fails. Exported pseudo-variables are documented at https://www.kamailio.org/wiki/. diff --git a/src/modules/pipelimit/README b/src/modules/pipelimit/README index 2dda0031a..0a174e2fb 100644 --- a/src/modules/pipelimit/README +++ b/src/modules/pipelimit/README @@ -120,15 +120,16 @@ Chapter 1. Admin Guide This module implements traffic limiting for SIP requests. The module defines in an abstract mode the notion of 'pipe', which can - be a link to an IP address, to a network or a trunk. The associtiation - of traffic to a pipe is done in the config file, therefore, a pipe - could represent SIP traffic coming from a user or the flow of specific - SIP requests such as INVITE or REGISTER. + be a reference to an IP address, to a network or a trunk. The + associtiation of traffic to a pipe is done in the config file, + therefore, a pipe could represent SIP traffic coming from a user or the + flow of specific SIP requests such as INVITE or REGISTER. Pipelimit started from ratelimit module, adding support for definition of pipes limits in database and dynamic names. Complexity of keeping everything in a module and make it dual mode functional resulted in a - new module which is focused on just traffic shaping policies. + new module which is focused on just traffic shaping policies, the + implementation of queues was discarded. 1.1. Algorithms @@ -141,7 +142,8 @@ Chapter 1. Admin Guide This is a trivial algorithm that imposes some risks when used in conjunction with long timer intervals. At the start of each interval an internal counter is reset and incremented for each incoming message. - Once the counter hits the configured limit pl_check returns an error. + Once the counter hits the configured limit pl_check() returns false + (negative value). Random Early Detection Algorithm (RED) @@ -160,8 +162,8 @@ Chapter 1. Admin Guide This algorithm relies on information provided by network interfaces. The total amount of bytes waiting to be consumed on all the network interfaces is retrieved once every timer_interval seconds. If the - returned amount exceeds the limit specified in the modparam, pl_check - returns an error. + returned amount exceeds the limit specified in the modparam, pl_check() + returns false (negative value). Feedback Algorithm (FEEDBACK) @@ -277,12 +279,15 @@ modparam("pipelimit", "plp_algorithm_column", "name") 3.7. timer_interval (integer) - The initial length of a timer interval in seconds. All amounts of - messages have to be divided by this timer to get a messages per second - value. + The length of the timer interval in seconds. Counted messages are reset + each timer_interval, therefore the amounts of messages have to be + divided by this timer_interval value to get the messages per second + value. For example, if you want to allow an average of 10 messages per + second with a timer inteval of 10 seconds, then the limit value has to + be 100. - IMPORTANT: A too small value may lead to performance penalties due to - timer process overloading. + Note: A too small value may lead to performance penalties due to timer + process overloading. Default value is 10. @@ -333,8 +338,9 @@ kamcmd cfg.set_now_string pipelimit reply_reason "Limiting" Check the current request against the 'name' pipe. If algorithm and limit are provided, the function attempts to create a - new pipe of one with that name doesn't exit. If it exists, no changes - to algorithm and limit are done. Algorithm is case sensitive. + new pipe if one with that name doesn't exit. If it exists, no changes + to algorithm is done and the pipe limit is set to the 'limit' parameter + value, if this is greater than 0. Algorithm is case sensitive. The pipe name can be provided via a pseudo variabile. @@ -349,7 +355,8 @@ kamcmd cfg.set_now_string pipelimit reply_reason "Limiting" * algorithm - the string or pseudovariable with the algorithm. The values can be: TAILDROP, RED, NETWORK, or FEEDBACK - see readme of ratelimit module for details on each algorithm. - * limit - the integer or pseudovariable with the limit value. + * limit - the integer or pseudovariable with the limit value per + timer_interval. This function can be used from ANY_ROUTE. diff --git a/src/modules/presence/presentity.c b/src/modules/presence/presentity.c index 1a0271aea..641ef8914 100644 --- a/src/modules/presence/presentity.c +++ b/src/modules/presence/presentity.c @@ -379,6 +379,10 @@ int delete_presentity_if_dialog_id_exists(presentity_t* presentity, int i = 0; presentity_t old_presentity; + if (presentity->event->evp->type != EVENT_DIALOG) { + return 0; + } + query_cols[n_query_cols] = &str_domain_col; query_ops[n_query_cols] = OP_EQ; query_vals[n_query_cols].type = DB1_STR; @@ -706,17 +710,18 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body, goto error; } } + if (presentity->event->evp->type == EVENT_DIALOG) { + check_if_dialog(*body, &is_dialog, &dialog_id); + if (dialog_id) { + if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) { + free(dialog_id); + dialog_id = NULL; + goto error; + } - check_if_dialog(*body, &is_dialog, &dialog_id); - if ( dialog_id ) { - if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) { free(dialog_id); dialog_id = NULL; - goto error; } - - free(dialog_id); - dialog_id = NULL; } LM_DBG("inserting %d cols into table\n",n_query_cols); diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c index 6f6fe9328..e7c07a005 100644 --- a/src/modules/pv/pv_trans.c +++ b/src/modules/pv/pv_trans.c @@ -2051,28 +2051,28 @@ done: } \ } -#define _tr_parse_sparam(_p, _p0, _tp, _spec, _ps, _in, _s) \ +/** + * _m: 1 - the parameter value can be the TR_PARAM_MARKER; 0 - not allowed + */ +#define _tr_parse_sparamx(_p, _p0, _tp, _spec, _ps, _in, _s, _m) \ while(is_in_str(_p, _in) && (*_p==' ' || *_p=='\t' || *_p=='\n')) _p++; \ if(*_p==PV_MARKER) \ { /* pseudo-variable */ \ _spec = (pv_spec_t*)pkg_malloc(sizeof(pv_spec_t)); \ - if(_spec==NULL) \ - { \ + if(_spec==NULL) { \ LM_ERR("no more private memory!\n"); \ goto error; \ } \ _s.s = _p; _s.len = _in->s + _in->len - _p; \ _p0 = pv_parse_spec(&_s, _spec); \ - if(_p0==NULL) \ - { \ + if(_p0==NULL) { \ LM_ERR("invalid spec in substr transformation: %.*s!\n", \ _in->len, _in->s); \ goto error; \ } \ _p = _p0; \ _tp = (tr_param_t*)pkg_malloc(sizeof(tr_param_t)); \ - if(_tp==NULL) \ - { \ + if(_tp==NULL) { \ LM_ERR("no more private memory!\n"); \ goto error; \ } \ @@ -2083,17 +2083,23 @@ done: _ps = _p; \ while(is_in_str(_p, _in) && *_p!='\t' && *_p!='\n' \ && *_p!=TR_PARAM_MARKER && *_p!=TR_RBRACKET) \ - _p++; \ - if(*_p=='\0') \ - { \ + _p++; \ + if(*_p=='\0') { \ LM_ERR("invalid param in transformation: %.*s!!\n", \ _in->len, _in->s); \ goto error; \ } \ + if(_m && *_p==TR_PARAM_MARKER) { \ + _p++; \ + if(*_p=='\0') { \ + LM_ERR("invalid param in transformation: %.*s!!!\n", \ + _in->len, _in->s); \ + goto error; \ + } \ + } \ _tp = (tr_param_t*)pkg_malloc(sizeof(tr_param_t)); \ - if(_tp==NULL) \ - { \ - LM_ERR("no more private memory!\n"); \ + if(_tp==NULL) { \ + LM_ERR("no more private memory!!\n"); \ goto error; \ } \ memset(_tp, 0, sizeof(tr_param_t)); \ @@ -2102,6 +2108,8 @@ done: _tp->v.s.len = _p - _ps; \ } +#define _tr_parse_sparam(_p, _p0, _tp, _spec, _ps, _in, _s) \ + _tr_parse_sparamx(_p, _p0, _tp, _spec, _ps, _in, _s, 0) /*! * \brief Helper fuction to parse a string transformation @@ -2758,13 +2766,11 @@ char* tr_parse_paramlist(str* in, trans_t *t) goto done; } else if(name.len==5 && strncasecmp(name.s, "count", 5)==0) { t->subtype = TR_PL_COUNT; - if(*p==TR_PARAM_MARKER) - { + if(*p==TR_PARAM_MARKER) { start_pos = ++p; - _tr_parse_sparam(p, p0, tp, spec, ps, in, s); + _tr_parse_sparamx(p, p0, tp, spec, ps, in, s, 1); t->params = tp; - if (tp->type != TR_PARAM_SPEC && p - start_pos != 1) - { + if (tp->type != TR_PARAM_SPEC && p - start_pos != 1) { LM_ERR("invalid separator in transformation: " "%.*s\n", in->len, in->s); goto error; @@ -2772,8 +2778,7 @@ char* tr_parse_paramlist(str* in, trans_t *t) tp = 0; while(*p && (*p==' ' || *p=='\t' || *p=='\n')) p++; - if(*p!=TR_RBRACKET) - { + if(*p!=TR_RBRACKET) { LM_ERR("invalid name transformation: %.*s!\n", in->len, in->s); goto error; diff --git a/src/modules/rabbitmq/rabbitmq.c b/src/modules/rabbitmq/rabbitmq.c index 1e5ae7f35..32c6ad130 100644 --- a/src/modules/rabbitmq/rabbitmq.c +++ b/src/modules/rabbitmq/rabbitmq.c @@ -68,16 +68,16 @@ static int rabbitmq_publish_consume( static int mod_init(void); static int mod_child_init(int); -amqp_socket_t *amqp_sock = NULL; -amqp_connection_state_t conn = NULL; +static amqp_socket_t *amqp_sock = NULL; +static amqp_connection_state_t amqp_conn = NULL; /* module parameters */ -struct amqp_connection_info amqp_info; -char *amqp_url = RABBITMQ_DEFAULT_AMQP_URL; -int max_reconnect_attempts = 1; -int timeout_sec = 1; -int timeout_usec = 0; -int direct_reply_to = 0; +static struct amqp_connection_info amqp_info; +static char *amqp_url = RABBITMQ_DEFAULT_AMQP_URL; +static int max_reconnect_attempts = 1; +static int timeout_sec = 1; +static int timeout_usec = 0; +static int direct_reply_to = 0; /* module helper functions */ static int rabbitmq_connect(amqp_connection_state_t *conn); @@ -85,7 +85,7 @@ static int rabbitmq_disconnect(amqp_connection_state_t *conn); static int rabbitmq_reconnect(amqp_connection_state_t *conn); /* module fixup functions */ -static int fixup_params(void **param, int param_no) +static int rbmq_fixup_params(void **param, int param_no) { if(param_no == 5) { if(fixup_pvar_null(param, 1) != 0) { @@ -98,18 +98,18 @@ static int fixup_params(void **param, int param_no) } return 0; } else { - return fixup_spve_null(param, 1); + return fixup_spve_all(param, param_no); } return -1; } -static int fixup_free_params(void **param, int param_no) +static int rbmq_fixup_free_params(void **param, int param_no) { if(param_no == 5) { return fixup_free_pvar_null(param, 1); } else { - return fixup_free_spve_null(param, 1); + return fixup_free_spve_all(param, param_no); } return -1; @@ -117,10 +117,10 @@ static int fixup_free_params(void **param, int param_no) /* module commands */ static cmd_export_t cmds[] = { - {"rabbitmq_publish", (cmd_function)rabbitmq_publish, 4, fixup_params, - fixup_free_params, REQUEST_ROUTE}, + {"rabbitmq_publish", (cmd_function)rabbitmq_publish, 4, fixup_spve_all, + fixup_free_spve_all, REQUEST_ROUTE}, {"rabbitmq_publish_consume", (cmd_function)rabbitmq_publish_consume, 5, - fixup_params, fixup_free_params, REQUEST_ROUTE}, + rbmq_fixup_params, rbmq_fixup_free_params, REQUEST_ROUTE}, {0, 0, 0, 0, 0, 0} }; @@ -170,7 +170,7 @@ static int mod_child_init(int rank) } // routing process - if(rabbitmq_connect(&conn) != RABBITMQ_OK) { + if(rabbitmq_connect(&amqp_conn) != RABBITMQ_OK) { LM_ERR("FAIL rabbitmq_connect()"); return -1; } @@ -188,9 +188,9 @@ static int ki_rabbitmq_publish(sip_msg_t *msg, str *exchange, str *routingkey, reconnect: // open channel - amqp_channel_open(conn, 1); + amqp_channel_open(amqp_conn, 1); log_ret = - log_on_amqp_error(amqp_get_rpc_reply(conn), "amqp_channel_open()"); + log_on_amqp_error(amqp_get_rpc_reply(amqp_conn), "amqp_channel_open()"); // open channel - failed if(log_ret != AMQP_RESPONSE_NORMAL) { @@ -203,7 +203,7 @@ reconnect: LM_ERR("RETRY: rabbitmq_reconnect()\n"); // reconnect - success - if(rabbitmq_reconnect(&conn) == RABBITMQ_OK) { + if(rabbitmq_reconnect(&amqp_conn) == RABBITMQ_OK) { // reconnect - debug LM_ERR("SUCCESS: rabbitmq_reconnect()\n"); } @@ -214,7 +214,7 @@ reconnect: } // reconnect - close channel - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); // reconnect - return error return RABBITMQ_ERR_CHANNEL; @@ -229,7 +229,7 @@ reconnect: props.correlation_id = amqp_cstring_bytes("1"); // publish - if(log_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes(exchange->s), + if(log_on_error(amqp_basic_publish(amqp_conn, 1, amqp_cstring_bytes(exchange->s), amqp_cstring_bytes(routingkey->s), 0, 0, &props, amqp_cstring_bytes(messagebody->s)), "amqp_basic_publish()") @@ -238,7 +238,8 @@ reconnect: LM_ERR("FAIL: amqp_basic_publish()\n"); // cleanup - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_maybe_release_buffers(amqp_conn); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); // error return RABBITMQ_ERR_PUBLISH; @@ -248,7 +249,8 @@ reconnect: LM_DBG("SUCCESS: amqp_basic_publish()\n"); // cleanup - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_maybe_release_buffers(amqp_conn); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); // success return RABBITMQ_OK; @@ -311,9 +313,9 @@ static int rabbitmq_publish_consume_helper(sip_msg_t *msg, str *exchange, reconnect: // open channel - amqp_channel_open(conn, 1); + amqp_channel_open(amqp_conn, 1); log_ret = - log_on_amqp_error(amqp_get_rpc_reply(conn), "amqp_channel_open()"); + log_on_amqp_error(amqp_get_rpc_reply(amqp_conn), "amqp_channel_open()"); // open channel - failed if(log_ret != AMQP_RESPONSE_NORMAL) { @@ -326,7 +328,7 @@ reconnect: LM_ERR("RETRY: rabbitmq_reconnect()\n"); // reconnect - success - if(rabbitmq_reconnect(&conn) == RABBITMQ_OK) { + if(rabbitmq_reconnect(&amqp_conn) == RABBITMQ_OK) { // reconnect - debug LM_ERR("SUCCESS: rabbitmq_reconnect()\n"); } @@ -337,7 +339,7 @@ reconnect: } // reconnect - close channel - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); // reconnect - return error return RABBITMQ_ERR_CHANNEL; @@ -345,7 +347,7 @@ reconnect: // alloc reply_to queue if(direct_reply_to == 1) { - reply_to = amqp_queue_declare(conn, 1, + reply_to = amqp_queue_declare(amqp_conn, 1, amqp_cstring_bytes("amq.rabbitmq.reply-to"), 0, 0, 1, 1, amqp_empty_table); } else { @@ -356,14 +358,14 @@ reconnect: strcat(reply_to_buffer, uuid_buffer); reply_to = - amqp_queue_declare(conn, 1, amqp_cstring_bytes(reply_to_buffer), + amqp_queue_declare(amqp_conn, 1, amqp_cstring_bytes(reply_to_buffer), 0, 0, 1, 1, amqp_empty_table); } - if(log_on_amqp_error(amqp_get_rpc_reply(conn), "amqp_queue_declare()") + if(log_on_amqp_error(amqp_get_rpc_reply(amqp_conn), "amqp_queue_declare()") != AMQP_RESPONSE_NORMAL) { LM_ERR("FAIL: amqp_queue_declare()\n"); - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); return RABBITMQ_ERR_QUEUE; } @@ -379,36 +381,36 @@ reconnect: props.reply_to = reply_to->queue; if(props.reply_to.bytes == NULL) { LM_ERR("Out of memory while copying queue name"); - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); return -1; } props.correlation_id = amqp_cstring_bytes("1"); // start consume - amqp_basic_consume(conn, 1, reply_to->queue, amqp_empty_bytes, 0, 1, 0, + amqp_basic_consume(amqp_conn, 1, reply_to->queue, amqp_empty_bytes, 0, 1, 0, amqp_empty_table); - if(log_on_amqp_error(amqp_get_rpc_reply(conn), "amqp_basic_consume()") + if(log_on_amqp_error(amqp_get_rpc_reply(amqp_conn), "amqp_basic_consume()") != AMQP_RESPONSE_NORMAL) { LM_ERR("FAIL: amqp_basic_consume()\n"); - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); return RABBITMQ_ERR_CONSUME; } // publish - if(log_on_error(amqp_basic_publish(conn, 1, amqp_cstring_bytes(exchange->s), + if(log_on_error(amqp_basic_publish(amqp_conn, 1, amqp_cstring_bytes(exchange->s), amqp_cstring_bytes(routingkey->s), 0, 0, &props, amqp_cstring_bytes(messagebody->s)), "amqp_basic_publish()") != AMQP_RESPONSE_NORMAL) { LM_ERR("FAIL: amqp_basic_publish()\n"); - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); return RABBITMQ_ERR_PUBLISH; } // consume frame for(;;) { - amqp_maybe_release_buffers(conn); - result = amqp_simple_wait_frame_noblock(conn, &frame, &tv); + amqp_maybe_release_buffers(amqp_conn); + result = amqp_simple_wait_frame_noblock(amqp_conn, &frame, &tv); if(result < 0) { LM_ERR("amqp_simple_wait_frame_noblock() error: %d\n", result); result = -1; @@ -433,7 +435,7 @@ reconnect: (char *)d->exchange.bytes, (int)d->routing_key.len, (char *)d->routing_key.bytes); - result = amqp_simple_wait_frame_noblock(conn, &frame, &tv); + result = amqp_simple_wait_frame_noblock(amqp_conn, &frame, &tv); if(result < 0) { LM_ERR("amqp_simple_wait_frame_noblock() error: %d\n", result); result = -1; @@ -458,7 +460,7 @@ reconnect: body_received = 0; while(body_received < body_target) { - result = amqp_simple_wait_frame_noblock(conn, &frame, &tv); + result = amqp_simple_wait_frame_noblock(amqp_conn, &frame, &tv); if(result < 0) { LM_ERR("amqp_simple_wait_frame_noblock() error: %d\n", result); result = -1; @@ -495,7 +497,7 @@ reconnect: break; } - amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS); + amqp_channel_close(amqp_conn, 1, AMQP_REPLY_SUCCESS); return result; } diff --git a/src/modules/regex/doc/regex_admin.xml b/src/modules/regex/doc/regex_admin.xml index e0e052a82..00320c05e 100644 --- a/src/modules/regex/doc/regex_admin.xml +++ b/src/modules/regex/doc/regex_admin.xml @@ -10,18 +10,18 @@ - + &adminguide; - +
- + Overview - + This module offers matching operations using regular expressions based on the powerful PCRE library. - + A text file containing regular expressions categorized in groups is compiled when the module is loaded, the resulting PCRE objects are stored in an array. A @@ -30,18 +30,18 @@ The module also offers a function to perform a PCRE matching operation against a regular expression provided as function parameter. - + For a detailed list of PCRE features read the man page of the library. - +
- +
- + Dependencies - +
&kamailio; Modules @@ -70,9 +70,9 @@
- +
- +
Parameters @@ -230,7 +230,7 @@ modparam("regex", "pcre_extended", 1)
Functions -
+
<function moreinfo="none">pcre_match (string, pcre_regex)</function> @@ -294,7 +294,7 @@ if (pcre_match("$rU", "^user[1234]$$")) { # Will be converted to "^user[1234]$"
-
+
<function moreinfo="none">pcre_match_group (string [, group])</function> @@ -353,7 +353,7 @@ if (pcre_match_group("$ua", "$avp(i:10)")) { ... - +
@@ -391,13 +391,13 @@ if (pcre_match_group("$ua", "$avp(i:10)")) {
- +
Installation and Running - +
File format - + The file contains regular expressions categorized in groups. Each group starts with "[number]" line. Lines starting by space, tab, @@ -405,11 +405,11 @@ if (pcre_match_group("$ua", "$avp(i:10)")) { take up just one line, this means that a regular expression can't be splitted in various lines. - + An example of the file format would be the following: - + regex file @@ -446,14 +446,14 @@ if (pcre_match_group("$ua", "$avp(i:10)")) { ^1\d{3}$ ^((\+|00)34)?900\d{6}$ - + The module compiles the text above to the following regular expressions: - + group 0: ((^Twinkle/1)|(^X-Lite)|(^eyeBeam)|(^Bria)|(^SIP Communicator)| (^Linphone)|(^Snom)|(^SIPp)|(^PJSUA)) @@ -465,7 +465,7 @@ group 2: ((^1\d{3}$)|(^((\+|00)34)?900\d{6}$)) The first group can be used to avoid auto-generated PUBLISH (pua_usrloc module) for UA's already supporting presence: - + Using with pua_usrloc @@ -479,14 +479,14 @@ route[REGISTER] { } - + NOTE: It's important to understand that the numbers in each group header ([number]) must start by 0. If not, the real group number will not match the number appearing in the file. For example, the following text file: - + Incorrect groups file @@ -499,39 +499,39 @@ route[REGISTER] { ^ddd - + will generate the following regular expressions: - + group 0: ((^aaa)|(^bbb)) group 1: ((^ccc)|(^ddd)) - + Note that the real index doesn't match the group number in the file. This is, compiled group 0 always points to the first group in the file, regardless of its number in the file. In fact, the group number appearing in the file is used for nothing but for delimiting different groups. - + NOTE: A line containing a regular expression cannot start by '[' since it would be treated as a new group. The same for lines starting by space, tab, or '#' (they would be ignored by the parser). As a workaround, using brackets would work: - + [0] ([0-9]{9}) ( #abcde) ( qwerty) - +
- + diff --git a/src/modules/regex/regex_mod.c b/src/modules/regex/regex_mod.c index 9d5cbf6cf..6c3e088d6 100644 --- a/src/modules/regex/regex_mod.c +++ b/src/modules/regex/regex_mod.c @@ -638,7 +638,7 @@ static int ki_pcre_match_group(sip_msg_t* _msg, str* string, int num_pcre) static int w_pcre_match_group(struct sip_msg* _msg, char* _s1, char* _s2) { str string, group; - unsigned int num_pcre; + unsigned int num_pcre = 0; if (_s1 == NULL) { LM_ERR("bad parameters\n"); diff --git a/src/modules/rr/README b/src/modules/rr/README index 5bbc59d11..69cecd490 100644 --- a/src/modules/rr/README +++ b/src/modules/rr/README @@ -166,8 +166,8 @@ Chapter 1. Admin Guide 3261 (see 12.1.1 UAS behavior). For this purpose, the modules offers the following functions: - * add_rr_param() - see Section 5.6, “add_rr_param(param)” - * check_route_param() - see Section 5.7, “check_route_param(re)” + * add_rr_param() - see ??? + * check_route_param() - see ??? Example 1.1. Dialog support in RR module ... @@ -478,9 +478,8 @@ record_route_advertised_address("1.2.3.4:5080"); Adds a parameter to the Record-Route URI (param must be in “;name=value” format. The function may be called also before or after - the record_route() or record_route_advertised_address() calls (see - Section 5.2, “record_route() and record_route(string)” or Section 5.5, - “record_route_advertised_address(address)”)). + the record_route() or record_route_advertised_address() calls (see ??? + or ???)). Meaning of the parameters is as follows: * param - String containing the URI parameter to be added. It must @@ -498,8 +497,7 @@ add_rr_param(";nat=yes"); The function checks if the URI parameters of the local Route header (corresponding to the local server) matches the given regular - expression. It must be call after loose_route() (see Section 5.1, - “loose_route()”). + expression. It must be call after loose_route() (see ???). Meaning of the parameters is as follows: * re - regular expression to check against the Route URI parameters. @@ -517,9 +515,8 @@ if (check_route_param("nat=yes")) { The function checks the flow direction of in-dialog requests. This function uses the “ftag” prameter from the Route header, therefore the - append_fromtag (see Section 4.2, “append_fromtag (integer)” module - parameter must be enabled. Also this must be called only after - loose_route() (see Section 5.1, “loose_route()”). + append_fromtag (see ??? module parameter must be enabled. Also this + must be called only after loose_route() (see ???). The function returns true if the “dir” is the same with the request's flow direction. @@ -661,9 +658,8 @@ record_route_advertised_address("1.2.3.4:5090"); The function checks the flow direction of the request “msg”. As for checking it's used the “ftag” Route header parameter, the - append_fromtag (see Section 4.2, “append_fromtag (integer)” module - parameter must be enables. Also this must be call only after the - loose_route is done. + append_fromtag (see ??? module parameter must be enables. Also this + must be call only after the loose_route is done. The function returns 0 if the “dir” is the same with the request's flow direction. Otherwise, -1 is returned. diff --git a/src/modules/rtpengine/README b/src/modules/rtpengine/README index cef0c098d..de3b52553 100644 --- a/src/modules/rtpengine/README +++ b/src/modules/rtpengine/README @@ -1883,20 +1883,21 @@ rtpengine_offer(); otherwise the RTP proxy will only insert itself as additional ICE candidate. Other SDP substitutions (c=, m=, etc) are unaffected by this flag. - + RTP, SRTP, AVP, AVPF - These flags control the RTP transport - protocol that should be used towards the recipient of the SDP. - If none of them are specified, the protocol given in the SDP - is left untouched. Otherwise, the “SRTP” flag indicates that - SRTP should be used, while “RTP” indicates that SRTP should - not be used. “AVPF” indicates that the advanced RTCP profile - with feedback messages should be used, and “AVP” indicates - that the regular RTCP profile should be used. See also the - next set of flags below. - + RTP/AVP, RTP/SAVP, RTP/AVPF, RTP/SAVPF - these serve as an - alternative, more explicit way to select between the different - RTP protocols and profiles supported by the RTP proxy. For - example, giving the flag “RTP/SAVPF” has the same effect as - giving the two flags “SRTP AVPF”. + + RTP, SRTP, DTLS, AVP, AVPF - These flags control the RTP + transport protocol that should be used towards the recipient + of the SDP. If none of them are specified, the protocol given + in the SDP is left untouched. Otherwise, the “SRTP” flag + indicates that SRTP should be used, while “RTP” indicates that + SRTP should not be used. “AVPF” indicates that the advanced + RTCP profile with feedback messages should be used, and “AVP” + indicates that the regular RTCP profile should be used. See + also the next set of flags below. + + RTP/AVP, RTP/SAVP, UDP/TLS/RTP/SAVP, RTP/AVPF, RTP/SAVPF, + UDP/TLS/RTP/SAVPF - these serve as an alternative, more + explicit way to select between the different RTP protocols and + profiles supported by the RTP proxy. For example, giving the + flag “RTP/SAVPF” has the same effect as giving the two flags + “SRTP AVPF”. + to-tag - force inclusion of the “To” tag. Normally, the “To” tag is always included when present, except for “delete” messages. Including the “To” tag in a “delete” messages allows diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index cc2c048a9..f11d03d3f 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/src/modules/rtpengine/rtpengine.c @@ -2501,7 +2501,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen) } v[0].iov_base = gencookie(); v[0].iov_len = strlen(v[0].iov_base); - rtpengine_retr = cfg_get(rtpengine,rtpengine_cfg,rtpengine_retr); + rtpengine_retr = cfg_get(rtpengine,rtpengine_cfg,rtpengine_retr); for (i = 0; i < rtpengine_retr; i++) { do { len = writev(rtpp_socks[node->idx], v, vcnt + 1); @@ -2511,14 +2511,14 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen) LM_ERR("can't send command \"%.*s\" to RTP proxy <%s>\n", out.len, out.s, node->rn_url.s); goto badproxy; } - rtpengine_tout_ms = cfg_get(rtpengine,rtpengine_cfg,rtpengine_tout_ms); + rtpengine_tout_ms = cfg_get(rtpengine,rtpengine_cfg,rtpengine_tout_ms); while ((poll(fds, 1, rtpengine_tout_ms) == 1) && (fds[0].revents & POLLIN) != 0) { do { len = recv(rtpp_socks[node->idx], buf, sizeof(buf)-1, 0); } while (len == -1 && errno == EINTR); if (len <= 0) { - LM_ERR("can't read reply from RTP proxy <%s>\n", node->rn_url.s); + LM_ERR("can't read reply for command \"%.*s\" from RTP proxy <%s>\n", out.len, out.s, node->rn_url.s); goto badproxy; } if (len >= (v[0].iov_len - 1) && @@ -2535,7 +2535,7 @@ send_rtpp_command(struct rtpp_node *node, bencode_item_t *dict, int *outlen) } } if (i == rtpengine_retr) { - LM_ERR("timeout waiting reply from RTP proxy <%s>\n", node->rn_url.s); + LM_ERR("timeout waiting reply for command \"%.*s\" from RTP proxy <%s>\n", out.len, out.s, node->rn_url.s); goto badproxy; } } diff --git a/src/modules/rtpproxy/README b/src/modules/rtpproxy/README index 3c2c38916..f845311bb 100644 --- a/src/modules/rtpproxy/README +++ b/src/modules/rtpproxy/README @@ -230,7 +230,7 @@ Chapter 1. Admin Guide 4.1. rtpproxy_sock (string) - Used to define the list of RTPPRoxy instances to connect to. These can + Used to define the list of RTPProxy instances to connect to. These can be UNIX sockets or IPv4/IPv6 UDP sockets. Each modparam entry will insert sockets into a single set. If no set ID is given, the default set ID '0' will be used. To define multiple sets add the set number at diff --git a/src/modules/sanity/README b/src/modules/sanity/README index cbece0ebd..24569d772 100644 --- a/src/modules/sanity/README +++ b/src/modules/sanity/README @@ -120,10 +120,10 @@ Chapter 1. Admin Guide of the sanity_check function. The integer value is the sum of the check numbers which should be executed by default. - Default value is “999”. This resolves to the following list of checks: + Default value is “3047”. This resolves to the following list of checks: ruri_sip_version (1), ruri_scheme (2), required_headers (4), - cseq_method (32), cseq_value (64), cotent_length (128), expires_value - (256), proxy_require (512). + cseq_method (32), cseq_value (64), content_length (128), expires_value + (256), proxy_require (512), digest credentials (2048). Example 1.1. Set default_checks parameter ... diff --git a/src/modules/sctp/README b/src/modules/sctp/README index c8f5ffa46..16d68c322 100644 --- a/src/modules/sctp/README +++ b/src/modules/sctp/README @@ -120,6 +120,9 @@ Chapter 1. Admin Guide not changed and SCTP variable is not overwritten from command line, then the SCTP support in core is enabled. + Note: it is recommended to use recent versions of libsctp (>1.0.10) and + kernel (>4.0.0) when enabling SCTP transport. + 2. Dependencies 2.1. Kamailio Modules diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c index 035ace455..1e26bc213 100644 --- a/src/modules/siptrace/siptrace.c +++ b/src/modules/siptrace/siptrace.c @@ -1520,7 +1520,10 @@ int siptrace_net_data_send(sr_event_param_t *evp) return -1; new_dst = *nd->dst; - new_dst.send_sock = get_send_socket(0, &nd->dst->to, nd->dst->proto); + + if(new_dst.send_sock == 0) { + new_dst.send_sock = get_send_socket(0, &nd->dst->to, nd->dst->proto); + } memset(&sto, 0, sizeof(siptrace_data_t)); diff --git a/src/modules/siputils/README b/src/modules/siputils/README index 11ecba4d6..3db13beda 100644 --- a/src/modules/siputils/README +++ b/src/modules/siputils/README @@ -927,9 +927,11 @@ if (is_supported("outbound")) { ... } sender. For incoming SIP requests, it means there is only one Via header. For incoming SIP replies, it means that top Record-Route URI is 'myself' and source address is not matching it (to avoid detecting in - case of local loops). Note that it does not detect spirals, which can - have the condition for replies true also in the case of additional SIP - reply receival. + case of local loops). The detection is done only when Record-Route has + an IP address in its URI (for a domain, it returns -1/false). + + Note that it does not detect spirals, which can have the condition for + replies true also in the case of additional SIP reply reception. This function can be used from ANY_ROUTE. diff --git a/src/modules/speeddial/README b/src/modules/speeddial/README index fa3027b4f..d2a68ccb1 100644 --- a/src/modules/speeddial/README +++ b/src/modules/speeddial/README @@ -126,7 +126,7 @@ Chapter 1. Admin Guide Example 1.1. Set db_url parameter ... -modparam("speeddial", "db_url", "mysql://openser:xxx@localhost/openser") +modparam("speeddial", "db_url", "mysql://kamailio:xxx@localhost/kamailio") ... 3.2. user_column (string) @@ -231,7 +231,7 @@ modparam("speeddial", "use_domain", 1) Example 1.9. sd_lookup usage ... -# 'speed_dial' is the default table name created by openser db script +# 'speed_dial' is the default table name created by kamailio db script if(uri=~"sip:[0-9]{2}@.*") sd_lookup("speed_dial"); # use auth username diff --git a/src/modules/textops/README b/src/modules/textops/README index 00875a04b..309a76643 100644 --- a/src/modules/textops/README +++ b/src/modules/textops/README @@ -910,9 +910,10 @@ if(has_body("application/sdp")) 4.32. is_audio_on_hold() The function returns true if the SIP message has a body attached and at - least one audio stream in on hold. Only RFC2543 is supported - (c=0.0.0.0). Hold detection based on RFC3264 is not supported - (a=sendonly/inactive). + least one audio stream in on hold. The return code of the function + indicates the detected hold type: + * 1 - RFC2543 hold type: null connection IP detected + * 2 - RFC3264 hold type: inactive or sendonly attributes detected This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE and BRANCH_ROUTE. @@ -921,7 +922,15 @@ if(has_body("application/sdp")) ... if(is_audio_on_hold()) { - # do interesting stuff here + switch ($rc) { + case 1: + # RFC2543 hold type + # do interesting stuff here + break; + case 2: + # RFC3264 hold type + # do interesting stuff here + break; } ... @@ -956,7 +965,7 @@ if(is_privacy("id")) ... $var(subject) = "fi"; $var(list) = "dk,fi,no,se"; -if (in_list("$var(subject)", "$var(list)", ",") { +if (in_list("$var(subject)", "$var(list)", ",")) { xlog("L_INFO", "subject is found in list\n"); } ... diff --git a/src/modules/textopsx/README b/src/modules/textopsx/README index 071eec2ee..60b458d18 100644 --- a/src/modules/textopsx/README +++ b/src/modules/textopsx/README @@ -156,8 +156,8 @@ if(msg_apply_changes()) Example 1.2. change_reply_status usage ... -onreply_route { - if (@status == "603") { +reply_route { + if (status == "603") { change_reply_status(404, "Not Found"); exit; } diff --git a/src/modules/tm/README b/src/modules/tm/README index 0b484fa6a..a95e62b38 100644 --- a/src/modules/tm/README +++ b/src/modules/tm/README @@ -146,6 +146,7 @@ Daniel-Constantin Mierla 6. Event Routes 6.1. event_route[tm:branch-failure] + 6.2. event_route[tm:local-response] 7. TM Module API @@ -260,6 +261,7 @@ Daniel-Constantin Mierla 1.91. t_is_retr_async_reply usage 1.92. t_uac_send usage 1.93. event_route[tm:branch-failure] usage + 1.94. event_route[tm:local-response] usage Chapter 1. Admin Guide @@ -387,6 +389,7 @@ Chapter 1. Admin Guide 6. Event Routes 6.1. event_route[tm:branch-failure] + 6.2. event_route[tm:local-response] 7. TM Module API @@ -2900,6 +2903,7 @@ t_uac_send("OPTIONS", "sip:alice@kamailio.org", "", "", 6. Event Routes 6.1. event_route[tm:branch-failure] + 6.2. event_route[tm:local-response] 6.1. event_route[tm:branch-failure] @@ -2924,6 +2928,18 @@ event_route[tm:branch-failure:myroute] { } ... +6.2. event_route[tm:local-response] + + Executed after the tm module has sent a local generated, transaction + stateful response. + + Example 1.94. event_route[tm:local-response] usage +... +event_route[tm:local-response] { + xlog("tm:local-response replied locally\n"); +} +... + 7. TM Module API 7.1. Defines diff --git a/src/modules/tm/t_lookup.c b/src/modules/tm/t_lookup.c index 400af5e03..e178510e8 100644 --- a/src/modules/tm/t_lookup.c +++ b/src/modules/tm/t_lookup.c @@ -47,6 +47,7 @@ #include "../../core/parser/parser_f.h" #include "../../core/parser/parse_from.h" #include "../../core/ut.h" +#include "../../core/fmsg.h" #include "../../core/timer.h" #include "../../core/timer_ticks.h" #include "../../core/hash_func.h" @@ -1319,6 +1320,10 @@ int t_newtran( struct sip_msg* p_msg ) LM_DBG("msg id=%d , global msg id=%d ," " T on entrance=%p\n",p_msg->id,global_msg_id,T); + if(faked_msg_match(p_msg)) { + LM_INFO("attempt to create transaction for a faked request" + " - try to avoid it\n"); + } if ( T && T!=T_UNDEFINED ) { /* ERROR message moved to w_t_newtran */ LM_DBG("transaction already in process %p\n", T ); diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c index 67ee4784d..9ac51798a 100644 --- a/src/modules/tm/t_reply.c +++ b/src/modules/tm/t_reply.c @@ -477,7 +477,7 @@ static int _reply_light( struct cell *trans, char* buf, unsigned int len, if (lock) LOCK_REPLIES( trans ); if (trans->uas.status>=200) { - LM_ERR("can't generate %d reply when a final %d was sent out\n", + LM_INFO("can't generate %d reply when a final %d was sent out\n", code, trans->uas.status); goto error2; } @@ -2171,7 +2171,7 @@ int reply_received( struct sip_msg *p_msg ) #ifdef WITH_XAVP sr_xavp_t **backup_xavps; #endif - int replies_locked; + int replies_locked = 0; #ifdef USE_DNS_FAILOVER int branch_ret; int prev_branch; @@ -2205,10 +2205,15 @@ int reply_received( struct sip_msg *p_msg ) /* if transaction found, increment the rpl_received counter */ t_stats_rpl_received(); + /* lock -- onreply_route, safe avp usage, ... */ + /* - it is a recurrent mutex, so it is safe if a function executed + * down here does another lock/unlock */ + LOCK_REPLIES( t ); + replies_locked=1; + tm_ctx_set_branch_index(branch); init_cancel_info(&cancel_data); msg_status=p_msg->REPLY_STATUS; - replies_locked=0; uac=&t->uac[branch]; LM_DBG("org. status uas=%d, uac[%d]=%d local=%d is_invite=%d)\n", @@ -2345,11 +2350,6 @@ int reply_received( struct sip_msg *p_msg ) /* processing of on_reply block */ if (onreply_route) { set_route_type(TM_ONREPLY_ROUTE); - - /* lock onreply_route, for safe avp usage */ - LOCK_REPLIES( t ); - replies_locked=1; - /* transfer transaction flag to message context */ if (t->uas.request) p_msg->flags=t->uas.request->flags; /* set the as avp_list the one from transaction */ @@ -2418,27 +2418,12 @@ int reply_received( struct sip_msg *p_msg ) if (unlikely((ctx.run_flags&DROP_R_F) && (msg_status<200))) #endif /* TM_ONREPLY_FINAL_DROP_OK */ { - if (likely(replies_locked)) { - replies_locked = 0; - UNLOCK_REPLIES( t ); - } goto done; } #ifdef TM_ONREPLY_FINAL_DROP_OK if (msg_status >= 200) { /* stop final reply timers, now that we executed the onreply route * and the reply was not DROPed */ - if (likely(replies_locked)){ - /* if final reply => we have to execute stop_rb_timers, - * but with replies unlocked to avoid a possible deadlock - * (if the timer is currently running, stop_rb_timers() - * will wait until the timer handler ends, but the - * final_response_handler() will try to lock replies - * => deadlock). - */ - UNLOCK_REPLIES( t ); - replies_locked=0; - } stop_rb_timers(&uac->request); } #endif /* TM_ONREPLY_FINAL_DROP_OK */ @@ -2494,11 +2479,6 @@ int reply_received( struct sip_msg *p_msg ) branch_ret=add_uac_dns_fallback(t, t->uas.request, uac, !replies_locked); prev_branch=-1; - /* unlock replies to avoid sending() while holding a lock */ - if (unlikely(replies_locked)) { - UNLOCK_REPLIES( t ); - replies_locked = 0; - } while((branch_ret>=0) &&(branch_ret!=prev_branch)){ prev_branch=branch_ret; branch_ret=t_send_branch(t, branch_ret, t->uas.request , 0, 1); @@ -2507,12 +2487,8 @@ int reply_received( struct sip_msg *p_msg ) #endif if (unlikely(p_msg->msg_flags&FL_RPL_SUSPENDED)) { - goto skip_send_reply; - /* suspend the reply (async), no error */ - } - if (unlikely(!replies_locked)){ - LOCK_REPLIES( t ); - replies_locked=1; + /* suspended the reply (async) - no error */ + goto done; } if ( is_local(t) ) { /* local_reply() does UNLOCK_REPLIES( t ) */ @@ -2570,18 +2546,16 @@ int reply_received( struct sip_msg *p_msg ) uac->request.flags|=F_RB_FR_INV; /* mark fr_inv */ } /* provisional replies */ -skip_send_reply: - - if (likely(replies_locked)){ - /* unlock replies if still locked coming via goto skip_send_reply */ +done: + if (unlikely(replies_locked)){ + /* unlock replies if still locked coming via goto */ UNLOCK_REPLIES(t); replies_locked=0; } -done: tm_ctx_set_branch_index(T_BR_UNDEFINED); - /* we are done with the transaction, so unref it - the reference - * was incremented by t_check() function -bogdan*/ + /* done processing the transaction, so unref it + * - the reference counter was incremented by t_check() function */ t_unref(p_msg); /* don't try to relay statelessly neither on success * (we forwarded statefully) nor on error; on troubles, diff --git a/src/modules/tm/t_serial.c b/src/modules/tm/t_serial.c index 8f8ee0646..68b8afc1c 100644 --- a/src/modules/tm/t_serial.c +++ b/src/modules/tm/t_serial.c @@ -599,10 +599,18 @@ int ki_t_next_contacts(struct sip_msg* msg) xavp_rm(prev_xavp, NULL); vavp = xavp_get(&q_flag_name, xavp->val.v.xavp); - q_flag = vavp->val.v.i; + if(vavp) { + q_flag = vavp->val.v.i; + } else { + q_flag = 0; + } vavp = xavp_get(&uri_name, xavp->val.v.xavp); - uri = vavp->val.v.s; + if(vavp) { + uri = vavp->val.v.s; + } else { + uri.len = 0; + } vavp = xavp_get(&dst_uri_name, xavp->val.v.xavp); if (vavp != NULL) { diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c index da569ad83..14860635a 100644 --- a/src/modules/tm/tm.c +++ b/src/modules/tm/tm.c @@ -662,6 +662,9 @@ static int fixup_t_check_status(void** param, int param_no) { int ret; + ret = fix_param(FPARAM_PVS, param); + if (ret <= 0) return ret; + ret = fix_param(FPARAM_AVP, param); if (ret <= 0) return ret; diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c index 47e300af1..9fd28ee44 100644 --- a/src/modules/tmx/t_var.c +++ b/src/modules/tmx/t_var.c @@ -34,6 +34,7 @@ struct _pv_tmx_data { unsigned int index; unsigned int label; + int branch; struct sip_msg msg; struct sip_msg *tmsgp; char *buf; @@ -175,7 +176,8 @@ int pv_t_update_rpl(struct sip_msg *msg) if(t->uac[branch].reply==NULL || t->uac[branch].reply==FAKED_REPLY) return 1; - if (_pv_trpl.label == t->label && _pv_trpl.index == t->hash_index) + if (_pv_trpl.label == t->label && _pv_trpl.index == t->hash_index + && _pv_trpl.branch == branch) return 0; /* make a copy */ @@ -188,6 +190,7 @@ int pv_t_update_rpl(struct sip_msg *msg) _pv_trpl.tmsgp = NULL; _pv_trpl.index = 0; _pv_trpl.label = 0; + _pv_trpl.branch = 0; _pv_trpl.buf_size = t->uac[branch].reply->len+1; _pv_trpl.buf = (char*)pkg_malloc(_pv_trpl.buf_size*sizeof(char)); if(_pv_trpl.buf==NULL) @@ -207,6 +210,7 @@ int pv_t_update_rpl(struct sip_msg *msg) _pv_trpl.tmsgp = t->uac[branch].reply; _pv_trpl.index = t->hash_index; _pv_trpl.label = t->label; + _pv_trpl.branch = branch; if(pv_t_copy_msg(t->uac[branch].reply, &_pv_trpl.msg)!=0) { @@ -216,6 +220,7 @@ int pv_t_update_rpl(struct sip_msg *msg) _pv_trpl.tmsgp = NULL; _pv_trpl.index = 0; _pv_trpl.label = 0; + _pv_trpl.branch = 0; return -1; } diff --git a/src/modules/tmx/tmx_mod.c b/src/modules/tmx/tmx_mod.c index 28c68d470..688c19aa2 100644 --- a/src/modules/tmx/tmx_mod.c +++ b/src/modules/tmx/tmx_mod.c @@ -37,6 +37,7 @@ #include "../../core/counters.h" #include "../../core/dset.h" #include "../../core/kemi.h" +#include "../../core/fmsg.h" #include "t_var.h" #include "tmx_pretran.h" @@ -681,6 +682,11 @@ static int ki_t_suspend(sip_msg_t* msg) unsigned int tlabel; tm_cell_t *t = 0; + if(faked_msg_match(msg)) { + LM_ERR("suspending a faked request is not allowed\n"); + return -1; + } + t=_tmx_tmb.t_gett(); if (t==NULL || t==T_UNDEFINED) { diff --git a/src/modules/topoh/th_msg.c b/src/modules/topoh/th_msg.c index 2ba568839..142eda158 100644 --- a/src/modules/topoh/th_msg.c +++ b/src/modules/topoh/th_msg.c @@ -701,7 +701,7 @@ int th_unmask_route(sip_msg_t *msg) (strncasecmp(rr->nameaddr.uri.s,th_uri_prefix.s, th_uri_prefix.len)!=0))) { - LM_DBG("rr %d is not encoded: [%.*s]", i, + LM_DBG("rr %d is not encoded: [%.*s] - missing prefix\n", i, rr->nameaddr.uri.len, rr->nameaddr.uri.s); rr = rr->next; continue; @@ -709,7 +709,12 @@ int th_unmask_route(sip_msg_t *msg) if(th_get_uri_param_value(&rr->nameaddr.uri, &th_uparam_name, &eval)<0 || eval.len<=0) - return -1; + { + LM_DBG("rr %d is not encoded: [%.*s] - missing param\n", i, + rr->nameaddr.uri.len, rr->nameaddr.uri.s); + rr = rr->next; + continue; + } out.s = th_mask_decode(eval.s, eval.len, &th_uparam_prefix, 0, &out.len); diff --git a/src/modules/topoh/topoh_mod.c b/src/modules/topoh/topoh_mod.c index 4d41e229b..1362f4cd7 100644 --- a/src/modules/topoh/topoh_mod.c +++ b/src/modules/topoh/topoh_mod.c @@ -288,6 +288,12 @@ int th_prepare_msg(sip_msg_t *msg) return 3; } + if(msg->via1==NULL || msg->callid==NULL) { + LM_ERR("mandatory headers missing - via1: %p callid: %p\n", + msg->via1, msg->callid); + return 4; + } + return 0; } diff --git a/src/modules/topos/README b/src/modules/topos/README index cf4bce61f..a9bd0d832 100644 --- a/src/modules/topos/README +++ b/src/modules/topos/README @@ -84,7 +84,10 @@ Chapter 1. Admin Guide The module is transparent for the configuration writer. It only needs to be loaded (tune the parameters if needed). - It works for SIP MESSAGE requests. + It also works for SIP MESSAGE or other requests that do not create a + call dialog -- record_route() must be used for them as well, the + headers are not going to be in the messages sent to the network, they + are needed to know local addresses used to communicate with each side. 2. Dependencies @@ -95,7 +98,8 @@ Chapter 1. Admin Guide The following modules must be loaded before this module: * rr module - server must perform record routing to ensure in-dialog - requests are encoded/decoded. + requests are encoded/decoded (it must be done for all initial + requests). * database module - to store the data for topology stripping and restoring. @@ -157,7 +161,7 @@ modparam("topos", "mask_callid", 1) 3.4. sanity_checks (int) - If set to 1, topoh module will bind to sanity module in order to + If set to 1, topos module will bind to sanity module in order to perform sanity checks over received SIP request. Default sanity checks are done. It is useful to check if received request is well formated before proceeding to encoding/decoding. @@ -166,7 +170,7 @@ modparam("topos", "mask_callid", 1) Example 1.4. Set sanity_checks parameter ... -modparam("topoh", "sanity_checks", 1) +modparam("topos", "sanity_checks", 1) ... 3.5. branch_expire (int) diff --git a/src/modules/topos/doc/topos_admin.xml b/src/modules/topos/doc/topos_admin.xml index 3320bf364..049d11ea8 100644 --- a/src/modules/topos/doc/topos_admin.xml +++ b/src/modules/topos/doc/topos_admin.xml @@ -150,7 +150,7 @@ modparam("topos", "mask_callid", 1)
<varname>sanity_checks</varname> (int) - If set to 1, topoh module will bind to sanity module in order + If set to 1, topos module will bind to sanity module in order to perform sanity checks over received SIP request. Default sanity checks are done. It is useful to check if received request is well formated before proceeding to encoding/decoding. @@ -164,7 +164,7 @@ modparam("topos", "mask_callid", 1) Set <varname>sanity_checks</varname> parameter ... -modparam("topoh", "sanity_checks", 1) +modparam("topos", "sanity_checks", 1) ... diff --git a/src/modules/topos/topos_mod.c b/src/modules/topos/topos_mod.c index 0368ae829..9dff909fe 100644 --- a/src/modules/topos/topos_mod.c +++ b/src/modules/topos/topos_mod.c @@ -291,6 +291,12 @@ int tps_prepare_msg(sip_msg_t *msg) return 3; } + if(msg->via1==NULL || msg->callid==NULL) { + LM_ERR("mandatory headers missing - via1: %p callid: %p\n", + msg->via1, msg->callid); + return 4; + } + return 0; } diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c index b34986526..897f3b675 100644 --- a/src/modules/topos/tps_msg.c +++ b/src/modules/topos/tps_msg.c @@ -1029,6 +1029,7 @@ int tps_response_sent(sip_msg_t *msg) str lkey; uint32_t direction = TPS_DIR_UPSTREAM; str xvbranch = {0, 0}; + int contact_keep = 0; LM_DBG("handling outgoing response\n"); @@ -1076,10 +1077,17 @@ int tps_response_sent(sip_msg_t *msg) tps_remove_headers(msg, HDR_RECORDROUTE_T); /* keep contact without updates for redirect responses sent out */ - if(msg->first_line.u.reply.statuscode<300 - || msg->first_line.u.reply.statuscode>=400) { + if(msg->first_line.u.reply.statuscode>=300 + && msg->first_line.u.reply.statuscode<400) { + contact_keep = 1; + } + if(contact_keep==0 && msg->first_line.u.reply.statuscode>100 + && msg->first_line.u.reply.statuscode<200 + && msg->contact==NULL) { + contact_keep = 1; + } + if(contact_keep==0) { tps_remove_headers(msg, HDR_CONTACT_T); - if(direction==TPS_DIR_DOWNSTREAM) { tps_reinsert_contact(msg, &stsd, &stsd.as_contact); } else { diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c index 08bf15ec8..e434a45e6 100644 --- a/src/modules/topos/tps_storage.c +++ b/src/modules/topos/tps_storage.c @@ -337,6 +337,18 @@ int tps_storage_link_msg(sip_msg_t *msg, tps_data_t *td, int dir) /* no mandatory contact unless is INVITE - done */ return 0; } + if(msg->first_line.type==SIP_REPLY) { + if(msg->first_line.u.reply.statuscode>=100 + && msg->first_line.u.reply.statuscode<200 + && msg->first_line.u.reply.statuscode!=183) { + /* provisional response with no mandatory contact header */ + return 0; + } + if(msg->first_line.u.reply.statuscode>=400) { + /* failure response with no mandatory contact header */ + return 0; + } + } LM_ERR("bad sip message or missing Contact hdr\n"); goto error; } diff --git a/src/modules/topos_redis/topos_redis_storage.c b/src/modules/topos_redis/topos_redis_storage.c index 22279e013..a72dd7c26 100644 --- a/src/modules/topos_redis/topos_redis_storage.c +++ b/src/modules/topos_redis/topos_redis_storage.c @@ -737,8 +737,13 @@ int tps_redis_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd, LM_ERR("failed to load the INVITE branch value\n"); return -1; } + memset(&id, 0, sizeof(tps_data_t)); xvbranch1 = &id.x_vbranch1; } + if(xvbranch1->len<=0 || xvbranch1->s==NULL) { + LM_DBG("branch value not found (mode: %u)\n", mode); + return 1; + } rp = _tps_redis_cbuf; memcpy(rp, _tps_redis_bprefix.s, _tps_redis_bprefix.len); memcpy(rp + _tps_redis_bprefix.len, diff --git a/src/modules/tsilo/README b/src/modules/tsilo/README index a60594a04..979e60424 100644 --- a/src/modules/tsilo/README +++ b/src/modules/tsilo/README @@ -196,7 +196,7 @@ if (is_method("INVITE")) { Example 1.4. ts_append usage ... if (is_method("REGISTER")) { - ts_append("location", "$tU"); + ts_append("location", "$tu"); } ... diff --git a/src/modules/tsilo/doc/tsilo_admin.xml b/src/modules/tsilo/doc/tsilo_admin.xml index e6cfe9b15..7c79994d3 100644 --- a/src/modules/tsilo/doc/tsilo_admin.xml +++ b/src/modules/tsilo/doc/tsilo_admin.xml @@ -178,7 +178,7 @@ if (is_method("INVITE")) { ... if (is_method("REGISTER")) { - ts_append("location", "$tU"); + ts_append("location", "$tu"); } ... diff --git a/src/modules/tsilo/ts_store.c b/src/modules/tsilo/ts_store.c index a33924fa5..6d1c5a5f7 100644 --- a/src/modules/tsilo/ts_store.c +++ b/src/modules/tsilo/ts_store.c @@ -71,6 +71,11 @@ int ts_store(struct sip_msg* msg, str *puri) { else aor = ruri.user; + if(aor.s==NULL) { + LM_ERR("malformed aor from uri[%.*s]\n", suri.len, suri.s); + return -1; + } + t = _tmb.t_gett(); if (!t || t==T_UNDEFINED) { LM_ERR("no transaction defined for %.*s\n", aor.len, aor.s); diff --git a/src/modules/uac/README b/src/modules/uac/README index a69d481a2..ba1c3d1bb 100644 --- a/src/modules/uac/README +++ b/src/modules/uac/README @@ -789,8 +789,11 @@ failure_route[REMOTE_AUTH] { 6.1. event_route[uac:reply] - Event route executed for the final reply to the request set with - uac_req_send(). The associated $uac_req(evroute) has to be set to 1. + Event route executed for the final reply of the branch for the request + sent with uac_req_send(). The associated $uac_req(evroute) has to be + set to 1. If the request is challenged for authentication with 401/407, + then the event_route is executed twice, first for 401/407 and second + for final reply of the transaction. Example 1.30. event_route[uac:reply] usage ... diff --git a/src/modules/uac/auth_alg.c b/src/modules/uac/auth_alg.c index 9d236e9d2..0425561fe 100644 --- a/src/modules/uac/auth_alg.c +++ b/src/modules/uac/auth_alg.c @@ -135,6 +135,7 @@ void uac_calc_response( HASHHEX ha1, HASHHEX ha2, { MD5_CTX Md5Ctx; HASH RespHash; + char *p; MD5Init(&Md5Ctx); MD5Update(&Md5Ctx, ha1, HASHHEXLEN); @@ -148,7 +149,12 @@ void uac_calc_response( HASHHEX ha1, HASHHEX ha2, MD5Update(&Md5Ctx, ":", 1); MD5Update(&Md5Ctx, cnonce->s, cnonce->len); MD5Update(&Md5Ctx, ":", 1); - MD5Update(&Md5Ctx, auth->qop.s, auth->qop.len); + p = memchr(auth->qop.s, ',', auth->qop.len); + if(p) { + MD5Update(&Md5Ctx, auth->qop.s, (size_t)(p - auth->qop.s)); + } else { + MD5Update(&Md5Ctx, auth->qop.s, auth->qop.len); + } MD5Update(&Md5Ctx, ":", 1); }; MD5Update(&Md5Ctx, ha2, HASHHEXLEN); diff --git a/src/modules/uac_redirect/README b/src/modules/uac_redirect/README index 11e251ba7..8c8602e6a 100644 --- a/src/modules/uac_redirect/README +++ b/src/modules/uac_redirect/README @@ -196,12 +196,12 @@ modparam("uac_redirect","accept_filter",".*@siphub\.net") 4.4. acc_function (string) - Specifies the accounting function to be used. Just be defining this + Specifies the accounting function to be used. Just by defining this parameter, the accounting support will not be enabled. Accounting may only be enabled via two parameters set_accept_filter() scripting function. - Its values my be: + Its values may be: * acc_log_request * acc_db_request * acc_rad_request @@ -217,7 +217,7 @@ modparam("uac_redirect","acc_function","acc_db_request") 4.5. acc_db_table (string) Specifies the accounting table to be used if DB accounting was chosen - (acc_function was set to “acc_db_request”). Just be defining this + (acc_function was set to “acc_db_request”). Just by defining this parameter, the accounting support will not be enabled. Accounting may only be enabled via two parameters set_accept_filter() scripting function. diff --git a/src/modules/uri_db/README b/src/modules/uri_db/README index c00e1d485..4bad97c80 100644 --- a/src/modules/uri_db/README +++ b/src/modules/uri_db/README @@ -125,7 +125,7 @@ Chapter 1. Admin Guide Example 1.1. Set db_url parameter ... -modparam("uri_db", "db_url", "mysql://username:password@localhost/openser") +modparam("uri_db", "db_url", "mysql://username:password@localhost/kamailio") ... 3.2. db_table (string) diff --git a/src/modules/usrloc/README b/src/modules/usrloc/README index 74a967295..fb7646597 100644 --- a/src/modules/usrloc/README +++ b/src/modules/usrloc/README @@ -64,30 +64,31 @@ Carsten Bock 3.18. server_id_column (string) 3.19. connection_id_column (string) 3.20. keepalive_column (string) - 3.21. use_domain (integer) - 3.22. desc_time_order (integer) - 3.23. timer_interval (integer) - 3.24. db_url (string) - 3.25. db_mode (integer) - 3.26. db_load (integer) - 3.27. db_insert_update (integer) - 3.28. matching_mode (integer) - 3.29. cseq_delay (integer) - 3.30. fetch_rows (integer) - 3.31. hash_size (integer) - 3.32. preload (string) - 3.33. db_update_as_insert (string) - 3.34. db_check_update (string) - 3.35. timer_procs (string) - 3.36. xavp_contact (string) - 3.37. db_ops_ruid (int) - 3.38. handle_lost_tcp (int) - 3.39. close_expired_tcp (int) - 3.40. expires_type (int) - 3.41. db_raw_fetch_type (int) - 3.42. db_insert_null (int) - 3.43. skip_remote_socket (int) - 3.44. db_timer_clean (int) + 3.21. partition_column (string) + 3.22. use_domain (integer) + 3.23. desc_time_order (integer) + 3.24. timer_interval (integer) + 3.25. db_url (string) + 3.26. db_mode (integer) + 3.27. db_load (integer) + 3.28. db_insert_update (integer) + 3.29. matching_mode (integer) + 3.30. cseq_delay (integer) + 3.31. fetch_rows (integer) + 3.32. hash_size (integer) + 3.33. preload (string) + 3.34. db_update_as_insert (string) + 3.35. db_check_update (string) + 3.36. timer_procs (string) + 3.37. xavp_contact (string) + 3.38. db_ops_ruid (int) + 3.39. handle_lost_tcp (int) + 3.40. close_expired_tcp (int) + 3.41. expires_type (int) + 3.42. db_raw_fetch_type (int) + 3.43. db_insert_null (int) + 3.44. skip_remote_socket (int) + 3.45. db_timer_clean (int) 4. RPC Commands @@ -155,30 +156,31 @@ Carsten Bock 1.18. Set server_id_column parameter 1.19. Set connection_id_column parameter 1.20. Set keepalive_column parameter - 1.21. Set use_domain parameter - 1.22. Set desc_time_order parameter - 1.23. Set timer_interval parameter - 1.24. Set db_url parameter - 1.25. Set db_mode parameter - 1.26. Set db_load parameter - 1.27. Set db_insert_update parameter - 1.28. Set matching_mode parameter - 1.29. Set cseq_delay parameter - 1.30. Set fetch_rows parameter - 1.31. Set hash_size parameter - 1.32. Set preload parameter - 1.33. Set db_update_as_insert parameter - 1.34. Set db_check_update parameter - 1.35. Set timer_procs parameter - 1.36. Set xavp_contact parameter - 1.37. Set db_ops_ruid parameter - 1.38. Set handle_lost_tcp parameter - 1.39. Set close_expired_tcp parameter - 1.40. Set expires_type parameter - 1.41. Set db_raw_fetch_type parameter - 1.42. Set db_insert_null parameter - 1.43. Set skip_remote_socket parameter - 1.44. Set db_timer_clean parameter + 1.21. Set partitioncolumn parameter + 1.22. Set use_domain parameter + 1.23. Set desc_time_order parameter + 1.24. Set timer_interval parameter + 1.25. Set db_url parameter + 1.26. Set db_mode parameter + 1.27. Set db_load parameter + 1.28. Set db_insert_update parameter + 1.29. Set matching_mode parameter + 1.30. Set cseq_delay parameter + 1.31. Set fetch_rows parameter + 1.32. Set hash_size parameter + 1.33. Set preload parameter + 1.34. Set db_update_as_insert parameter + 1.35. Set db_check_update parameter + 1.36. Set timer_procs parameter + 1.37. Set xavp_contact parameter + 1.38. Set db_ops_ruid parameter + 1.39. Set handle_lost_tcp parameter + 1.40. Set close_expired_tcp parameter + 1.41. Set expires_type parameter + 1.42. Set db_raw_fetch_type parameter + 1.43. Set db_insert_null parameter + 1.44. Set skip_remote_socket parameter + 1.45. Set db_timer_clean parameter Chapter 1. Admin Guide @@ -215,30 +217,31 @@ Chapter 1. Admin Guide 3.18. server_id_column (string) 3.19. connection_id_column (string) 3.20. keepalive_column (string) - 3.21. use_domain (integer) - 3.22. desc_time_order (integer) - 3.23. timer_interval (integer) - 3.24. db_url (string) - 3.25. db_mode (integer) - 3.26. db_load (integer) - 3.27. db_insert_update (integer) - 3.28. matching_mode (integer) - 3.29. cseq_delay (integer) - 3.30. fetch_rows (integer) - 3.31. hash_size (integer) - 3.32. preload (string) - 3.33. db_update_as_insert (string) - 3.34. db_check_update (string) - 3.35. timer_procs (string) - 3.36. xavp_contact (string) - 3.37. db_ops_ruid (int) - 3.38. handle_lost_tcp (int) - 3.39. close_expired_tcp (int) - 3.40. expires_type (int) - 3.41. db_raw_fetch_type (int) - 3.42. db_insert_null (int) - 3.43. skip_remote_socket (int) - 3.44. db_timer_clean (int) + 3.21. partition_column (string) + 3.22. use_domain (integer) + 3.23. desc_time_order (integer) + 3.24. timer_interval (integer) + 3.25. db_url (string) + 3.26. db_mode (integer) + 3.27. db_load (integer) + 3.28. db_insert_update (integer) + 3.29. matching_mode (integer) + 3.30. cseq_delay (integer) + 3.31. fetch_rows (integer) + 3.32. hash_size (integer) + 3.33. preload (string) + 3.34. db_update_as_insert (string) + 3.35. db_check_update (string) + 3.36. timer_procs (string) + 3.37. xavp_contact (string) + 3.38. db_ops_ruid (int) + 3.39. handle_lost_tcp (int) + 3.40. close_expired_tcp (int) + 3.41. expires_type (int) + 3.42. db_raw_fetch_type (int) + 3.43. db_insert_null (int) + 3.44. skip_remote_socket (int) + 3.45. db_timer_clean (int) 4. RPC Commands @@ -298,7 +301,7 @@ Chapter 1. Admin Guide check the Call-ID only (independent of the Contact-Header or Path). To find out how to control/select the contact maching algorithm, please - see the module parameter matching_mode - Section 3.28, “matching_mode + see the module parameter matching_mode - Section 3.29, “matching_mode (integer)”. 2. Dependencies @@ -339,30 +342,31 @@ Chapter 1. Admin Guide 3.18. server_id_column (string) 3.19. connection_id_column (string) 3.20. keepalive_column (string) - 3.21. use_domain (integer) - 3.22. desc_time_order (integer) - 3.23. timer_interval (integer) - 3.24. db_url (string) - 3.25. db_mode (integer) - 3.26. db_load (integer) - 3.27. db_insert_update (integer) - 3.28. matching_mode (integer) - 3.29. cseq_delay (integer) - 3.30. fetch_rows (integer) - 3.31. hash_size (integer) - 3.32. preload (string) - 3.33. db_update_as_insert (string) - 3.34. db_check_update (string) - 3.35. timer_procs (string) - 3.36. xavp_contact (string) - 3.37. db_ops_ruid (int) - 3.38. handle_lost_tcp (int) - 3.39. close_expired_tcp (int) - 3.40. expires_type (int) - 3.41. db_raw_fetch_type (int) - 3.42. db_insert_null (int) - 3.43. skip_remote_socket (int) - 3.44. db_timer_clean (int) + 3.21. partition_column (string) + 3.22. use_domain (integer) + 3.23. desc_time_order (integer) + 3.24. timer_interval (integer) + 3.25. db_url (string) + 3.26. db_mode (integer) + 3.27. db_load (integer) + 3.28. db_insert_update (integer) + 3.29. matching_mode (integer) + 3.30. cseq_delay (integer) + 3.31. fetch_rows (integer) + 3.32. hash_size (integer) + 3.33. preload (string) + 3.34. db_update_as_insert (string) + 3.35. db_check_update (string) + 3.36. timer_procs (string) + 3.37. xavp_contact (string) + 3.38. db_ops_ruid (int) + 3.39. handle_lost_tcp (int) + 3.40. close_expired_tcp (int) + 3.41. expires_type (int) + 3.42. db_raw_fetch_type (int) + 3.43. db_insert_null (int) + 3.44. skip_remote_socket (int) + 3.45. db_timer_clean (int) 3.1. nat_bflag (integer) @@ -590,7 +594,18 @@ modparam("usrloc", "connection_id_column", "con_id") modparam("usrloc", "keepalive_column", "kalive") ... -3.21. use_domain (integer) +3.21. partition_column (string) + + Name of database table column containing the value for partition id. + + Default value is “partition”. + + Example 1.21. Set partitioncolumn parameter +... +modparam("usrloc", "partition_column", "part") +... + +3.22. use_domain (integer) If the domain part of the user should be also saved and used for identifing the user (along with the username part). Useful in multi @@ -598,24 +613,24 @@ modparam("usrloc", "keepalive_column", "kalive") Default value is “0 (false)”. - Example 1.21. Set use_domain parameter + Example 1.22. Set use_domain parameter ... modparam("usrloc", "use_domain", 1) ... -3.22. desc_time_order (integer) +3.23. desc_time_order (integer) If the user's contacts should be kept timestamp ordered; otherwise the contact will be ordered based on q value. Non 0 value means true. Default value is “0 (false)”. - Example 1.22. Set desc_time_order parameter + Example 1.23. Set desc_time_order parameter ... modparam("usrloc", "desc_time_order", 1) ... -3.23. timer_interval (integer) +3.24. timer_interval (integer) Number of seconds between two timer runs. The module uses a timer to delete expired contacts, synchronize with database and other tasks, @@ -623,23 +638,23 @@ modparam("usrloc", "desc_time_order", 1) Default value is 60. - Example 1.23. Set timer_interval parameter + Example 1.24. Set timer_interval parameter ... modparam("usrloc", "timer_interval", 120) ... -3.24. db_url (string) +3.25. db_url (string) URL of the database that should be used. Default value is “mysql://kamailio:kamailiorw@localhost/kamailio”. - Example 1.24. Set db_url parameter + Example 1.25. Set db_url parameter ... modparam("usrloc", "db_url", "dbdriver://username:password@dbhost/dbname") ... -3.25. db_mode (integer) +3.26. db_mode (integer) The usrloc module can utilize a database for persistent contact storage. If a database is used, the location database (contacts) will @@ -685,12 +700,12 @@ Warning Default value is 0. - Example 1.25. Set db_mode parameter + Example 1.26. Set db_mode parameter ... modparam("usrloc", "db_mode", 2) ... -3.26. db_load (integer) +3.27. db_load (integer) Determine if the usrloc module should load contacts from the database storage during module initialization A value of 0 disable the loading @@ -698,12 +713,12 @@ modparam("usrloc", "db_mode", 2) Default value is 1. - Example 1.26. Set db_load parameter + Example 1.27. Set db_load parameter ... modparam("usrloc", "db_load", "0") ... -3.27. db_insert_update (integer) +3.28. db_insert_update (integer) Determine if the usrloc module should do an update when a duplicate key is found while inserting A value of 1 will activate update on duplicate @@ -711,12 +726,12 @@ modparam("usrloc", "db_load", "0") Default value is 0. - Example 1.27. Set db_insert_update parameter + Example 1.28. Set db_insert_update parameter ... modparam("usrloc", "db_insert_update", "1") ... -3.28. matching_mode (integer) +3.29. matching_mode (integer) What contact matching algorithm to be used. Refer to section Section 1.1, “Contact matching” for the description of the algorithms. @@ -732,12 +747,12 @@ modparam("usrloc", "db_insert_update", "1") Default value is 0 (CONTACT_ONLY). - Example 1.28. Set matching_mode parameter + Example 1.29. Set matching_mode parameter ... modparam("usrloc", "matching_mode", 1) ... -3.29. cseq_delay (integer) +3.30. cseq_delay (integer) Delay (in seconds) for accepting as retransmissions register requests with same Call-ID and Cseq. The delay is calculated starting from the @@ -751,12 +766,12 @@ modparam("usrloc", "matching_mode", 1) Default value is “20 seconds”. - Example 1.29. Set cseq_delay parameter + Example 1.30. Set cseq_delay parameter ... modparam("usrloc", "cseq_delay", 5) ... -3.30. fetch_rows (integer) +3.31. fetch_rows (integer) The number of the rows to be fetched at once from database when loading the location records. This value can be used to tune the load time at @@ -765,12 +780,12 @@ modparam("usrloc", "cseq_delay", 5) Default value is “2000”. - Example 1.30. Set fetch_rows parameter + Example 1.31. Set fetch_rows parameter ... modparam("usrloc", "fetch_rows", 3000) ... -3.31. hash_size (integer) +3.32. hash_size (integer) The number of entries of the hash table used by usrloc to store the location records is 2^hash_size. For hash_size=4, the number of slots @@ -778,12 +793,12 @@ modparam("usrloc", "fetch_rows", 3000) Default value is “10” (1024 slots). - Example 1.31. Set hash_size parameter + Example 1.32. Set hash_size parameter ... modparam("usrloc", "hash_size", 12) ... -3.32. preload (string) +3.33. preload (string) Preload location table given as value. A location table is loaded based on fixup of registrar functions, therefore you need to use this @@ -792,12 +807,12 @@ modparam("usrloc", "hash_size", 12) Default value is “NULL”. - Example 1.32. Set preload parameter + Example 1.33. Set preload parameter ... modparam("usrloc", "preload", "location") ... -3.33. db_update_as_insert (string) +3.34. db_update_as_insert (string) Set this parameter if you want to do INSERT DB operations instead of UPDATE DB operations. It is recommended to set this parameter if you @@ -805,12 +820,12 @@ modparam("usrloc", "preload", "location") Default value is “0”. - Example 1.33. Set db_update_as_insert parameter + Example 1.34. Set db_update_as_insert parameter ... modparam("usrloc", "db_update_as_insert", 1) ... -3.34. db_check_update (string) +3.35. db_check_update (string) Set this parameter to 1 if you want to do DB INSERT if the number of affected rows by contact DB UPDATE operation is 0. The database module @@ -820,12 +835,12 @@ modparam("usrloc", "db_update_as_insert", 1) Default value is “0” (no DB INSERT). - Example 1.34. Set db_check_update parameter + Example 1.35. Set db_check_update parameter ... modparam("usrloc", "db_check_update", 1) ... -3.35. timer_procs (string) +3.36. timer_procs (string) Number of timer processes to be started by module. Timer processes take care of checking expired records and syncronization with database. If @@ -834,12 +849,12 @@ modparam("usrloc", "db_check_update", 1) Default value is “0”. - Example 1.35. Set timer_procs parameter + Example 1.36. Set timer_procs parameter ... modparam("usrloc", "timer_procs", 4) ... -3.36. xavp_contact (string) +3.37. xavp_contact (string) The name of XAVP storing the attributes per contact. They are saved in location record and restored at lookup. The tm module parameter @@ -848,12 +863,12 @@ modparam("usrloc", "timer_procs", 4) Default value is “NULL”. - Example 1.36. Set xavp_contact parameter + Example 1.37. Set xavp_contact parameter ... modparam("tm|usrloc", "xavp_contact", "ulattrs") ... -3.37. db_ops_ruid (int) +3.38. db_ops_ruid (int) If set to 1, database queries for update or delete are done using ruid value. If it is set to 0, the old style using aor, contact and call-id @@ -861,12 +876,12 @@ modparam("tm|usrloc", "xavp_contact", "ulattrs") Default value is “1”. - Example 1.37. Set db_ops_ruid parameter + Example 1.38. Set db_ops_ruid parameter ... modparam("usrloc", "db_ops_ruid", 0) ... -3.38. handle_lost_tcp (int) +3.39. handle_lost_tcp (int) If set to 1, Kamailio will remove location records made via TCP/TLS/WS/WSS transports when it looses corresponding tcp connections. @@ -874,24 +889,24 @@ modparam("usrloc", "db_ops_ruid", 0) Default value is “0”. - Example 1.38. Set handle_lost_tcp parameter + Example 1.39. Set handle_lost_tcp parameter ... modparam("usrloc", "handle_lost_tcp", 1) ... -3.39. close_expired_tcp (int) +3.40. close_expired_tcp (int) If set to 1, Kamailio will close the TCP connection when a contact has expired, if the corresponding transport is TCP/TLS/WS/WSS. Default value is “0”. - Example 1.39. Set close_expired_tcp parameter + Example 1.40. Set close_expired_tcp parameter ... modparam("usrloc", "close_expired_tcp", 1) ... -3.40. expires_type (int) +3.41. expires_type (int) If set to 1, Kamailio expects to deal with BIGINT type on database columns for expires and last modified values. It allows to handle @@ -901,12 +916,12 @@ modparam("usrloc", "close_expired_tcp", 1) Default value is “0”. - Example 1.40. Set expires_type parameter + Example 1.41. Set expires_type parameter ... modparam("usrloc", "expires_type", 1) ... -3.41. db_raw_fetch_type (int) +3.42. db_raw_fetch_type (int) This affect DB-only mode and controls what kind of raw query is used to fetch the contacts from database for specific needs (e.g., sending NAT @@ -916,12 +931,12 @@ modparam("usrloc", "expires_type", 1) Default value is “0”. - Example 1.41. Set db_raw_fetch_type parameter + Example 1.42. Set db_raw_fetch_type parameter ... modparam("usrloc", "db_raw_fetch_type", 1) ... -3.42. db_insert_null (int) +3.43. db_insert_null (int) If set to 1, the insert operation to database will add null values in the statement. It has to be set to 1 for the database systems that do @@ -934,12 +949,12 @@ modparam("usrloc", "db_raw_fetch_type", 1) Default value is “0” (don't add null fields in insert statement). - Example 1.42. Set db_insert_null parameter + Example 1.43. Set db_insert_null parameter ... modparam("usrloc", "db_insert_null", 1) ... -3.43. skip_remote_socket (int) +3.44. skip_remote_socket (int) If set to 1, Kamailio will skip location record when loading from database, if socket value of the record does not in kamailio listening @@ -947,12 +962,12 @@ modparam("usrloc", "db_insert_null", 1) Default value is “0”. - Example 1.43. Set skip_remote_socket parameter + Example 1.44. Set skip_remote_socket parameter ... modparam("usrloc", "skip_remote_socket", 1) ... -3.44. db_timer_clean (int) +3.45. db_timer_clean (int) Enable (1) or disable (0) cleaning of expired db records on timer basis for db_mode WRITE-BACK and WRITE-THROUGH. It uses the secondary timer @@ -960,7 +975,7 @@ modparam("usrloc", "skip_remote_socket", 1) Default value is “0”. - Example 1.44. Set db_timer_clean parameter + Example 1.45. Set db_timer_clean parameter ... modparam("usrloc", "db_timer_clean", 1) ... diff --git a/src/modules/websocket/README b/src/modules/websocket/README index 158248654..c8241be6e 100644 --- a/src/modules/websocket/README +++ b/src/modules/websocket/README @@ -34,6 +34,8 @@ Peter Dunkley 4.7. cors_mode (integer) 4.8. verbose_list (int) 4.9. event_callback (str) + 4.10. timer_interval (integer) + 4.11. rm_delay_interval (integer) 5. Functions @@ -70,10 +72,12 @@ Peter Dunkley 1.9. Set cors_mode parameter 1.10. Set verbose_list parameter 1.11. Set event_callback parameter - 1.12. ws_handle_handshake usage - 1.13. ws_close usage - 1.14. event_route[websocket:closed] usage - 1.15. $ws_conid usage + 1.12. Set timer_intervalparameter + 1.13. Set rm_timer_intervalparameter + 1.14. ws_handle_handshake usage + 1.15. ws_close usage + 1.16. event_route[websocket:closed] usage + 1.17. $ws_conid usage Chapter 1. Admin Guide @@ -102,6 +106,8 @@ Chapter 1. Admin Guide 4.7. cors_mode (integer) 4.8. verbose_list (int) 4.9. event_callback (str) + 4.10. timer_interval (integer) + 4.11. rm_delay_interval (integer) 5. Functions @@ -203,7 +209,7 @@ event_route[xhttp:request] { # Optional... perform HTTP authentication # ws_handle_handshake() exits (no further configuration file - # processing of the request) when complete. + # processing of the request) when complete in case of failure. if (ws_handle_handshake()) { # Optional... cache some information about the @@ -345,6 +351,8 @@ onreply_route[WS_REPLY] { 4.7. cors_mode (integer) 4.8. verbose_list (int) 4.9. event_callback (str) + 4.10. timer_interval (integer) + 4.11. rm_delay_interval (integer) 4.1. keepalive_mechanism (integer) @@ -483,6 +491,29 @@ function ksr_websocket_event(evname) end ... +4.10. timer_interval (integer) + + The number of seconds between each timer process run + + Default value is 1. + + Example 1.12. Set timer_intervalparameter +... +modparam("websocket", "timer_interval", 5) +... + +4.11. rm_delay_interval (integer) + + The number of seconds to wait before destroying the websocket + connection once put in remove state. + + Default value is 5. + + Example 1.13. Set rm_timer_intervalparameter +... +modparam("websocket", "rm_delay_interval", 2) +... + 5. Functions 5.1. ws_handle_handshake() @@ -500,9 +531,10 @@ end Note This function returns 0, stopping all further processing of the - request, when there is a problem. + request, when there is a problem. Otherwise, it returns 1 (or positive + number) in case of success. - Example 1.12. ws_handle_handshake usage + Example 1.14. ws_handle_handshake usage ... ws_handle_handshake(); ... @@ -527,7 +559,7 @@ Note This function can be used from ANY_ROUTE. - Example 1.13. ws_close usage + Example 1.15. ws_close usage ... ws_close(4000, "Because I say so"); ... @@ -641,7 +673,7 @@ kamcmd ws.enable connection closes. The connection may be identified using the the $si and $sp pseudo-variables. - Example 1.14. event_route[websocket:closed] usage + Example 1.16. event_route[websocket:closed] usage ... event_route[websocket:closed] { xlog("L_INFO", "WebSocket connection from $si:$sp has closed\n"); @@ -657,7 +689,7 @@ event_route[websocket:closed] { Connection id of closed websocket connection. Can only be used in websocket:closed event route. - Example 1.15. $ws_conid usage + Example 1.17. $ws_conid usage ... event_route[websocket:closed] { xlog("L_INFO", "WebSocket connection with id $ws_conid has closed\n"); diff --git a/src/modules/websocket/doc/websocket_admin.xml b/src/modules/websocket/doc/websocket_admin.xml index 055498862..6b6483d73 100644 --- a/src/modules/websocket/doc/websocket_admin.xml +++ b/src/modules/websocket/doc/websocket_admin.xml @@ -90,13 +90,13 @@ event_route[xhttp:request] { # Optional... perform HTTP authentication # ws_handle_handshake() exits (no further configuration file - # processing of the request) when complete. + # processing of the request) when complete in case of failure. if (ws_handle_handshake()) - { - # Optional... cache some information about the - # successful connection - exit; - } + { + # Optional... cache some information about the + # successful connection + exit; + } } xhttp_reply("404", "Not found", "", ""); @@ -181,9 +181,9 @@ route[WITHINDLG] { onreply_route[WS_REPLY] { if (nat_uac_test(64)) { # Do NAT traversal stuff for replies to a WebSocket connection - # - even if it is not behind a NAT! + # - even if it is not behind a NAT! # This won't be needed in the future if Kamailio and the - # WebSocket client support Outbound and Path. + # WebSocket client support Outbound and Path. add_contact_alias(); } } @@ -477,6 +477,37 @@ end
+
+ <varname>timer_interval</varname> (integer) + The number of seconds between each timer process run + + Default value is 1. + + Set <varname>timer_interval</varname>parameter + +... +modparam("websocket", "timer_interval", 5) +... + + +
+ +
+ <varname>rm_delay_interval</varname> (integer) + The number of seconds to wait before destroying the websocket + connection once put in remove state. + + Default value is 5. + + Set <varname>rm_timer_interval</varname>parameter + +... +modparam("websocket", "rm_delay_interval", 2) +... + + +
+
@@ -491,7 +522,8 @@ end This function can be used from ANY_ROUTE (but will only work in event_route[xhttp:request]). This function returns 0, stopping all further - processing of the request, when there is a problem. + processing of the request, when there is a problem. Otherwise, it + returns 1 (or positive number) in case of success. <function>ws_handle_handshake</function> usage diff --git a/src/modules/websocket/websocket.c b/src/modules/websocket/websocket.c index 4a76cac48..c84fc446f 100644 --- a/src/modules/websocket/websocket.c +++ b/src/modules/websocket/websocket.c @@ -60,13 +60,19 @@ static int ws_init_rpc(void); sl_api_t ws_slb; +#define WS_DEFAULT_RM_DELAY_INTERVAL 5 +int ws_rm_delay_interval = WS_DEFAULT_RM_DELAY_INTERVAL; + +#define DEFAULT_TIMER_INTERVAL 1 +static int ws_timer_interval = DEFAULT_TIMER_INTERVAL; + #define DEFAULT_KEEPALIVE_INTERVAL 1 static int ws_keepalive_interval = DEFAULT_KEEPALIVE_INTERVAL; static int ws_keepalive_timeout = DEFAULT_KEEPALIVE_TIMEOUT; #define DEFAULT_KEEPALIVE_PROCESSES 1 -static int ws_keepalive_processes = DEFAULT_KEEPALIVE_PROCESSES; +int ws_keepalive_processes = DEFAULT_KEEPALIVE_PROCESSES; int ws_verbose_list = 0; @@ -107,6 +113,9 @@ static param_export_t params[] = { { "keepalive_interval", INT_PARAM, &ws_keepalive_interval }, { "keepalive_processes", INT_PARAM, &ws_keepalive_processes }, + { "timer_interval", INT_PARAM, &ws_timer_interval }, + { "rm_delay_interval", INT_PARAM, &ws_rm_delay_interval }, + { "verbose_list", PARAM_INT, &ws_verbose_list }, { "event_callback", PARAM_STR, &ws_event_callback}, @@ -229,6 +238,13 @@ static int mod_init(void) /* Add extra process/timer for the keepalive process */ register_sync_timers(ws_keepalive_processes); } + if(ws_timer_interval < 1 || ws_timer_interval > 60) + ws_timer_interval = DEFAULT_TIMER_INTERVAL; + /* timer routing to clean up inactive connections */ + register_sync_timers(1); + + if(ws_rm_delay_interval < 1 || ws_rm_delay_interval > 60) + ws_rm_delay_interval = WS_DEFAULT_RM_DELAY_INTERVAL; if(ws_sub_protocols & SUB_PROTOCOL_MSRP && !sr_event_enabled(SREV_TCP_MSRP_FRAME)) @@ -282,16 +298,24 @@ static int child_init(int rank) if(rank == PROC_INIT || rank == PROC_TCP_MAIN) return 0; - if(rank == PROC_MAIN - && ws_keepalive_mechanism != KEEPALIVE_MECHANISM_NONE) { - for(i = 0; i < ws_keepalive_processes; i++) { - if(fork_sync_timer(PROC_TIMER, "WEBSOCKET KEEPALIVE", 1, - ws_keepalive, NULL, ws_keepalive_interval) + if(rank == PROC_MAIN) { + if(ws_keepalive_mechanism != KEEPALIVE_MECHANISM_NONE) { + for(i = 0; i < ws_keepalive_processes; i++) { + if(fork_sync_timer(PROC_TIMER, "WEBSOCKET KEEPALIVE", 1, + ws_keepalive, (void*)(long)i, ws_keepalive_interval) + < 0) { + LM_ERR("starting keepalive process\n"); + return -1; + } + } + } + if(fork_sync_timer(PROC_TIMER, "WEBSOCKET TIMER", 1, + ws_timer, NULL, ws_timer_interval) < 0) { - LM_ERR("starting keepalive process\n"); + LM_ERR("starting timer process\n"); return -1; - } } + } return 0; diff --git a/src/modules/websocket/ws_conn.c b/src/modules/websocket/ws_conn.c index b3ea15e50..46cdf0986 100644 --- a/src/modules/websocket/ws_conn.c +++ b/src/modules/websocket/ws_conn.c @@ -39,6 +39,8 @@ extern int ws_verbose_list; extern str ws_event_callback; +extern int ws_keepalive_processes; +extern int ws_rm_delay_interval; ws_connection_t **wsconn_id_hash = NULL; #define wsconn_listadd tcpconn_listadd @@ -53,7 +55,7 @@ gen_lock_t *wsconn_lock = NULL; gen_lock_t *wsstat_lock = NULL; -ws_connection_used_list_t *wsconn_used_list = NULL; +ws_connection_list_t *wsconn_used_list = NULL; stat_var *ws_current_connections; stat_var *ws_max_concurrent_connections; @@ -103,13 +105,13 @@ int wsconn_init(void) memset((void *)wsconn_id_hash, 0, TCP_ID_HASH_SIZE * sizeof(ws_connection_t *)); - wsconn_used_list = (ws_connection_used_list_t *)shm_malloc( - sizeof(ws_connection_used_list_t)); + wsconn_used_list = (ws_connection_list_t *)shm_malloc( + sizeof(ws_connection_list_t)); if(wsconn_used_list == NULL) { LM_ERR("allocating WebSocket used list\n"); goto error; } - memset((void *)wsconn_used_list, 0, sizeof(ws_connection_used_list_t)); + memset((void *)wsconn_used_list, 0, sizeof(ws_connection_list_t)); return 0; @@ -382,54 +384,66 @@ void wsconn_close_now(ws_connection_t *wsc) con->timeout = get_ticks_raw(); } -/* must be called with unlocked WSCONN_LOCK */ -int wsconn_put(ws_connection_t *wsc) +void wsconn_detach_connection(ws_connection_t *wsc) { - int destroy = 0; + /* Remove from the WebSocket used list */ + if(wsconn_used_list->head == wsc) + wsconn_used_list->head = wsc->used_next; + if(wsconn_used_list->tail == wsc) + wsconn_used_list->tail = wsc->used_prev; + if(wsc->used_prev) + wsc->used_prev->used_next = wsc->used_next; + if(wsc->used_next) + wsc->used_next->used_prev = wsc->used_prev; - LM_DBG("wsconn_put start for [%p] refcnt [%d]\n", wsc, - atomic_get(&wsc->refcnt)); + /* remove from wsconn_id_hash */ + wsconn_listrm(wsconn_id_hash[wsc->id_hash], wsc, id_next, id_prev); + /* stat */ + update_stat(ws_current_connections, -1); + if(wsc->sub_protocol == SUB_PROTOCOL_SIP) + update_stat(ws_sip_current_connections, -1); + else if(wsc->sub_protocol == SUB_PROTOCOL_MSRP) + update_stat(ws_msrp_current_connections, -1); +} + +/* mode controls if lock needs to be aquired */ +int wsconn_put_mode(ws_connection_t *wsc, int mode) +{ if(!wsc) return -1; - WSCONN_LOCK; + LM_DBG("wsconn_put start for [%p] refcnt [%d]\n", wsc, + atomic_get(&wsc->refcnt)); + + if(mode) { + WSCONN_LOCK; + } + if(wsc->state == WS_S_REMOVING) { + goto done; + } /* refcnt == 0*/ if(wsconn_unref(wsc)) { - /* Remove from the WebSocket used list */ - if(wsconn_used_list->head == wsc) - wsconn_used_list->head = wsc->used_next; - if(wsconn_used_list->tail == wsc) - wsconn_used_list->tail = wsc->used_prev; - if(wsc->used_prev) - wsc->used_prev->used_next = wsc->used_next; - if(wsc->used_next) - wsc->used_next->used_prev = wsc->used_prev; - - /* remove from wsconn_id_hash */ - wsconn_listrm(wsconn_id_hash[wsc->id_hash], wsc, id_next, id_prev); - - /* stat */ - update_stat(ws_current_connections, -1); - if(wsc->sub_protocol == SUB_PROTOCOL_SIP) - update_stat(ws_sip_current_connections, -1); - else if(wsc->sub_protocol == SUB_PROTOCOL_MSRP) - update_stat(ws_msrp_current_connections, -1); - - destroy = 1; + wsc->state = WS_S_REMOVING; + wsc->rmticks = get_ticks(); } - WSCONN_UNLOCK; - LM_DBG("wsconn_put end for [%p] refcnt [%d]\n", wsc, atomic_get(&wsc->refcnt)); - /* wsc is removed from all lists and can be destroyed safely */ - if(destroy) - wsconn_dtor(wsc); +done: + if(mode) { + WSCONN_UNLOCK; + } return 0; } +/* must be called with unlocked WSCONN_LOCK */ +int wsconn_put(ws_connection_t *wsc) +{ + return wsconn_put_mode(wsc, 1); +} + ws_connection_t *wsconn_get(int id) { int id_hash = tcp_id_hash(id); @@ -454,6 +468,30 @@ ws_connection_t *wsconn_get(int id) return NULL; } +int wsconn_put_id(int id) +{ + int id_hash = tcp_id_hash(id); + ws_connection_t *wsc; + + LM_DBG("wsconn put id [%d]\n", id); + + WSCONN_LOCK; + for(wsc = wsconn_id_hash[id_hash]; wsc; wsc = wsc->id_next) { + if(wsc->id == id) { + LM_DBG("wsc [%p] refcnt [%d]\n", wsc, + atomic_get(&wsc->refcnt)); + wsconn_put_mode(wsc, 0); + + WSCONN_UNLOCK; + + return 1; + } + } + WSCONN_UNLOCK; + + return 0; +} + ws_connection_t **wsconn_get_list(void) { ws_connection_t **list = NULL; @@ -539,6 +577,128 @@ int wsconn_put_list(ws_connection_t **list_head) } +ws_connection_id_t *wsconn_get_list_ids(int idx) +{ + ws_connection_id_t *list = NULL; + ws_connection_t *wsc = NULL; + size_t list_size = 0; + size_t list_len = 0; + size_t i = 0; + + if(ws_verbose_list) + LM_DBG("wsconn get list ids - starting\n"); + + WSCONN_LOCK; + + /* get the number of used connections */ + wsc = wsconn_used_list->head; + while(wsc) { + if(wsc->id % ws_keepalive_processes == idx) { + if(ws_verbose_list) { + LM_DBG("counter wsc [%p] prev => [%p] next => [%p] (%d/%d)\n", + wsc, wsc->used_prev, wsc->used_next, wsc->id, idx); + } + list_len++; + } + wsc = wsc->used_next; + } + + if(!list_len) + goto end; + + /* allocate a NULL terminated list of wsconn pointers */ + list_size = (list_len + 1) * sizeof(ws_connection_id_t); + list = pkg_malloc(list_size); + if(!list) + goto end; + + memset(list, 0, list_size); + + /* copy */ + wsc = wsconn_used_list->head; + for(i = 0; i < list_len; i++) { + if(!wsc) { + LM_ERR("Wrong list length\n"); + break; + } + + if(wsc->id % ws_keepalive_processes == idx) { + list[i].id = wsc->id; + wsconn_ref(wsc); + if(ws_verbose_list) { + LM_DBG("wsc [%p] id [%d] (%d) - ref++\n", wsc, wsc->id, idx); + } + } + wsc = wsc->used_next; + } + list[i].id = -1; /* explicit -1 termination */ + +end: + WSCONN_UNLOCK; + + if(ws_verbose_list) { + LM_DBG("wsconn get list id returns list [%p]" + " with [%d] members (%d)\n", + list, (int)list_len, idx); + } + + return list; +} + +int wsconn_put_list_ids(ws_connection_id_t *list_head) +{ + ws_connection_id_t *list = NULL; + int i; + + LM_DBG("wsconn put list id [%p]\n", list_head); + + if(!list_head) + return -1; + + list = list_head; + for(i=0; list[i].id!=-1; i++) { + wsconn_put_id(list[i].id); + } + + pkg_free(list_head); + + return 0; +} + +void ws_timer(unsigned int ticks, void *param) +{ + ws_connection_list_t rmlist; + ws_connection_t *wsc; + ws_connection_t *next; + ticks_t nticks; + int h; + + rmlist.head = NULL; + nticks = get_ticks(); + + WSCONN_LOCK; + for(h = 0; h < TCP_ID_HASH_SIZE; h++) { + wsc = wsconn_id_hash[h]; + while(wsc) { + next = wsc->id_next; + if(wsc->state == WS_S_REMOVING + && wsc->rmticks <= nticks - ws_rm_delay_interval) { + wsconn_detach_connection(wsc); + wsc->id_next = rmlist.head; + rmlist.head = wsc; + } + wsc = next; + } + } + WSCONN_UNLOCK; + + for(wsc = rmlist.head; wsc; ) { + next = wsc->id_next; + wsconn_dtor(wsc); + wsc = next; + } +} + static int ws_rpc_add_node( rpc_t *rpc, void *ctx, void *ih, ws_connection_t *wsc) { diff --git a/src/modules/websocket/ws_conn.h b/src/modules/websocket/ws_conn.h index 74cb40f7c..9319238e4 100644 --- a/src/modules/websocket/ws_conn.h +++ b/src/modules/websocket/ws_conn.h @@ -31,11 +31,13 @@ #include "../../core/counters.h" #include "../../core/rpc.h" +#include "../../core/timer.h" typedef enum { WS_S_CONNECTING = 0, /* Never used - included for completeness */ WS_S_OPEN, WS_S_CLOSING, + WS_S_REMOVING, WS_S_CLOSED /* Never used - included for completeness */ } ws_conn_state_t; @@ -43,6 +45,7 @@ typedef struct ws_connection { ws_conn_state_t state; int awaiting_pong; + ticks_t rmticks; int last_used; struct ws_connection *used_prev; @@ -63,18 +66,23 @@ typedef struct ws_connection str frag_buf; } ws_connection_t; +typedef struct ws_connection_id +{ + int id; +} ws_connection_id_t; + typedef struct { ws_connection_t *head; ws_connection_t *tail; -} ws_connection_used_list_t; +} ws_connection_list_t; typedef enum { WSCONN_EVENTROUTE_NO = 0, WSCONN_EVENTROUTE_YES } ws_conn_eventroute_t; -extern ws_connection_used_list_t *wsconn_used_list; +extern ws_connection_list_t *wsconn_used_list; extern char *wsconn_state_str[]; @@ -95,5 +103,9 @@ ws_connection_t *wsconn_get(int id); int wsconn_put(ws_connection_t *wsc); ws_connection_t **wsconn_get_list(void); int wsconn_put_list(ws_connection_t **list); +ws_connection_id_t *wsconn_get_list_ids(int idx); +int wsconn_put_list_ids(ws_connection_id_t *list); +int wsconn_put_id(int id); void ws_rpc_dump(rpc_t *rpc, void *ctx); +void ws_timer(unsigned int ticks, void *param); #endif /* _WS_CONN_H */ diff --git a/src/modules/websocket/ws_frame.c b/src/modules/websocket/ws_frame.c index 2d7ca8ec5..840125a04 100644 --- a/src/modules/websocket/ws_frame.c +++ b/src/modules/websocket/ws_frame.c @@ -796,31 +796,37 @@ void ws_keepalive(unsigned int ticks, void *param) int check_time = (int)time(NULL) - cfg_get(websocket, ws_cfg, keepalive_timeout); - ws_connection_t **list = NULL, **list_head = NULL; + ws_connection_id_t *list_head = NULL; ws_connection_t *wsc = NULL; + int i = 0; + int idx = (int)(long)param; /* get an array of pointer to all ws connection */ - list_head = wsconn_get_list(); + list_head = wsconn_get_list_ids(idx); if(!list_head) return; - list = list_head; - wsc = *list_head; - while(wsc && wsc->last_used < check_time) { - if(wsc->state == WS_S_CLOSING || wsc->awaiting_pong) { - LM_WARN("forcibly closing connection\n"); - wsconn_close_now(wsc); - } else { - int opcode = (ws_keepalive_mechanism == KEEPALIVE_MECHANISM_PING) + while(list_head[i].id!=-1) { + wsc = wsconn_get(list_head[i].id); + if(wsc && wsc->last_used < check_time) { + if(wsc->state == WS_S_CLOSING || wsc->awaiting_pong) { + LM_WARN("forcibly closing connection\n"); + wsconn_close_now(wsc); + } else { + int opcode = (ws_keepalive_mechanism == KEEPALIVE_MECHANISM_PING) ? OPCODE_PING : OPCODE_PONG; - ping_pong(wsc, opcode); + ping_pong(wsc, opcode); + } + } + if(wsc) { + wsconn_put_id(list_head[i].id); } + i++; - wsc = *(++list); } - wsconn_put_list(list_head); + wsconn_put_list_ids(list_head); } int ws_close(sip_msg_t *msg) diff --git a/src/modules/xcap_client/README b/src/modules/xcap_client/README index c61e6f640..be340df07 100644 --- a/src/modules/xcap_client/README +++ b/src/modules/xcap_client/README @@ -28,12 +28,11 @@ Anca-Maria Vamanu 3.3. periodical_query(int) 3.4. query_period(int) - 4. Functions - 5. RPC Commands + 4. RPC Commands - 5.1. xcap_client.refreshXcapDoc + 4.1. xcap_client.refreshXcapDoc - 6. Remarks + 5. Remarks 2. Developer Guide @@ -66,12 +65,11 @@ Chapter 1. Admin Guide 3.3. periodical_query(int) 3.4. query_period(int) - 4. Functions - 5. RPC Commands + 4. RPC Commands - 5.1. xcap_client.refreshXcapDoc + 4.1. xcap_client.refreshXcapDoc - 6. Remarks + 5. Remarks 1. Overview @@ -171,15 +169,11 @@ modparam("xcap_client", "periodical_query", 0) modparam("xcap_client", "query_period", 50) ... -4. Functions +4. RPC Commands - None to be used in configuration file. + 4.1. xcap_client.refreshXcapDoc -5. RPC Commands - - 5.1. xcap_client.refreshXcapDoc - -5.1. xcap_client.refreshXcapDoc +4.1. xcap_client.refreshXcapDoc Management command that should be sent by an XCAP server when a stored document changes. @@ -197,7 +191,7 @@ kamcmd xcap_client.refreshXcapDoc /xcap-root/resource-lists/users/eyebeam/buddies-resource-list.xml 8000 ... -6. Remarks +5. Remarks Note: libcurl leak in CentOS 6 - this module uses libcurl library and in case if you are using CentOS 6, be aware that standard diff --git a/src/modules/xcap_server/README b/src/modules/xcap_server/README index 43ba8c996..7f8c9af6e 100644 --- a/src/modules/xcap_server/README +++ b/src/modules/xcap_server/README @@ -39,7 +39,7 @@ Daniel-Constantin Mierla 4.2. xcaps_get(uri, path) 4.3. xcaps_del(uri, path) - 5. Exported pseudo-variables + 5. Pseudo Variables 6. Simple XCAP Server Config List of Examples @@ -83,7 +83,7 @@ Chapter 1. Admin Guide 4.2. xcaps_get(uri, path) 4.3. xcaps_del(uri, path) - 5. Exported pseudo-variables + 5. Pseudo Variables 6. Simple XCAP Server Config 1. Overview @@ -312,7 +312,7 @@ event_route[xhttp:request] { } ... -5. Exported pseudo-variables +5. Pseudo Variables * $xcapuri(name=>key) - name can be any to idenitfy the XCAP uri; key can be: data, uri, root, auid, type, tree, xuid, file, node, diff --git a/utils/kamcmd/kamcmd.8 b/utils/kamcmd/kamcmd.8 index 017c814df..c2355243f 100644 --- a/utils/kamcmd/kamcmd.8 +++ b/utils/kamcmd/kamcmd.8 @@ -22,6 +22,14 @@ It can be used to manage users, domains, aliases and other server options. .B \-h display a short usage description, including all available options. +.SH NOTE +.B kamcmd +tries to convert number parameters to integer, to avoid it, prefix the number +with +.B 's:' +, like +.B 's:123456789'. + .SH AUTHORS see diff --git a/utils/kamctl/kamctl.8 b/utils/kamctl/kamctl.8 index d82f25dc4..83a09c170 100644 --- a/utils/kamctl/kamctl.8 +++ b/utils/kamctl/kamctl.8 @@ -40,6 +40,10 @@ inside .B kamctlrc file. +.PP +For some commands, parameters can be prefixed with 's:' in order to enforce +string type (e.g., 's:123456789'). + .SH AUTHORS see diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base index 641449422..2873c2ddb 100644 --- a/utils/kamctl/kamctl.base +++ b/utils/kamctl/kamctl.base @@ -699,7 +699,7 @@ filter_json() $AWK 'function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s } BEGIN { line=0; IGNORECASE=1; } { line++; } - NR == 1 && /^{.+"id"[ \t]*:[ \t]*[0-9]+[ \t]*}$/ { print; next; } + NR == 1 && /^[{].+"id"[ \t]*:[ \t]*[0-9]+[ \t]*}$/ { print; next; } NR == 1 && /^200 OK/ { next; } /^[ \t]*"jsonrpc":[ \t]*"2.0"/ { print; next; } /^[ \t]*"result":[ \t]*\[.+/ { diff --git a/utils/kamctl/kamctl.pgsql b/utils/kamctl/kamctl.pgsql index 7e5abaef9..1250dc0d7 100644 --- a/utils/kamctl/kamctl.pgsql +++ b/utils/kamctl/kamctl.pgsql @@ -57,15 +57,17 @@ pgsql_query() { # input: sql query, optional pgsql command-line params pgsql_ro_query() { - mdbg "pgsql_ro_query: $PGSQL $2 -h $DBHOST -U $DBROUSER $DBNAME -c '$1'" + mdbg "pgsql_ro_query: $PGSQL $2 -A -q -t -h $DBHOST -U $DBROUSER $DBNAME -c '$1'" if [ -z "$DBPORT" ] ; then PGPASSWORD="$DBROPW" $PGSQL $2 \ + -A -q -t \ -h $DBHOST \ -U $DBROUSER \ $DBNAME \ -c "$1" else PGPASSWORD="$DBROPW" $PGSQL $2 \ + -A -q -t \ -h $DBHOST \ -p $DBPORT \ -U $DBROUSER \ diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base index 13af37e7c..0099aa8bf 100644 --- a/utils/kamctl/kamdbctl.base +++ b/utils/kamctl/kamdbctl.base @@ -33,20 +33,20 @@ INSTALL_DBUID_TABLES=${INSTALL_DBUID_TABLES:-ask} # Used by dbtext and db_berkeley to define tables to be created, used by # postgres to do the grants -STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain domain_attrs +STANDARD_TABLES=${STANDARD_TABLES:-'version acc dbaliases domain domain_attrs grp uri speed_dial lcr_gw lcr_rule lcr_rule_target pdt subscriber location location_attrs re_grp trusted address missed_calls usr_preferences aliases silo dialog dialog_vars dispatcher dialplan - acc_cdrs topos_d topos_t} -EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy + acc_cdrs topos_d topos_t'} +EXTRA_TABLES=${EXTRA_TABLES:-'imc_members imc_rooms cpl sip_trace domainpolicy carrierroute carrier_name domain_name carrierfailureroute userblacklist globalblacklist htable purplemap uacreg pl_pipes mtree mtrees sca_subscriptions mohqcalls mohqueues rtpproxy rtpengine - dr_gateways dr_rules dr_gw_lists dr_groups} -PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap - pua rls_presentity rls_watchers} -DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs - uid_global_attrs uid_uri uid_uri_attrs uid_user_attrs} + dr_gateways dr_rules dr_gw_lists dr_groups'} +PRESENCE_TABLES=${PRESENCE_TABLES:-'presentity active_watchers watchers xcap + pua rls_presentity rls_watchers'} +DBUID_TABLES=${UID_TABLES:-'uid_credentials uid_domain uid_domain_attrs + uid_global_attrs uid_uri uid_uri_attrs uid_user_attrs'} # SQL definitions # If you change this definitions here, then you must change them @@ -69,18 +69,18 @@ GREP=${GREP:-grep} SED=${SED:-sed} # define what modules should be installed -STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group +STANDARD_MODULES=${STANDARD_MODULES:-'standard acc lcr domain group permissions registrar usrloc msilo alias_db uri_db speeddial - avpops auth_db pdt dialog dispatcher dialplan topos} + avpops auth_db pdt dialog dispatcher dialplan topos'} -PRESENCE_MODULES=${PRESENCE_MODULES:-presence rls} +PRESENCE_MODULES=${PRESENCE_MODULES:-'presence rls'} -EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute +EXTRA_MODULES=${EXTRA_MODULES:-'imc cpl siptrace domainpolicy carrierroute drouting userblacklist htable purple uac pipelimit mtree sca mohqueue - rtpproxy rtpengine} + rtpproxy rtpengine'} -DBUID_MODULES=${UID_MODULES:-uid_auth_db uid_avp_db uid_domain uid_gflags - uid_uri_db} +DBUID_MODULES=${UID_MODULES:-'uid_auth_db uid_avp_db uid_domain uid_gflags + uid_uri_db'} ############################################################