diff --git a/ChangeLog b/ChangeLog index da2d30ba2..7a9bb60c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,1474 @@ +===================== 2011-09-14 Version 3.1.5 Released ===================== + +===================== Changes Since Version 3.1.4 =========================== + +commit df2ff926c990b4123bf02cd51a15c9e1390cc55b +Author: Daniel-Constantin Mierla +Date: Wed Sep 14 18:53:56 2011 +0200 + + pkg: version set to 3.1.5 for kamailio rpms + +commit 97607a0da2bc284500e03bce77247e9588a7a9db +Author: Daniel-Constantin Mierla +Date: Wed Sep 14 18:52:10 2011 +0200 + + pkg: version set to 3.1.5 for kamailio debs + +commit d616d8372da87a3cf404c8573467a3d64eb37f14 +Author: Daniel-Constantin Mierla +Date: Wed Sep 14 18:49:49 2011 +0200 + + Makefile: version set to 3.1.5 + +commit 53ee5d0e7e387cdf0f39a371b356ff44f3d36fa9 +Author: Daniel-Constantin Mierla +Date: Wed Sep 14 18:39:37 2011 +0200 + + tm: backup X/AVP lists when building new T in t_uac() + + - build_cell() is setting core X/AVP lists to new T structure, losing + the lists that existed in case another T was set already. This is in + t_uac() which is used for local generated requests, such as + uac_req_send(), presence notifications, msilo... + - a revious patch was backing up only X/AVPs lists for + execution of event_route[tm:local-request] + - reported by Vitaliy Aleksandrov + (cherry picked from commit 1e83919bcb3f1a2fb2890a6766a007b8f50cb986) + +commit b4fae8b9eee6d893aa2591bcc9039ea53a142161 +Author: Daniel-Constantin Mierla +Date: Wed Sep 14 11:19:56 2011 +0200 + + rr(k): execute callbacks only for local route uri + + - parameters callback are executed only if there is a list with + parameters in Route URI and for loose routing the URI has to match + myself condition + - should fix bogus value of Route URI params in callback function when + URI of top Route is not myself + - reported by Andreas Granig + (cherry picked from commit 10eac9b125ff2a13a2ae240897a3f17bc1243c71) + +commit 471b7780706efa2086fe2d1a614ec84cb1c4b19d +Author: Daniel-Constantin Mierla +Date: Wed Sep 14 10:54:15 2011 +0200 + + Revert "auth_radius(s): use the update pre_auth" + + - reverted invalid backport mistakenly selected + This reverts commit 7c9a316c78c670889ee55772a5d2e8e72a6808d3. + +commit 13703fac521feb3662cbce921a8ba0f299d001e2 +Author: Juha Heinanen +Date: Fri May 20 23:08:24 2011 +0300 + + core: fixed via branch value in ack to 200 ok + + - By default, sr was using non-rfc3261 compliant via branch value when + it generated ack to 200 ok. + (cherry picked from commit ebb3b085c15b398192cd8e242d46914252278448) + +commit 39387157697847f6cb87531956a9da7c3c4e530d +Author: Andrei Pelinescu-Onciul +Date: Fri Sep 2 10:22:35 2011 +0200 + + sctp: update the cfg before handling notifications + + Update the local config immediately after successfully reading + a message (before processing notifications, since some of the + notifications processing makes use of cfg values). + (cherry picked from commit 5813703a7931f288b95840b9a93c628773c33a03) + +commit 7c9a316c78c670889ee55772a5d2e8e72a6808d3 +Author: Andrei Pelinescu-Onciul +Date: Mon Aug 22 11:45:38 2011 +0200 + + auth_radius(s): use the update pre_auth + + Handle the new pre_auth returns. + (cherry picked from commit 01a0bfd830a4efb5e2f8d26fbaf80297eb5a1ba3) + +commit cd1290e5602f06be16589cde193d1443aee4dcd2 +Author: Daniel-Constantin Mierla +Date: Mon Sep 12 12:52:33 2011 +0200 + + dispatcher(k): typo in ds_next_dst() dstid avp handling + + - fixes wrong condition in finding dstid avp + - patch by Bogdan Pintea + (cherry picked from commit 11f7ddaf80d2865a649d35581f8d0ff06857af04) + +commit 266167598becf8711f29c4d3a6838ba22b8bb1d6 +Author: Daniel-Constantin Mierla +Date: Sun Sep 11 11:36:10 2011 +0200 + + pua_xmpp: removed invalid lib path from Makefile + +commit 30fd945c4ec528d6cb451f9e1c0d14f40a71408a +Author: Daniel-Constantin Mierla +Date: Sun Sep 11 11:34:24 2011 +0200 + + presence_xml: removed invalid lib path from Makefile + +commit 2b7c8a947a1a34a2b8d9846754e9cd0015d69c0d +Author: Daniel-Constantin Mierla +Date: Sun Sep 11 11:32:34 2011 +0200 + + presence(k): removed invalid lib path from Makefile + +commit 7723e6b6da380d18675316fb39f8b850d2109fb6 +Author: Daniel-Constantin Mierla +Date: Sat Mar 12 12:27:52 2011 +0100 + + tmx: added the docs for t_flush_flags() + (cherry picked from commit ce7aa8e46e839a56d5759a688d03515f94497267) + +commit b5ba5f8f0aa8b38819922751743cacedab54742e +Author: Daniel-Constantin Mierla +Date: Sat Mar 12 12:22:51 2011 +0100 + + tmx: restored t_flush_flags() + + - function to sycn the msg flags back to transaction when the + transaction was created before modifying the flags + - reported by Juha Heinanen + (cherry picked from commit 83620cb7cd14ee3b509eef72d99337567f53967f) + +commit 14d457543beebdff71eaa4dfdb90ef115c2e1877 +Author: Daniel-Constantin Mierla +Date: Sun Jun 26 11:48:39 2011 +0200 + + tm: renamed typedef cell_type to tm_cell_t + (cherry picked from commit c4c3773622a5419d890a13a5226d721ff0a7bcfa) + +commit 8027fd1dbf27b5de2ba7e90b0feef9c1772242ea +Author: Daniel-Constantin Mierla +Date: Fri Sep 9 10:25:02 2011 +0200 + + xcap_client: use curl-config to get include and lib compile flags + +commit f31b2a60e861eef20866004bdd82eaae8dbd45c2 +Author: Daniel-Constantin Mierla +Date: Fri Sep 9 10:08:33 2011 +0200 + + xcap_server: use xml2-config to get include and libs compile flags + (cherry picked from commit 3e502e2ac387999306d4a472784ed0699b8c7f77) + +commit b0bc86360334237095ad764cf8552a12907d8996 +Author: Daniel-Constantin Mierla +Date: Wed Sep 7 21:57:03 2011 +0200 + + xcap_server: remove invalid lib dir from Makefile + (cherry picked from commit 7e1564b7e67a25eb22c26f4ae235d9b380ce8417) + +commit 2f4a52c9e4a1c058d1355dbb5f45d3589d7554a7 +Author: Daniel-Constantin Mierla +Date: Tue Sep 6 14:12:00 2011 +0200 + + tm: update T msg flags after {branch/failure}_route + + - after execution of branch_route or failure_route, set the message + flags of the temporary request back to transaction request + - 1.x behaviour + - reported and partial patch by Alex Hermann + (cherry picked from commit c589ca35b2aa3097a3c9e2a5a050514337300c05) + +commit b7edd05ca05020f5a40f6c177d309894a7e958d8 +Author: Daniel-Constantin Mierla +Date: Tue Aug 23 00:27:10 2011 +0200 + + app_lua: fixed assignments for Makefile vars + (cherry picked from commit 1d4f8bbf2e3889c9c5279bf81ec832fb86b69112) + +commit ee121bfbda8c4d27ef606e0003506de18b5ca911 +Author: Daniel-Constantin Mierla +Date: Fri Aug 12 22:51:20 2011 +0200 + + pua_xmpp: fixes to SIP-XMPP presence status translations + + * patch by Laura Testi to fix: + - the online/offline status is ok in both direction (SIP<-->XMPP) + - other status (away/busy) is not ok from XMPP to SIP + - busy status is not ok from SIP to XMPP + - each time XMPP contact change the status, triger a new SUBSCRIBE in xmpp + gateway which generate multiple same subscriptions with different callid + in both active_watchers and pua tables. This also makes multiple NOTIFY + generation from the main Presence Server to GW when the SIP contact change + it's status + (cherry picked from commit d1097d6ac9295c529ad6e682534ee4b3f0a9daae) + +commit 6b07dd067f55ff9ff418a4646d8efe967f6cc8f5 +Author: Daniel-Constantin Mierla +Date: Thu Aug 4 11:41:32 2011 +0200 + + tls: safety check for current cipher + + - SSL_get_current_cipher(...) may return NULL, in case of the cipher was + not set yet for the connection + - caused crash when RPC command tls.list was used in such moment + - cipher description is set to 'unknown' for such case + - reported by Francesco Castellano + (cherry picked from commit 816a0218130782ea86a3cc16feb2a008fe6fff68) + +commit a38f6184044e964a1eff56da80c2ae6bfdf50a06 +Author: Daniel-Constantin Mierla +Date: Wed Aug 3 23:03:54 2011 +0200 + + tm: don't set dst_uri to next hop for branch_route + + - added flag to skip setting dst_uri to next hop for branch_route if the + dst_uri was not set before + - there is already a select and a pseudo-variable to access next hop value, + in case it is needed in branch route + - reported by Alex Hermann + (cherry picked from commit fb4ecbf986f4af366e5be9cbad26ceba924c77fd) + +commit 0dcf964514ba3fb9d09f21340bbeb01626bd8109 +Author: Daniel-Constantin Mierla +Date: Wed Aug 3 19:34:09 2011 +0200 + + tm: allow nested backup of avp lists when sending local requests + + - added ability to use a local variable instead static var to + backup/restore avps lists for local generated transactions + (cherry picked from commit 08798a6d06b628fa5888ded867c5d18416b9f013) + +commit ab9451afe5cc27a8253d9273a2d50d6470d6cc78 +Author: Daniel-Constantin Mierla +Date: Mon Aug 1 14:36:39 2011 +0200 + + tm: backup/restore lists of avps for usage t_uac + + - when sending a self-generated request while processing other sip + message, backup the list of avps and restore afterwards + - reported by Sebastian Damm + - added helper function to backup/restore the lists of avps from msg + context to static var and use transaction lists + (cherry picked from commit 203b2678a7115f2ba744eeda5279108fdd5b139d) + +commit 3585f8f08d55d150aa78b566e2a817c0d78a6766 +Author: Daniel-Constantin Mierla +Date: Sun Jul 17 00:28:26 2011 +0200 + + app_python: provide a clone string to dirname and basename + + - script name value is cloned before execution of dirname and basename + since they may modify the parameter + - reported by Arnaud Chong, FS#137 + (cherry picked from commit 53605f2ca1718e42f1f1fcb87bb67935c889249a) + +commit 25bebfc6a398820d507c75ecfbab3677c6b016ab +Author: Daniel-Constantin Mierla +Date: Sun Jul 17 00:17:58 2011 +0200 + + app_python: fixed compile warning + + - warning: dereferencing type-punned pointer will break strict-aliasing + rules + +commit 66e3531def2e011aa640033a161c9a2fd6e4578c +Author: Daniel-Constantin Mierla +Date: Wed Sep 7 13:23:07 2011 +0200 + + dispatcher(k): fix segfault if dispatcher cannot resolve hostnames + + - applies if the dispatcher module cannot resolve hostnames during + startup (and tries to shutdown) + - patch by Hugh Waite + (cherry picked from commit cad2daebf295443f2318abbb608102bb99111948) + +commit 19f3a0d6a6951ddae4734f9d217ae8f223d60de7 +Author: Henning Westerholt +Date: Mon Sep 5 21:50:23 2011 +0200 + + pgk: add symlink to kamailio directory for new gentoo ebuild + (cherry picked from commit a89e2b1a2f71c932f38c0bfdcceb2fa1880431f5) + +commit b76666deb6221fedfdf2927b2db6e07e8440864c +Author: Henning Westerholt +Date: Mon Sep 5 21:46:12 2011 +0200 + + pkg: also remove Makefile.defs.diff from calling files + (cherry picked from commit 4c201e8c08e607f60efe695b5b9bb22042b7dbbe) + +commit 738f0b36bf416de6cd1232f18e4f9dbaf650f2c8 +Author: Henning Westerholt +Date: Mon Sep 5 21:42:03 2011 +0200 + + pkg: remove Makefile.defs.diff file, which set special daemon name - use the default + (cherry picked from commit 65340ae5b19f20d904d6a80b2e80711c93d44f7d) + +commit 007cd3ffdadf0964f6e338d2999658bac6676f74 +Author: Henning Westerholt +Date: Mon Sep 5 21:33:21 2011 +0200 + + pkg: move gentoo ebuild to ser directory, remove obselete 0.8.X ebuild + +commit f1252f026d12624908b2cf79e3a433472f038392 +Author: Henning Westerholt +Date: Mon Sep 5 18:17:40 2011 +0200 + + pkg: remove obselete gentoo ebuild, add new generic ebuild from Claudio Furrer (FS#134) + (cherry picked from commit d7b0e82c14caa1809bb6f0d96646354eabf2c253) + +commit 535c86ef0c297a4f08f82e0d1a66fca0882fd2fb +Author: Henning Westerholt +Date: Mon Sep 5 18:10:39 2011 +0200 + + pkg: fix wrong package name, closes FS#148, reported from Andrew Pogrebennyk + (cherry picked from commit 15adc86286e05805cb99617686ae2c6fe1e69d27) + +commit 5e827db17414a02902ee8899d762af9933baec66 +Author: Sven Knoblich +Date: Mon Sep 5 13:35:50 2011 +0200 + + core: fix typo in parser. + + - use correct function-name in log message of parse_param.c:parse_contact_class. + (fixes flyspray-issue 147) + (cherry picked from commit 21ff48876956bf1df67ace6651ea9782e297946b) + +commit 97f788a3f1e4e993c99fb1225a1fbcbe4ff0ffc8 +Author: Daniel-Constantin Mierla +Date: Wed Aug 31 09:38:28 2011 +0200 + + usrloc(k): request a db connection per child + + - avoid sharing the connection between processes + - reported by MÉSZÁROS Mihály + (cherry picked from commit d593078c2e0bb123d56de2d440473cc12a08fba6) + +commit 18881421102eaac97c85d84cbbd1597c3f342d23 +Author: Marius Zbihlei +Date: Wed Aug 17 15:00:00 2011 +0300 + + modules_k/dialog When hash_size was smaller then 1, consider this as a value(1 == 2^0) + + The 1<<(n-1) check for the power of two smaller than the given number doesn't work for n == 0 (undefined behavior), + so values of dlg_hash_size smaller than 1 where not checked correctly. + (cherry picked from commit 11033b05be673593a87afdc2a1d8a2c887fb9ab7) + +commit cb21425e6fa9e824a51b44829b0ad9d9bf9beb99 +Author: Timo Reimann +Date: Sat Aug 27 02:20:00 2011 +0200 + + modules_k/dialog: Fix commit backport mistakes in dlg_handlers.c + causing compiler run to fail. + + - Add and set missing "spiral_detected" flag variable. + - Use correct SIP message variable name (req -> msg). + +commit d5e90ab587746a39c9be44d9f9f1c325b8d4902d +Author: Timo Reimann +Date: Sat Aug 27 01:44:03 2011 +0200 + + modules_k/dialog: Improve error handling during dialog creation. + + - Set current dialog only after all other setup work succeeded. + (Eliminates call to profile_cleanup() and guarantees that dialog + profiling does not yield to segfault if dialog creation fails + for certain reasons.) + - During error handling, refrain from decrementing the reference + counter for dialog linking if this is a spiraled request + (because positive spiral detection skips the linkage code path). + (cherry picked from commit 71dd754818d8c3ec304298f1002a45889c2da0aa) + + Conflicts: + + modules_k/dialog/dlg_handlers.c + +commit 8ff999c7641bf08f0e6d52a14d1f612511525eb3 +Author: Timo Reimann +Date: Thu Aug 25 15:17:48 2011 +0200 + + modules_k/dialog: Simplify and refactor parts of reference counter + handling. + + - Remove special handling for dialogs in the "deleted" state to + allow accessing such dialogs (e.g., from the configuration + script). + Besides making the code easier to understand, this also fixes a + bug where the reference counter would be decremented after + detecting a spiral (dlg_handlers.c) even though get_dlg() does + not increment it for "deleted" dialogs. + - Adapt interfaces for lookup_dlg() and get_dlg() accordingly, + i.e., remove "del" parameter and update in-code documentation. + - Replace direct increments on a dialog structure's ref variable + by calls to ref_dlg_unsafe(). + - Move {un}ref_dlg_unsafe() definitions towards the head of the + file to make declaration available earlier. + - Improve store_dlg_in_tm(): + * Return and evaluate result code. + * Replace second register call by passing unreference_dialog() + as release function to the first register call. + - Document various places in the code dealing with reference + counting. + (cherry picked from commit f44534cbe841046079e176512b04a6b9c5a68bdc) + + Conflicts: + + modules_k/dialog/dlg_handlers.c + modules_k/dialog/dlg_hash.c + modules_k/dialog/dlg_hash.h + +commit 084da0afc666fef6f92c00754bbfb3c192751ff6 +Author: Timo Reimann +Date: Thu Aug 25 13:26:32 2011 +0200 + + modules_k/dialog: Provide in-code documentation for tricky part in + dlg_new_dialog(). + (cherry picked from commit d903b7707d1f9c5ecb4110de9ab9d8a573a6f8cd) + +commit e17caaf8354f8fefb1d9558347c18fc96b3a6011 +Author: Timo Reimann +Date: Tue Aug 23 15:36:45 2011 +0200 + + modules_k/dialog: Add reference count to list of items returned + via RPC. + (cherry picked from commit cf8e80cbe53380e628476edf0cff0e05b77e25f9) + +commit e57897b4b3f5c3bb535164dc7349f36538ea3d79 +Author: Timo Reimann +Date: Tue Aug 23 11:05:59 2011 +0200 + + modules_k/auth_db: Fix error in docs. + (cherry picked from commit d702484d2021cf132f48aa2fe3ed9f0984f028f1) + +commit e46b74fb4d32a6b2f8f1f0e8c68e9b33a8a38dbd +Author: Timo Reimann +Date: Sun Aug 21 23:05:19 2011 +0200 + + modules_k/rls: Remove definitions of CONT_COPY{,_1} as they are + not used within the module and produce compiler warnings. + + (Fits commit bdfdf6b7e35db04dd3fd48924082dba4dd4a63d5 done in master; + cherry pick avoided, however, because automatic merge introduced too + many changes.) + +commit acf576857af94c99cb9fa96bff5c6f52af2177e1 +Author: Timo Reimann +Date: Wed Aug 17 11:19:38 2011 +0200 + + modules_k/dialog: Remove superfluous node check. + + (cherry picked from commit + 0e54244acb0064760844e709d9e949e32f827ba9) + +commit 410be63cfcd6368079dcf23d3118ec986e227fac +Author: Timo Reimann +Date: Sun Aug 21 22:54:11 2011 +0200 + + modules_k/dialog: Clear dialog table after loading dialogs from + database into memory if DB_MODE_SHUTDOWN is used. + + - Closes Flyspray issue #126 ('3.x dialog module: dialogs stay in + database when in "shutdown only" mode'). + (cherry picked from commit 76fc55be0107da80997f9515bb940e837ff899de) + + Conflicts: + + modules_k/dialog/dlg_db_handler.c + +commit a914d2fe78c042d9d9d753e56c1f1368821941c1 +Author: Timo Reimann +Date: Sun Aug 21 22:21:12 2011 +0200 + + modules_k/dialog: Add multiple features. + + - Move unreference_dialog() to a more suitable location. + - Provide functions to add and remove a dialog from a transaction + (required for referencing at certain occassions). + - Move spiral detection functionality into dlg_new_dialog() to + faciliate spiral detection when dlg_manage() is used. + - Add a dialog's reference count to list of printable statistics. + + Credits to Sven Knoblich, sven.knoblich@1und1.de . + + (cherry picked and restricted to bug-fixes only from commit + c021559e414892b9bafae0f1ce40081945fff49a) + + Conflicts: + + modules_k/dialog/dlg_handlers.c + modules_k/dialog/dlg_var.c + modules_k/dialog/dlg_var.h + +commit 2cfe776481ce70f18557d9e376e584b6d29e8046 +Author: Timo Reimann +Date: Thu Mar 10 20:13:41 2011 +0100 + + dialog(k): Fix indention in spiral detection example code (docs). + + (cherry picked from commit + acca0fad60183745d8b9317f11326bfa601c5b02) + +commit 3ca04c644ee40c22b242ae50c7d87d71cc2f63c5 +Author: Timo Reimann +Date: Fri Aug 12 14:08:02 2011 +0200 + + modules_k/dialog: Fix a bug that would cause a segfault when + caller bind address information could not be retrieved from + database and "dlg_list" was fifo-issued. + + - Check nulliness of dlg->bind_addr[DLG_CALLER_LEG] before + printing. + (May be NULL when server doesn't feel responsible for a bound + address loaded from dialog database.) + - Move check-and-print code for both directions (caller and + callee) next to each other. + (cherry picked from commit ab21b25652a8a1b44c1ec1ece01767d24e0ba33b) + +commit 4fa1e1b5e4dbd9939b8dca2b2440bfde1dab72f0 +Author: Timo Reimann +Date: Thu Aug 11 17:19:20 2011 +0200 + + modules_k/dialog: Improve dialog timer list handling. + + - Avoid updating a dialog timer item if it is not yet linked into + the timer list. + (Avoids reference counting bugs due to race conditions where the + timer list has not been initialized yet prior to any update + attempts.) + - In case of bogus dialog during timer insertion, postpone release + of dialog timer lock until error log message has been emitted. + (cherry picked from commit 7afb2cf8e4640bbaadfc80fcc052b34d5ae3cfae) + +commit e66d50297ca9a4b1eb3f0c7c61095ffb26a44af8 +Author: Alex Hermann +Date: Mon Aug 1 16:09:38 2011 +0200 + + modules/tm: fix t_load_contacts for failure_route. Ignore ruri if it has already been used. + + Commit e973bbe5e7310861f77b17ce0afaf1cca35fe48a removed the logic for handling + failure_route. The result was that when t_load_contacts is called from + failure_route, the current request-uri is added as branch _again_. + + This commit restores the original functionality by ignoring the request uri + if it is marked as consumed. + +commit cc4bcb18b064f7d66b16db2b452c0e36f14aecc3 +Author: Juha Heinanen +Date: Mon Aug 8 11:22:23 2011 +0300 + + modules/tm: reverted previous commit on t_load_contacts() + +commit 8268c8e6e6af3acf4dafdbd13bbf3d223662b35d +Author: Juha Heinanen +Date: Mon Aug 8 10:55:24 2011 +0300 + + modules/tm: t_load_contacts() now ignores ruri if it has already been used + - Thanks to Alex Hermann for the patch. + (cherry picked from commit 9efc7014638e2c7ead56ac36d880b303f2873b85) + +commit 6239efef5fe047248843da847d1cc458a44bd658 +Author: Daniel-Constantin Mierla +Date: Wed Aug 3 18:03:05 2011 +0200 + + kamctl: added missing db tables creation scripts + + - pipelimit was not generated after cherry-picking the xml schema + definition, reported by Hala Alramli + - other tables were ignored due to match of 'kamailio' token in + path due to gitignore rules + +commit d7783646cc965cb15780cd2bdfc4909073f39cdd +Author: Daniel-Constantin Mierla +Date: Wed Aug 3 18:00:56 2011 +0200 + + kamctl: updated the db screation scripts based on latest xml schema definitions + + - dbtext and db_berkely folders were matched by gitignore rules due to + 'kamailio' token + +commit 2a080ba89d057ca5460d0df6d31c2d3d5dc6c9ce +Author: Daniel-Constantin Mierla +Date: Mon Aug 1 14:33:15 2011 +0200 + + .gitingnore: set root path for binary names + + - some directories containing the binary name (e.g., kamailio like in + utils/kamctl/dbtext/kamailio/...) in path were ignored. Updated + .gitignore to use /kamailio and /ser which according to manual should + match on the root folder of GIT tree + (cherry picked from commit 285566bd31379ee4b6199f72c8c589a6b313bf07) + +commit 8b801716e9f86950a9ec3a7b54374963e890dbfa +Author: Juha Heinanen +Date: Sun Jul 31 19:04:43 2011 +0300 + + lib/srdb1/schema: removed index that included missing columns + (cherry picked from commit 27f722f44ac080df47bb4c64e513f50be611aa7a) + +commit 9213ce40cc77d388033e5bf70f10aa9457c4aacf +Author: Henning Westerholt +Date: Wed Aug 3 17:48:44 2011 +0200 + + pdbt: off-by-one error fixed in carrier.c, better output for pdbt command-line interface (parseable) + (cherry picked from commit 91f79909c53d3b86d497193a4671699b4ec09782) + +commit 956e4c18955ea0d9ddd5c85d4d11a05452b6be32 +Author: Daniel-Constantin Mierla +Date: Sat May 21 12:33:00 2011 +0200 + + core: added some binary operators + + - not, xor, left shift and right shift + (cherry picked from commit 508ad1c0011352e6d24234dbef70a3f6abbdc276) + +commit 505e4b790578e2cfe372ae318fab967b71cd265c +Author: Daniel-Constantin Mierla +Date: Thu Jul 28 13:18:11 2011 +0200 + + textops(k): internal API bind function exported via module interface + + - internal API was defined but no function to bind it was available in + the module interface, reported by Timo Klecker + - rename of functions and typedef'ed struct to match the patterns of + exporting modules internal API + (cherry picked from commit db188fbcf4d752a2afab2e298a2f081f836d7e92) + +commit 9dbf735878acc87bab1a0740476f1d106f89412f +Author: Daniel-Constantin Mierla +Date: Wed Jul 27 19:34:35 2011 +0200 + + core: allow forcing send socket for replies + + - patch by Marcus Hunger, closes FS#142 + (cherry picked from commit bf48d46366eb50ebcaf0972d2524b65d3accdffa) + +commit 66b15ad5369a24ea6fce563215e6efe6f8ba35ed +Author: Daniel-Constantin Mierla +Date: Thu Jul 21 08:07:22 2011 +0200 + + presence(k): removed mistakenly typed } before the previous commit + (cherry picked from commit 403ba772771545f4410ba4a5cf396125be353b12) + +commit 97131c94922d48ed7aed632bb34293af034a5fee +Author: Daniel-Constantin Mierla +Date: Thu Jul 21 00:31:49 2011 +0200 + + presence(k): insert empty string as sender in db if missing + + - if sender_uri parameter is not given to handle_publish(), insert empty + string for sender column in presentity table + - the field is used for SLA/BLA + - fixes constraint of non-null value in db table, reported by Roberto + Fichera + (cherry picked from commit b39747e213e350609761d14583db3e689ad6fefc) + +commit 3b23a42d19b3f53e2670cf1407c0ec029a0c443a +Author: Daniel-Constantin Mierla +Date: Thu Jul 21 00:08:42 2011 +0200 + + presence(k): log message abour not supported event printed as warning + (cherry picked from commit 460fc8bf6ad5108ff3779c85ff150e4f5145b189) + +commit dd8b88da870eee544e2e05e6075436b884d16d99 +Author: Daniel-Constantin Mierla +Date: Wed Jul 20 23:42:05 2011 +0200 + + kamdbctl: added pipelimit to the list of extra tables to create + (cherry picked from commit 0be9f5a4efeba2eb297a2e3286b9795f33f2dbe2) + +commit 55e4811d4d0620d1dcbb94b1462f443195564594 +Author: Daniel-Constantin Mierla +Date: Wed Jul 20 23:35:01 2011 +0200 + + srdb1: added definition of pipelimit module db table + (cherry picked from commit e8a949e3032b9cadf40ce2be0027c780b29637a7) + +commit 8ebbed77f2be9277b6296c95952b17e5a4a5c9b7 +Author: Daniel-Constantin Mierla +Date: Tue Jul 19 19:41:20 2011 +0200 + + tm: be sure branch PV is set when t_check_trans() is used for reply + + - reported by Alex Hermann, FS#117 + (cherry picked from commit 2e426419ab2f3f15adc4a50de6efe3bb06dc77b8) + +commit c9a4e86fb196aaa1024ac08f25c8fa7d7d3a400f +Author: Daniel-Constantin Mierla +Date: Mon Jul 18 22:37:07 2011 +0200 + + pv: use suip2a(...) for $snd(..) + + - fixes FS#140, reported by Klaus Darilion + (cherry picked from commit e151a9e99b1fed7805eaed5d16ca3d6466e1f517) + +commit 189644b5100b8a7285688c87d2081bb3c8937500 +Author: Daniel-Constantin Mierla +Date: Mon Jul 18 22:34:47 2011 +0200 + + core: new function to get IP address from su structure + + - suip2a(...) returns zero-terminated string representation of IPv4/IPv6 + address + (cherry picked from commit fabaa667795e5162fe17afd3e4a073bc99057144) + +commit e9a61dd16dffb6e6e74810431741a297b62524c1 +Author: Elena-Ramona Modroiu +Date: Tue Jul 19 09:46:35 2011 +0200 + + mqueue: decrease number of items when size limit is reached + + - proper counting of intems in the queue + - patch by Denis Chukhryaev + +commit acf25edbf8047a7511b304e0941d8c6365980e48 +Author: Daniel-Constantin Mierla +Date: Wed Jul 6 19:39:36 2011 +0200 + + presence(k): switch to terminated status if no longer active + + - if contact is removed via xcap, making the status different than + active, set it to terminated states + - patch by Laura Testi, FS#133 + (cherry picked from commit 73ec9511e3c740304f6376890f0c0b416d84dd8f) + +commit ec63ebad94faaf2800aa9738b9da9c25687dfe3a +Author: Henning Westerholt +Date: Wed Jul 6 18:26:16 2011 +0200 + + utils: fix kamctl start if installed in a custom prefix, tested from Fabian Borot + (cherry picked from commit 7ca54b8867ca325fd318536e29f8ae8e028611c9) + +commit 1971e78a51ca7d5b6ca614cfd9fd24d1bb50d12d +Author: Iñaki Baz Castillo +Date: Wed Jun 22 17:42:13 2011 +0200 + + dns: typo fixed (dns_a_resovle -> dns_a_resolve) + (cherry picked from commit 12cc6b39ecafedd611fde7eb917becaa78038cbf) + +commit 57092200dbc11a61510988b7bb6939284618f5ff +Author: Daniel-Constantin Mierla +Date: Wed Jun 22 11:42:30 2011 +0200 + + uac: more verbose debug message + + - give hint of how to get rid of append_fromtag requirement on rr module + (cherry picked from commit 70ae31556b09d300f6d708b0e4edf287927748d2) + +commit fba61d177eb87879925a44a1b1ad0ea51864da57 +Author: Daniel-Constantin Mierla +Date: Tue Jun 7 23:19:18 2011 +0200 + + core: IPv6 addr enclosed in square brackets for process descripton + + - UDP and SCTP listeners will have the IPv6 address in between square + brackets inside the description string + (cherry picked from commit 5629f449af98134c05c0679588de906a414364ab) + +commit a568684930e5dfea48b0044e17ee2ee57bfede57 +Author: Daniel-Constantin Mierla +Date: Tue Jun 7 22:57:32 2011 +0200 + + kamctl: don't require sercmd all the time + + - sercmd is not needed for all commands - throw error only when it is + going to be executed but it is not found + (cherry picked from commit 8b445f464c7d3904eae5d62a571148c621c3c6f8) + +commit 69443e87325aea1f5a4286e7a8df7ac778f91f83 +Author: Daniel-Constantin Mierla +Date: Thu Jun 30 15:54:42 2011 +0200 + + db_mysql: search also for mysql_config5 in Makefile + + - on some OSes, the mysql_config tool might have the name mysql_config5 + (cherry picked from commit d0858edd95726117d2ccc9567b9f7bf012204448) + +commit e2d6f0e3e0a3b9511f05be79d11a097a99d70eb7 +Author: Andrei Pelinescu-Onciul +Date: Sat Jun 11 10:38:10 2011 +0200 + + dns: case insensitive check for NAPTR record flags + + The NAPTR records flags where not checked in case insensitive + mode. Records with the 'S' flags where ignored ('s' was expected). + + Closes: FS#135 + Reported-by: Inaki Baz Castillo ibc aliax net + (cherry picked from commit fa00eaf013a1787f0523559595a1a73ab469de83) + +commit e23e5140bc90627ee7c4e15580cde037e3fefc11 +Author: Daniel-Constantin Mierla +Date: Fri Jun 10 11:19:44 2011 +0200 + + debugger: safety check for pid list + + - some event route blocks can be executed before all children + initialization and the internal pid list structure is not created, + disable debugging in this case + (cherry picked from commit 35ef4b0d8f85f1e902e0d99d513f311ebd39bc6d) + +commit 65951e6f0573858cfedcb5676dee56ad9cc529bc +Author: Marius Zbihlei +Date: Mon Jun 6 15:44:16 2011 +0300 + + pkg/kamailio/squeeze : Make lintian happy(er) by adding dependancy on $remote_fs + + As Kamailio need /usr paths to be available, this requires a LSB dependancy on $remote_fs. + +commit b981181c4dc90eee4b324180716bc786433507f7 +Author: Marius Zbihlei +Date: Thu Apr 28 10:30:55 2011 +0300 + + module_k/pv Changed the nameaddr transformation by relaxing the requirements on the input. + + As some headers might be either uri or nameaddr form, using a single transformation for parsing them was + impossible, as nameaddr.uri returns "" on an uri input(e.g. sip:12345@example.com). With this change, the + nameaddr transformation succedes and the resulting transformation places the whole string in the .uri field, + .name field being empty. A transformation chaning like the one below will work as expected on both SIP URIs and + SIP Nameaddr + $(val(test){nameaddr.uri}{uri.domain}) + (cherry picked from commit 9287609db4ac64c709aa500e6326ac33af2c2061) + +commit 16183d4553aca270da1284255f3f6862132a3aeb +Author: Daniel-Constantin Mierla +Date: Sat Jun 4 10:22:09 2011 +0200 + + registrar(k): reset local interator to contacts headers + + - when the REGISTER request had more than one Contact header and + max_contacts parameter was set, there were two iterations through the + list fo Contacts header without reseting the iterator, resulting in + not processing all Contact headers in save() - reported by Andreas Granig + - instead of parsing the fist contact header as parameter to several + functions, take it from sip msg structure hook + (cherry picked from commit a74f12d633188a7e70b09238c0d48b207efc66c3) + +commit 1312f780d4c2409536e909ea472d01489d1e7182 +Author: Daniel-Constantin Mierla +Date: Sat Jun 4 10:00:55 2011 +0200 + + kamailio.cfg: use defined branch flag id + + - use FLB_NATB instead of 6, like everywhere else + +commit 1127790f97fd37767fa3e4439fb9daf67e5ec465 +Author: Daniel-Constantin Mierla +Date: Fri Jun 3 10:25:19 2011 +0200 + + imc: fix announcing attepts to join private rooms + + - if an user cannot join a private room, the announcement was wrong, + using invalid structure + - reported by Ozren Lapcevic + (cherry picked from commit f375eef5e2559847bb42381fdb6a9727692004b4) + +commit d8c08a50fd1366ddd10ee079a4594cba6684236e +Author: Henning Westerholt +Date: Mon May 30 14:17:32 2011 +0200 + + deb pkg: add start suggestions for mysql, postgresql and radius, suggested from Rick Aldred + (cherry picked from commit 33f7e045768298e8e48231820fb0116398d80c2f) + +commit 8c763b4f2565dba4f640ab22a83e101946fdbc4e +Author: Daniel-Constantin Mierla +Date: Wed Jun 1 12:36:09 2011 +0200 + + imc: keep db handle open for main process + + - the module sync's back to database at shutdown + - dicovered based on an email by Ozren Lapcevic + (cherry picked from commit 3402cfd8461c6c94dfc601d9f40116bdbdf8e0a4) + +commit 3b4da7610c57073b98afb34e8e663648366db1d4 +Author: Daniel-Constantin Mierla +Date: Thu May 26 18:42:03 2011 +0200 + + ChangeLog: updated for 3.1.4 + +commit eac6d9e89e83edb962c14b35e7d3803adb9eb4bd +Author: Daniel-Constantin Mierla +Date: Thu May 26 18:04:32 2011 +0200 + + Makefile: version set to 3.1.4 + +commit 06b74b600e6644f4bf289d256538d463f6734717 +Author: Andrei Pelinescu-Onciul +Date: Fri Apr 29 19:40:36 2011 +0200 + + tm: recursive hash locks + + The hash locks are now recursive/re-entrant. + This removes some of the TMCB_REQUEST_IN and TMCB_LOCAL_REQUEST_IN + callback restrictions (like do not create new transactions, + do not call t_lookup_*()) solving problems like the one + described in + http://lists.sip-router.org/pipermail/sr-users/2011-April/068331.html + (cherry picked from commit 1699b6a4c479031c116fb081a805635a4d088bcb) + + +===================== 2011-05-26 Version 3.1.4 Released ===================== + +===================== Changes Since Version 3.1.3 =========================== + +commit eac6d9e89e83edb962c14b35e7d3803adb9eb4bd +Author: Daniel-Constantin Mierla +Date: Thu May 26 18:04:32 2011 +0200 + + Makefile: version set to 3.1.4 + +commit 06b74b600e6644f4bf289d256538d463f6734717 +Author: Andrei Pelinescu-Onciul +Date: Fri Apr 29 19:40:36 2011 +0200 + + tm: recursive hash locks + + The hash locks are now recursive/re-entrant. + This removes some of the TMCB_REQUEST_IN and TMCB_LOCAL_REQUEST_IN + callback restrictions (like do not create new transactions, + do not call t_lookup_*()) solving problems like the one + described in + http://lists.sip-router.org/pipermail/sr-users/2011-April/068331.html + (cherry picked from commit 1699b6a4c479031c116fb081a805635a4d088bcb) + +commit 1837d493e7d08427a19038721ecc0ac52d72a75b +Author: Daniel-Constantin Mierla +Date: Thu May 26 16:16:54 2011 +0200 + + rpm/kamailio: version set to 3.1.4 + +commit dd8b674cc2d19689612977b656fe7830304ac88d +Author: Daniel-Constantin Mierla +Date: Thu May 26 15:22:52 2011 +0200 + + debs/kamailio: version set to 3.1.4 in changelog + +commit ec3f4706b500771aef14e49d1a9ea3a2cdef2be1 +Author: Daniel-Constantin Mierla +Date: Thu May 26 07:09:14 2011 +0200 + + htable: adjust item array size + + - it was 1 too much, reported by Juha Heinanen + (cherry picked from commit 6987c52c42e8df6a08d54e155ee868b8b9eb523b) + +commit f98d523cc7034c6c69e305cdbb3370693df0b1e8 +Author: Daniel-Constantin Mierla +Date: Wed May 25 21:59:14 2011 +0200 + + htable: set the size of item arrays + + - it was not computed properly, reported by Juha Henanen + (cherry picked from commit 01e7be75f2643fec6a6ac6ab6614ce65421f8bf3) + +commit 8e38978c09ff89418a51caeb3abca9ea221423a9 +Author: Henning Westerholt +Date: Wed May 25 12:00:41 2011 +0200 + + core: also include newline in error msg.. + (cherry picked from commit 207f7c6f55fd1c986f7c1566a3acfdd3361434b5) + +commit bc143d2f471ccddbff6d3630c2d53921a6b2f9ec +Author: Henning Westerholt +Date: Wed May 25 11:28:20 2011 +0200 + + core: spelling fix in error msg, reported from Bret McDanel, trixter at 0xdecafbad dot com + (cherry picked from commit d70215e5af181fe2f9513e44b0725e6d68fa8ba5) + +commit 4ffe22ae5215f48873438e788fa541d82c5ba3ad +Author: Henning Westerholt +Date: Mon May 23 13:06:49 2011 +0200 + + htable: spelling fix in htable table definition docs + (cherry picked from commit 938b50beab952645438743720833070a484c07ab) + +commit 2e35717359d011a22a348b27f57c2fdeb7de73bd +Author: Timo Reimann +Date: Mon May 23 14:06:08 2011 +0200 + + Sorry, this commit was never meant to see the real world. :) + (just a test module.) + + This reverts commit ca5fe4f895855580d0e19a8f3b178c5b00c5ea9e. + +commit 76a0f0241566c28809c76fed73c18cb45bdb115f +Author: Timo Reimann +Date: Mon May 23 13:58:33 2011 +0200 + + Stress that DLGCB_CONFIRMED includes reception of the call-concluding ACK message. + (cherry picked from commit bea80d75f6c496a88f09591fcf4b3a412b2fde03) + +commit ca5fe4f895855580d0e19a8f3b178c5b00c5ea9e +Author: Timo Reimann +Date: Wed Jul 28 13:45:46 2010 +0200 + + Add version of ui-test compatible with sip-router. + +commit 6c6fee9ac072de715cc0b4079a0ce5983139fbac +Author: Juha Heinanen +Date: Fri May 20 22:39:49 2011 +0300 + + modules/mediaproxy: Fixed crash in mediaproxy due to insufficient buffer size. + - Credits to giti. + (cherry picked from commit 82c86ff64c2059256b776df32628e6bd4f5c13e9) + +commit 0a2810181e1901708b1885d4e0c41774b28d25f9 +Author: Henning Westerholt +Date: Tue May 17 13:04:07 2011 +0200 + + Revert "tm: add warning about t_newtran behaviour (pointed out from Iñaki" + + This reverts commit 6ef54ae2cb3c5390be823707aa1ebb2008b5eaef. + +commit abeaaff1f7a4ad3d9badb203273b249d5722a29b +Author: Henning Westerholt +Date: Mon May 16 18:21:09 2011 +0200 + + geoip: also include URL in docs + (cherry picked from commit 4d777c5100927edc1bd99ef429625eaf552f8d23) + +commit 5c6f5de622ccb873701119f1e3f6e1559d56aa84 +Author: Henning Westerholt +Date: Mon May 16 15:48:53 2011 +0200 + + geoip: extend docs after discussion with Francesco Castellano + (cherry picked from commit b280f89b3ac4f97c3cad1487961509bae893f656) + +commit 203e6d078015e47ecf25a160653ace1d3745807c +Author: Elena-Ramona Modroiu +Date: Mon Oct 11 12:20:24 2010 +0200 + + mqueue: return false if queue is empty + + - return code -2 + - reported by Alex Balashov + (cherry picked from commit e6fa8ae004f5d487e1c64471bf282931e4b9e901) + +commit 6ef54ae2cb3c5390be823707aa1ebb2008b5eaef +Author: Henning Westerholt +Date: Mon May 16 15:22:15 2011 +0200 + + tm: add warning about t_newtran behaviour (pointed out from Iñaki + (cherry picked from commit 9f27cb55a1b4def4f393def6170430cbf70e6615) + +commit 040d6d56de87bc4d63acc45d56bfde9d58738794 +Author: Daniel-Constantin Mierla +Date: Sat May 14 14:17:34 2011 +0200 + + debs(k): version set to 3.1.3 in deb changelog + +commit 59f7428173b40944f0ba1fbe909254c9ef1ea455 +Author: Daniel-Constantin Mierla +Date: Fri Mar 4 22:50:02 2011 +0100 + + dialog: safer unref of terminated dialogs + + - if reference counter is already <=0, don't deref anymore, dialog in + destroyed state + - should protect against bogus dereferencing + - reported by Anton Roman + (cherry picked from commit 2c28a251a87fd66fa81b4802fe960fef3989fb3d) + +commit ea8430ddb32e2f45f29362a97ffed2fee011f6a3 +Author: Marius Bucur +Date: Wed May 11 13:43:08 2011 +0300 + + modules/carrieroute: fixed a bug in carrieroute + + the bug caused carrieroute to crash when an invalid SIP message is received (e.g. with no callid) + +commit 41e576663d1826fd94106d8aa1b8aff0fc7104ae +Author: Daniel-Constantin Mierla +Date: Fri May 6 06:42:51 2011 +0200 + + pkg: deb lib dir name is set by variable LIBDIR + + - fixes the check for duplicate libs to variants of deb distros + - reported in FS#130 and FS#128 + (cherry picked from commit 807b73d8a242ae12f93564b024baaa38dce89c8e) + +commit 078667f55841b64fb0e33b20c5ae066f849a6195 +Author: Daniel-Constantin Mierla +Date: Fri May 6 05:42:21 2011 +0200 + + pkg: lib dir name is set by variable LIBDIR + + - fixes the check for duplicate libs + - reported in FS#130 and FS#128 + (cherry picked from commit 29b996a5d89a74c7fe866919a6e3067071f84d75) + +commit 1e14827ab627db52eae556a027838cc64d3a57cd +Author: Andrei Pelinescu-Onciul +Date: Thu May 5 00:43:48 2011 +0200 + + tcp: fix send2child() error case + + If send2child() fails don't decrement the refcnt if the connection + was already removed from the hash due to some other previous + error (very unlikely, but possible). + (cherry picked from commit a8859f52b9dab4b3a79babe19f3d30c3dfcb95ce) + +commit 463053fcd129b80b2370145b36d69638c65f7e63 +Author: Andrei Pelinescu-Onciul +Date: Thu May 5 00:35:31 2011 +0200 + + tcp: fix tcp_*_destroy() bug case + + Mark unhashed connections in the "bug" code path to avoid + attempting to remove them twice. + (cherry picked from commit 42d1a15584eb601a23c54a8af802e99473a8c4b6) + +commit 521b16ea814d68f9d872e2f6e1b0f081f285254b +Author: Andrei Pelinescu-Onciul +Date: Thu May 5 00:13:36 2011 +0200 + + tcp: fix multiple hash removal attempts + + In some corner cases (pending new tcp connection created in async + mode, other processes try to append data to it but fail and the + initial send fails after that) it was possible to attempt removing + the connection from the hash and the local timer multiple times. + (cherry picked from commit 76cb63c6f120c22a134babc8948611819b9081c3) + +commit acad20d9479b2a48c29709304042b0f54032c16d +Author: Daniel-Constantin Mierla +Date: Wed May 4 19:25:36 2011 +0200 + + tm: allow t_on_reply() in branch_route + + - same for t_on_failure() + - reported by Sebastian Damm + (cherry picked from commit e950f44d733f9004710f0155d794a1c797f1580d) + +commit 725c8d7318c76e322a8eeef5423436347f56214d +Author: Andrei Pelinescu-Onciul +Date: Sat Apr 30 00:11:02 2011 +0200 + + stun: fix attribute padded length outside the packet case + + - check if the attribute padded length points still inside the + packet (only the un-padded value was checked before) + - use an integer and not an UINT for the remainder part of the + packet + - fix padded length computation in copy_str_to_buffer() + + Closes: FS#129 + Reported-by: Francesco Castellano + (cherry picked from commit 677a7bfabd0a266ebdd712b23caee75198993e4a) + +commit 66af75fcdda45ed383f8493ea9b3d8b9b8c2cf47 +Author: Andrei Pelinescu-Onciul +Date: Sat Apr 30 00:08:11 2011 +0200 + + stun: fix padd macros + + The PADDED_TO_* macros did not work when the length was a multiple + of the pad value. + (FS#129) + + Reported-by: Francesco Castellano + (cherry picked from commit 263ee122bc55f81db878ddea9ad4aa2bfd8afbae) + +commit 2192a1d7a35364fff6241f640bdf7dd282e06447 +Author: Andrei Pelinescu-Onciul +Date: Sat Apr 30 00:48:12 2011 +0200 + + Makefile: fix gcc 4.5 support for all archs + + Commit c925278 split gcc 4.5 support from the generic 4.2+ support, + but it handled gcc 4.5 only for x86_64 (trying to compile on other + architectures with gcc 4.5 resulted in warnings and common gcc + optimization options). + (cherry picked from commit fd6704daccd4359f59183367f2059576e184635e) + +commit 9e451170ecb2b6aebf583e6e22960cb65813c69d +Author: Daniel-Constantin Mierla +Date: Fri Apr 29 17:38:29 2011 +0200 + + Makefile.defs: moved setting of dirs after target ARCH detection + + - should fix FS#128 - error building deb packages on chroot systems + reported by Ali Onur Uyar + (cherry picked from commit 7bb701b79d769f0c7d79d367521a1f984b35fa64) + +commit e506dae55f1c5011fe3b7f05e94ba9f02a13dc8b +Author: Marius Zbihlei +Date: Wed Apr 27 15:32:18 2011 +0300 + + modules_k/htable $shtex(htable=>key) caused a segfault when reading (null pointer deref) + +commit 67420b88a997cc66d3c6ca2e8cef98c4f7cc91dd +Author: Marius Zbihlei +Date: Mon Jan 17 14:32:22 2011 +0200 + + modules_k/group : In case of incorrect param, don't crash + (cherry picked from commit 5d668ec98ccf4c315da67a1cce6dc3a5cf1b2dc5) + +commit e3f8cf21c9bb601ad08e8069bc2f31ae3b6ccd20 +Author: Marius Zbihlei +Date: Wed Apr 27 13:26:13 2011 +0300 + + Fixed definitions for presence related tables. Size of callid and contact should be larger than 64. + (cherry picked from commit 5af83d0a629cf51344b2ba01b7219c3a507bd225) + +commit bbf59bb235f45e70f8e2925bdf584495610656c5 +Author: Marius Zbihlei +Date: Wed Apr 27 12:56:58 2011 +0300 + + lib/srdb1 Fixed crash caused by NULL pointer parameter + +commit 270a5cfcabaa1be16ccc5cf4c5a3da439fe7d644 +Author: Marius Zbihlei +Date: Wed Apr 27 12:21:11 2011 +0300 + + modules_k/presence : Fixed a bug caused by an incorrect Macro + + the macro expanded to incorrect results when called in statements like + if(cond) COND_COPY(...); + (cherry picked from commit 41b11916eec28133af499b7368940504c7c5834d) + +commit ac679cf5093f99931da6aeea4b40c1215e295a4b +Author: Marius Zbihlei +Date: Wed Apr 27 11:48:46 2011 +0300 + + utils/kamctl/presence-create.sql Increased size of contact and callid in presence tables + + Some CPE (e.g. FritzBox,Samsung) issue larger contacts that 64 chars, thus resulting in a truncation in the + DB backend + +commit 4d5a004b2bb78fa8bf9bb4b603b085d04dee5519 +Author: Daniel-Constantin Mierla +Date: Mon Apr 25 11:45:12 2011 +0200 + + rls(k): few fixes + + - string comparison that fails because sometimes one of the strings + is '\0' terminated and the other never is. + - fix for when some non-RLS SUBSCRIBEs are not identified as such. + - fix for a small typo in an error diagnostic. + - patch by Peter Dunkley + (cherry picked from commit 2917d848a0ede8b7285a2f8414d43fcd4262f6e3) + +commit a0b0c849119c13c2ce0572670cfa4ec282015e6e +Author: Daniel-Constantin Mierla +Date: Mon Apr 18 11:40:20 2011 +0200 + + Makefile: disable '-mtune' parameter for gcc 4.5 x86_64 + + - gcc 4.5 gives error when it has parameter -mtune=x86_64 (this should + be the default value anyhow) - tested on opensuse 11.4 + (cherry picked from commit c925278b8ee3492f71a04c52784f593712522df8) + +commit 3b6a5953a368b1856a6b1eb7bdda62d397291920 +Author: Daniel-Constantin Mierla +Date: Sat Apr 16 15:21:32 2011 +0200 + + htable: safety check for null db values + + - with some db engines the non-null condition might not be enforced, + resulting in working with null values + - reported by Eric Hiller + (cherry picked from commit 5cd534834b7ee529adbcef3f758a19ed93d29210) + +commit f3690cfddd08f43d7afb651a8d9f05b31e2174c2 +Author: Timo Teräs +Date: Wed Apr 6 09:33:10 2011 +0300 + + modules_k/uac: fix from/to restore for small original URI + + Seems that the URI length check is superfluous and fails under + certain conditions. It does not make sense for the URI to have + zero bytes, so just use the first seen zero byte as end marker. + + I have a reproducible test case where the restore inserts URI + with multiple zero-bytes to wire. This happens if the original + URI is smaller than the one we rewrote it to using uac_replace_from. + (cherry picked from commit e1d1c774c9ac0b4d9103f4a1c5e9b550adbb2f38) + +commit d2fe333c9429cf1183a7e8ce27c578f445db929b +Author: Daniel-Constantin Mierla +Date: Tue Apr 12 10:22:15 2011 +0200 + + acc_radius(k): usage flags for acc_rad_request() set to ANY_ROUTE + + - they were forgotten as the main acc module has this type of flags for + acc request functions + (cherry picked from commit 5673f5cd5a50714b4a9c770294723caba15a995e) + +commit 8464b29cbffb17b810cc7f3f4f459e754bc0e4ed +Author: Daniel-Constantin Mierla +Date: Tue Apr 12 10:19:38 2011 +0200 + + acc(k): safety check for empty db_url + + - if db_url is provided as empty string, disable db accounting + - if db_url is not provided, db acc flags are set to -1 instead + of 0 to avoid conflict with usage in config of flag 0 + - reported by Francesco Castellano + (cherry picked from commit de2015d507cdd40502160070a096aa3fb6754f55) + +commit 9ec10a2249a8319384a143137bc67770445e2467 +Author: Daniel-Constantin Mierla +Date: Mon Apr 11 23:52:38 2011 +0200 + + srdb1: reset prev_token for safer free on error + + - if parse_db_url() fails internally, prev_token can point to same + memory chunk as one of the db id attributes, causing a double-free + (cherry picked from commit 765c17f8c2ef79fd49ec2a74781b49a56aa47c3a) + +commit f027ca95a2a1818cd40e4ed6d4358a76d18252ad +Author: Marius Zbihlei +Date: Mon Apr 11 13:45:10 2011 +0300 + + modules/ratelimit Timer was ran at a 1.5 s interval instead of timer_interval, thus rendering TAILDROP alg unusable + (cherry picked from commit 3a06d7d3561f889c84249eaa5ec7a5b79a2a23bd) + +commit 6d4cfc5dd8a8d7b0f67ee08120f7326edacdcf69 +Author: Daniel-Constantin Mierla +Date: Mon Apr 11 12:02:23 2011 +0200 + + xcap_server: use ETag header instead of SIP-ETag + + - over http the name of header carrying entity tag is ETag + - patch by Peter Dunkley + (cherry picked from commit a20da4ced92796959d619adb6ba61334869f8588) + +commit 25ef2d798ade6827f67b5b5058ba6ef534b8fa15 +Author: Daniel-Constantin Mierla +Date: Sun Apr 10 12:47:55 2011 +0200 + + seas(k): enable cfg framework for module's extra process + (cherry picked from commit 4990dea6ab31e9d0aec78ca09af96a481196cd70) + +commit 87a95a607533815325ac6628db9339ffb7cdbd21 +Author: Daniel-Constantin Mierla +Date: Sun Apr 10 12:41:11 2011 +0200 + + snmpstats(k): enable cfg framework for module's extra process + (cherry picked from commit 17e94fd7535f541438e09d9536c8b2767e397f13) + +commit bef4e7d50b65f3c1db23ea1142d966c366398133 +Author: Daniel-Constantin Mierla +Date: Sun Apr 10 12:34:53 2011 +0200 + + purple(k): enable cfg framework for module's extra process + (cherry picked from commit 11efca600514ba791e456cc809743dd5ec6819c2) + +commit 2e9113a87be66da3e2f0119d20095777ecd32223 +Author: Daniel-Constantin Mierla +Date: Sun Apr 10 12:18:44 2011 +0200 + + xmpp(k): enable cfg framework for module's extra process + (cherry picked from commit cd3d112dcd6b0c5dd6e66fabc8082b70dcb317ae) + +commit 1ad6e142aad3fb4e0229d46dab52ab6ebab7e113 +Author: Daniel-Constantin Mierla +Date: Sun Apr 10 12:11:07 2011 +0200 + + uac(k): enable cfg framework for module's extra process + (cherry picked from commit db0a6250180226ffaa700b67018ba25eb5451caf) + +commit 1a33654d739577747fd58d7a661b07e3a1f6fd41 +Author: Marius Zbihlei +Date: Fri Apr 8 16:48:37 2011 +0300 + + modules_k:siputils Fixed the fixup for ring_insert_callid + (cherry picked from commit 8fdc717ab8b28857e23366804f0668b83971f249) + +commit 341d6f035740eb1fa370760ff72e59f506a1860c +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 22:56:46 2011 +0200 + + nat_traversal: use register_dummy_timers() to handle cfg framework updates + (cherry picked from commit 44bc565d39ef8cb078c7e46f12863a7788c7b4e4) + +commit 86f0ca802a1d1f7bc6da82702aa97a46e5575f5d +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 22:55:46 2011 +0200 + + nathelper(k): use register_dummy_timers() to handle cfg framework updates + (cherry picked from commit 1decfa6aaf44cb228569cd180c57dd67375dbe43) + +commit c4cfa4cc3893d2c8d5825167a298d1baff812c0f +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 22:54:15 2011 +0200 + + rtimer: use register_dymmy_timers() to handle cfg framework updates + (cherry picked from commit 7d784e2e7195b953f568caa1dd553cce1e587fe3) + +commit febb7de20cbcf94046f8e119664308ec596fa266 +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 20:34:18 2011 +0200 + + core: wrapper to pre-register new dummy timers + + - register_dummy_timers(no) adds the number of new processes in the + process table and initializes as well the number of new childres + to the cfg framework + - fork_dummy_timer() handles now the updates in cfg framework + (cherry picked from commit 421cba5d6b25d85d542b875633368e0bc98be07d) + +commit f1bd0d840ec4a8521d8ad97bc8fe424913b71a7e +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 19:29:36 2011 +0200 + + mi_xmlrpc: update cfg framework structures in extra MI processes + (cherry picked from commit b1429aef87e64833e0fa3c8f3356ce2ac69a4dee) + +commit eb6f5f221a6134e9d8e81e6eaeffd33e76d551a6 +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 19:17:57 2011 +0200 + + mi_datagram: update cfg framework structures in extra MI processes + (cherry picked from commit 0baefce396796b02c77c9d9e2b02a63682d02173) + +commit 6452fc57d09792245dfc12f84c8c294bb7789b23 +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 19:02:15 2011 +0200 + + mi_fifo: update the config framework structures in fifo process + + - the extra process created by mi_fifo to listen on fifo file was not + registered for updating the config framework structures + - reported by Klaus Darilion + - credits to Miklos Tirpak for hints to do it + (cherry picked from commit b5754d49ce59d659f641e5892f763208401ce8d2) + +commit a1b10bff76e1a88c647612c30b12eb5e9e51c90e +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 13:32:45 2011 +0200 + + rls(k): safer build of chunked body + + - the check for the size of alloc'ed buffer was using static estimation, + not it is cmputed based on values and makes sure the ending '\0' is + safe as well. When handling bodies with long values, could have caused + overflow + - reported by Peter Dunkley + +commit cdee458b2ec4296cb847dd6e531285c0ac64dd80 +Author: Daniel-Constantin Mierla +Date: Thu Apr 7 12:03:32 2011 +0200 + + rls(k): send 200ok for NOTIFY with subscription state termintated + + - when rls module sends an un-SUBSCRIBE (expires=0), then the dialog + structure is removed and the NOTIFY arriving later to confirm the + termination of subscription does not find any record, resulting in no + reply + - the patch detects the subscribe-state terminated in NOTIFY requests + and sends back 200ok + - reported by Peter Dunkley + +commit 8b3506e364546a78d18c295505066fdfc93d83b2 +Author: Daniel-Constantin Mierla +Date: Mon Mar 7 11:59:45 2011 +0100 + + makefile: store the flavour in tarball + + - Makefile.vars is auto-generated to store the flavour when creating the + tarball + - Makefile.vars is stored inside the tarball + - do 'make maintainer-clean' or 'make clean-makefile-vars' to remove it + - allow to build the packaged flavour even when 'make FLAVOUR=... cfg' + is forgotten - suggested by Olle E. Johansson + (cherry picked from commit dd15ae96c06c1e39f42894238cff74efff3563fa) + + ===================== 2011-04-04 Version 3.1.3 Released ===================== ===================== Changes Since Version 3.1.2 =========================== diff --git a/Makefile.defs b/Makefile.defs index 49822ab44..9616c1765 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -161,7 +161,7 @@ INSTALL_FLAVOUR=$(FLAVOUR) #version number VERSION = 3 PATCHLEVEL = 1 -SUBLEVEL = 3 +SUBLEVEL = 5 EXTRAVERSION = # memory debugger switcher @@ -225,107 +225,6 @@ endif # extra CC command line options (e.g -march=athlon-mp) CC_EXTRA_OPTS ?= -LIBDIR ?= -ifeq ($(LIBDIR),) -ARCHBSZ= $(shell echo $(HOST_ARCH) | sed -e 's/.*64.*/64b/') -ifeq ($(ARCHBSZ),64b) - LIBDIR = lib64 -else - LIBDIR = lib -endif -endif - -# dirs -cfg_dir = etc/$(MAIN_NAME)/ -bin_dir = sbin/ -share_dir = share/$(MAIN_NAME)/ -# lib/$(MAIN_NAME)/modules , lib/$(MAIN_NAME)/modules-s, lib/$(MAIN_NAME)/modules-k -modules_dir = $(LIBDIR)/$(MAIN_NAME)/ -lib_dir = $(LIBDIR)/$(MAIN_NAME)/ - -doc_dir = doc/$(MAIN_NAME)/ -man_dir = man/ -data_dir = $(MAIN_NAME)/ - -ifeq ($(OS), linux) - doc_dir = share/doc/$(MAIN_NAME)/ - man_dir = share/man/ - data_dir = share/$(MAIN_NAME)/ - LOCALBASE ?= /usr/local -endif - -ifeq ($(OS), freebsd) - doc_dir = share/doc/$(MAIN_NAME)/ - man_dir = man/ - data_dir = share/$(MAIN_NAME)/ - LOCALBASE ?= /usr/local -endif - -ifeq ($(OS), openbsd) - doc_dir = share/doc/$(MAIN_NAME)/ - man_dir = man/ - data_dir = share/$(MAIN_NAME)/ - LOCALBASE ?= /usr/local -endif - -ifeq ($(OS), netbsd) - doc_dir = share/doc/$(MAIN_NAME)/ - man_dir = man/ - data_dir = share/$(MAIN_NAME)/ - LOCALBASE ?= /usr/pkg -endif - -ifeq ($(OS), dragonfly) - doc_dir = share/doc/$(MAIN_NAME)/ - man_dir = man/ - data_dir = share/$(MAIN_NAME)/ - LOCALBASE ?= /usr/pkg -endif - -ifeq ($(OS), darwin) - doc_dir = share/doc/$(MAIN_NAME)/ - man_dir = man/ - data_dir = share/$(MAIN_NAME)/ - LOCALBASE ?= /usr/local -endif - -LOCALBASE ?= /usr/local - -# Doxygen directory -doxygen_dir=doc/doxygen - -# install location -PREFIX ?= $(LOCALBASE) -prefix = $(PREFIX) -# install path is $(basedir) $(prefix) -# example: -# creating a bin. archive in /tmp, which unpacks in /usr/local -# basedir=/tmp -# prefix=/usr/local - -BASEDIR ?= $(DESTDIR) -basedir = $(BASEDIR) -# install prefixes for various stuff -cfg_prefix = $(basedir)$(prefix) -bin_prefix = $(basedir)$(prefix) -modules_prefix = $(basedir)$(prefix) -lib_prefix = $(basedir)$(prefix) -doc_prefix = $(basedir)$(prefix) -man_prefix = $(basedir)$(prefix) -ut_prefix = $(basedir)$(prefix) -share_prefix = $(basedir)$(prefix) -data_prefix = $(basedir)$(prefix) - - -# target dirs for various stuff -cfg_target = $(prefix)/$(cfg_dir) -bin_target = $(prefix)/$(bin_dir) -#modules_target = $(prefix)/$(modules_dir) -lib_target = $(prefix)/$(lib_dir) -doc_target = $(prefix)/$(doc_dir) -data_target = $(prefix)/$(data_dir) - - ifeq ($(OS), solaris) #use GNU versions @@ -385,12 +284,18 @@ ifneq (,$(findstring gcc, $(CC_LONGVER))) #transform gcc version into 2.9x or 3.0 CC_SHORTVER:=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \ sed -e 's/[^0-9]*-\(.*\)/\1/'| \ - sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-3]\..*/3.0/' -e \ - 's/3\.[0-3]/3.0/' -e 's/3\.[4-9]\..*/3.4/' -e \ - 's/3\.[4-9]/3.4/' -e 's/4\.[0-1]\..*/4.x/' -e \ - 's/4\.[0-1]/4.x/' -e 's/4\.[2-9]\..*/4.2+/' -e \ - 's/4\.[2-9]$$/4.2+/') -ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+,$(CC_SHORTVER)))) + sed -e 's/2\.9.*/2.9x/' \ + -e 's/3\.[0-3]\..*/3.0/' \ + -e 's/3\.[0-3]/3.0/' \ + -e 's/3\.[4-9]\..*/3.4/' \ + -e 's/3\.[4-9]/3.4/' \ + -e 's/4\.[0-1]\..*/4.x/' \ + -e 's/4\.[0-1]/4.x/' \ + -e 's/4\.[2-46-9]\..*/4.2+/' \ + -e 's/4\.[2-46-9]$$/4.2+/' \ + -e 's/4\.5\..*/4.5/' \ + -e 's/4\.5$$/4.5/') +ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+ 4.5,$(CC_SHORTVER)))) # dependencies can be generated on-the-fly while compiling *.c CC_MKDEP_OPTS=-MMD -MP endif # 3.0 <= $(CC_SHORTVER) <= 4.x @@ -504,6 +409,107 @@ ARCH:=$(HOST_ARCH) endif $(info target architecture <$(ARCH)>, host architecture <$(HOST_ARCH)>) +LIBDIR ?= +ifeq ($(LIBDIR),) +ARCHBSZ= $(shell echo $(ARCH) | sed -e 's/.*64.*/64b/') +ifeq ($(ARCHBSZ),64b) + LIBDIR = lib64 +else + LIBDIR = lib +endif +endif + +# dirs +cfg_dir = etc/$(MAIN_NAME)/ +bin_dir = sbin/ +share_dir = share/$(MAIN_NAME)/ +# lib/$(MAIN_NAME)/modules , lib/$(MAIN_NAME)/modules-s, lib/$(MAIN_NAME)/modules-k +modules_dir = $(LIBDIR)/$(MAIN_NAME)/ +lib_dir = $(LIBDIR)/$(MAIN_NAME)/ + +doc_dir = doc/$(MAIN_NAME)/ +man_dir = man/ +data_dir = $(MAIN_NAME)/ + +ifeq ($(OS), linux) + doc_dir = share/doc/$(MAIN_NAME)/ + man_dir = share/man/ + data_dir = share/$(MAIN_NAME)/ + LOCALBASE ?= /usr/local +endif + +ifeq ($(OS), freebsd) + doc_dir = share/doc/$(MAIN_NAME)/ + man_dir = man/ + data_dir = share/$(MAIN_NAME)/ + LOCALBASE ?= /usr/local +endif + +ifeq ($(OS), openbsd) + doc_dir = share/doc/$(MAIN_NAME)/ + man_dir = man/ + data_dir = share/$(MAIN_NAME)/ + LOCALBASE ?= /usr/local +endif + +ifeq ($(OS), netbsd) + doc_dir = share/doc/$(MAIN_NAME)/ + man_dir = man/ + data_dir = share/$(MAIN_NAME)/ + LOCALBASE ?= /usr/pkg +endif + +ifeq ($(OS), dragonfly) + doc_dir = share/doc/$(MAIN_NAME)/ + man_dir = man/ + data_dir = share/$(MAIN_NAME)/ + LOCALBASE ?= /usr/pkg +endif + +ifeq ($(OS), darwin) + doc_dir = share/doc/$(MAIN_NAME)/ + man_dir = man/ + data_dir = share/$(MAIN_NAME)/ + LOCALBASE ?= /usr/local +endif + +LOCALBASE ?= /usr/local + +# Doxygen directory +doxygen_dir=doc/doxygen + +# install location +PREFIX ?= $(LOCALBASE) +prefix = $(PREFIX) +# install path is $(basedir) $(prefix) +# example: +# creating a bin. archive in /tmp, which unpacks in /usr/local +# basedir=/tmp +# prefix=/usr/local + +BASEDIR ?= $(DESTDIR) +basedir = $(BASEDIR) +# install prefixes for various stuff +cfg_prefix = $(basedir)$(prefix) +bin_prefix = $(basedir)$(prefix) +modules_prefix = $(basedir)$(prefix) +lib_prefix = $(basedir)$(prefix) +doc_prefix = $(basedir)$(prefix) +man_prefix = $(basedir)$(prefix) +ut_prefix = $(basedir)$(prefix) +share_prefix = $(basedir)$(prefix) +data_prefix = $(basedir)$(prefix) + + +# target dirs for various stuff +cfg_target = $(prefix)/$(cfg_dir) +bin_target = $(prefix)/$(bin_dir) +#modules_target = $(prefix)/$(modules_dir) +lib_target = $(prefix)/$(lib_dir) +doc_target = $(prefix)/$(doc_dir) +data_target = $(prefix)/$(data_dir) + + # compile-time options # # -DSTATS @@ -857,8 +863,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) $(call set_if_empty,CPU,athlon64) CFLAGS+=-m32 -minline-all-stringops \ -falign-loops \ @@ -907,7 +913,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc ifeq ($(CC_NAME), icc) @@ -932,6 +938,16 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE) + #if gcc 4.5 + # don't add '-mtune=$(CPU)' - gcc failure +ifeq ($(CC_SHORTVER), 4.5) +$(call set_if_empty,CPU,opteron) + CFLAGS+=-m64 -minline-all-stringops \ + -falign-loops \ + -ftree-vectorize \ + -fno-strict-overflow + LDFLAGS+=-m64 +else #if gcc 4.2+ ifeq ($(CC_SHORTVER), 4.2+) $(call set_if_empty,CPU,opteron) @@ -983,6 +999,7 @@ endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 else # CC_NAME, gcc ifeq ($(CC_NAME), icc) @@ -1009,8 +1026,8 @@ ifeq ($(CC_NAME), gcc) CFLAGS=-g -O9 -funroll-loops $(PROFILE) \ #-Wcast-align \ #-Wmissing-prototypes - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) $(call set_if_empty,CPU,ultrasparc) #use 32bit for now CFLAGS+=-m64 -mcpu=ultrasparc \ @@ -1076,7 +1093,7 @@ endif #CC_SHORTVER, 2.9x endif #CC_SHORTVER, 3.0 endif #CC_SHORTVER, 3.4 endif #CC_SHORTVER, 4.x -endif #CC_SHORTVER, 4.2+ +endif #CC_SHORTVER, 4.5 or 4.2+ else #CC_NAME, gcc ifeq ($(CC_NAME), suncc) @@ -1100,8 +1117,8 @@ ifeq ($(CC_NAME), gcc) CFLAGS=-g -O9 -funroll-loops $(PROFILE) \ #-Wcast-align \ #-Wmissing-prototypes - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) $(call set_if_empty,CPU,v8) #use 32bit for now CFLAGS+= -mtune=$(CPU) \ @@ -1142,7 +1159,7 @@ endif #CC_SHORTVER, 2.9x endif #CC_SHORTVER, 3.0 endif #CC_SHORTVER, 3.4 endif #CC_SHORTVER, 4.x -endif #CC_SHORTVER, 4.2+ +endif #CC_SHORTVER, 4.5 or 4.2+ else #CC_NAME, gcc ifeq ($(CC_NAME), suncc) @@ -1163,8 +1180,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS=-O9 -funroll-loops -fsigned-char $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) CFLAGS+= -ftree-vectorize -fno-strict-overflow # not supported on arm: -minline-all-stringops else @@ -1196,7 +1213,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1212,8 +1229,8 @@ ifeq ($(CC_NAME), gcc) #common stuff CFLAGS=-march=armv6 -O9 -funroll-loops -fsigned-char \ $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) CFLAGS+= -ftree-vectorize -fno-strict-overflow else #if gcc 4.x+ @@ -1243,7 +1260,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1258,8 +1275,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS=-O9 -funroll-loops $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) CFLAGS+=-march=r3000 -minline-all-stringops \ -ftree-vectorize -fno-strict-overflow else @@ -1290,7 +1307,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1305,8 +1322,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) CFLAGS+=-minline-all-stringops -ftree-vectorize \ -fno-strict-overflow else @@ -1335,7 +1352,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1350,8 +1367,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS= -mips64 -O9 -funroll-loops $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) CFLAGS+=-minline-all-stringops -ftree-vectorize \ -fno-strict-overflow else @@ -1380,7 +1397,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1395,8 +1412,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS= -O9 -funroll-loops $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) CFLAGS+= -fno-strict-overflow # not supported: -minline-all-stringops else @@ -1426,7 +1443,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1441,8 +1458,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS= -O9 -funroll-loops -fsigned-char $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) $(call set_if_empty,CPU,powerpc) CFLAGS+=-ftree-vectorize \ -fno-strict-overflow \ @@ -1475,7 +1492,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers @@ -1490,8 +1507,8 @@ ifeq ($(CC_NAME), gcc) C_DEFS+=-DCC_GCC_LIKE_ASM #common stuff CFLAGS= -O9 -funroll-loops -fsigned-char $(PROFILE) - #if gcc 4.2+ -ifeq ($(CC_SHORTVER), 4.2+) + #if gcc 4.5 or 4.2+ +ifeq (,$(strip $(filter-out 4.2+ 4.5,$(CC_SHORTVER)))) $(call set_if_empty,CPU,powerpc64) CFLAGS+=-ftree-vectorize \ -fno-strict-overflow \ @@ -1524,7 +1541,7 @@ endif # CC_SHORTVER, 2.9x endif # CC_SHORTVER, 3.0 endif # CC_SHORTVER, 3.4 endif # CC_SHORTVER, 4.x -endif # CC_SHORTVER, 4.2+ +endif # CC_SHORTVER, 4.5 or 4.2+ else # CC_NAME, gcc #other compilers diff --git a/Makefile.vars b/Makefile.vars new file mode 100644 index 000000000..a8bb6ba96 --- /dev/null +++ b/Makefile.vars @@ -0,0 +1 @@ +FLAVOUR?=kamailio diff --git a/autover.h b/autover.h new file mode 100644 index 000000000..311a60c45 --- /dev/null +++ b/autover.h @@ -0,0 +1,7 @@ +/* this file is autogenerated by make autover.h + * DO NOT EDIT IT + */ + +#define REPO_VER "ec672a" +#define REPO_HASH "ec672a" +#define REPO_STATE "" diff --git a/cfg.lex b/cfg.lex index 11822ea29..3f677d396 100644 --- a/cfg.lex +++ b/cfg.lex @@ -297,6 +297,10 @@ LOG_AND "and"|"&&" BIN_AND "&" LOG_OR "or"|"||" BIN_OR "|" +BIN_NOT "~" +BIN_XOR "^" +BIN_LSHIFT "<<" +BIN_RSHIFT ">>" PLUS "+" MINUS "-" MODULO "mod" @@ -927,6 +931,10 @@ SUBST subst {BIN_AND} { count(); return BIN_AND; } {LOG_OR} { count(); return LOG_OR; } {BIN_OR} { count(); return BIN_OR; } +{BIN_NOT} { count(); return BIN_NOT; } +{BIN_XOR} { count(); return BIN_XOR; } +{BIN_LSHIFT} { count(); return BIN_LSHIFT; } +{BIN_RSHIFT} { count(); return BIN_RSHIFT; } {PLUS} { count(); return PLUS; } {MINUS} { count(); return MINUS; } {MODULO} { count(); return MODULO; } diff --git a/cfg.y b/cfg.y index dee2e2d39..d0bf74800 100644 --- a/cfg.y +++ b/cfg.y @@ -564,11 +564,14 @@ extern char *finame; %left LOG_AND %left BIN_OR %left BIN_AND +%left BIN_XOR +%left BIN_LSHIFT +%left BIN_RSHIFT %left EQUAL_T DIFF MATCH INTEQ INTDIFF STREQ STRDIFF %left GT LT GTE LTE %left PLUS MINUS %left STAR SLASH MODULO -%right NOT UNARY +%right NOT UNARY BIN_NOT %right DEFINED %right INTCAST STRCAST %left DOT @@ -2733,6 +2736,7 @@ rval: intno {$$=mk_rve_rval(RV_INT, (void*)$1); } rve_un_op: NOT { $$=RVE_LNOT_OP; } + | BIN_NOT { $$=RVE_BNOT_OP; } | MINUS %prec UNARY { $$=RVE_UMINUS_OP; } /* TODO: RVE_BOOL_OP, RVE_NOT_OP? */ ; @@ -2762,6 +2766,9 @@ rval_expr: rval { $$=$1; | rval_expr MODULO rval_expr {$$=mk_rve2(RVE_MOD_OP, $1, $3); } | rval_expr BIN_OR rval_expr {$$=mk_rve2(RVE_BOR_OP, $1, $3); } | rval_expr BIN_AND rval_expr {$$=mk_rve2(RVE_BAND_OP, $1, $3);} + | rval_expr BIN_XOR rval_expr {$$=mk_rve2(RVE_BXOR_OP, $1, $3);} + | rval_expr BIN_LSHIFT rval_expr {$$=mk_rve2(RVE_BLSHIFT_OP, $1, $3);} + | rval_expr BIN_RSHIFT rval_expr {$$=mk_rve2(RVE_BRSHIFT_OP, $1, $3);} | rval_expr rve_cmpop rval_expr %prec GT { $$=mk_rve2( $2, $1, $3);} | rval_expr rve_equalop rval_expr %prec EQUAL_T { $$=mk_rve2( $2, $1, $3);} diff --git a/dns_cache.c b/dns_cache.c index 22d1676d2..f14a11d98 100644 --- a/dns_cache.c +++ b/dns_cache.c @@ -2978,7 +2978,7 @@ inline static int dns_a_resolve( struct dns_hash_entry** e, ret=-E_DNS_EOR; } error: - DBG("dns_a_resovle(%.*s, %d) returning %d\n", + DBG("dns_a_resolve(%.*s, %d) returning %d\n", name->len, name->s, *rr_no, ret); return ret; } diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg index 9aa39156c..961aaae73 100644 --- a/etc/kamailio.cfg +++ b/etc/kamailio.cfg @@ -796,7 +796,7 @@ onreply_route[REPLY_ONE] { && status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } - if (isbflagset("6")) { + if (isbflagset(FLB_NATB)) { fix_nated_contact(); } #!endif diff --git a/forward.c b/forward.c index 9306a282e..eafe592b7 100644 --- a/forward.c +++ b/forward.c @@ -545,8 +545,8 @@ int forward_request(struct sip_msg* msg, str* dst, unsigned short port, value in there; better for performance */ if (syn_branch ) { - *msg->add_to_branch_s='0'; - msg->add_to_branch_len=1; + memcpy(msg->add_to_branch_s, "z9hG4bKcydzigwkX", 16); + msg->add_to_branch_len=16; } else { if (!char_msg_val( msg, md5 )) { /* parses transaction key */ LOG(L_ERR, "ERROR: forward_request: char_msg_val failed\n"); @@ -785,7 +785,7 @@ int forward_reply(struct sip_msg* msg) || (msg->via2==0) || (msg->via2->error!=PARSE_OK)) { /* no second via => error */ - /* LOG(L_INFO, "broken reply to forward - no 2nd via\n"); */ + /*LOG(L_INFO, "broken reply to forward - no 2nd via\n");*/ DBG("DEBUG: broken reply to forward - no 2nd via\n"); goto error; } diff --git a/ip_addr.h b/ip_addr.h index 2f046935b..d9cbf0268 100644 --- a/ip_addr.h +++ b/ip_addr.h @@ -722,7 +722,7 @@ static inline char* su2a(union sockaddr_union* su, int su_len) { static char buf[SU2A_MAX_STR_SIZE]; int offs; - + #ifdef USE_IPV6 if (unlikely(su->s.sa_family==AF_INET6)){ if (unlikely(su_lensin6))) @@ -744,6 +744,34 @@ static inline char* su2a(union sockaddr_union* su, int su_len) return buf; } +#define SUIP2A_MAX_STR_SIZE (IP6_MAX_STR_SIZE + 2 /* [] */ + 1 /* \0 */) +/* returns an asciiz string containing the ip + * ( or []) + */ +static inline char* suip2a(union sockaddr_union* su, int su_len) +{ + static char buf[SUIP2A_MAX_STR_SIZE]; + int offs; + +#ifdef USE_IPV6 + if (unlikely(su->s.sa_family==AF_INET6)){ + if (unlikely(su_lensin6))) + return ""; + buf[0]='['; + offs=1+ip6tosbuf((unsigned char*)su->sin6.sin6_addr.s6_addr, &buf[1], + sizeof(buf)-4); + buf[offs]=']'; + offs++; + }else +#endif /* USE_IPV6*/ + if (unlikely(su_lensin))) + return ""; + else + offs=ip4tosbuf((unsigned char*)&su->sin.sin_addr, buf, sizeof(buf)-2); + buf[offs]=0; + return buf; +} + /* converts an ip_addr structure to a hostent, returns pointer to internal diff --git a/lib/srdb1/db_id.c b/lib/srdb1/db_id.c index d7fcf025e..6e8671e9f 100644 --- a/lib/srdb1/db_id.c +++ b/lib/srdb1/db_id.c @@ -162,12 +162,14 @@ static int parse_db_url(struct db_id* id, const str* url) case '@': st = ST_HOST; id->username = prev_token; + prev_token = 0; if (dupl_string(&id->password, begin, url->s + i) < 0) goto err; begin = url->s + i + 1; break; case '/': id->host = prev_token; + prev_token = 0; id->port = str2s(begin, url->s + i - begin, 0); if (dupl_string(&id->database, url->s + i + 1, url->s + len) < 0) goto err; return 0; @@ -207,11 +209,14 @@ static int parse_db_url(struct db_id* id, const str* url) return 0; err: - if (id->scheme) pkg_free(id->scheme); - if (id->username) pkg_free(id->username); - if (id->password) pkg_free(id->password); - if (id->host) pkg_free(id->host); - if (id->database) pkg_free(id->database); + if(id){ + if (id->scheme) pkg_free(id->scheme); + if (id->username) pkg_free(id->username); + if (id->password) pkg_free(id->password); + if (id->host) pkg_free(id->host); + if (id->database) pkg_free(id->database); + memset(id, 0, sizeof(struct db_id)); + } if (prev_token) pkg_free(prev_token); return -1; } diff --git a/lib/srdb1/schema/htable.xml b/lib/srdb1/schema/htable.xml index 0344c7d6a..8de8ac35a 100644 --- a/lib/srdb1/schema/htable.xml +++ b/lib/srdb1/schema/htable.xml @@ -12,7 +12,7 @@ 1 &MYSQL_TABLE_TYPE; - This table us used by the htabke module to load values in the hash table at start up. More information about the avpops module can be found at: &KAMAILIO_MOD_DOC;htable.html + This table us used by the htable module to load values in the hash table at start up. More information about the htable module can be found at: &KAMAILIO_MOD_DOC;htable.html diff --git a/lib/srdb1/schema/kamailio-pipelimit.xml b/lib/srdb1/schema/kamailio-pipelimit.xml new file mode 100644 index 000000000..5fd7d2d6d --- /dev/null +++ b/lib/srdb1/schema/kamailio-pipelimit.xml @@ -0,0 +1,12 @@ + + + %entities; +]> + + + Pipelimit + + diff --git a/lib/srdb1/schema/pipelimit.xml b/lib/srdb1/schema/pipelimit.xml new file mode 100644 index 000000000..71941d9f9 --- /dev/null +++ b/lib/srdb1/schema/pipelimit.xml @@ -0,0 +1,55 @@ + + +%entities; + +]> + + + pl_pipes + 1 + &MYSQL_TABLE_TYPE; + + This table us used by the pipelimit module to keep the definition of pipes. + More information about the pipelimit module can be found at: &KAMAILIO_MOD_DOC;pipelimit.html + + + + + id + unsigned int + &table_id_len; + + + int,auto + unique ID + + + + pipeid + string + 64 + + Unique ID for pipe + + + + algorithm + string + 32 + + Algorithm to be used for pipe limits. See the readme of the + module for description of available options: NOP, RED, TAILDROP, FEEDBACK, NETWORK + + + + + plimit + int + 0 + Pipe limit (hits per second) + + +
diff --git a/lib/srdb1/schema/pr_active_watchers.xml b/lib/srdb1/schema/pr_active_watchers.xml index 2cfdcffb7..8c27d5692 100644 --- a/lib/srdb1/schema/pr_active_watchers.xml +++ b/lib/srdb1/schema/pr_active_watchers.xml @@ -96,7 +96,7 @@ callid string - &domain_len; + &uri_len; Call ID @@ -117,7 +117,7 @@ contact string - &domain_len; + &uri_len; Contact diff --git a/lib/srdb1/schema/pr_pua.xml b/lib/srdb1/schema/pr_pua.xml index 21930c496..e5a21fe61 100644 --- a/lib/srdb1/schema/pr_pua.xml +++ b/lib/srdb1/schema/pr_pua.xml @@ -95,7 +95,7 @@ call_id string - &domain_len; + &uri_len; Call ID diff --git a/main.c b/main.c index fcc25aead..085420be2 100644 --- a/main.c +++ b/main.c @@ -1537,9 +1537,15 @@ int main_loop() /* udp processes */ for(si=udp_listen; si; si=si->next){ for(i=0;iaddress.af==AF_INET6) { + snprintf(si_desc, MAX_PT_DESC, "udp receiver child=%d " + "sock=[%s]:%s", + i, si->name.s, si->port_no_str.s); + } else { + snprintf(si_desc, MAX_PT_DESC, "udp receiver child=%d " "sock=%s:%s", i, si->name.s, si->port_no_str.s); + } child_rank++; pid = fork_process(child_rank, si_desc, 1); if (pid<0){ @@ -1562,9 +1568,15 @@ int main_loop() if (!sctp_disable){ for(si=sctp_listen; si; si=si->next){ for(i=0;iaddress.af==AF_INET6) { + snprintf(si_desc, MAX_PT_DESC, "sctp receiver child=%d " + "sock=[%s]:%s", + i, si->name.s, si->port_no_str.s); + } else { + snprintf(si_desc, MAX_PT_DESC, "sctp receiver child=%d " "sock=%s:%s", i, si->name.s, si->port_no_str.s); + } child_rank++; pid = fork_process(child_rank, si_desc, 1); if (pid<0){ diff --git a/modules/app_lua/Makefile b/modules/app_lua/Makefile index 47d607246..1fb1b1d9f 100644 --- a/modules/app_lua/Makefile +++ b/modules/app_lua/Makefile @@ -33,12 +33,12 @@ ifeq ($(BUILDER),) LIBS= -llua5.1 endif else - DEFS+ = $(shell pkg-config --cflags lua) + DEFS+= $(shell pkg-config --cflags lua) LIBS = $(shell pkg-config --libs lua) endif endif else - DEFS+ = $(shell lua-config --include) + DEFS+= $(shell lua-config --include) LIBS = $(shell lua-config --libs) endif diff --git a/modules/app_python/python_mod.c b/modules/app_python/python_mod.c index f943e07e5..c89c92831 100644 --- a/modules/app_python/python_mod.c +++ b/modules/app_python/python_mod.c @@ -85,7 +85,7 @@ struct module_exports exports = { static int mod_init(void) { - char *dname, *bname; + char *dname, *bname, *tname; int i; PyObject *sys_path, *pDir, *pModule, *pFunc, *pArgs; PyThreadState *mainThreadState; @@ -100,11 +100,19 @@ mod_init(void) child_init_mname.len = strlen(child_init_mname.s); } - dname = dirname(script_name.s); + tname = as_asciiz(&script_name); + if(tname==NULL) + { + LM_ERR("no more pkg memory\n"); + return -1; + } + dname = dirname(tname); if (strlen(dname) == 0) dname = "."; - bname = basename(script_name.s); + memcpy(tname, script_name.s, script_name.len); + bname = basename(tname); i = strlen(bname); + pkg_free(tname); if (bname[i - 1] == 'c' || bname[i - 1] == 'o') i -= 1; if (bname[i - 3] == '.' && bname[i - 2] == 'p' && bname[i - 1] == 'y') { diff --git a/modules/app_python/python_msgobj.c b/modules/app_python/python_msgobj.c index 4bf601aa1..3e4a2cd78 100644 --- a/modules/app_python/python_msgobj.c +++ b/modules/app_python/python_msgobj.c @@ -526,8 +526,7 @@ static PyTypeObject MSGtype = { int python_msgobj_init(void) { - - Py_TYPE(&MSGtype) = &PyType_Type; + Py_TYPE((void*)(&MSGtype)) = &PyType_Type; if (PyType_Ready(&MSGtype) < 0) return -1; return 0; diff --git a/modules/carrierroute/cr_func.c b/modules/carrierroute/cr_func.c index 714a130b5..1006228a3 100644 --- a/modules/carrierroute/cr_func.c +++ b/modules/carrierroute/cr_func.c @@ -437,7 +437,7 @@ static int rewrite_on_rule(struct route_flags *rf_head, flag_t flags, str * dest } break; case alg_crc32_nofallback: - if ((prob = (hash_func(msg, hash_source, rf->max_targets) + 1)) < 0) { + if ((prob = (hash_func(msg, hash_source, rf->max_targets))) < 0) { LM_ERR("could not hash message with CRC32"); return -1; } @@ -445,7 +445,7 @@ static int rewrite_on_rule(struct route_flags *rf_head, flag_t flags, str * dest * this function just tries only a backup rule and otherwise * returns -1. This way we get an error */ - if ((rr = get_rule_by_hash(rf, prob)) == NULL) { + if ((rr = get_rule_by_hash(rf, prob + 1)) == NULL) { LM_CRIT("no route found\n"); return -1; } diff --git a/modules/db_mysql/Makefile b/modules/db_mysql/Makefile index d71ca94c0..6c7c01ccf 100644 --- a/modules/db_mysql/Makefile +++ b/modules/db_mysql/Makefile @@ -14,6 +14,9 @@ DEFS +=-DSER_MOD_INTERFACE ifeq ($(CROSS_COMPILE),) MYSQLCFG=$(shell which mysql_config) +ifeq ($(MYSQLCFG),) +MYSQLCFG=$(shell which mysql_config5) +endif endif ifneq ($(MYSQLCFG),) diff --git a/modules/debugger/debugger_api.c b/modules/debugger/debugger_api.c index 5b4ff585a..7fbfd0dbf 100644 --- a/modules/debugger/debugger_api.c +++ b/modules/debugger/debugger_api.c @@ -240,7 +240,7 @@ int dbg_cfg_trace(void *data) a = (struct action *)srevp[0]; msg = (struct sip_msg *)srevp[1]; - if(a==NULL || msg==NULL) + if(a==NULL || msg==NULL || _dbg_pid_list==NULL) return 0; an = dbg_get_action_name(a); diff --git a/modules/geoip/README b/modules/geoip/README index 11c8c7392..13008507d 100644 --- a/modules/geoip/README +++ b/modules/geoip/README @@ -68,12 +68,20 @@ Chapter 1. Admin Guide identifying the physical location with which an IP host address is associated on a relatively granular level. - This database itself can be obtained on a free or commercial basis - here. The library that interfaces with the Max Mind API, as well as - scripts to automate downloading of the on-disk version of the - open-source database is also packaged by the Debian Linux distribution - and its derivatives as libgeoip, and probably by other distributions as - well. + This database itself can be obtained on a free or commercial basis from + http://www.maxmind.com/app/ip-location. The library that interfaces + with the Max Mind API, as well as scripts to automate downloading of + the on-disk version of the open-source database is also packaged by the + Debian Linux distribution and its derivatives as libgeoip, and probably + by other distributions as well. + + Debian Linux squeeze includes already a database as dependency, but as + this contain the wrong data, it will not work correctly with the + module. More acurate, the module expect the GeoIP City Edition, and + will not work with the GeoIP Country Edition. In newer Debian Linux + releases the package geoip-database-contrib should contain the + necessary database. You can download the Lite edition of the DB from + http://www.maxmind.com/app/geolitecity. This module exports a new class of pseudo-variables - $gip(pvc=>key) - to enable access to the results of a query to the database. diff --git a/modules/geoip/doc/geoip_admin.xml b/modules/geoip/doc/geoip_admin.xml index b8c9f1745..e34b5cde3 100644 --- a/modules/geoip/doc/geoip_admin.xml +++ b/modules/geoip/doc/geoip_admin.xml @@ -28,13 +28,24 @@ This database itself can be obtained on a free or commercial basis - here. The + from + http://www.maxmind.com/app/ip-location. The library that interfaces with the Max Mind API, as well as scripts to automate downloading of the on-disk version of the open-source database is also packaged by the Debian Linux distribution and its derivatives as libgeoip, and probably by other distributions as well. + + Debian Linux squeeze includes already a database as dependency, but as + this contain the wrong data, it will not work correctly with the module. + More acurate, the module expect the GeoIP City Edition, + and will not work with the GeoIP Country Edition. In + newer Debian Linux releases the package geoip-database-contrib + should contain the necessary database. You can download the Lite edition + of the DB from + http://www.maxmind.com/app/geolitecity. + This module exports a new class of pseudo-variables - $gip(pvc=>key) - to enable access to the results of a query to the diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c index b1951230e..c17971f4e 100644 --- a/modules/mediaproxy/mediaproxy.c +++ b/modules/mediaproxy/mediaproxy.c @@ -1563,7 +1563,7 @@ use_media_proxy(struct sip_msg *msg, char *dialog_id, ice_candidate_data *ice_da str callid, cseq, from_uri, to_uri, from_tag, to_tag, user_agent; str signaling_ip, media_relay, sdp, str_buf, tokens[MAX_STREAMS+1]; str priority_str, candidate; - char request[8192], media_str[4096], buf[64], *result, *type; + char request[8192], media_str[4096], buf[128], *result, *type; int i, j, port, len, status; Bool removed_session_ip, have_sdp; SessionInfo session; diff --git a/modules/mqueue/README b/modules/mqueue/README index 4c439a421..f876b2a76 100644 --- a/modules/mqueue/README +++ b/modules/mqueue/README @@ -10,7 +10,7 @@ Elena-Ramona Modroiu - Copyright 2010 Elena-Ramona Modroiu (asipto.com) + Copyright © 2010 Elena-Ramona Modroiu (asipto.com) __________________________________________________________________ Table of Contents @@ -94,7 +94,7 @@ Chapter 1. Admin Guide Definition of memory queue - Default value is "none". + Default value is “none”. Value must be a list of parameters: attr=value;... The attribute 'name' is mandatory, defining the name of the queue. Optional attribute 'size' @@ -128,8 +128,11 @@ mq_add("myq", "$rU", "call from $fU"); 4.2. mq_fetch(queue) - Take oldest item from que and fill $mqk(queue) and $mqv(queue) pseudo - variables. Return true on success. + Take oldest item from queue and fill $mqk(queue) and $mqv(queue) pseudo + variables. + + Return: true on success (1); false on failure (-1) or no item fetched + (-2). Example 1.3. mq_fetch usage ... diff --git a/modules/mqueue/doc/mqueue_admin.xml b/modules/mqueue/doc/mqueue_admin.xml index e02ca3800..d1b924a6f 100644 --- a/modules/mqueue/doc/mqueue_admin.xml +++ b/modules/mqueue/doc/mqueue_admin.xml @@ -118,8 +118,12 @@ mq_add("myq", "$rU", "call from $fU"); mq_fetch(queue) - Take oldest item from que and fill $mqk(queue) and $mqv(queue) pseudo - variables. Return true on success. + Take oldest item from queue and fill $mqk(queue) and + $mqv(queue) pseudo variables. + + + Return: true on success (1); false on failure (-1) or + no item fetched (-2). <function>mq_fetch</function> usage diff --git a/modules/mqueue/mqueue_api.c b/modules/mqueue/mqueue_api.c index f75f23aa8..a86d3758c 100644 --- a/modules/mqueue/mqueue_api.c +++ b/modules/mqueue/mqueue_api.c @@ -254,18 +254,22 @@ int mq_head_fetch(str *name) return -1; lock_get(&mh->lock); - if(mh->ifirst!=NULL) + if(mh->ifirst==NULL) { - mp->item = mh->ifirst; - mh->ifirst = mh->ifirst->next; - if(mh->ifirst==NULL) { - mh->ilast = NULL; - } else { - mh->ifirst->prev = NULL; - } - mh->csize--; + /* empty queue */ + lock_release(&mh->lock); + return -2; } + mp->item = mh->ifirst; + mh->ifirst = mh->ifirst->next; + if(mh->ifirst==NULL) { + mh->ilast = NULL; + } else { + mh->ifirst->prev = NULL; + } + mh->csize--; + lock_release(&mh->lock); return 0; } @@ -339,6 +343,8 @@ int mq_item_add(str *qname, str *key, str *val) mh->ilast = NULL; else mh->ifirst->prev = NULL; + mh->csize--; + shm_free(mi); } lock_release(&mh->lock); return 0; diff --git a/modules/mqueue/mqueue_mod.c b/modules/mqueue/mqueue_mod.c index 922f02edc..5a74f58e6 100644 --- a/modules/mqueue/mqueue_mod.c +++ b/modules/mqueue/mqueue_mod.c @@ -109,8 +109,11 @@ static void mod_destroy(void) static int w_mq_fetch(struct sip_msg* msg, char* mq, char* str2) { - if(mq_head_fetch((str*)mq)<0) - return -1; + int ret; + + ret = mq_head_fetch((str*)mq); + if(ret<0) + return ret; return 1; } diff --git a/modules/ratelimit/ratelimit.c b/modules/ratelimit/ratelimit.c index 628a4863f..53ff5591d 100644 --- a/modules/ratelimit/ratelimit.c +++ b/modules/ratelimit/ratelimit.c @@ -424,7 +424,7 @@ static int mod_init(void) return -1; } timer_init(rl_timer, rl_timer_handle, 0, F_TIMER_FAST); - timer_add(rl_timer, MS_TO_TICKS(1500)); /* Start it after 1500ms */ + timer_add(rl_timer, MS_TO_TICKS(1000*timer_interval)); network_load_value = shm_malloc(sizeof(int)); if (network_load_value==NULL) { diff --git a/modules/tls/tls_rpc.c b/modules/tls/tls_rpc.c index 3fabcf6a5..1dfa6ac17 100644 --- a/modules/tls/tls_rpc.c +++ b/modules/tls/tls_rpc.c @@ -133,11 +133,15 @@ static void tls_list(rpc_t* rpc, void* c) "dst_ip", dst_ip, "dst_port", con->rcv.dst_port); if (tls_d) { - tls_info = SSL_CIPHER_description( + if(SSL_get_current_cipher(tls_d->ssl)) { + tls_info = SSL_CIPHER_description( SSL_get_current_cipher(tls_d->ssl), buf, sizeof(buf)); - len = strlen(buf); - if (len && buf[len - 1] == '\n') buf[len - 1] = '\0'; + len = strlen(buf); + if (len && buf[len - 1] == '\n') buf[len - 1] = '\0'; + } else { + tls_info = "unknown"; + } /* tls data */ state = "unknown/error"; lock_get(&con->write_lock); diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c index 33e72d7fe..b18e2d0d4 100644 --- a/modules/tm/h_table.c +++ b/modules/tm/h_table.c @@ -97,13 +97,29 @@ enum kill_reason get_kr() { void lock_hash(int i) { - lock(&_tm_table->entries[i].mutex); + + int mypid; + + mypid = my_pid(); + if (likely(atomic_get(&_tm_table->entries[i].locker_pid) != mypid)) { + lock(&_tm_table->entries[i].mutex); + atomic_set(&_tm_table->entries[i].locker_pid, mypid); + } else { + /* locked within the same process that called us*/ + _tm_table->entries[i].rec_lock_level++; + } } void unlock_hash(int i) { - unlock(&_tm_table->entries[i].mutex); + if (likely(_tm_table->entries[i].rec_lock_level == 0)) { + atomic_set(&_tm_table->entries[i].locker_pid, 0); + unlock(&_tm_table->entries[i].mutex); + } else { + /* recursive locked => decrease rec. lock count */ + _tm_table->entries[i].rec_lock_level--; + } } @@ -478,4 +494,82 @@ error0: } +/** + * backup xdata from/to msg context to local var and use T lists + * - mode = 0 - from msg context to _txdata and use T lists + * - mode = 1 - restore to msg context from _txdata + */ +void tm_xdata_swap(tm_cell_t *t, tm_xlinks_t *xd, int mode) +{ + static tm_xlinks_t _txdata; + tm_xlinks_t *x; + + if(xd==NULL) + x = &_txdata; + else + x = xd; + + if(mode==0) { + if(t==NULL) + return; + x->uri_avps_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from ); + x->uri_avps_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to ); + x->user_avps_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from ); + x->user_avps_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to ); + x->domain_avps_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from ); + x->domain_avps_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to ); +#ifdef WITH_XAVP + x->xavps_list = xavp_set_list(&t->xavps_list); +#endif + } else if(mode==1) { + /* restore original avp list */ + set_avp_list( AVP_TRACK_FROM | AVP_CLASS_URI, x->uri_avps_from ); + set_avp_list( AVP_TRACK_TO | AVP_CLASS_URI, x->uri_avps_to ); + set_avp_list( AVP_TRACK_FROM | AVP_CLASS_USER, x->user_avps_from ); + set_avp_list( AVP_TRACK_TO | AVP_CLASS_USER, x->user_avps_to ); + set_avp_list( AVP_TRACK_FROM | AVP_CLASS_DOMAIN, x->domain_avps_from ); + set_avp_list( AVP_TRACK_TO | AVP_CLASS_DOMAIN, x->domain_avps_to ); +#ifdef WITH_XAVP + xavp_set_list(x->xavps_list); +#endif + } +} + +/** + * replace existing lists with newxd and backup in bakxd or restore from bakxd + */ +void tm_xdata_replace(tm_xdata_t *newxd, tm_xlinks_t *bakxd) +{ + if(newxd==NULL && bakxd!=NULL) { + set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, bakxd->uri_avps_from); + set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, bakxd->uri_avps_to); + set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, bakxd->user_avps_from); + set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, bakxd->user_avps_to); + set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, bakxd->domain_avps_from); + set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, bakxd->domain_avps_to); +#ifdef WITH_XAVP + xavp_set_list(bakxd->xavps_list); +#endif + return; + } + + if(newxd!=NULL && bakxd!=NULL) { + bakxd->uri_avps_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, + &newxd->uri_avps_from); + bakxd->uri_avps_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, + &newxd->uri_avps_to); + bakxd->user_avps_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, + &newxd->user_avps_from); + bakxd->user_avps_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, + &newxd->user_avps_to); + bakxd->domain_avps_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, + &newxd->domain_avps_from); + bakxd->domain_avps_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, + &newxd->domain_avps_to); +#ifdef WITH_XAVP + bakxd->xavps_list = xavp_set_list(&newxd->xavps_list); +#endif + return; + } +} diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h index 784606eaf..6dbca5d8c 100644 --- a/modules/tm/h_table.h +++ b/modules/tm/h_table.h @@ -300,6 +300,42 @@ struct totag_elem { * saves us 2*2 bytes */ typedef unsigned short retr_timeout_t; +/** + * extra data from SIP message context to transaction storage + */ +typedef struct tm_xdata +{ + /* lists with avps */ + struct usr_avp *uri_avps_from; + struct usr_avp *uri_avps_to; + struct usr_avp *user_avps_from; + struct usr_avp *user_avps_to; + struct usr_avp *domain_avps_from; + struct usr_avp *domain_avps_to; +#ifdef WITH_XAVP + sr_xavp_t *xavps_list; +#endif +} tm_xdata_t; + + +/** + * links to extra data from SIP message context to transaction storage + */ +typedef struct tm_xlinks +{ + /* links to lists with avps */ + struct usr_avp **uri_avps_from; + struct usr_avp **uri_avps_to; + struct usr_avp **user_avps_from; + struct usr_avp **user_avps_to; + struct usr_avp **domain_avps_from; + struct usr_avp **domain_avps_to; +#ifdef WITH_XAVP + sr_xavp_t **xavps_list; +#endif +} tm_xlinks_t; + + /* transaction context */ typedef struct cell @@ -370,7 +406,7 @@ typedef struct cell * many due to downstream forking; */ struct totag_elem *fwded_totags; - /* list with avp */ + /* lists with avps */ struct usr_avp *uri_avps_from; struct usr_avp *uri_avps_to; struct usr_avp *user_avps_from; @@ -406,7 +442,7 @@ typedef struct cell /* place holder for MD5checksum (meaningful only if syn_branch=0) */ char md5[0]; /* if syn_branch==0 then MD5_LEN bytes are extra alloc'ed*/ -}cell_type; +} tm_cell_t; #if 0 @@ -429,6 +465,8 @@ typedef struct entry struct cell* prev_c; /* sync mutex */ ser_lock_t mutex; + atomic_t locker_pid; /* pid of the process that holds the lock */ + int rec_lock_level; /* recursive lock count */ /* currently highest sequence number in a synonym list */ unsigned int next_label; #ifdef TM_HASH_STATS @@ -541,6 +579,13 @@ inline static void remove_from_hash_table_unsafe( struct cell * p_cell) t_stats_deleted( is_local(p_cell) ); } +/** + * backup xdata from/to msg context to local var and use T lists + */ +void tm_xdata_swap(tm_cell_t *t, tm_xlinks_t *xd, int mode); + +void tm_xdata_replace(tm_xdata_t *newxd, tm_xlinks_t *bakxd); + #endif diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c index d0e8fb928..aea75987a 100644 --- a/modules/tm/t_fwd.c +++ b/modules/tm/t_fwd.c @@ -152,6 +152,8 @@ unsigned int get_on_branch(void) /* prepare_new_uac flags */ #define UAC_DNS_FAILOVER_F 1 /**< new branch due to dns failover */ +#define UAC_SKIP_BR_DST_F 2 /**< don't set next hop as dst_uri for + branch_route */ /** prepares a new branch "buffer". @@ -177,7 +179,7 @@ unsigned int get_on_branch(void) * @param fsocket - forced send socket for forwarding. * @param send_flags - special flags for sending (see SND_F_* / snd_flags_t). * @param fproto - forced proto for forwarding. Used only if next_hop!=0. - * @param flags - 0 or UAC_DNS_FAILOVER_F for now. + * @param flags - 0, UAC_DNS_FAILOVER_F or UAC_SKIP_BR_DST_F for now. * * @return 0 on success, < 0 (ser_errror E***) on failure. */ @@ -305,10 +307,12 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req, i_req->dst_uri.s=0; i_req->dst_uri.len=0; if (likely(next_hop)){ - /* set dst uri to next_hop for the on_branch route */ - if (unlikely(set_dst_uri(i_req, next_hop)<0)){ - ret=E_OUT_OF_MEM; - goto error03; + if(unlikely((flags & UAC_SKIP_BR_DST_F)==0)){ + /* set dst uri to next_hop for the on_branch route */ + if (unlikely(set_dst_uri(i_req, next_hop)<0)){ + ret=E_OUT_OF_MEM; + goto error03; + } } } @@ -1481,7 +1485,8 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg , try_new=1; branch_ret=add_uac( t, p_msg, GET_RURI(p_msg), GET_NEXT_HOP(p_msg), &p_msg->path_vec, proxy, p_msg->force_send_socket, - p_msg->fwd_send_flags, proto, 0); + p_msg->fwd_send_flags, proto, + (p_msg->dst_uri.len)?0:UAC_SKIP_BR_DST_F); if (branch_ret>=0) added_branches |= 1<fwd_send_flags, - proto, 0); + proto, (dst_uri.len)?0:UAC_SKIP_BR_DST_F); /* pick some of the errors in case things go wrong; note that picking lowest error is just as good as any other algorithm which picks any other negative @@ -1512,6 +1517,9 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg , setbflagsval(0, backup_bflags); + /* update message flags, if changed in branch route */ + t->uas.request->flags = p_msg->flags; + /* don't forget to clear all branches processed so far */ /* things went wrong ... no new branch has been fwd-ed at all */ diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index e65d1b9db..ec11948e9 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -960,11 +960,13 @@ int run_failure_handlers(struct cell *t, struct sip_msg *rpl, on_failure = t->on_negative; t->on_negative=0; if (exec_pre_script_cb(&faked_req, FAILURE_CB_TYPE)>0) { - /* run a reply_route action if some was marked */ + /* run a failure_route action if some was marked */ if (run_top_route(failure_rt.rlist[on_failure], &faked_req, 0)<0) LOG(L_ERR, "ERROR: run_failure_handlers: Error in run_top_route\n"); exec_post_script_cb(&faked_req, FAILURE_CB_TYPE); } + /* update message flags, if changed in failure route */ + t->uas.request->flags = faked_req.flags; } /* restore original environment and free the fake msg */ diff --git a/modules/tm/t_serial.c b/modules/tm/t_serial.c index 899cb5b6a..bd5ae2705 100644 --- a/modules/tm/t_serial.c +++ b/modules/tm/t_serial.c @@ -242,15 +242,21 @@ int t_load_contacts(struct sip_msg* msg, char* key, char* value) } ruri = (str *)0; - - /* Take first q from Request-URI */ - ruri = GET_RURI(msg); - if (!ruri) { - LM_ERR("no Request-URI found\n"); - return -1; + if (ruri_is_new) { + /* Take first q from Request-URI */ + ruri = GET_RURI(msg); + if (!ruri) { + LM_ERR("no Request-URI found\n"); + return -1; + } + first_q = get_ruri_q(); + first_idx = 0; + } else { + /* Take first q from first branch */ + uri.s = get_branch(0, &uri.len, &first_q, &dst_uri, &path, &flags, + &sock); + first_idx = 1; } - first_q = get_ruri_q(); - first_idx = 0; /* Check if all q values are equal */ for(idx = first_idx; (tmp.s = get_branch(idx, &tmp.len, &q, 0, 0, 0, 0)) @@ -272,15 +278,24 @@ rest: return -1; } - /* Insert Request-URI branch to first contact */ - contacts->uri.s = ruri->s; - contacts->uri.len = ruri->len; - contacts->dst_uri = msg->dst_uri; - contacts->sock = msg->force_send_socket; - getbflagsval(0, &contacts->flags); - contacts->path = msg->path_vec; - contacts->q = first_q; - contacts->next = (struct contact *)0; + if (ruri_is_new) { + /* Insert Request-URI branch to first contact */ + contacts->uri.s = ruri->s; + contacts->uri.len = ruri->len; + contacts->dst_uri = msg->dst_uri; + contacts->sock = msg->force_send_socket; + getbflagsval(0, &contacts->flags); + contacts->path = msg->path_vec; + } else { + /* Insert first branch to first contact */ + contacts->uri = uri; + contacts->dst_uri = dst_uri; + contacts->sock = sock; + contacts->flags = flags; + contacts->path = path; + } + contacts->q = first_q; + contacts->next = (struct contact *)0; /* Insert (remaining) branches to contact list in increasing q order */ diff --git a/modules/tm/tm.c b/modules/tm/tm.c index 160da2634..cf3e09901 100644 --- a/modules/tm/tm.c +++ b/modules/tm/tm.c @@ -402,9 +402,9 @@ static cmd_export_t cmds[]={ {"t_relay_cancel", w_t_relay_cancel, 0, 0, REQUEST_ROUTE}, {"t_on_failure", w_t_on_negative, 1, fixup_on_failure, - REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE }, + REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE }, {"t_on_reply", w_t_on_reply, 1, fixup_on_reply, - REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE }, + REQUEST_ROUTE | FAILURE_ROUTE | TM_ONREPLY_ROUTE | BRANCH_ROUTE }, {"t_on_branch", w_t_on_branch, 1, fixup_on_branch, REQUEST_ROUTE | FAILURE_ROUTE }, {"t_check_status", t_check_status, 1, fixup_t_check_status, @@ -1940,12 +1940,17 @@ int w_t_reply_wrp(struct sip_msg *m, unsigned int code, char *txt) static int t_check_trans(struct sip_msg* msg, char* foo, char* bar) { struct cell* t; + int branch; + int ret; - if (msg->first_line.type==SIP_REPLY) - return w_t_check(msg, 0 ,0); - else if (msg->REQ_METHOD==METHOD_CANCEL) + if (msg->first_line.type==SIP_REPLY) { + branch = 0; + ret = (t_check_msg( msg , &branch)==1) ? 1 : -1; + tm_ctx_set_branch_index(branch); + return ret; + } else if (msg->REQ_METHOD==METHOD_CANCEL) { return w_t_lookup_cancel(msg, 0, 0); - else{ + } else { switch(t_check_msg(msg, 0)){ case -2: /* possible e2e ack */ return 1; diff --git a/modules/tm/uac.c b/modules/tm/uac.c index 1a70e389e..6ba1e9101 100644 --- a/modules/tm/uac.c +++ b/modules/tm/uac.c @@ -216,6 +216,8 @@ static inline int t_uac_prepare(uac_req_t *uac_r, int backup_route_type; #endif snd_flags_t snd_flags; + tm_xlinks_t backup_xd; + tm_xdata_t local_xd; ret=-1; hi=0; /* make gcc happy */ @@ -275,7 +277,13 @@ static inline int t_uac_prepare(uac_req_t *uac_r, } #endif /* USE_DNS_FAILOVER */ + /* build cell sets X/AVP lists to new transaction structure + * => bakup in a tmp struct and restore afterwards */ + memset(&local_xd, 0, sizeof(tm_xdata_t)); + tm_xdata_replace(&local_xd, &backup_xd); new_cell = build_cell(0); + tm_xdata_replace(0, &backup_xd); + if (!new_cell) { ret=E_OUT_OF_MEM; LOG(L_ERR, "t_uac: short of cell shmem\n"); @@ -352,9 +360,8 @@ static inline int t_uac_prepare(uac_req_t *uac_r, #ifdef USE_COMP lreq.rcv.comp=dst.comp; #endif /* USE_COMP */ - /* AVPs are reset anyway afterwards, so no need to - backup/restore them*/ sflag_bk = getsflags(); + tm_xdata_swap(new_cell, &backup_xd, 0); /* run the route */ backup_route_type = get_route_type(); @@ -373,6 +380,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r, set_route_type( backup_route_type ); /* restore original environment */ + tm_xdata_swap(new_cell, &backup_xd, 1); setsflagsval(sflag_bk); if (unlikely(lreq.new_uri.s)) @@ -408,13 +416,6 @@ static inline int t_uac_prepare(uac_req_t *uac_r, } #endif - /* better reset avp list now - anyhow, it's useless from - * this point (bogdan) */ - reset_avps(); -#ifdef WITH_XAVP - xavp_reset_list(); -#endif - new_cell->method.s = buf; new_cell->method.len = uac_r->method->len; diff --git a/modules_k/acc/acc_mod.c b/modules_k/acc/acc_mod.c index ee9336e04..cd7b8f475 100644 --- a/modules_k/acc/acc_mod.c +++ b/modules_k/acc/acc_mod.c @@ -360,8 +360,13 @@ static int mod_init( void ) return -1; #ifdef SQL_ACC - if (db_url.s) + if (db_url.s) { db_url.len = strlen(db_url.s); + if(db_url.len<=0) { + db_url.s = NULL; + db_url.len = 0; + } + } db_table_acc.len = strlen(db_table_acc.s); db_table_mc.len = strlen(db_table_mc.s); acc_method_col.len = strlen(acc_method_col.s); @@ -471,8 +476,10 @@ static int mod_init( void ) return -1; } } else { - db_flag = 0; - db_missed_flag = 0; + db_url.s = NULL; + db_url.len = 0; + db_flag = -1; + db_missed_flag = -1; } #endif @@ -503,8 +510,8 @@ static int mod_init( void ) } } else { radius_config = 0; - radius_flag = 0; - radius_missed_flag = 0; + radius_flag = -1; + radius_missed_flag = -1; } #endif diff --git a/modules_k/acc_radius/acc_radius_mod.c b/modules_k/acc_radius/acc_radius_mod.c index 31b413b77..fdeb869fb 100644 --- a/modules_k/acc_radius/acc_radius_mod.c +++ b/modules_k/acc_radius/acc_radius_mod.c @@ -88,7 +88,7 @@ acc_extra_t *rad_extra = 0; static cmd_export_t cmds[] = { {"acc_rad_request", (cmd_function)w_acc_radius_request, 1, acc_api_fixup, free_acc_api_fixup, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, + ANY_ROUTE}, {0, 0, 0, 0, 0, 0} }; diff --git a/modules_k/auth_db/doc/auth_db_admin.xml b/modules_k/auth_db/doc/auth_db_admin.xml index f00e5ca21..a49aa53b2 100644 --- a/modules_k/auth_db/doc/auth_db_admin.xml +++ b/modules_k/auth_db/doc/auth_db_admin.xml @@ -347,7 +347,7 @@ modparam("auth_db", "load_credentials", "$avp(i:123)=rpid;email_address") <function moreinfo="none">www_authorize</function> usage ... -if (www_authorize("kamailio.org", "subscriber")) { +if (!www_authorize("kamailio.org", "subscriber")) { www_challenge("kamailio.org", "1"); }; ... diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c index e581ca314..38a30b5de 100644 --- a/modules_k/dialog/dialog.c +++ b/modules_k/dialog/dialog.c @@ -559,11 +559,18 @@ static int mod_init(void) return -1; } + /* sanitize dlg_hash_zie */ + if (dlg_hash_size < 1){ + LM_WARN("hash_size is smaller " + "then 1 -> rounding from %d to 1\n", + dlg_hash_size); + dlg_hash_size = 1; + } /* initialized the hash table */ for( n=0 ; n<(8*sizeof(n)) ; n++) { if (dlg_hash_size==(1< rounding from %d to %d\n", dlg_hash_size, 1<<(n-1)); @@ -1089,9 +1096,10 @@ static int w_dlg_get(struct sip_msg *msg, char *ci, char *ft, char *tt) return -1; } - dlg = get_dlg(&sc, &sf, &st, &dir, NULL); + dlg = get_dlg(&sc, &sf, &st, &dir); if(dlg==NULL) return -1; + /* set current dialog pointer - re-use ref increment from dlg_get() above */ current_dlg_pointer = dlg; _dlg_ctx.dlg = dlg; _dlg_ctx.dir = dir; @@ -1154,8 +1162,8 @@ static inline void internal_rpc_print_dlg(rpc_t *rpc, void *c, struct dlg_cell * { rpc_cb_ctx_t rpc_cb; - rpc->printf(c, "hash:%u:%u state:%u timestart:%u timeout:%u", - dlg->h_entry, dlg->h_id, dlg->state, dlg->start_ts, dlg->tl.timeout); + rpc->printf(c, "hash:%u:%u state:%u ref_count:%u timestart:%u timeout:%u", + dlg->h_entry, dlg->h_id, dlg->state, dlg->ref, dlg->start_ts, dlg->tl.timeout); rpc->printf(c, "\tcallid:%.*s from_tag:%.*s to_tag:%.*s", dlg->callid.len, dlg->callid.s, dlg->tag[DLG_CALLER_LEG].len, dlg->tag[DLG_CALLER_LEG].s, @@ -1383,7 +1391,7 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) { if (rpc->scan(c, "ddS", &h_entry, &h_id, &rpc_extra_hdrs) < 2) return; - dlg = lookup_dlg(h_entry, h_id, NULL); + dlg = lookup_dlg(h_entry, h_id); if(dlg){ dlg_bye_all(dlg, (rpc_extra_hdrs.len>0)?&rpc_extra_hdrs:NULL); unref_dlg(dlg, 1); diff --git a/modules_k/dialog/dlg_db_handler.c b/modules_k/dialog/dlg_db_handler.c index 86dd074b6..4ec4f6813 100644 --- a/modules_k/dialog/dlg_db_handler.c +++ b/modules_k/dialog/dlg_db_handler.c @@ -403,6 +403,13 @@ static int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows) }while (nr_rows>0); + if (dlg_db_mode==DB_MODE_SHUTDOWN) { + if (dialog_dbf.delete(dialog_db_handle, 0, 0, 0, 0) < 0) { + LM_ERR("failed to clear dialog table\n"); + goto error; + } + } + end: dialog_dbf.free_result(dialog_db_handle, res); return 0; diff --git a/modules_k/dialog/dlg_handlers.c b/modules_k/dialog/dlg_handlers.c index d5c4cb976..89fb0b30b 100644 --- a/modules_k/dialog/dlg_handlers.c +++ b/modules_k/dialog/dlg_handlers.c @@ -534,52 +534,12 @@ static inline int pre_match_parse( struct sip_msg *req, str *callid, */ void dlg_onreq(struct cell* t, int type, struct tmcb_params *param) { - struct dlg_cell *dlg; - str callid; - str ftag; - str ttag; - unsigned int dir; - unsigned int del; struct sip_msg *req = param->req; if((req->flags&dlg_flag)!=dlg_flag) return; if (current_dlg_pointer!=NULL) return; - if (!detect_spirals) - goto create; - - /* skip initial requests - they may end up here because of the - * preloaded route */ - if ( (!req->to && parse_headers(req, HDR_TO_F,0)<0) || !req->to ) { - LM_ERR("bad request or missing TO hdr :-/\n"); - return; - } - - dlg = 0; - dir = DLG_DIR_NONE; - - if (pre_match_parse( req, &callid, &ftag, &ttag, 0)<0) { - LM_WARN("pre-matching failed\n"); - return; - } - dlg = get_dlg(&callid, &ftag, &ttag, &dir, &del); - if (del == 1) { - LM_DBG("dialog marked for deletion, ignoring\n"); - return; - } - if (!dlg){ - LM_DBG("Callid '%.*s' not found, must be a new dialog\n", - req->callid->body.len, req->callid->body.s); - goto create; - } - - run_dlg_callbacks( DLGCB_SPIRALED, dlg, req, DLG_DIR_DOWNSTREAM, 0); - - unref_dlg(dlg, 1); - return; - -create: dlg_new_dialog(req, t); } @@ -598,6 +558,18 @@ static void unref_new_dialog(void *dialog) dlg_onreply(0, TMCB_DESTROY, &p); } +/*! + * \brief Unreference a dialog (small wrapper to take care of shutdown) + * \see unref_dlg + * \param dialog unreferenced dialog + */ +static void unreference_dialog(void *dialog) +{ + // if the dialog table is gone, it means the system is shutting down. + if (!dialog || !d_table) + return; + unref_dlg((struct dlg_cell*)dialog, 1); +} /*! * \brief Dummy callback just to keep the compiler happy @@ -610,6 +582,65 @@ void dlg_tmcb_dummy(struct cell* t, int type, struct tmcb_params *param) return; } +/*! + * \brief Register a transaction on a dialog + * \param t transaction + * \param type type of the entered callback + * \param param saved dialog structure in the callback + */ +static int store_dlg_in_tm(struct sip_msg* msg, + struct cell* t, + struct dlg_cell *dlg) +{ + if( !msg || msg == FAKED_REPLY || !t || !dlg) + { + LM_ERR("invalid parameter msg(%p), t(%p), dlg(%p)\n", msg, t, dlg); + return -1; + } + + if(get_dialog_from_tm(t)) + { + LM_NOTICE("dialog %p is already set for this transaction!\n",dlg); + return 1; + } + + // facilitate referencing of dialog through TMCB_MAX + if( d_tmb.register_tmcb (msg, + t, + TMCB_MAX, + dlg_tmcb_dummy, + (void*)dlg, unreference_dialog)<0 ) + { + LM_ERR("failed cache in T the shortcut to dlg %p\n",dlg); + return -3; + } + + // registering succeeded, we must increase the reference counter + ref_dlg(dlg, 1); + + return 0; +} + +/*! + * \brief Callback to register a transaction on a dialog + * \param t transaction, unused + * \param type type of the entered callback + * \param param saved dialog structure in the callback + */ +static void store_dlg_in_tm_cb (struct cell* t, + int type, + struct tmcb_params *param) +{ + struct dlg_cell *dlg = (struct dlg_cell *)(*param->param); + + struct sip_msg* msg = param->rpl; + if (msg == NULL || msg == FAKED_REPLY) + { + msg = param->req; + } + + store_dlg_in_tm (msg, t, dlg); +} /*! * \brief Create a new dialog from a sip message @@ -628,32 +659,26 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) { struct dlg_cell *dlg; str s; - str req_uri; + str callid; + str ftag; + str ttag; + str req_uri; + unsigned int dir; + int spiral_detected; - if((msg->to==NULL && parse_headers(msg, HDR_TO_F,0)<0) || msg->to==NULL) - { - LM_ERR("bad request or missing TO hdr\n"); - return -1; - } - s = get_to(msg)->tag_value; - if(s.s!=0 && s.len!=0) + if(current_dlg_pointer != NULL) return -1; if(msg->first_line.u.request.method_value==METHOD_CANCEL) return -1; - if(parse_from_header(msg)) - { - LM_ERR("bad request or missing FROM hdr\n"); + if(pre_match_parse( msg, &callid, &ftag, &ttag, 0)<0) { + LM_WARN("pre-matching failed\n"); return -1; } - if((msg->callid==NULL && parse_headers(msg,HDR_CALLID_F,0)<0) - || msg->callid==NULL){ - LM_ERR("bad request or missing CALLID hdr\n"); + + if(ttag.s!=0 && ttag.len!=0) return -1; - } - s = msg->callid->body; - trim(&s); if (pv_printf_s(msg, ruri_param_model, &req_uri)<0) { LM_ERR("error - cannot print the r-uri format\n"); @@ -661,17 +686,34 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) } trim(&req_uri); - /* some sanity checks */ - if (s.len==0 || get_from(msg)->tag_value.len==0) { - LM_ERR("invalid request -> callid (%d) or from TAG (%d) empty\n", - s.len, get_from(msg)->tag_value.len); - return -1; + if (detect_spirals) + { + dir = DLG_DIR_NONE; + + dlg = get_dlg(&callid, &ftag, &ttag, &dir); + if (dlg) + { + LM_DBG("Callid '%.*s' found, must be a spiraled request\n", + callid.len, callid.s); + spiral_detected = 1; + + run_dlg_callbacks( DLGCB_SPIRALED, dlg, msg, DLG_DIR_DOWNSTREAM, 0); + + // get_dlg with del==0 has incremented the ref count by 1 + unref_dlg(dlg, 1); + goto finish; + } } + spiral_detected = 0; - dlg = build_new_dlg(&s /*callid*/, &(get_from(msg)->uri) /*from uri*/, - &(get_to(msg)->uri) /*to uri*/, - &(get_from(msg)->tag_value)/*from_tag*/, &req_uri /*r-uri*/ ); - if (dlg==0) { + dlg = build_new_dlg (&callid /*callid*/, + &(get_from(msg)->uri) /*from uri*/, + &(get_to(msg)->uri) /*to uri*/, + &ftag/*from_tag*/, + &req_uri /*r-uri*/ ); + + if (dlg==0) + { LM_ERR("failed to create new dialog\n"); return -1; } @@ -685,10 +727,10 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) return -1; } - set_current_dialog(msg, dlg); - _dlg_ctx.dlg = dlg; - link_dlg(dlg, 2/* extra ref for the callback and current dlg hook */); + link_dlg(dlg,0); + + run_create_callbacks(dlg, msg); /* first INVITE seen (dialog created, unconfirmed) */ if ( seq_match_mode!=SEQ_MATCH_NO_ID && @@ -703,6 +745,8 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) LM_ERR("failed to register TMCB\n"); goto error; } + // increase reference counter because of registered callback + ref_dlg(dlg, 1); dlg->lifetime = get_dlg_timeout(msg); s.s = _dlg_ctx.to_route_name; @@ -713,23 +757,36 @@ int dlg_new_dialog(struct sip_msg *msg, struct cell *t) if (_dlg_ctx.to_bye!=0) dlg->dflags |= DLG_FLAG_TOBYE; - if ( d_tmb.register_tmcb( msg, t, TMCB_MAX, - dlg_tmcb_dummy, (void*)dlg, 0)<0 ) { - LM_ERR("failed cache in T the shortcut to dlg\n"); - goto error; - } -#if 0 - t->dialog_ctx = (void*) dlg; -#endif + if_update_stat( dlg_enable_stats, processed_dlgs, 1); - run_create_callbacks( dlg, msg); +finish: + if (t) { + // transaction exists ==> keep ref counter large enough to + // avoid premature cleanup and ensure proper dialog referencing + if (store_dlg_in_tm( msg, t, dlg) < 0) { + LM_ERR("failed to store dialog in transaction\n"); + goto error; + } + } + else + { + // no transaction exists ==> postpone work until we see the + // request being forwarded statefully + if ( d_tmb.register_tmcb( msg, NULL, TMCB_REQUEST_FWDED, + store_dlg_in_tm_cb, (void*)dlg, NULL)<0 ) { + LM_ERR("failed to register callback for storing dialog in transaction\n"); + } + } - if_update_stat( dlg_enable_stats, processed_dlgs, 1); + set_current_dialog(msg, dlg); + _dlg_ctx.dlg = dlg; + ref_dlg(dlg, 1); return 0; + error: - unref_dlg(dlg,1); - profile_cleanup(msg, 0, NULL); + if (!spiral_detected) + unref_dlg(dlg,1); // undo ref regarding linking return -1; } @@ -792,21 +849,6 @@ static inline int update_cseqs(struct dlg_cell *dlg, struct sip_msg *req, } } - -/*! - * \brief Unreference a dialog, small wrapper to care for shutdown - * \see unref_dlg - * \param dialog unreferenced dialog - */ -static void unreference_dialog(void *dialog) -{ - // if the dialog table is gone, it means the system is shutting down. - if (!d_table) - return; - unref_dlg((struct dlg_cell*)dialog, 1); -} - - /*! * \brief Unreference a dialog from tm callback (another wrapper) * \param t transaction, unused @@ -842,7 +884,6 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) str val, callid, ftag, ttag; int h_entry, h_id, new_state, old_state, unref, event, timeout; unsigned int dir; - unsigned int del; int ret = 0; if (current_dlg_pointer!=NULL) @@ -871,11 +912,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) if ( parse_dlg_rr_param( val.s, val.s+val.len, &h_entry, &h_id)<0 ) return; - dlg = lookup_dlg( h_entry, h_id, &del); - if (del == 1) { - LM_DBG("dialog marked for deletion, ignoring\n"); - return; - } + dlg = lookup_dlg( h_entry, h_id); if (dlg==0) { LM_WARN("unable to find dialog for %.*s " "with route param '%.*s' [%u:%u]\n", @@ -885,8 +922,8 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) if (seq_match_mode==SEQ_MATCH_STRICT_ID ) return; } else { - // lookup_dlg has incremented the ref count by 1 if (pre_match_parse( req, &callid, &ftag, &ttag, 1)<0) { + // lookup_dlg has incremented the ref count by 1 unref_dlg(dlg, 1); return; } @@ -905,6 +942,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) dlg->tag[DLG_CALLER_LEG].len, dlg->tag[DLG_CALLEE_LEG].len, dlg->tag[DLG_CALLEE_LEG].s, dlg->tag[DLG_CALLEE_LEG].len); + // lookup_dlg has incremented the ref count by 1 unref_dlg(dlg, 1); // Reset variables in order to do a lookup based on SIP-Elements. @@ -923,11 +961,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) return; /* TODO - try to use the RR dir detection to speed up here the * search -bogdan */ - dlg = get_dlg(&callid, &ftag, &ttag, &dir, &del); - if (del == 1) { - LM_DBG("dialog marked for deletion, ignoring\n"); - return; - } + dlg = get_dlg(&callid, &ftag, &ttag, &dir); if (!dlg){ LM_DBG("Callid '%.*s' not found\n", req->callid->body.len, req->callid->body.s); @@ -935,6 +969,15 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) } } + /* set current dialog - re-use ref increment from dlg_get() above */ + set_current_dialog( req, dlg); + _dlg_ctx.dlg = dlg; + + if ( d_tmb.register_tmcb( req, NULL, TMCB_REQUEST_FWDED, + store_dlg_in_tm_cb, (void*)dlg, NULL)<0 ) { + LM_ERR("failed to store dialog in transaction during dialog creation for later reference\n"); + } + /* run state machine */ switch ( req->first_line.u.request.method_value ) { case METHOD_PRACK: @@ -953,10 +996,6 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) CURR_DLG_LIFETIME = (unsigned int)(time(0))-dlg->start_ts; CURR_DLG_STATUS = new_state; - /* set current dialog - it will keep a ref! */ - set_current_dialog( req, dlg); - _dlg_ctx.dlg = dlg; - /* delay deletion of dialog until transaction has died off in order * to absorb in-air messages */ if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) { @@ -992,12 +1031,6 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) unref++; } /* dialog terminated (BYE) */ - run_dlg_callbacks( DLGCB_TERMINATED, dlg, req, dir, 0); - - /* delete the dialog from DB */ - if (dlg_db_mode) - remove_dialog_from_db(dlg); - unref_dlg(dlg, unref); if_update_stat( dlg_enable_stats, active_dlgs, -1); @@ -1098,11 +1131,7 @@ void dlg_ontimeout( struct dlg_tl *tl) dlg->tag[DLG_CALLEE_LEG].len, dlg->tag[DLG_CALLEE_LEG].s); /* dialog timeout */ - run_dlg_callbacks( DLGCB_EXPIRED, dlg, 0, DLG_DIR_NONE, 0); - - /* delete the dialog from DB */ - if (dlg_db_mode) - remove_dialog_from_db(dlg); + run_dlg_callbacks( DLGCB_EXPIRED, dlg, NULL, DLG_DIR_NONE, 0); unref_dlg(dlg, unref+1); diff --git a/modules_k/dialog/dlg_hash.c b/modules_k/dialog/dlg_hash.c index 0c14f05a4..c0dedb3d5 100644 --- a/modules_k/dialog/dlg_hash.c +++ b/modules_k/dialog/dlg_hash.c @@ -61,6 +61,7 @@ #include "dlg_hash.h" #include "dlg_profile.h" #include "dlg_req_within.h" +#include "dlg_db_handler.h" #define MAX_LDG_LOCKS 2048 #define MIN_LDG_LOCKS 2 @@ -70,6 +71,49 @@ struct dlg_table *d_table = 0; +/*! + * \brief Reference a dialog without locking + * \param _dlg dialog + * \param _cnt increment for the reference counter + */ +#define ref_dlg_unsafe(_dlg,_cnt) \ + do { \ + (_dlg)->ref += (_cnt); \ + LM_DBG("ref dlg %p with %d -> %d\n", \ + (_dlg),(_cnt),(_dlg)->ref); \ + }while(0) + + +/*! + * \brief Unreference a dialog without locking + * \param _dlg dialog + * \param _cnt decrement for the reference counter + * \param _d_entry dialog entry + */ +#define unref_dlg_unsafe(_dlg,_cnt,_d_entry) \ + do { \ + (_dlg)->ref -= (_cnt); \ + LM_DBG("unref dlg %p with %d -> %d\n",\ + (_dlg),(_cnt),(_dlg)->ref);\ + if ((_dlg)->ref<0) {\ + LM_CRIT("bogus ref %d with cnt %d for dlg %p [%u:%u] "\ + "with clid '%.*s' and tags '%.*s' '%.*s'\n",\ + (_dlg)->ref, _cnt, _dlg,\ + (_dlg)->h_entry, (_dlg)->h_id,\ + (_dlg)->callid.len, (_dlg)->callid.s,\ + (_dlg)->tag[DLG_CALLER_LEG].len,\ + (_dlg)->tag[DLG_CALLER_LEG].s,\ + (_dlg)->tag[DLG_CALLEE_LEG].len,\ + (_dlg)->tag[DLG_CALLEE_LEG].s); \ + }\ + if ((_dlg)->ref<=0) { \ + unlink_unsafe_dlg( _d_entry, _dlg);\ + LM_DBG("ref <=0 for dialog %p\n",_dlg);\ + destroy_dlg(_dlg);\ + }\ + }while(0) + + /*! * \brief Initialize the global dialog table * \param size size of the table @@ -154,6 +198,10 @@ inline void destroy_dlg(struct dlg_cell *dlg) run_dlg_callbacks( DLGCB_DESTROY , dlg, 0, DLG_DIR_NONE, 0); + /* delete the dialog from DB*/ + if (dlg_db_mode) + remove_dialog_from_db(dlg); + if(dlg==get_current_dlg_pointer()) reset_current_dlg_pointer(); @@ -370,18 +418,18 @@ error: /*! * \brief Lookup a dialog in the global list + * + * Note that the caller is responsible for decrementing (or reusing) + * the reference counter by one again iff a dialog has been found. * \param h_entry number of the hash table entry * \param h_id id of the hash table entry * \return dialog on success, NULL on failure */ -struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id, unsigned int *del) +struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id) { struct dlg_cell *dlg; struct dlg_entry *d_entry; - if (del != NULL) - *del = 0; - if (h_entry>=d_table->size) goto not_found; @@ -391,14 +439,7 @@ struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id, unsigned i for( dlg=d_entry->first ; dlg ; dlg=dlg->next ) { if (dlg->h_id == h_id) { - if (dlg->state==DLG_STATE_DELETED) { - if (del != NULL) - *del = 1; - dlg_unlock( d_table, d_entry); - goto not_found; - } - dlg->ref++; - LM_DBG("ref dlg %p with 1 -> %d\n", dlg, dlg->ref); + ref_dlg_unsafe(dlg, 1); dlg_unlock( d_table, d_entry); LM_DBG("dialog id=%u found on entry %u\n", h_id, h_entry); return dlg; @@ -422,15 +463,11 @@ not_found: * \return dialog structure on success, NULL on failure */ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry, - str *callid, str *ftag, str *ttag, unsigned int *dir, - unsigned int *del) + str *callid, str *ftag, str *ttag, unsigned int *dir) { struct dlg_cell *dlg; struct dlg_entry *d_entry; - if (del != NULL) - *del = 0; - d_entry = &(d_table->entries[h_entry]); dlg_lock( d_table, d_entry); @@ -438,14 +475,7 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry, for( dlg = d_entry->first ; dlg ; dlg = dlg->next ) { /* Check callid / fromtag / totag */ if (match_dialog( dlg, callid, ftag, ttag, dir)==1) { - if (dlg->state==DLG_STATE_DELETED) { - if (del != NULL) - *del = 1; - dlg_unlock( d_table, d_entry); - goto not_found; - } - dlg->ref++; - LM_DBG("ref dlg %p with 1 -> %d\n", dlg, dlg->ref); + ref_dlg_unsafe(dlg, 1); dlg_unlock( d_table, d_entry); LM_DBG("dialog callid='%.*s' found\n on entry %u, dir=%d\n", callid->len, callid->s,h_entry,*dir); @@ -454,8 +484,6 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry, } dlg_unlock( d_table, d_entry); - -not_found: LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s); return 0; } @@ -470,21 +498,22 @@ not_found: * "The combination of the To tag, From tag, and Call-ID completely * defines a peer-to-peer SIP relationship between [two UAs] and is * referred to as a dialog." + * Note that the caller is responsible for decrementing (or reusing) + * the reference counter by one again iff a dialog has been found. * \param callid callid * \param ftag from tag * \param ttag to tag * \param dir direction * \return dialog structure on success, NULL on failure */ -struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir, - unsigned int *del) +struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir) { struct dlg_cell *dlg; if ((dlg = internal_get_dlg(core_hash(callid, 0, - d_table->size), callid, ftag, ttag, dir, del)) == 0 && + d_table->size), callid, ftag, ttag, dir)) == 0 && (dlg = internal_get_dlg(core_hash(callid, ttag->len - ?ttag:0, d_table->size), callid, ftag, ttag, dir, del)) == 0) { + ?ttag:0, d_table->size), callid, ftag, ttag, dir)) == 0) { LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s); return 0; } @@ -514,57 +543,13 @@ void link_dlg(struct dlg_cell *dlg, int n) d_entry->last = dlg; } - dlg->ref += 1 + n; - - LM_DBG("ref dlg %p with %d -> %d\n", dlg, n+1, dlg->ref); + ref_dlg_unsafe(dlg, 1+n); dlg_unlock( d_table, d_entry); return; } -/*! - * \brief Reference a dialog without locking - * \param _dlg dialog - * \param _cnt increment for the reference counter - */ -#define ref_dlg_unsafe(_dlg,_cnt) \ - do { \ - (_dlg)->ref += (_cnt); \ - LM_DBG("ref dlg %p with %d -> %d\n", \ - (_dlg),(_cnt),(_dlg)->ref); \ - }while(0) - - -/*! - * \brief Unreference a dialog without locking - * \param _dlg dialog - * \param _cnt decrement for the reference counter - */ -#define unref_dlg_unsafe(_dlg,_cnt,_d_entry) \ - do { \ - (_dlg)->ref -= (_cnt); \ - LM_DBG("unref dlg %p with %d -> %d\n",\ - (_dlg),(_cnt),(_dlg)->ref);\ - if ((_dlg)->ref<0) {\ - LM_CRIT("bogus ref %d with cnt %d for dlg %p [%u:%u] "\ - "with clid '%.*s' and tags '%.*s' '%.*s'\n",\ - (_dlg)->ref, _cnt, _dlg,\ - (_dlg)->h_entry, (_dlg)->h_id,\ - (_dlg)->callid.len, (_dlg)->callid.s,\ - (_dlg)->tag[DLG_CALLER_LEG].len,\ - (_dlg)->tag[DLG_CALLER_LEG].s,\ - (_dlg)->tag[DLG_CALLEE_LEG].len,\ - (_dlg)->tag[DLG_CALLEE_LEG].s); \ - }\ - if ((_dlg)->ref<=0) { \ - unlink_unsafe_dlg( _d_entry, _dlg);\ - LM_DBG("ref <=0 for dialog %p\n",_dlg);\ - destroy_dlg(_dlg);\ - }\ - }while(0) - - /*! * \brief Refefence a dialog with locking * \see ref_dlg_unsafe @@ -826,6 +811,11 @@ static inline int internal_mi_print_dlg(struct mi_node *rpl, if (node1==0) goto error; + p= int2str((unsigned long)dlg->ref, &len); + node1 = add_mi_node_child( node, MI_DUP_VALUE, "ref_count", 9, p, len); + if (node1==0) + goto error; + p= int2str((unsigned long)dlg->start_ts, &len); node1 = add_mi_node_child(node,MI_DUP_VALUE,"timestart",9, p, len); if (node1==0) @@ -869,11 +859,25 @@ static inline int internal_mi_print_dlg(struct mi_node *rpl, if(node1 == 0) goto error; - node1 = add_mi_node_child(node, 0,"caller_bind_addr",16, - dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s, + if (dlg->bind_addr[DLG_CALLER_LEG]) { + node1 = add_mi_node_child(node, 0, + "caller_bind_addr",16, + dlg->bind_addr[DLG_CALLER_LEG]->sock_str.s, dlg->bind_addr[DLG_CALLER_LEG]->sock_str.len); - if(node1 == 0) - goto error; + } else { + node1 = add_mi_node_child(node, 0, + "caller_bind_addr",16,0,0); + } + + if (dlg->bind_addr[DLG_CALLEE_LEG]) { + node1 = add_mi_node_child(node, 0, + "callee_bind_addr",16, + dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.s, + dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.len); + } else { + node1 = add_mi_node_child(node, 0, + "callee_bind_addr",16,0,0); + } node1 = add_mi_node_child(node, MI_DUP_VALUE, "to_uri", 6, dlg->to_uri.s, dlg->to_uri.len); @@ -903,18 +907,6 @@ static inline int internal_mi_print_dlg(struct mi_node *rpl, if(node1 == 0) goto error; - if (dlg->bind_addr[DLG_CALLEE_LEG]) { - node1 = add_mi_node_child(node, 0, - "callee_bind_addr",16, - dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.s, - dlg->bind_addr[DLG_CALLEE_LEG]->sock_str.len); - } else { - node1 = add_mi_node_child(node, 0, - "callee_bind_addr",16,0,0); - } - if(node1 == 0) - goto error; - if (with_context) { node1 = add_mi_node_child(node, 0, "context", 7, 0, 0); if(node1 == 0) diff --git a/modules_k/dialog/dlg_hash.h b/modules_k/dialog/dlg_hash.h index 79b53d3ce..40343b7e9 100644 --- a/modules_k/dialog/dlg_hash.h +++ b/modules_k/dialog/dlg_hash.h @@ -250,12 +250,14 @@ int dlg_set_toroute(struct dlg_cell *dlg, str *route); /*! * \brief Lookup a dialog in the global list + * + * Note that the caller is responsible for decrementing (or reusing) + * the reference counter by one again iff a dialog has been found. * \param h_entry number of the hash table entry * \param h_id id of the hash table entry - * \param del unless null, flag that is set if dialog is in "deleted" state * \return dialog on success, NULL on failure */ -struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id, unsigned int *del); +struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id); /*! @@ -266,14 +268,15 @@ struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id, unsigned i * "The combination of the To tag, From tag, and Call-ID completely * defines a peer-to-peer SIP relationship between [two UAs] and is * referred to as a dialog." + * Note that the caller is responsible for decrementing (or reusing) + * the reference counter by one again iff a dialog has been found. * \param callid callid * \param ftag from tag * \param ttag to tag * \param dir direction - * \param del unless null, flag that is set if dialog is in "deleted" state * \return dialog structure on success, NULL on failure */ -struct dlg_cell* get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir, unsigned int *del); +struct dlg_cell* get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir); /*! diff --git a/modules_k/dialog/dlg_profile.c b/modules_k/dialog/dlg_profile.c index a5f755882..aeeec40fe 100644 --- a/modules_k/dialog/dlg_profile.c +++ b/modules_k/dialog/dlg_profile.c @@ -327,17 +327,33 @@ int profile_cleanup( struct sip_msg *msg, unsigned int flags, void *param ) } + +struct dlg_cell* get_dialog_from_tm(struct cell *t) +{ + if (t==NULL || t==T_UNDEFINED) + return NULL; + + struct tm_callback* x = (struct tm_callback*)(t->tmcb_hl.first); + + while(x){ + membar_depends(); + if (x->types==TMCB_MAX && x->callback==dlg_tmcb_dummy){ + return (struct dlg_cell*)(x->param); + } + x=x->next; + } + + return NULL; +} + /*! * \brief Get the current dialog for a message, if exists * \param msg SIP message * \return NULL if called in REQUEST_ROUTE, pointer to dialog ctx otherwise */ -static struct dlg_cell *get_current_dialog(struct sip_msg *msg) +struct dlg_cell *get_current_dialog(struct sip_msg *msg) { - struct cell *trans; - struct tm_callback* x; - - if (is_route_type(REQUEST_ROUTE)) { + if (is_route_type(REQUEST_ROUTE|BRANCH_ROUTE)) { /* use the per-process static holder */ if (msg->id==current_dlg_msg_id) return current_dlg_pointer; @@ -348,18 +364,7 @@ static struct dlg_cell *get_current_dialog(struct sip_msg *msg) return NULL; } else { /* use current transaction to get dialog */ - trans = d_tmb.t_gett(); - if (trans==NULL || trans==T_UNDEFINED) - return NULL; - x=(struct tm_callback*)(trans->tmcb_hl.first); - while(x){ - membar_depends(); - if (x->types==TMCB_MAX && x->callback==dlg_tmcb_dummy){ - return (struct dlg_cell*)(x->param); - } - x=x->next; - } - return NULL; + return get_dialog_from_tm(d_tmb.t_gett()); } } @@ -460,6 +465,9 @@ void set_current_dialog(struct sip_msg *msg, struct dlg_cell *dlg) } current_pending_linkers = NULL; current_dlg_pointer = dlg; + + /* do not increase reference counter here, let caller handle it + * (yes, this is somewhat ugly) */ } diff --git a/modules_k/dialog/dlg_profile.h b/modules_k/dialog/dlg_profile.h index 608102bc3..f11af76cb 100644 --- a/modules_k/dialog/dlg_profile.h +++ b/modules_k/dialog/dlg_profile.h @@ -33,6 +33,8 @@ #include "../../parser/msg_parser.h" #include "../../locking.h" #include "../../str.h" +#include "../../modules/tm/h_table.h" + /*! @@ -83,6 +85,10 @@ struct dlg_cell *get_current_dlg_pointer(void); void reset_current_dlg_pointer(void); +struct dlg_cell* get_dialog_from_tm(struct cell *t); + +struct dlg_cell *get_current_dialog(struct sip_msg *msg); + /*! * \brief Add profile definitions to the global list * \see new_dlg_profile diff --git a/modules_k/dialog/dlg_req_within.c b/modules_k/dialog/dlg_req_within.c index 36e301207..c7ab138a4 100644 --- a/modules_k/dialog/dlg_req_within.c +++ b/modules_k/dialog/dlg_req_within.c @@ -318,7 +318,7 @@ struct mi_root * mi_terminate_dlg(struct mi_root *cmd_tree, void *param ){ LM_DBG("h_entry %u h_id %u\n", h_entry, h_id); - dlg = lookup_dlg(h_entry, h_id, NULL); + dlg = lookup_dlg(h_entry, h_id); // lookup_dlg has incremented the reference count diff --git a/modules_k/dialog/dlg_timer.c b/modules_k/dialog/dlg_timer.c index 03cc5b3b6..7308eee2c 100644 --- a/modules_k/dialog/dlg_timer.c +++ b/modules_k/dialog/dlg_timer.c @@ -133,9 +133,9 @@ int insert_dlg_timer(struct dlg_tl *tl, int interval) lock_get( d_timer->lock); if (tl->next!=0 || tl->prev!=0) { - lock_release( d_timer->lock); LM_CRIT("Trying to insert a bogus dlg tl=%p tl->next=%p tl->prev=%p\n", tl, tl->next, tl->prev); + lock_release( d_timer->lock); return -1; } tl->timeout = get_ticks()+interval; @@ -202,14 +202,13 @@ int update_dlg_timer(struct dlg_tl *tl, int timeout) { lock_get( d_timer->lock); - if ( tl->next ) { - if (tl->prev==0) { - lock_release( d_timer->lock); - return -1; - } - remove_dialog_timer_unsafe(tl); + if (tl->next==0 || tl->prev==0) { + LM_CRIT("Trying to update a bogus dlg tl=%p tl->next=%p tl->prev=%p\n", + tl, tl->next, tl->prev); + lock_release( d_timer->lock); + return -1; } - + remove_dialog_timer_unsafe( tl ); tl->timeout = get_ticks()+timeout; insert_dialog_timer_unsafe( tl ); diff --git a/modules_k/dialog/doc/dialog_admin.xml b/modules_k/dialog/doc/dialog_admin.xml index aaed79eba..9305b7311 100644 --- a/modules_k/dialog/doc/dialog_admin.xml +++ b/modules_k/dialog/doc/dialog_admin.xml @@ -341,9 +341,9 @@ modparam("dialog", "dlg_match_mode", 1) Set <varname>detect_spirals</varname> parameter - ... - modparam("dialog", "detect_spirals", 1) - ... +... +modparam("dialog", "detect_spirals", 1) +... diff --git a/modules_k/dialog/doc/dialog_devel.xml b/modules_k/dialog/doc/dialog_devel.xml index 4865dee8e..322d45bb2 100644 --- a/modules_k/dialog/doc/dialog_devel.xml +++ b/modules_k/dialog/doc/dialog_devel.xml @@ -52,7 +52,8 @@ DLGCB_CONFIRMED - called when the - dialog is confirmed (2xx replied) - it's a per dialog type. + dialog is confirmed (2xx replied) and the setup-concluding ACK + message from the caller has been seen - it's a per dialog type. diff --git a/modules_k/dispatcher/dispatch.c b/modules_k/dispatcher/dispatch.c index ba123bb8c..e16277c53 100644 --- a/modules_k/dispatcher/dispatch.c +++ b/modules_k/dispatcher/dispatch.c @@ -349,7 +349,6 @@ int add_dest2list(int id, str uri, int flags, int priority, str *attrs, if (he==0) { LM_ERR("could not resolve %.*s\n", puri.host.len, puri.host.s); - pkg_free(hn); goto err; } /* Free the hostname */ @@ -841,7 +840,8 @@ void destroy_list(int list_id) dest->uri.s = NULL; } } - shm_free(sp->dlist); + if (sp->dlist != NULL) + shm_free(sp->dlist); sp = sp->next; } @@ -1954,9 +1954,9 @@ int ds_next_dst(struct sip_msg *msg, int mode) { prev_avp = search_first_avp(dstid_avp_type, dstid_avp_name, &avp_value, &st); - if(prev_avp!=NULL) + if(prev_avp==NULL) { - LM_ERR("cannot uid for dst addr\n"); + LM_ERR("cannot find uid avp for destination address\n"); return -1; } if(ds_load_replace(msg, &avp_value.s)<0) diff --git a/modules_k/group/group.c b/modules_k/group/group.c index 3a2368b95..faac07d8a 100644 --- a/modules_k/group/group.c +++ b/modules_k/group/group.c @@ -117,6 +117,10 @@ int get_username_domain(struct sip_msg *msg, group_check_p gcp, } turi = &puri; break; + default: { + LM_ERR("incorrect check id %d\n", gcp->id); + return -1; + } } if (gcp->id != 4) { diff --git a/modules_k/htable/ht_db.c b/modules_k/htable/ht_db.c index 0f88500ff..1c6b56618 100644 --- a/modules_k/htable/ht_db.c +++ b/modules_k/htable/ht_db.c @@ -108,7 +108,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode) { db_key_t db_cols[4] = {&ht_db_name_column, &ht_db_ktype_column, &ht_db_vtype_column, &ht_db_value_column}; - db_key_t db_ord = &ht_db_ktype_column; + db_key_t db_ord = &ht_db_name_column; db1_res_t* db_res = NULL; str kname; str pname; @@ -183,64 +183,54 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode) cnt++; /* not NULL values enforced in table definition ?!?! */ kname.s = (char*)(RES_ROWS(db_res)[i].values[0].val.string_val); + if(kname.s==NULL) { + LM_ERR("null key in row %d\n", i); + goto error; + } kname.len = strlen(kname.s); ktype = RES_ROWS(db_res)[i].values[1].val.int_val; - if(ktype==0 && last_ktype==1) + if(last_ktype==1) { - snprintf(ht_name_buf, HT_NAME_BUF_SIZE, "%.*s%.*s", - pname.len, pname.s, ht_array_size_suffix.len, - ht_array_size_suffix.s); - hname.s = ht_name_buf; - hname.len = strlen(ht_name_buf); - val.n = n+1; - - if(ht_set_cell(ht, &hname, 0, &val, mode)) + if(pname.len>0 + && (pname.len!=kname.len + || strncmp(pname.s, kname.s, pname.len)!=0)) { - LM_ERR("error adding array size to hash table.\n"); - goto error; + /* new key name, last was an array => add its size */ + snprintf(ht_name_buf, HT_NAME_BUF_SIZE, "%.*s%.*s", + pname.len, pname.s, ht_array_size_suffix.len, + ht_array_size_suffix.s); + hname.s = ht_name_buf; + hname.len = strlen(ht_name_buf); + val.n = n; + + if(ht_set_cell(ht, &hname, 0, &val, mode)) + { + LM_ERR("error adding array size to hash table.\n"); + goto error; + } + pname.len = 0; + pname.s = ""; + n = 0; } - pname.len = 0; - pname.s = ""; - n = 0; } + last_ktype = ktype; + pname = kname; if(ktype==1) { - if(pname.len!=kname.len - || strncmp(pname.s, kname.s, pname.len)) - { - /* add count */ - if(pname.len > 0) - { - /* perhaps some opt can be done here */ - snprintf(ht_name_buf, HT_NAME_BUF_SIZE, "%.*s%.*s", - pname.len, pname.s, ht_array_size_suffix.len, - ht_array_size_suffix.s); - hname.s = ht_name_buf; - hname.len = strlen(ht_name_buf); - val.n = n+1; - - if(ht_set_cell(ht, &hname, 0, &val, mode)) - { - LM_ERR("error adding array size to hash table\n"); - goto error; - } - } - /* reset */ - pname = kname; - n=0; - } else { - n++; - } snprintf(ht_name_buf, HT_NAME_BUF_SIZE, "%.*s[%d]", kname.len, kname.s, n); hname.s = ht_name_buf; hname.len = strlen(ht_name_buf); + n++; } else { hname = kname; } - last_ktype = ktype; vtype = RES_ROWS(db_res)[i].values[2].val.int_val; kvalue.s = (char*)(RES_ROWS(db_res)[i].values[3].val.string_val); + if(kvalue.s==NULL) { + LM_ERR("null value in row %d\n", i); + goto error; + } kvalue.len = strlen(kvalue.s); /* add to hash */ @@ -272,7 +262,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode) ht_array_size_suffix.s); hname.s = ht_name_buf; hname.len = strlen(ht_name_buf); - val.n = n+1; + val.n = n; if(ht_set_cell(ht, &hname, 0, &val, mode)) { LM_ERR("error adding array size to hash table.\n"); diff --git a/modules_k/htable/ht_var.c b/modules_k/htable/ht_var.c index e97bc1d2f..03ca66f90 100644 --- a/modules_k/htable/ht_var.c +++ b/modules_k/htable/ht_var.c @@ -176,7 +176,6 @@ int pv_get_ht_cell_expire(struct sip_msg *msg, pv_param_t *param, pv_value_t *res) { str htname; - ht_cell_t *htc=NULL; ht_pv_t *hpv; unsigned int now; @@ -196,7 +195,7 @@ int pv_get_ht_cell_expire(struct sip_msg *msg, pv_param_t *param, if(ht_get_cell_expire(hpv->ht, &htname, &now)!=0) return pv_get_null(msg, param, res); /* integer */ - return pv_get_uintval(msg, param, res, htc->value.n); + return pv_get_uintval(msg, param, res, now); } int pv_set_ht_cell_expire(struct sip_msg* msg, pv_param_t *param, diff --git a/modules_k/imc/imc.c b/modules_k/imc/imc.c index ccbea01f1..a948f150a 100644 --- a/modules_k/imc/imc.c +++ b/modules_k/imc/imc.c @@ -437,7 +437,7 @@ static int mod_init(void) */ static int child_init(int rank) { - if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN) + if (rank==PROC_INIT || rank==PROC_TCP_MAIN) return 0; /* do nothing for the main process */ if (imc_dbf.init==0) diff --git a/modules_k/imc/imc_cmd.c b/modules_k/imc/imc_cmd.c index 0bf8e50b1..6c1e3bc9e 100644 --- a/modules_k/imc/imc_cmd.c +++ b/modules_k/imc/imc_cmd.c @@ -326,13 +326,22 @@ int imc_handle_join(struct sip_msg* msg, imc_cmd_t *cmd, build_inform: /* send info message */ body.s = imc_body_buf; - body.len = snprintf(body.s, IMC_BUF_SIZE, "*** <%.*s> has joined the room", - member->uri.len, member->uri.s); + if(member!=NULL) + { + body.len = snprintf(body.s, IMC_BUF_SIZE, + "*** <%.*s@%.*s> has joined the room", + src->user.len, src->user.s, src->host.len, src->host.s); + + } else { + body.len = snprintf(body.s, IMC_BUF_SIZE, + "*** <%.*s@%.*s> attempted to join the room", + src->user.len, src->user.s, src->host.len, src->host.s); + } if(body.len>0) imc_room_broadcast(room, &all_hdrs, &body); - if(body.len>=IMC_BUF_SIZE) - LM_ERR("member name %.*s truncated\n", member->uri.len, member->uri.s); + LM_ERR("member name %.*s@%.*s truncated\n", + src->user.len, src->user.s, src->host.len, src->host.s); done: if(room!=NULL) diff --git a/modules_k/mi_datagram/datagram_fnc.c b/modules_k/mi_datagram/datagram_fnc.c index e26a55aac..6c4dc2949 100644 --- a/modules_k/mi_datagram/datagram_fnc.c +++ b/modules_k/mi_datagram/datagram_fnc.c @@ -48,6 +48,7 @@ #include #include "../../resolve.h" +#include "../../cfg/cfg_struct.h" #include "mi_datagram.h" #include "datagram_fnc.h" #include "mi_datagram_parser.h" @@ -434,6 +435,9 @@ void mi_datagram_server(int rx_sock, int tx_sock) f = 0; while(1) { /*read the datagram*/ + /* update the local config framework structures */ + cfg_update(); + memset(mi_buf, 0, DATAGRAM_SOCK_BUF_SIZE); reply_addr_len = sizeof(reply_addr); diff --git a/modules_k/mi_datagram/mi_datagram.c b/modules_k/mi_datagram/mi_datagram.c index e45cee22f..0e2f30385 100644 --- a/modules_k/mi_datagram/mi_datagram.c +++ b/modules_k/mi_datagram/mi_datagram.c @@ -56,6 +56,7 @@ #include "../../lib/kmi/mi.h" #include "../../ip_addr.h" #include "../../pt.h" +#include "../../cfg/cfg_struct.h" #include "mi_datagram.h" #include "datagram_fnc.h" #include "mi_datagram_parser.h" @@ -253,6 +254,8 @@ static int mi_mod_init(void) done: /* add space for extra processes */ register_procs(mi_procs[0].no); + /* add child to update local config framework structures */ + cfg_register_child(mi_procs[0].no); return 0; } @@ -282,6 +285,11 @@ static int mi_child_init(int rank) return -1; /* error */ if(pid==0) { /* child */ + + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + datagram_process(i); return 0; } diff --git a/modules_k/mi_fifo/fifo_fnc.c b/modules_k/mi_fifo/fifo_fnc.c index 628459052..5f0d07dec 100644 --- a/modules_k/mi_fifo/fifo_fnc.c +++ b/modules_k/mi_fifo/fifo_fnc.c @@ -47,6 +47,7 @@ #include "../../lib/kmi/mi.h" #include "../../mem/mem.h" #include "../../mem/shm_mem.h" +#include "../../cfg/cfg_struct.h" #include "mi_fifo.h" #include "fifo_fnc.h" #include "mi_parser.h" @@ -409,6 +410,9 @@ void mi_fifo_server(FILE *fifo_stream) FILE *reply_stream; while(1) { + /* update the local config framework structures */ + cfg_update(); + reply_stream = NULL; /* commands must look this way '::[filename]' */ diff --git a/modules_k/mi_fifo/mi_fifo.c b/modules_k/mi_fifo/mi_fifo.c index 17a72b80a..9530c4c46 100644 --- a/modules_k/mi_fifo/mi_fifo.c +++ b/modules_k/mi_fifo/mi_fifo.c @@ -46,6 +46,7 @@ #include "../../pt.h" #include "../../mem/mem.h" #include "../../mem/shm_mem.h" +#include "../../cfg/cfg_struct.h" #include "../../lib/kmi/mi.h" #include "mi_fifo.h" #include "mi_parser.h" @@ -174,6 +175,9 @@ static int mi_mod_init(void) /* add space for one extra process */ register_procs(1); + /* add child to update local config framework structures */ + cfg_register_child(1); + return 0; } @@ -196,6 +200,11 @@ static int mi_child_init(int rank) return -1; /* error */ if(pid==0){ /* child */ + + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + fifo_process(1); } } diff --git a/modules_k/mi_xmlrpc/mi_xmlrpc.c b/modules_k/mi_xmlrpc/mi_xmlrpc.c index 6d9bf5193..9be16503f 100644 --- a/modules_k/mi_xmlrpc/mi_xmlrpc.c +++ b/modules_k/mi_xmlrpc/mi_xmlrpc.c @@ -65,6 +65,7 @@ #include "../../pt.h" #include "../../mem/mem.h" #include "../../mem/shm_mem.h" +#include "../../cfg/cfg_struct.h" xmlrpc_env env; xmlrpc_value * xr_response; @@ -134,6 +135,9 @@ static int mod_init(void) /* add space for extra processes */ register_procs(1); + /* add child to update local config framework structures */ + cfg_register_child(1); + return 0; } @@ -146,6 +150,11 @@ static int child_init(int rank) return -1; /* error */ if(pid==0){ /* child */ + + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + xmlrpc_process(1); } } diff --git a/modules_k/mi_xmlrpc/xr_server.c b/modules_k/mi_xmlrpc/xr_server.c index 18d5e0fa4..8d3f8bcd8 100644 --- a/modules_k/mi_xmlrpc/xr_server.c +++ b/modules_k/mi_xmlrpc/xr_server.c @@ -35,6 +35,7 @@ #include "../../mem/shm_mem.h" #include "../../locking.h" #include "../../ut.h" +#include "../../cfg/cfg_struct.h" #include "xr_writer.h" #include "xr_parser.h" #include "mi_xmlrpc.h" @@ -177,6 +178,9 @@ xmlrpc_value* default_method (xmlrpc_env* env, LM_DBG("starting up.....\n"); + /* update the local config framework structures */ + cfg_update(); + f = lookup_mi_cmd((char*)methodName, strlen(methodName)); if ( f == 0 ) { diff --git a/modules_k/nat_traversal/nat_traversal.c b/modules_k/nat_traversal/nat_traversal.c index 559fb4906..791488d61 100644 --- a/modules_k/nat_traversal/nat_traversal.c +++ b/modules_k/nat_traversal/nat_traversal.c @@ -1809,7 +1809,7 @@ mod_init(void) LM_NOTICE("using 10 seconds for keepalive_interval\n"); keepalive_interval = 10; } - register_procs(1); + register_dummy_timers(1); return 0; } diff --git a/modules_k/nathelper/nathelper.c b/modules_k/nathelper/nathelper.c index 2b07f38f2..a66cfc466 100644 --- a/modules_k/nathelper/nathelper.c +++ b/modules_k/nathelper/nathelper.c @@ -649,7 +649,7 @@ mod_init(void) init_sip_ping(); } - register_procs(natping_processes); + register_dummy_timers(natping_processes); } /* Prepare 1918 networks list */ diff --git a/modules_k/path/path.c b/modules_k/path/path.c index 5a0c3cd70..f2860772e 100644 --- a/modules_k/path/path.c +++ b/modules_k/path/path.c @@ -208,9 +208,9 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param) { param_hooks_t hooks; param_t *params; - + if (parse_params(r_param, CLASS_CONTACT, &hooks, ¶ms) != 0) { - LM_ERR("failed to parse route parameters '%.*s'\n", r_param->len, r_param->s); + LM_ERR("failed to parse route parametes\n"); return; } diff --git a/modules_k/perl/openserxs.c b/modules_k/perl/openserxs.c new file mode 100644 index 000000000..6b7066ddc --- /dev/null +++ b/modules_k/perl/openserxs.c @@ -0,0 +1,1971 @@ +/* + * This file was generated automatically by ExtUtils::ParseXS version 2.18_02 from the + * contents of openserxs.xs. Do not edit this file, edit openserxs.xs instead. + * + * ANY CHANGES MADE HERE WILL BE LOST! + * + */ + +#line 1 "openserxs.xs" +/* + * $Id$ + * + * Perl module for OpenSER + * + * Copyright (C) 2006 Collax GmbH + * (Bastian Friedrich ) + * + * This file is part of openser, a free SIP server. + * + * openser is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version + * + * openser is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include +#include +#include +#include +#undef load_module + +/* perl.h defines union semun */ +#ifdef USE_SYSV_SEM +# undef _SEM_SEMUN_UNDEFINED +#endif + +#include "../../sr_module.h" +#include "../../parser/msg_parser.h" +#include "../../parser/parse_uri.h" +#include "../../usr_avp.h" +#include "../../action.h" +#include "../../flags.h" +#include "../../pvar.h" +#include "../../dset.h" +#include "../../mem/mem.h" +#include "../../route_struct.h" +#include "../../qvalue.h" +#include "../../dprint.h" + +extern int unsafemodfnc; + +enum xs_uri_members { + XS_URI_USER = 0, + XS_URI_PASSWD, + XS_URI_HOST, + XS_URI_PORT, + XS_URI_PARAMS, + XS_URI_HEADERS, + XS_URI_TRANSPORT, + XS_URI_TTL, + XS_URI_USER_PARAM, + XS_URI_MADDR, + XS_URI_METHOD, + XS_URI_LR, + XS_URI_R2, + XS_URI_TRANSPORT_VAL, + XS_URI_TTL_VAL, + XS_URI_USER_PARAM_VAL, + XS_URI_MADDR_VAL, + XS_URI_METHOD_VAL, + XS_URI_LR_VAL, + XS_URI_R2_VAL + + /* These members are no strings: + unsigned short port_no; + unsigned short proto; / * from transport * / + uri_type type; / * uri scheme */ +}; + +/* + * Return the sip_msg struct referred to by perl reference sv + */ +struct sip_msg * sv2msg(SV *sv) { + struct sip_msg* m; + if (SvROK(sv)) { + sv = SvRV(sv); + if (SvIOK(sv)) { + m = INT2PTR(struct sip_msg*, SvIV(sv)); + return m; + } + } + return NULL; /* In case of error above... */ +} + +struct sip_uri * sv2uri(SV *sv) { + struct sip_uri* u; + if (SvROK(sv)) { + sv = SvRV(sv); + if (SvIOK(sv)) { + u = INT2PTR(struct sip_uri*, SvIV(sv)); + return u; + } + } + return NULL; /* In case of error above... */ +} + +struct action * sv2action(SV *sv) { + struct action* a; + if (SvROK(sv)) { + sv = SvRV(sv); + if (SvIOK(sv)) { + a = INT2PTR(struct action*, SvIV(sv)); + return a; + } + } + return NULL; /* In case of error above... */ +} + +/* + * We have a private function for two reasons: + * a) Return SIP_INVALID even if type was sth different + * b) easy access + */ + +inline static int getType(struct sip_msg *msg) { + int t = SIP_INVALID; + + if (!msg) return SIP_INVALID; + + switch ((msg->first_line).type) { + case SIP_REQUEST: t = SIP_REQUEST; break; + case SIP_REPLY: t = SIP_REPLY; break; + } + return t; +} + + +SV *getStringFromURI(SV *self, enum xs_uri_members what) { + struct sip_uri *myuri = sv2uri(self); + str *ret = NULL; + + if (!myuri) { + LM_ERR("Invalid URI reference\n"); + ret = NULL; + } else { + + switch (what) { + case XS_URI_USER: ret = &(myuri->user); + break; + case XS_URI_HOST: ret = &(myuri->host); + break; + case XS_URI_PASSWD: ret = &(myuri->passwd); + break; + case XS_URI_PORT: ret = &(myuri->port); + break; + case XS_URI_PARAMS: ret = &(myuri->params); + break; + case XS_URI_HEADERS: ret = &(myuri->headers); + break; + case XS_URI_TRANSPORT: ret = &(myuri->transport); + break; + case XS_URI_TTL: ret = &(myuri->ttl); + break; + case XS_URI_USER_PARAM: ret = &(myuri->user_param); + break; + case XS_URI_MADDR: ret = &(myuri->maddr); + break; + case XS_URI_METHOD: ret = &(myuri->method); + break; + case XS_URI_LR: ret = &(myuri->lr); + break; + case XS_URI_R2: ret = &(myuri->r2); + break; + case XS_URI_TRANSPORT_VAL: ret = &(myuri->transport_val); + break; + case XS_URI_TTL_VAL: ret = &(myuri->ttl_val); + break; + case XS_URI_USER_PARAM_VAL: ret = &(myuri->user_param_val); + break; + case XS_URI_MADDR_VAL: ret = &(myuri->maddr_val); + break; + case XS_URI_METHOD_VAL: ret = &(myuri->method_val); + break; + case XS_URI_LR_VAL: ret = &(myuri->lr_val); + break; + case XS_URI_R2_VAL: ret = &(myuri->r2_val); + break; + + default: LM_INFO("Unknown URI element" + " requested: %d\n", what); + break; + } + } + + if ((ret) && (ret->len)) { + return sv_2mortal(newSVpv(ret->s, ret->len)); + } else { + return &PL_sv_undef; + } +} + + + +/* + * Calls an exported function. Parameters are copied and fixup'd. + * + * Return codes: + * -1 - Function not available (or other error). + * 1 - Function was called. Its return value is returned via the retval + * parameter. + */ + +int moduleFunc(struct sip_msg *m, char *func, + char *param1, char *param2, + int *retval) { + + sr31_cmd_export_t* exp_func_struct; + struct action *act; + unsigned mod_ver; + char *argv[2]; + int argc = 0; + struct run_act_ctx ra_ctx; + + if (!func) { + LM_ERR("moduleFunc called with null function name. Error."); + return -1; + } + + if ((!param1) && param2) { + LM_ERR("moduleFunc called with parameter 1 UNSET and" + " parameter 2 SET. Error."); + return -1; + } + + + if (param1) { + argv[0] = (char *)pkg_malloc(strlen(param1)+1); + strcpy(argv[0], param1); + argc++; + } else { + argv[0] = NULL; + } + + if (param2) { + argv[1] = (char *)pkg_malloc(strlen(param2)+1); + strcpy(argv[1], param2); + argc++; + } else { + argv[1] = NULL; + } + + exp_func_struct = find_export_record(func, argc, 0, &mod_ver); + if (!exp_func_struct || mod_ver < 1) { + LM_ERR("function '%s' called, but not available.", func); + *retval = -1; + if (argv[0]) pkg_free(argv[0]); + if (argv[1]) pkg_free(argv[1]); + return -1; + } + + act = mk_action(MODULE2_T, 4 /* number of (type, value) pairs */, + MODEXP_ST, exp_func_struct, /* function */ + NUMBER_ST, 2, /* parameter number */ + STRING_ST, argv[0], /* param. 1 */ + STRING_ST, argv[1] /* param. 2 */ + ); + + + if (!act) { + LM_ERR("action structure could not be created. Error."); + if (argv[0]) pkg_free(argv[0]); + if (argv[1]) pkg_free(argv[1]); + return -1; + } + + + if (exp_func_struct->fixup) { + if (!unsafemodfnc) { + LM_ERR("Module function '%s' is unsafe. Call is refused.\n", func); + if (argv[0]) pkg_free(argv[0]); + if (argv[1]) pkg_free(argv[1]); + *retval = -1; + return -1; + } + + if (argc>=2) { + *retval = exp_func_struct->fixup(&(act->val[3].u.data), 2); + if (*retval < 0) { + LM_ERR("Error in fixup (2)\n"); + return -1; + } + act->val[3].type = MODFIXUP_ST; + } + if (argc>=1) { + *retval = exp_func_struct->fixup(&(act->val[2].u.data), 1); + if (*retval < 0) { + LM_ERR("Error in fixup (1)\n"); + return -1; + } + act->val[2].type = MODFIXUP_ST; + } + if (argc==0) { + *retval = exp_func_struct->fixup(0, 0); + if (*retval < 0) { + LM_ERR("Error in fixup (0)\n"); + return -1; + } + } + } + + init_run_actions_ctx(&ra_ctx); + *retval = do_action(&ra_ctx, act, m); + + if ((act->val[3].type == MODFIXUP_ST) && (act->val[3].u.data)) { + /* pkg_free(act->elem[3].u.data); */ + LM_WARN("moduleFunction: A fixup function was called. " + "This currently creates a memory leak.\n"); + } + + if ((act->val[2].type == MODFIXUP_ST) && (act->val[2].u.data)) { + /* pkg_free(act->elem[2].u.data); */ + LM_WARN("moduleFunction: A fixup function was called. " + "This currently creates a memory leak.\n"); + } + + if (argv[0]) pkg_free(argv[0]); + if (argv[1]) pkg_free(argv[1]); + + pkg_free(act); + + return 1; +} + + +/** + * Rewrite Request-URI + */ +static inline int rewrite_ruri(struct sip_msg* _m, char* _s) +{ + struct action act; + struct run_act_ctx ra_ctx; + + act.type = SET_URI_T; + act.val[0].type = STRING_ST; + act.val[0].u.string = _s; + act.next = 0; + + init_run_actions_ctx(&ra_ctx); + if (do_action(&ra_ctx, &act, _m) < 0) + { + LM_ERR("rewrite_ruri: Error in do_action\n"); + return -1; + } + return 0; +} + + +/** + * Compile a string with pseudo variables substituted by their values. + * A string buffer is allocated. Deallocate afterwards! + */ +char *pv_sprintf(struct sip_msg *m, char *fmt) { + int buf_size = 4096; + pv_elem_t *model; + str s; + char *out = (char *)pkg_malloc(buf_size); + char *ret = NULL; + + if (!out) { + LM_ERR("pv_sprintf: Memory exhausted!\n"); + return NULL; + } + + s.s = fmt; s.len = strlen(s.s); + if(pv_parse_format(&s, &model) < 0) { + LM_ERR("pv_sprintf: ERROR: wrong format[%s]!\n", + fmt); + return NULL; + } + + if(pv_printf(m, model, out, &buf_size) < 0) { + ret = NULL; + } else { + ret = strdup(out); + } + + pv_elem_free_all(model); + pkg_free(out); + + return ret; +} + +/** + * Convert an SV to an int_str struct. Needed in AVP package. + * - val: SV to convert. + * - is: pointer to resulting int_str + * - flags: pointer to flags to set + * - strflag: flag mask to be or-applied for string match + */ + +inline int sv2int_str(SV *val, int_str *is, + unsigned short *flags, unsigned short strflag) { + char *s; + STRLEN len; + + if (!SvOK(val)) { + LM_ERR("AVP:sv2int_str: Invalid value " + "(not a scalar).\n"); + return 0; + } + + if (SvIOK(val)) { /* numerical name */ + is->n = SvIV(val); + *flags = 0; + return 1; + } else if (SvPOK(val)) { + s = SvPV(val, len); + is->s.len = len; + is->s.s = s; + (*flags) |= strflag; + return 1; + } else { + LM_ERR("AVP:sv2int_str: Invalid value " + "(neither string nor integer).\n"); + return 0; + } +} + +/* ************************************************************************ */ +/* Object methods begin here */ + +#if 0 + "Skipped embedded POD." +#endif +#line 440 "openserxs.xs" + +#ifndef PERL_UNUSED_VAR +# define PERL_UNUSED_VAR(var) if (0) var = var +#endif + +#line 452 "openserxs.c" + +XS(XS_OpenSER_log); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER_log) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::log", "level, log"); + PERL_UNUSED_VAR(cv); /* -W */ + { + int level = (int)SvIV(ST(0)); + char * log = (char *)SvPV_nolen(ST(1)); +#line 470 "openserxs.xs" +#line 469 "openserxs.c" +#line 471 "openserxs.xs" +#line 471 "openserxs.c" +#line 472 "openserxs.xs" + switch (level) { + case L_ALERT: LM_ALERT("%s", log); break; + case L_CRIT: LM_CRIT("%s", log); break; + case L_ERR: LM_ERR("%s", log); break; + case L_WARN: LM_WARN("%s", log); break; + case L_NOTICE: LM_NOTICE("%s", log); break; + case L_INFO: LM_INFO("%s", log); break; + default: LM_DBG("%s", log); break; + } +#line 482 "openserxs.c" + } + XSRETURN_EMPTY; +} + + +XS(XS_OpenSER__Message_getType); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getType) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getType", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 508 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 503 "openserxs.c" + int RETVAL; + dXSTARG; +#line 510 "openserxs.xs" +#line 507 "openserxs.c" +#line 511 "openserxs.xs" + RETVAL = getType(msg); +#line 510 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getStatus); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getStatus) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getStatus", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 528 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + str *ret; +#line 533 "openserxs.c" + SV * RETVAL; +#line 531 "openserxs.xs" +#line 536 "openserxs.c" +#line 532 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + if (getType(msg) != SIP_REPLY) { + LM_ERR("getStatus: Status not available in" + " non-reply messages."); + ST(0) = &PL_sv_undef; + } else { + ret = &((msg->first_line).u.reply.status); + ST(0) = sv_2mortal(newSVpv(ret->s, ret->len)); + } + } +#line 551 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getReason); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getReason) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getReason", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 558 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + str *ret; +#line 573 "openserxs.c" + SV * RETVAL; +#line 561 "openserxs.xs" +#line 576 "openserxs.c" +#line 562 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + if (getType(msg) != SIP_REPLY) { + LM_ERR("getReason: Reason not available in" + " non-reply messages."); + ST(0) = &PL_sv_undef; + } else { + ret = &((msg->first_line).u.reply.reason); + ST(0) = sv_2mortal(newSVpv(ret->s, ret->len)); + } + } +#line 591 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getVersion); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getVersion) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getVersion", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 587 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + str *ret; +#line 613 "openserxs.c" + SV * RETVAL; +#line 590 "openserxs.xs" +#line 616 "openserxs.c" +#line 591 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + if (getType(msg) == SIP_REQUEST) { + ret = &((msg->first_line).u.request.version); + } else { /* SIP_REPLY */ + ret = &((msg->first_line).u.reply.version); + } + ST(0) = sv_2mortal(newSVpv(ret->s, ret->len)); + } +#line 629 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getRURI); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getRURI) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getRURI", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 621 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + str *ret; +#line 651 "openserxs.c" + SV * RETVAL; +#line 624 "openserxs.xs" +#line 654 "openserxs.c" +#line 625 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + if (getType(msg) != SIP_REQUEST) { + LM_ERR("Not a request message - " + "no RURI available.\n"); + ST(0) = &PL_sv_undef; + } else { + ret = &((msg->first_line).u.request.uri); + ST(0) = sv_2mortal(newSVpv(ret->s, ret->len)); + } + } +#line 669 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getMethod); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getMethod) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getMethod", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 654 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + str *ret; +#line 691 "openserxs.c" + char * RETVAL; + dXSTARG; +#line 657 "openserxs.xs" +#line 695 "openserxs.c" +#line 658 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + if (getType(msg) != SIP_REQUEST) { + LM_ERR("Not a request message - " + "no method available.\n"); + ST(0) = &PL_sv_undef; + } else { + ret = &((msg->first_line).u.request.method); + ST(0) = sv_2mortal(newSVpv(ret->s, ret->len)); + } + } +#line 710 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getFullHeader); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getFullHeader) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getFullHeader", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 687 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + char *firsttoken; + long headerlen; +#line 733 "openserxs.c" + SV * RETVAL; +#line 691 "openserxs.xs" +#line 736 "openserxs.c" +#line 692 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + if (getType(msg) == SIP_INVALID) { + LM_ERR("getFullHeader: Invalid message type.\n"); + ST(0) = &PL_sv_undef; + } else { + parse_headers(msg, ~0, 0); + if (getType(msg) == SIP_REQUEST) { + firsttoken = (msg->first_line).u.request.method.s; + } else { /* SIP_REPLY */ + firsttoken = (msg->first_line).u.reply.version.s; + } + + if (msg->eoh == NULL) + headerlen = 0; + else + headerlen = ((long)(msg->eoh)) + -((long)(firsttoken)); + + if (headerlen > 0) { + ST(0) = + sv_2mortal(newSVpv(firsttoken, headerlen)); + } else { + ST(0) = &PL_sv_undef; + } + } + } +#line 767 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getBody); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getBody) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getBody", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 733 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 788 "openserxs.c" + SV * RETVAL; +#line 735 "openserxs.xs" +#line 791 "openserxs.c" +#line 736 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + parse_headers(msg, ~0, 0); + ST(0) = sv_2mortal(newSVpv(get_body(msg), 0)); + } +#line 800 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getMessage); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getMessage) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getMessage", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 755 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 821 "openserxs.c" + SV * RETVAL; +#line 757 "openserxs.xs" +#line 824 "openserxs.c" +#line 758 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + ST(0) = sv_2mortal(newSVpv(msg->buf, 0)); + } +#line 832 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getHeader); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getHeader) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getHeader", "self, name"); + PERL_UNUSED_VAR(cv); /* -W */ + PERL_UNUSED_VAR(ax); /* -Wall */ + SP -= items; + { + SV * self = ST(0); + char * name = (char *)SvPV_nolen(ST(1)); +#line 781 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + str *body = NULL; + struct hdr_field *hf; + int found = 0; + int namelen = strlen(name); +#line 860 "openserxs.c" + SV * RETVAL; +#line 787 "openserxs.xs" +#line 863 "openserxs.c" +#line 788 "openserxs.xs" + LM_DBG("searching '%s'\n", name); + + if (!msg) { + LM_ERR("Invalid message reference\n"); + } else { + parse_headers(msg, ~0, 0); + for (hf = msg->headers; hf; hf = hf->next) { + if (namelen == hf->name.len) { + if (strncmp(name, hf->name.s, namelen) == 0) { + /* Found the right header. */ + found = 1; + body = &(hf->body); + XPUSHs(sv_2mortal(newSVpv(body->s, + body->len))); + } + } + } + } + if (!found) { + XPUSHs(&PL_sv_undef); + } +#line 886 "openserxs.c" + PUTBACK; + return; + } +} + + +XS(XS_OpenSER__Message_getHeaderNames); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getHeaderNames) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getHeaderNames", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + PERL_UNUSED_VAR(ax); /* -Wall */ + SP -= items; + { + SV * self = ST(0); +#line 822 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + struct hdr_field *hf = NULL; + int found = 0; +#line 912 "openserxs.c" + AV * RETVAL; +#line 827 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + } else { + parse_headers(msg, ~0, 0); + for (hf = msg->headers; hf; hf = hf->next) { + found = 1; + XPUSHs(sv_2mortal(newSVpv(hf->name.s, hf->name.len))); + } + } + if (!found) { + XPUSHs(&PL_sv_undef); + } +#line 927 "openserxs.c" + PUTBACK; + return; + } +} + + +XS(XS_OpenSER__Message_moduleFunction); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_moduleFunction) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items < 2 || items > 4) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::moduleFunction", "self, func, string1 = NULL, string2 = NULL"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + char * func = (char *)SvPV_nolen(ST(1)); + char * string1; + char * string2; +#line 973 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + int retval; /* Return value of called function */ + int ret; /* Return value of moduleFunc - < 0 for "non existing function" and other errors */ +#line 954 "openserxs.c" + int RETVAL; + dXSTARG; + + if (items < 3) + string1 = NULL; + else { + string1 = (char *)SvPV_nolen(ST(2)); + } + + if (items < 4) + string2 = NULL; + else { + string2 = (char *)SvPV_nolen(ST(3)); + } +#line 977 "openserxs.xs" +#line 970 "openserxs.c" +#line 978 "openserxs.xs" + LM_DBG("Calling exported func '%s', Param1 is '%s'," + " Param2 is '%s'\n", func, string1, string2); + + ret = moduleFunc(msg, func, string1, string2, &retval); + if (ret < 0) { + LM_ERR("calling module function '%s' failed." + " Missing loadmodule?\n", func); + retval = -1; + } + RETVAL = retval; +#line 982 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_log); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_log) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 3) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::log", "self, level, log"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + int level = (int)SvIV(ST(1)); + char * log = (char *)SvPV_nolen(ST(2)); +#line 1017 "openserxs.xs" +#line 1005 "openserxs.c" +#line 1018 "openserxs.xs" +#line 1007 "openserxs.c" +#line 1019 "openserxs.xs" + switch (level) { + case L_ALERT: LM_ALERT("%s", log); break; + case L_CRIT: LM_CRIT("%s", log); break; + case L_ERR: LM_ERR("%s", log); break; + case L_WARN: LM_WARN("%s", log); break; + case L_NOTICE: LM_NOTICE("%s", log); break; + case L_INFO: LM_INFO("%s", log); break; + default: LM_DBG("%s", log); break; + } +#line 1018 "openserxs.c" + } + XSRETURN_EMPTY; +} + + +XS(XS_OpenSER__Message_rewrite_ruri); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_rewrite_ruri) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::rewrite_ruri", "self, newruri"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + char * newruri = (char *)SvPV_nolen(ST(1)); +#line 1047 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 1040 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1049 "openserxs.xs" +#line 1044 "openserxs.c" +#line 1050 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + RETVAL = -1; + } else { + if (getType(msg) != SIP_REQUEST) { + LM_ERR("Not a Request. RURI rewrite unavailable.\n"); + RETVAL = -1; + } else { + LM_DBG("New R-URI is [%s]\n", newruri); + RETVAL = rewrite_ruri(msg, newruri); + } + } +#line 1058 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_setFlag); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_setFlag) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::setFlag", "self, flag"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + unsigned int flag = (unsigned int)SvUV(ST(1)); +#line 1079 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 1081 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1081 "openserxs.xs" +#line 1085 "openserxs.c" +#line 1082 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + RETVAL = -1; + } else { + RETVAL = setflag(msg, flag); + } +#line 1093 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_resetFlag); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_resetFlag) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::resetFlag", "self, flag"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + unsigned int flag = (unsigned int)SvUV(ST(1)); +#line 1103 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 1116 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1105 "openserxs.xs" +#line 1120 "openserxs.c" +#line 1106 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + RETVAL = -1; + } else { + RETVAL = resetflag(msg, flag); + } +#line 1128 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_isFlagSet); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_isFlagSet) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::isFlagSet", "self, flag"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + unsigned int flag = (unsigned int)SvUV(ST(1)); +#line 1126 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); +#line 1151 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1128 "openserxs.xs" +#line 1155 "openserxs.c" +#line 1129 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + RETVAL = -1; + } else { + RETVAL = isflagset(msg, flag) == 1 ? 1 : 0; + } +#line 1163 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_pseudoVar); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_pseudoVar) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::pseudoVar", "self, varstring"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + char * varstring = (char *)SvPV_nolen(ST(1)); +#line 1153 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + char *ret; +#line 1187 "openserxs.c" + SV * RETVAL; +#line 1156 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = &PL_sv_undef; + } else { + ret = pv_sprintf(msg, varstring); + if (ret) { + ST(0) = sv_2mortal(newSVpv(ret, strlen(ret))); + free(ret); + } else { + ST(0) = &PL_sv_undef; + } + } +#line 1202 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_append_branch); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_append_branch) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items < 1 || items > 3) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::append_branch", "self, branch = NULL, qval = NULL"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + char * branch; + char * qval; +#line 1183 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + qvalue_t q = Q_UNSPECIFIED; + str b = {0, 0}; +#line 1227 "openserxs.c" + int RETVAL; + dXSTARG; + + if (items < 2) + branch = NULL; + else { + branch = (char *)SvPV_nolen(ST(1)); + } + + if (items < 3) + qval = NULL; + else { + qval = (char *)SvPV_nolen(ST(2)); + } +#line 1187 "openserxs.xs" +#line 1243 "openserxs.c" +#line 1188 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + RETVAL = -1; + } else { + if (qval) { + if (str2q(&q, qval, strlen(qval)) < 0) { + LM_ERR("append_branch: Bad q value."); + } else { /* branch and qval set */ + b.s = branch; + b.len = strlen(branch); + } + } else { + if (branch) { /* branch set, qval unset */ + b.s = branch; + b.len = strlen(branch); + } + } + + RETVAL = km_append_branch(msg, (b.s!=0)?&b:0, 0, 0, q, 0, 0); + } +#line 1265 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__Message_getParsedRURI); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__Message_getParsedRURI) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::Message::getParsedRURI", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); +#line 1223 "openserxs.xs" + struct sip_msg *msg = sv2msg(self); + struct sip_uri *uri; + SV *ret; +#line 1289 "openserxs.c" + SV * RETVAL; +#line 1227 "openserxs.xs" +#line 1292 "openserxs.c" +#line 1228 "openserxs.xs" + if (!msg) { + LM_ERR("Invalid message reference\n"); + ST(0) = NULL; + } else { + parse_sip_msg_uri(msg); + parse_headers(msg, ~0, 0); + + uri = &(msg->parsed_uri); + ret = sv_newmortal(); + sv_setref_pv(ret, "OpenSER::URI", (void *)uri); + SvREADONLY_on(SvRV(ret)); + + ST(0) = ret; + } +#line 1308 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_user); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_user) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::user", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1266 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_USER); +#line 1330 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_host); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_host) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::host", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1279 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_HOST); +#line 1352 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_passwd); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_passwd) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::passwd", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1292 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_PASSWD); +#line 1374 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_port); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_port) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::port", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1305 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_PORT); +#line 1396 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_params); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_params) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::params", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1318 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_PARAMS); +#line 1418 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_headers); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_headers) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::headers", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1331 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_HEADERS); +#line 1440 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_transport); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_transport) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::transport", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1344 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_TRANSPORT); +#line 1462 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_ttl); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_ttl) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::ttl", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1357 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_TTL); +#line 1484 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_user_param); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_user_param) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::user_param", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1370 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_USER_PARAM); +#line 1506 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_maddr); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_maddr) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::maddr", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1384 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_MADDR); +#line 1528 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_method); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_method) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::method", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1396 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_METHOD); +#line 1550 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_lr); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_lr) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::lr", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1409 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_LR); +#line 1572 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_r2); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_r2) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::r2", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1422 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_R2); +#line 1594 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_transport_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_transport_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::transport_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1435 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_TRANSPORT_VAL); +#line 1616 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_ttl_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_ttl_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::ttl_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1448 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_TTL_VAL); +#line 1638 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_user_param_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_user_param_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::user_param_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1461 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_USER_PARAM_VAL); +#line 1660 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_maddr_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_maddr_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::maddr_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1474 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_MADDR_VAL); +#line 1682 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_method_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_method_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::method_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1487 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_METHOD_VAL); +#line 1704 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_lr_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_lr_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::lr_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1500 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_LR_VAL); +#line 1726 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__URI_r2_val); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__URI_r2_val) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::URI::r2_val", "self"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * self = ST(0); + SV * RETVAL; +#line 1513 "openserxs.xs" + ST(0) = getStringFromURI(self, XS_URI_R2_VAL); +#line 1748 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__AVP_add); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__AVP_add) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 2) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::AVP::add", "p_name, p_val"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * p_name = ST(0); + SV * p_val = ST(1); +#line 1557 "openserxs.xs" + int_str name; + int_str val; + unsigned short flags = 0; + char *s; + STRLEN len; +#line 1774 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1563 "openserxs.xs" + RETVAL = 0; + if (SvOK(p_name) && SvOK(p_val)) { + if (!sv2int_str(p_name, &name, &flags, AVP_NAME_STR)) { + RETVAL = -1; + } else if (!sv2int_str(p_val, &val, &flags, AVP_VAL_STR)) { + RETVAL = -1; + } + + if (RETVAL == 0) { + RETVAL = add_avp(flags, name, val); + } + } +#line 1790 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + + +XS(XS_OpenSER__AVP_get); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__AVP_get) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::AVP::get", "p_name"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * p_name = ST(0); +#line 1594 "openserxs.xs" + struct usr_avp *first_avp; + int_str name; + int_str val; + unsigned short flags = 0; + SV *ret = &PL_sv_undef; + int err = 0; + char *s; + STRLEN len; +#line 1819 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1603 "openserxs.xs" + if (SvOK(p_name)) { + if (!sv2int_str(p_name, &name, &flags, AVP_NAME_STR)) { + LM_ERR("AVP:get: Invalid name."); + err = 1; + } + } else { + LM_ERR("AVP:get: Invalid name."); + err = 1; + } + + if (err == 0) { + first_avp = search_first_avp(flags, name, &val, NULL); + + if (first_avp != NULL) { /* found correct AVP */ + if (is_avp_str_val(first_avp)) { + ret = sv_2mortal(newSVpv(val.s.s, val.s.len)); + } else { + ret = sv_2mortal(newSViv(val.n)); + } + } else { + /* Empty AVP requested. */ + } + } + + ST(0) = ret; +#line 1848 "openserxs.c" + } + XSRETURN(1); +} + + +XS(XS_OpenSER__AVP_destroy); /* prototype to pass -Wmissing-prototypes */ +XS(XS_OpenSER__AVP_destroy) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "OpenSER::AVP::destroy", "p_name"); + PERL_UNUSED_VAR(cv); /* -W */ + { + SV * p_name = ST(0); +#line 1645 "openserxs.xs" + struct usr_avp *first_avp; + int_str name; + int_str val; + unsigned short flags = 0; + SV *ret = &PL_sv_undef; + char *s; + STRLEN len; +#line 1875 "openserxs.c" + int RETVAL; + dXSTARG; +#line 1653 "openserxs.xs" + RETVAL = 1; + if (SvOK(p_name)) { + if (!sv2int_str(p_name, &name, &flags, AVP_NAME_STR)) { + RETVAL = 0; + LM_ERR("AVP:destroy: Invalid name."); + } + } else { + RETVAL = 0; + LM_ERR("VP:destroy: Invalid name."); + } + + if (RETVAL == 1) { + first_avp = search_first_avp(flags, name, &val, NULL); + + if (first_avp != NULL) { /* found correct AVP */ + destroy_avp(first_avp); + } else { + RETVAL = 0; + /* Empty AVP requested. */ + } + } + +#line 1901 "openserxs.c" + XSprePUSH; PUSHi((IV)RETVAL); + } + XSRETURN(1); +} + +#ifdef __cplusplus +extern "C" +#endif +XS(boot_OpenSER); /* prototype to pass -Wmissing-prototypes */ +XS(boot_OpenSER) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + char* file = __FILE__; + + PERL_UNUSED_VAR(cv); /* -W */ + PERL_UNUSED_VAR(items); /* -W */ + XS_VERSION_BOOTCHECK ; + + newXS("OpenSER::log", XS_OpenSER_log, file); + newXSproto("OpenSER::Message::getType", XS_OpenSER__Message_getType, file, "$"); + newXSproto("OpenSER::Message::getStatus", XS_OpenSER__Message_getStatus, file, "$"); + newXSproto("OpenSER::Message::getReason", XS_OpenSER__Message_getReason, file, "$"); + newXSproto("OpenSER::Message::getVersion", XS_OpenSER__Message_getVersion, file, "$"); + newXSproto("OpenSER::Message::getRURI", XS_OpenSER__Message_getRURI, file, "$"); + newXSproto("OpenSER::Message::getMethod", XS_OpenSER__Message_getMethod, file, "$"); + newXSproto("OpenSER::Message::getFullHeader", XS_OpenSER__Message_getFullHeader, file, "$"); + newXSproto("OpenSER::Message::getBody", XS_OpenSER__Message_getBody, file, "$"); + newXSproto("OpenSER::Message::getMessage", XS_OpenSER__Message_getMessage, file, "$"); + newXSproto("OpenSER::Message::getHeader", XS_OpenSER__Message_getHeader, file, "$$"); + newXSproto("OpenSER::Message::getHeaderNames", XS_OpenSER__Message_getHeaderNames, file, "$"); + newXSproto("OpenSER::Message::moduleFunction", XS_OpenSER__Message_moduleFunction, file, "$$;$$"); + newXSproto("OpenSER::Message::log", XS_OpenSER__Message_log, file, "$$$"); + newXSproto("OpenSER::Message::rewrite_ruri", XS_OpenSER__Message_rewrite_ruri, file, "$$"); + newXSproto("OpenSER::Message::setFlag", XS_OpenSER__Message_setFlag, file, "$$"); + newXSproto("OpenSER::Message::resetFlag", XS_OpenSER__Message_resetFlag, file, "$$"); + newXSproto("OpenSER::Message::isFlagSet", XS_OpenSER__Message_isFlagSet, file, "$$"); + newXSproto("OpenSER::Message::pseudoVar", XS_OpenSER__Message_pseudoVar, file, "$$"); + newXSproto("OpenSER::Message::append_branch", XS_OpenSER__Message_append_branch, file, "$;$$"); + newXSproto("OpenSER::Message::getParsedRURI", XS_OpenSER__Message_getParsedRURI, file, "$"); + newXSproto("OpenSER::URI::user", XS_OpenSER__URI_user, file, "$"); + newXSproto("OpenSER::URI::host", XS_OpenSER__URI_host, file, "$"); + newXSproto("OpenSER::URI::passwd", XS_OpenSER__URI_passwd, file, "$"); + newXSproto("OpenSER::URI::port", XS_OpenSER__URI_port, file, "$"); + newXSproto("OpenSER::URI::params", XS_OpenSER__URI_params, file, "$"); + newXSproto("OpenSER::URI::headers", XS_OpenSER__URI_headers, file, "$"); + newXSproto("OpenSER::URI::transport", XS_OpenSER__URI_transport, file, "$"); + newXSproto("OpenSER::URI::ttl", XS_OpenSER__URI_ttl, file, "$"); + newXSproto("OpenSER::URI::user_param", XS_OpenSER__URI_user_param, file, "$"); + newXSproto("OpenSER::URI::maddr", XS_OpenSER__URI_maddr, file, "$"); + newXSproto("OpenSER::URI::method", XS_OpenSER__URI_method, file, "$"); + newXSproto("OpenSER::URI::lr", XS_OpenSER__URI_lr, file, "$"); + newXSproto("OpenSER::URI::r2", XS_OpenSER__URI_r2, file, "$"); + newXSproto("OpenSER::URI::transport_val", XS_OpenSER__URI_transport_val, file, "$"); + newXSproto("OpenSER::URI::ttl_val", XS_OpenSER__URI_ttl_val, file, "$"); + newXSproto("OpenSER::URI::user_param_val", XS_OpenSER__URI_user_param_val, file, "$"); + newXSproto("OpenSER::URI::maddr_val", XS_OpenSER__URI_maddr_val, file, "$"); + newXSproto("OpenSER::URI::method_val", XS_OpenSER__URI_method_val, file, "$"); + newXSproto("OpenSER::URI::lr_val", XS_OpenSER__URI_lr_val, file, "$"); + newXSproto("OpenSER::URI::r2_val", XS_OpenSER__URI_r2_val, file, "$"); + newXSproto("OpenSER::AVP::add", XS_OpenSER__AVP_add, file, "$$"); + newXSproto("OpenSER::AVP::get", XS_OpenSER__AVP_get, file, "$"); + newXSproto("OpenSER::AVP::destroy", XS_OpenSER__AVP_destroy, file, "$"); + if (PL_unitcheckav) + call_list(PL_scopestack_ix, PL_unitcheckav); + XSRETURN_YES; +} + diff --git a/modules_k/presence/Makefile b/modules_k/presence/Makefile index 53b591d27..604c7db1f 100644 --- a/modules_k/presence/Makefile +++ b/modules_k/presence/Makefile @@ -12,7 +12,7 @@ LIBS= DEFS+=-I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 \ -I$(LOCALBASE)/include -LIBS+=-L/usr/include/lib -L$(LOCALBASE)/lib -lxml2 +LIBS+=-L$(LOCALBASE)/lib -lxml2 DEFS+=-DOPENSER_MOD_INTERFACE diff --git a/modules_k/presence/hash.h b/modules_k/presence/hash.h index 82eb23cac..ba9a0ab22 100644 --- a/modules_k/presence/hash.h +++ b/modules_k/presence/hash.h @@ -50,10 +50,12 @@ struct presentity; goto error #define CONT_COPY(buf, dest, source)\ + do{ \ dest.s= (char*)buf+ size;\ memcpy(dest.s, source.s, source.len);\ dest.len= source.len;\ - size+= source.len; + size+= source.len; \ + } while(0); #define PKG_MEM_TYPE 1<< 1 #define SHM_MEM_TYPE 1<< 2 diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c index 5b00ad391..322bc7a98 100644 --- a/modules_k/presence/presence.c +++ b/modules_k/presence/presence.c @@ -716,6 +716,14 @@ int pres_update_status(subs_t subs, str reason, db_key_t* query_cols, query_vals[q_wuser_col].val.str_val= subs.from_user; query_vals[q_wdomain_col].val.str_val= subs.from_domain; + /* if status is no longer ACTIVE, switch to terminated */ + if(subs.status!=status && status==ACTIVE_STATUS) + { + subs.status = TERMINATED_STATUS; + subs.reason.s = get_status_str(TERMINATED_STATUS); + subs.reason.len = strlen(subs.reason.s); + } + update_vals[u_status_col].val.int_val= subs.status; update_vals[u_reason_col].val.str_val= subs.reason; diff --git a/modules_k/presence/presentity.c b/modules_k/presence/presentity.c index 1dd946621..9b9077c28 100644 --- a/modules_k/presence/presentity.c +++ b/modules_k/presence/presentity.c @@ -354,15 +354,18 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body, (int)time(NULL); n_query_cols++; - if( presentity->sender) + query_cols[n_query_cols] = &str_sender_col; + query_vals[n_query_cols].type = DB1_STR; + query_vals[n_query_cols].nul = 0; + if(presentity->sender) { - query_cols[n_query_cols] = &str_sender_col; - query_vals[n_query_cols].type = DB1_STR; - query_vals[n_query_cols].nul = 0; query_vals[n_query_cols].val.str_val.s = presentity->sender->s; query_vals[n_query_cols].val.str_val.len = presentity->sender->len; - n_query_cols++; + } else { + query_vals[n_query_cols].val.str_val.s = ""; + query_vals[n_query_cols].val.str_val.len = 0; } + n_query_cols++; query_cols[n_query_cols] = &str_body_col; query_vals[n_query_cols].type = DB1_BLOB; diff --git a/modules_k/presence/publish.c b/modules_k/presence/publish.c index 05e6b15f3..839ed01d9 100644 --- a/modules_k/presence/publish.c +++ b/modules_k/presence/publish.c @@ -512,10 +512,10 @@ int handle_publish(struct sip_msg* msg, char* sender_uri, char* str2) unsupported_event: - LM_ERR("Missing or unsupported event header field value\n"); + LM_WARN("Missing or unsupported event header field value\n"); if(msg->event && msg->event->body.s && msg->event->body.len>0) - LM_ERR("\tevent=[%.*s]\n", msg->event->body.len, msg->event->body.s); + LM_ERR(" event=[%.*s]\n", msg->event->body.len, msg->event->body.s); reply_code= BAD_EVENT_CODE; reply_str= pu_489_rpl; diff --git a/modules_k/presence_xml/Makefile b/modules_k/presence_xml/Makefile index 451811df6..ad0fb631f 100644 --- a/modules_k/presence_xml/Makefile +++ b/modules_k/presence_xml/Makefile @@ -12,7 +12,7 @@ LIBS= DEFS+=-I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 \ -I$(LOCALBASE)/include -LIBS+=-L$(SYSBASE)/include/lib -L$(LOCALBASE)/lib -lxml2 +LIBS+=-L$(LOCALBASE)/lib -lxml2 DEFS+=-DOPENSER_MOD_INTERFACE diff --git a/modules_k/pua_xmpp/Makefile b/modules_k/pua_xmpp/Makefile index eacfc9d6a..c27568245 100644 --- a/modules_k/pua_xmpp/Makefile +++ b/modules_k/pua_xmpp/Makefile @@ -11,7 +11,7 @@ NAME= pua_xmpp.so LIBS= DEFS+=-I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -I$(LOCALBASE)/include -LIBS+=-L/usr/include/lib -L$(LOCALBASE)/lib -lxml2 +LIBS+=-L$(LOCALBASE)/lib -lxml2 DEFS+=-DOPENSER_MOD_INTERFACE diff --git a/modules_k/pua_xmpp/simple2xmpp.c b/modules_k/pua_xmpp/simple2xmpp.c index 040d36c9a..e041bcb1d 100644 --- a/modules_k/pua_xmpp/simple2xmpp.c +++ b/modules_k/pua_xmpp/simple2xmpp.c @@ -87,7 +87,7 @@ int Notify2Xmpp(struct sip_msg* msg, char* s1, char* s2) if(msg->to->parsed != NULL) { pto = (struct to_body*)msg->to->parsed; - LM_ERR("'To' header ALREADY PARSED:<%.*s>\n",pto->uri.len,pto->uri.s); + LM_DBG("'To' header ALREADY PARSED:<%.*s>\n",pto->uri.len,pto->uri.s); } else { @@ -415,7 +415,8 @@ int build_xmpp_content(str* to_uri, str* from_uri, str* body, str* id, goto error; } - if(xmlStrcasecmp((unsigned char*)note, (unsigned char*)"away")== 0) + if((xmlStrcasecmp((unsigned char*)note, (unsigned char*)"away")== 0)|| + (xmlStrcasecmp((unsigned char*)note, (unsigned char*)"On the phone")== 0)) { new_node = xmlNewChild(xmpp_root, NULL, BAD_CAST "show", BAD_CAST "away"); @@ -456,12 +457,14 @@ int build_xmpp_content(str* to_uri, str* from_uri, str* body, str* id, LM_ERR("while adding node: idle\n"); goto error; } - } - else */ + }*/ + else if((xmlStrcasecmp((unsigned char*)note, (unsigned char*)"dnd")== 0)|| (xmlStrcasecmp((unsigned char*)note, - (unsigned char*)"do not disturb")== 0)) + (unsigned char*)"do not disturb")== 0)|| + (xmlStrcasecmp((unsigned char*)note, + (unsigned char*)"Busy (DND)")== 0)) { new_node = xmlNewChild(xmpp_root, NULL, BAD_CAST "show", BAD_CAST "dnd"); @@ -471,6 +474,8 @@ int build_xmpp_content(str* to_uri, str* from_uri, str* body, str* id, goto error; } } + else + LM_DBG("Not Found Status\n"); /* adding status node */ diff --git a/modules_k/pua_xmpp/xmpp2simple.c b/modules_k/pua_xmpp/xmpp2simple.c index 43fa9a0c3..d0bdc1e74 100644 --- a/modules_k/pua_xmpp/xmpp2simple.c +++ b/modules_k/pua_xmpp/xmpp2simple.c @@ -76,13 +76,13 @@ void pres_Xmpp2Sip(char *msg, int type, void *param) { LM_DBG("type attribut not present\n"); build_publish(pres_node, -1); - if(presence_subscribe(pres_node, 3600, XMPP_SUBSCRIBE)< 0) + /* if(presence_subscribe(pres_node, 3600, XMPP_SUBSCRIBE)< 0) { LM_ERR("when sending subscribe for presence"); xmlFree(pres_type); goto error; } - + */ /* send subscribe after publish because in xmpp subscribe message * comes only when a new contact is inserted in buddy list */ @@ -91,13 +91,13 @@ void pres_Xmpp2Sip(char *msg, int type, void *param) if(strcmp(pres_type, "unavailable")== 0) { build_publish(pres_node, 0); - if(presence_subscribe(pres_node, 3600, XMPP_SUBSCRIBE)< 0) - /* else subscribe for one hour*/ + /* if(presence_subscribe(pres_node, 0, XMPP_SUBSCRIBE)< 0) { LM_ERR("when unsubscribing for presence"); xmlFree(pres_type); goto error; } + */ } else @@ -243,13 +243,13 @@ str* build_pidf(xmlNodePtr pres_node, char* uri, char* resource) if(show_cont) { if(strcmp(show_cont, "xa")== 0) - status= "not available"; + status= "Away"; else if(strcmp(show_cont, "chat")== 0) - status= "free for chat"; + status= "Online"; else if(strcmp(show_cont, "dnd")== 0) - status= "do not disturb"; + status= "Busy (DND)"; else status= show_cont; } @@ -264,24 +264,25 @@ str* build_pidf(xmlNodePtr pres_node, char* uri, char* resource) goto error; } */ - node = xmlNewChild(root_node, NULL, BAD_CAST "note", - BAD_CAST status_cont); + node = xmlNewChild(tuple_node, NULL, BAD_CAST "note", + BAD_CAST status); if(node== NULL) { LM_ERR("while adding node\n"); goto error; } - }else + } else { if(show_cont) { - node = xmlNewChild(root_node, NULL, BAD_CAST "note", + node = xmlNewChild(tuple_node, NULL, BAD_CAST "note", BAD_CAST status); if(node== NULL) { LM_ERR("while adding node\n"); goto error; } - } + } + } if(show_cont) { @@ -295,23 +296,6 @@ str* build_pidf(xmlNodePtr pres_node, char* uri, char* resource) goto error; } } - node= xmlNewChild(person_node, NULL, BAD_CAST "activities", - BAD_CAST 0); - if(node== NULL) - { - LM_ERR("while adding node\n"); - goto error; - } - - - if( xmlNewChild(person_node, NULL, BAD_CAST "note", - BAD_CAST status )== NULL) - { - LM_ERR("while adding node\n"); - goto error; - } - - } diff --git a/modules_k/purple/clientpipe.c b/modules_k/purple/clientpipe.c index 2e374fbd0..489ba8afd 100644 --- a/modules_k/purple/clientpipe.c +++ b/modules_k/purple/clientpipe.c @@ -23,6 +23,7 @@ #include #include "../../dprint.h" +#include "../../cfg/cfg_struct.h" #include "purple.h" #include "purplepipe.h" @@ -231,6 +232,9 @@ void pipe_reader(gpointer data, gint fd, PurpleInputCondition condition) { return; } + /* update the local config framework structures */ + cfg_update(); + switch (cmd->type) { case PURPLE_MESSAGE_CMD: LM_DBG("received message cmd via pipe from <%s> to <%s>\n", cmd->message.from, cmd->message.to); diff --git a/modules_k/purple/purple.c b/modules_k/purple/purple.c index f85b9d51a..7729ffe5e 100644 --- a/modules_k/purple/purple.c +++ b/modules_k/purple/purple.c @@ -30,6 +30,7 @@ #include "../../parser/parse_content.h" #include "../../parser/parse_from.h" #include "../../modules/tm/tm_load.h" +#include "../../cfg/cfg_struct.h" #include "../pua/pua_bind.h" #include "../pua/pidf.h" @@ -219,6 +220,8 @@ static int init(void) { /* add space for one extra process */ register_procs(1); + /* add child to update local config framework structures */ + cfg_register_child(1); return 0; } @@ -236,6 +239,9 @@ static int child_init(int rank) return -1; /* error */ if(pid==0){ /* child */ + /* initialize the config framework */ + if (cfg_child_init()) + return -1; runprocs(1); } } diff --git a/modules_k/purple/purple_sip.c b/modules_k/purple/purple_sip.c index 536f4f82f..5b23d89a2 100644 --- a/modules_k/purple/purple_sip.c +++ b/modules_k/purple/purple_sip.c @@ -23,6 +23,7 @@ #include "../../dprint.h" #include "../../str.h" +#include "../../cfg/cfg_struct.h" #include "../../modules/tm/tm_load.h" #include "../pua/pua_bind.h" #include "../pua/pidf.h" @@ -41,6 +42,9 @@ int purple_send_sip_msg(char *to, char *from, char *msg) { char hdr_buf[512], ruri_buf[512]; uac_req_t uac_r; + /* update the local config framework structures */ + cfg_update(); + ruri.s = ruri_buf; ruri.len = snprintf(ruri_buf, sizeof(ruri_buf), "%s;proto=purple", to); @@ -210,10 +214,13 @@ int purple_send_sip_publish(char *from, char *tupleid, enum purple_publish_basic char pres_buff[512]; publ_info_t publ; + str pres_uri; + + /* update the local config framework structures */ + cfg_update(); memset(&publ, 0, sizeof(publ_info_t)); - str pres_uri; pres_uri.s = pres_buff; pres_uri.len = sprintf(pres_buff, "%s;proto=purple", from); diff --git a/modules_k/pv/pv_branch.c b/modules_k/pv/pv_branch.c index a9dd1bc20..4081429c5 100644 --- a/modules_k/pv/pv_branch.c +++ b/modules_k/pv/pv_branch.c @@ -395,7 +395,7 @@ int pv_get_sndto(struct sip_msg *msg, pv_param_t *param, (int)snd_inf->len); default: /* 0 - ip */ - s.s = su2a(snd_inf->to, sizeof(*snd_inf->to)); + s.s = suip2a(snd_inf->to, sizeof(*snd_inf->to)); s.len = strlen(s.s); return pv_get_strval(msg, param, res, &s); } diff --git a/modules_k/pv/pv_trans.c b/modules_k/pv/pv_trans.c index e568ddb88..faa937628 100644 --- a/modules_k/pv/pv_trans.c +++ b/modules_k/pv/pv_trans.c @@ -880,6 +880,7 @@ int tr_eval_nameaddr(struct sip_msg *msg, tr_param_t *tp, int subtype, pv_value_t *val) { str sv; + int ret; if(val==NULL || (!(val->flags&PV_VAL_STR)) || val->rs.len<=0) return -1; @@ -909,8 +910,14 @@ int tr_eval_nameaddr(struct sip_msg *msg, tr_param_t *tp, int subtype, /* parse params */ sv = _tr_nameaddr_str; - if (parse_nameaddr(&sv, &_tr_nameaddr)<0) - return -1; + ret = parse_nameaddr(&sv, &_tr_nameaddr); + if (ret < 0) { + if(ret != -3) return -1; + /* -3 means no "<" found so treat whole nameaddr as an URI */ + _tr_nameaddr.uri = _tr_nameaddr_str; + _tr_nameaddr.name = _tr_empty; + _tr_nameaddr.len = _tr_nameaddr_str.len; + } } memset(val, 0, sizeof(pv_value_t)); diff --git a/modules_k/rls/notify.c b/modules_k/rls/notify.c index d414eeb81..06c4ed303 100644 --- a/modules_k/rls/notify.c +++ b/modules_k/rls/notify.c @@ -472,11 +472,12 @@ str* constr_multipart_body(db1_res_t* result, char** cid_array, int i, length= 0; db_row_t *row; db_val_t *row_vals; - char* content_id= NULL; + str content_id = {0, 0}; str body= {0, 0}; - str ctype= {0, 0}; - int antet_len; + str content_type= {0, 0}; + int chunk_len; str* multi_body= NULL; + str bstr = {0, 0}; LM_DBG("start\n"); buf= pkg_malloc(size* sizeof(char)); @@ -485,7 +486,8 @@ str* constr_multipart_body(db1_res_t* result, char** cid_array, ERR_MEM(PKG_MEM_STR); } - antet_len= COMPUTE_ANTET_LEN (boundary_string); + bstr.s = boundary_string; + bstr.len = strlen(bstr.s); for(i= 0; i< result->n; i++) { @@ -498,29 +500,37 @@ str* constr_multipart_body(db1_res_t* result, char** cid_array, body.s= (char*)row_vals[pres_state_col].val.string_val; body.len= strlen(body.s); trim(&body); - ctype.s = (char*)row_vals[content_type_col].val.string_val; - ctype.len = strlen(ctype.s); - - if(length+ antet_len+ body.len+ 4 > size) - { - REALLOC_BUF - } - - length+= sprintf(buf+ length, "--%s\r\n\r\n", boundary_string); - length+= sprintf(buf+ length, "Content-Transfer-Encoding: binary\r\n"); - content_id= cid_array[i]; - if(content_id== NULL) + content_type.s = (char*)row_vals[content_type_col].val.string_val; + content_type.len = strlen(content_type.s); + content_id.s= cid_array[i]; + if(content_id.s== NULL) { LM_ERR("No cid found in array for uri= %s\n", row_vals[resource_uri_col].val.string_val); goto error; } + content_id.len = strlen(content_id.s); + - length+= sprintf(buf+ length, "Content-ID: <%s>\r\n",content_id); + chunk_len = 4 + bstr.len + + 35 + + 16 + content_id.len + + 18 + content_type.len + + 4 + body.len + 8; + if(length + chunk_len >= size) + { + REALLOC_BUF + } + + length+= sprintf(buf+ length, "--%.*s\r\n", + bstr.len, bstr.s); + length+= sprintf(buf+ length, "Content-Transfer-Encoding: binary\r\n"); + length+= sprintf(buf+ length, "Content-ID: <%.*s>\r\n", + content_id.len, content_id.s); length+= sprintf(buf+ length, "Content-Type: %.*s\r\n\r\n", - ctype.len, ctype.s); - - length+= sprintf(buf+length,"%.*s\r\n\r\n", body.len, body.s); + content_type.len, content_type.s); + length+= sprintf(buf+length,"%.*s\r\n\r\n", + body.len, body.s); } if(length+ strlen( boundary_string)+ 7> size ) diff --git a/modules_k/rls/notify.h b/modules_k/rls/notify.h index e189e63aa..764ae5ebb 100644 --- a/modules_k/rls/notify.h +++ b/modules_k/rls/notify.h @@ -46,7 +46,6 @@ if(buf== NULL) \ { ERR_MEM("constr_multipart_body");} -#define COMPUTE_ANTET_LEN(boundary_string) (strlen( boundary_string)+ MAX_HEADERS_LENGTH + 6) int send_full_notify(subs_t* subs, xmlNodePtr rl_node, int version, str* rl_uri, unsigned int hash_code); diff --git a/modules_k/rls/resource_notify.c b/modules_k/rls/resource_notify.c index d41f3ca3a..34f402e3c 100644 --- a/modules_k/rls/resource_notify.c +++ b/modules_k/rls/resource_notify.c @@ -48,19 +48,6 @@ * */ static str su_200_rpl = str_init("OK"); -#define CONT_COPY(buf, dest, source)\ - dest.s= (char*)buf+ size;\ - memcpy(dest.s, source.s, source.len);\ - dest.len= source.len;\ - size+= source.len; - - -#define CONT_COPY_1 (buf, dest_s, dest_len, source_s, source_len)\ - dest_s= (char*)buf+ size;\ - memcpy(dest_s, source_s, source_len);\ - dest_len= source_len;\ - size+= source_len; - int parse_subs_state(str auth_state, str** reason, int* expires) { str str_exp; @@ -240,16 +227,6 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2) LM_ERR("unrecognized event package\n"); goto error; } - if(pua_get_record_id(&dialog, &res_id)< 0) // verify if within a stored dialog - { - LM_ERR("occured when trying to get record id\n"); - goto error; - } - if(res_id== 0) - { - LM_ERR("record not found\n"); - goto error; - } /* extract the subscription state */ hdr = msg->headers; @@ -276,6 +253,24 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2) LM_ERR("while parsing 'Subscription-State' header\n"); goto error; } + if(pua_get_record_id(&dialog, &res_id)< 0) // verify if within a stored dialog + { + LM_ERR("occured when trying to get record id\n"); + goto error; + } + if(res_id==0) + { + LM_DBG("presence dialog record not found\n"); + /* if it is a NOTIFY for a terminated SUBSCRIBE dialog in RLS, then + * the module might not have the dialog structure anymore + * - just send 200ok, it is harmless + */ + if(auth_flag==TERMINATED_STATE) + goto done; + LM_ERR("no presence dialog record for non-TERMINATED state\n"); + goto error; + } + if(msg->content_type== NULL || msg->content_type->body.s== NULL) { LM_DBG("cannot find content type header header\n"); @@ -408,9 +403,11 @@ done: goto error; } - pkg_free(res_id->s); - pkg_free(res_id); - + if(res_id!=NULL) + { + pkg_free(res_id->s); + pkg_free(res_id); + } return 1; error: @@ -472,8 +469,11 @@ void timer_send_notify(unsigned int ticks,void *param) unsigned int hash_code= 0; int len; int size= BUF_REALLOC_SIZE, buf_len= 0; - char* buf= NULL, *auth_state= NULL, *boundary_string= NULL, *cid= NULL; - int contor= 0, auth_state_flag, antet_len; + char* buf= NULL, *auth_state= NULL, *boundary_string= NULL; + str cid = {0,0}; + str content_type = {0,0}; + int contor= 0, auth_state_flag; + int chunk_len; str bstr= {0, 0}; str rlmi_cont= {0, 0}, multi_cont; subs_t* s, *dialog= NULL; @@ -547,7 +547,6 @@ void timer_send_notify(unsigned int ticks,void *param) ERR_MEM(PKG_MEM_STR); } - antet_len= COMPUTE_ANTET_LEN(bstr.s); LM_DBG("found %d records with updated state\n", result->n); for(i= 0; i< result->n; i++) { @@ -676,7 +675,8 @@ void timer_send_notify(unsigned int ticks,void *param) while(1) { contor++; - cid= NULL; + cid.s= NULL; + cid.len= 0; instance_node= xmlNewChild(resource_node, NULL, BAD_CAST "instance", NULL); if(instance_node== NULL) @@ -697,8 +697,8 @@ void timer_send_notify(unsigned int ticks,void *param) if(auth_state_flag & ACTIVE_STATE) { - cid= generate_cid(resource_uri, strlen(resource_uri)); - xmlNewProp(instance_node, BAD_CAST "cid", BAD_CAST cid); + cid.s= generate_cid(resource_uri, strlen(resource_uri)); + xmlNewProp(instance_node, BAD_CAST "cid", BAD_CAST cid.s); } else if(auth_state_flag & TERMINATED_STATE) @@ -708,18 +708,28 @@ void timer_send_notify(unsigned int ticks,void *param) } /* add in the multipart buffer */ - if(cid) + if(cid.s) { - if(buf_len+ antet_len+ pres_state.len+ 4 > size) + cid.len = strlen(cid.s); + content_type.s = (char*)row_vals[content_type_col].val.string_val; + content_type.len = strlen(content_type.s); + chunk_len = 4 + bstr.len + + 35 + + 16 + cid.len + + 18 + content_type.len + + 4 + pres_state.len + 8; + if(buf_len + chunk_len >= size) { REALLOC_BUF } - buf_len+= sprintf(buf+ buf_len, "--%s\r\n", bstr.s); + buf_len+= sprintf(buf+ buf_len, "--%.*s\r\n", bstr.len, + bstr.s); buf_len+= sprintf(buf+ buf_len, "Content-Transfer-Encoding: binary\r\n"); - buf_len+= sprintf(buf+ buf_len, "Content-ID: <%s>\r\n", cid); - buf_len+= sprintf(buf+ buf_len, "Content-Type: %s\r\n\r\n", - row_vals[content_type_col].val.string_val); + buf_len+= sprintf(buf+ buf_len, "Content-ID: <%.*s>\r\n", + cid.len, cid.s); + buf_len+= sprintf(buf+ buf_len, "Content-Type: %.*s\r\n\r\n", + content_type.len, content_type.s); buf_len+= sprintf(buf+buf_len,"%.*s\r\n\r\n", pres_state.len, pres_state.s); } diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c index f66737960..c1efbd9a2 100644 --- a/modules_k/rls/subscribe.c +++ b/modules_k/rls/subscribe.c @@ -90,7 +90,7 @@ xmlNodePtr rls_get_by_service_uri(xmlDocPtr doc, str* uri) val = XMLNodeGetAttrContentByName(node, "uri"); if(val!=NULL) { - if((uri->len==strlen(val)) && (strcmp(val, uri->s)==0)) + if((uri->len==strlen(val)) && (strncmp(val, uri->s, uri->len)==0)) { xmlFree(val); return node; @@ -241,13 +241,17 @@ int rls_get_service_list(str *service_uri, str *user, str *domain, *service_node = rls_get_by_service_uri(xmldoc, service_uri); if(*service_node==NULL) { - LM_ERR("service uri %.*s not found in rl document for user" + LM_DBG("service uri %.*s not found in rl document for user" " sip:%.*s@%.*s\n", service_uri->len, service_uri->s, user->len, user->s, domain->len, domain->s); - goto error; + rootdoc = NULL; + if(xmldoc!=NULL) + xmlFreeDoc(xmldoc); + } + else + { + *rootdoc = xmldoc; } - - *rootdoc = xmldoc; rls_dbf.free_result(rls_db, result); if(xcapdoc!=NULL) @@ -621,7 +625,7 @@ int rls_handle_subscribe(struct sip_msg* msg, char* s1, char* s2) if(send_full_notify(&subs, service_node, subs.version, &subs.pres_uri, hash_code)<0) { - LM_ERR("failed sending full state sotify\n"); + LM_ERR("failed sending full state notify\n"); goto error; } /* send subscribe requests for all in the list */ diff --git a/modules_k/rtimer/rtimer_mod.c b/modules_k/rtimer/rtimer_mod.c index d0ed96c51..33c7c2e6c 100644 --- a/modules_k/rtimer/rtimer_mod.c +++ b/modules_k/rtimer/rtimer_mod.c @@ -118,7 +118,7 @@ static int mod_init(void) return -1; } } else { - register_procs(1); + register_dummy_timers(1); } it = it->next; } diff --git a/modules_k/seas/event_dispatcher.c b/modules_k/seas/event_dispatcher.c index 7702c586b..7f8cbb3f3 100644 --- a/modules_k/seas/event_dispatcher.c +++ b/modules_k/seas/event_dispatcher.c @@ -38,6 +38,7 @@ #include "../../mem/shm_mem.h" /*shm_malloc*/ #include "../../dprint.h" /*LM_**/ #include "../../locking.h" +#include "../../cfg/cfg_struct.h" #include "seas.h" #include "ha.h" @@ -129,6 +130,9 @@ int dispatcher_main_loop(void) spawn_pinger(); while(1){ + /* update the local config framework structures */ + cfg_update(); + if(sig_flag==SIGCHLD){ while ((chld=waitpid( -1, &chld_status, WNOHANG ))>0) { if (WIFEXITED(chld_status)){ diff --git a/modules_k/seas/seas.c b/modules_k/seas/seas.c index b1adb9d81..c68bffa7a 100644 --- a/modules_k/seas/seas.c +++ b/modules_k/seas/seas.c @@ -37,6 +37,7 @@ #include "../../modules/tm/tm_load.h" /*load_tm_api*/ #include "../../modules/tm/h_table.h" /*cell*/ #include "../../modules/tm/t_lookup.h" /*T_UNDEFINED*/ +#include "../../cfg/cfg_struct.h" #include "encode_msg.h" /*encode_msg*/ @@ -681,6 +682,9 @@ static int seas_init(void) if(0>parse_cluster_cfg()) goto error; register_procs(1); + /* add child to update local config framework structures */ + cfg_register_child(1); + return 0; error: for(i=0;i<2;i++) @@ -728,6 +732,10 @@ static int seas_child_init(int rank) /*dispatcher child. we leave writing end open so that new childs spawned * by event dispatcher can also write to pipe.. */ + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + /* close(write_pipe); */ return dispatcher_main_loop(); } diff --git a/modules_k/siputils/ring.c b/modules_k/siputils/ring.c index ed0d478a3..1ae54b23c 100644 --- a/modules_k/siputils/ring.c +++ b/modules_k/siputils/ring.c @@ -374,6 +374,7 @@ int ring_filter(struct sip_msg *msg, unsigned int flags, void *bar) * \return 0 */ int ring_fixup(void ** param, int param_no) { + int ring_timeout = cfg_get(siputils, siputils_cfg, ring_timeout); if (ring_timeout == 0) { LM_ERR("ring_insert_callid functionality deactivated, you need to set a positive ring_timeout\n"); return -1; diff --git a/modules_k/siputils/ring.h b/modules_k/siputils/ring.h index 74b35a6f5..2097f8f15 100644 --- a/modules_k/siputils/ring.h +++ b/modules_k/siputils/ring.h @@ -38,7 +38,6 @@ extern gen_lock_t *ring_lock; -extern unsigned int ring_timeout; /*! diff --git a/modules_k/snmpstats/snmpstats.c b/modules_k/snmpstats/snmpstats.c index 19948766e..37dc8296a 100644 --- a/modules_k/snmpstats/snmpstats.c +++ b/modules_k/snmpstats/snmpstats.c @@ -79,6 +79,7 @@ #include "snmpstats.h" #include "snmpstats_globals.h" #include "../../timer.h" +#include "../../cfg/cfg_struct.h" #include #include @@ -340,6 +341,8 @@ static int mod_init(void) /* add space for one extra process */ register_procs(1); + /* add child to update local config framework structures */ + cfg_register_child(1); return 0; } @@ -363,6 +366,10 @@ static int mod_child_init(int rank) return -1; /* error */ if(pid==0){ /* child */ + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + agentx_child(1); return 0; } diff --git a/modules_k/snmpstats/sub_agent.c b/modules_k/snmpstats/sub_agent.c index 24273ecc6..d35a3de02 100644 --- a/modules_k/snmpstats/sub_agent.c +++ b/modules_k/snmpstats/sub_agent.c @@ -65,6 +65,7 @@ #include "snmpMIBNotifications.h" #include "../../dprint.h" +#include "../../cfg/cfg_struct.h" static int keep_running; @@ -110,6 +111,9 @@ static int initialize_agentx(void) keep_running = 1; while(keep_running) { + /* update the local config framework structures */ + cfg_update(); + agent_check_and_process(1); /* 0 == don't block */ } diff --git a/modules_k/textops/api.c b/modules_k/textops/api.c index aad62e15b..3180d09ba 100644 --- a/modules_k/textops/api.c +++ b/modules_k/textops/api.c @@ -103,7 +103,7 @@ int search_api(struct sip_msg *msg, str *regex){ /* * Function to load the textops api. */ -int load_textops(struct textops_binds *tob){ +int bind_textops(textops_api_t *tob){ if(tob==NULL){ LM_WARN("textops_binds: Cannot load textops API into a NULL pointer\n"); return -1; diff --git a/modules_k/textops/api.h b/modules_k/textops/api.h index fbad481f3..a2b72c49a 100644 --- a/modules_k/textops/api.h +++ b/modules_k/textops/api.h @@ -37,31 +37,31 @@ typedef int (*search_t)(struct sip_msg*, str*); /* * Struct with the textops api. */ -struct textops_binds{ +typedef struct textops_binds { append_hf_t append_hf; // Append a header to the message. remove_hf_t remove_hf; // Remove a header with the specified name from the message. search_append_t search_append; // Append a str after a match of the specified regex. search_t search; // Check if the regex matches a part of the message. -}; +} textops_api_t; -typedef int (*load_textops_f)(struct textops_binds*); +typedef int (*bind_textops_f)(textops_api_t*); /* * function exported by module - it will load the other functions */ -int load_textops(struct textops_binds*); +int bind_textops(textops_api_t*); /* * Function to be called direclty from other modules to load * the textops API. */ -inline static int load_textops_api(struct textops_binds *tob){ - load_textops_f load_textops_exports; - if(!(load_textops_exports=(load_textops_f)find_export("load_textops",0,0))){ - LM_ERR("Failed to import load_textops\n"); +inline static int load_textops_api(textops_api_t *tob){ + bind_textops_f bind_textops_exports; + if(!(bind_textops_exports=(bind_textops_f)find_export("bind_textops",0,0))){ + LM_ERR("Failed to import bind_textops\n"); return -1; } - return load_textops_exports(tob); + return bind_textops_exports(tob); } #endif /*TEXT_OPS_API_H_*/ diff --git a/modules_k/textops/textops.c b/modules_k/textops/textops.c index cb3907d41..9198f778a 100644 --- a/modules_k/textops/textops.c +++ b/modules_k/textops/textops.c @@ -247,6 +247,9 @@ static cmd_export_t cmds[]={ fixup_spve_spve, 0, REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, + {"bind_textops", (cmd_function)bind_textops, 0, 0, 0, + 0}, + {0,0,0,0,0,0} }; diff --git a/modules_k/tmx/README b/modules_k/tmx/README index 6b3f0504f..7f629592b 100644 --- a/modules_k/tmx/README +++ b/modules_k/tmx/README @@ -29,6 +29,7 @@ Daniel-Constantin Mierla 3.1. t_cancel_branches(which) 3.2. t_cancel_callid(callid, cseq, flag) 3.3. t_reply_callid(callid, cseq, code, reason) + 3.4. t_flush_flags() 4. Exported pseudo-variables 5. Exported MI Functions @@ -57,6 +58,7 @@ Daniel-Constantin Mierla 1.1. t_cancel_branches usage 1.2. t_cancel_callid usage 1.3. t_reply_callid usage + 1.4. t_flush_flags usage Chapter 1. Admin Guide @@ -73,6 +75,7 @@ Chapter 1. Admin Guide 3.1. t_cancel_branches(which) 3.2. t_cancel_callid(callid, cseq, flag) 3.3. t_reply_callid(callid, cseq, code, reason) + 3.4. t_flush_flags() 4. Exported pseudo-variables 5. Exported MI Functions @@ -124,6 +127,7 @@ Chapter 1. Admin Guide 3.1. t_cancel_branches(which) 3.2. t_cancel_callid(callid, cseq, flag) 3.3. t_reply_callid(callid, cseq, code, reason) + 3.4. t_flush_flags() 3.1. t_cancel_branches(which) @@ -182,6 +186,19 @@ if (t_reply_callid("123qaz", "5", "458", "Replied remotely")) { } ... +3.4. t_flush_flags() + + Flush the flags from current SIP message into the already created + transaction. It make sense only in routing block if the transaction was + created via t_newtran() and the flags have been altered since. + + This function can be used from ANY_ROUTE . + + Example 1.4. t_flush_flags usage +... +t_flush_flags(); +... + 4. Exported pseudo-variables * $T_branch_idx diff --git a/modules_k/tmx/doc/tmx_admin.xml b/modules_k/tmx/doc/tmx_admin.xml index 1012972aa..ccdb79164 100644 --- a/modules_k/tmx/doc/tmx_admin.xml +++ b/modules_k/tmx/doc/tmx_admin.xml @@ -168,6 +168,27 @@ if (t_reply_callid("123qaz", "5", "458", "Replied remotely")) { xlog("transaction replied\n"); } ... + + + +
+ + <function moreinfo="none">t_flush_flags()</function> + + + Flush the flags from current SIP message into the already created + transaction. It make sense only in routing block if the transaction was + created via t_newtran() and the flags have been altered since. + + + This function can be used from ANY_ROUTE . + + + <function>t_flush_flags</function> usage + +... +t_flush_flags(); +...
diff --git a/modules_k/tmx/tmx_mod.c b/modules_k/tmx/tmx_mod.c index 6e6f758aa..1da7fd36d 100644 --- a/modules_k/tmx/tmx_mod.c +++ b/modules_k/tmx/tmx_mod.c @@ -53,6 +53,8 @@ static int t_reply_callid(struct sip_msg* msg, char *cid, char *cseq, char *rc, char *rs); static int fixup_reply_callid(void** param, int param_no); +static int t_flush_flags(struct sip_msg* msg, char*, char* ); + /* statistic variables */ stat_var *tm_rcv_rpls; stat_var *tm_rld_rpls; @@ -135,6 +137,8 @@ static cmd_export_t cmds[]={ fixup_cancel_callid, 0, ANY_ROUTE }, {"t_reply_callid", (cmd_function)t_reply_callid, 4, fixup_reply_callid, 0, ANY_ROUTE }, + {"t_flush_flags", (cmd_function)t_flush_flags, 0, 0, + 0, ANY_ROUTE }, {0,0,0,0,0,0} }; @@ -398,6 +402,23 @@ static int t_reply_callid(struct sip_msg* msg, char *cid, char *cseq, return -1; } +/** + * + */ +static int t_flush_flags(struct sip_msg* msg, char *foo, char *bar) +{ + struct cell *t; + + t=_tmx_tmb.t_gett(); + if ( t==0 || t==T_UNDEFINED) { + LM_ERR("failed to flush flags - no transaction found\n"); + return -1; + } + + t->uas.request->flags = msg->flags; + return 1; +} + #ifdef STATISTICS /*** tm stats ***/ diff --git a/modules_k/uac/from.c b/modules_k/uac/from.c index 4657e111d..50822b609 100644 --- a/modules_k/uac/from.c +++ b/modules_k/uac/from.c @@ -463,15 +463,17 @@ int restore_from( struct sip_msg *msg, int *is_from ) LM_ERR("new URI shorter than old URI\n"); goto failed; } - for( i=0 ; ilen = snprintf(xcaps_etag_buf, XCAPS_ETAG_SIZE, - "SIP-ETag: %.*s\r\n", s.len, s.s); + "ETag: %.*s\r\n", s.len, s.s); if(etag->len < 0) { LM_ERR("error printing etag hdr\n "); @@ -953,8 +953,8 @@ static int w_xcaps_del(sip_msg_t* msg, char* puri, char* ppath) LM_ERR("could not generate etag\n"); goto error; } - etag.s = etag_hdr.s + 10; /* 'SIP-ETag: ' */ - etag.len = etag_hdr.len - 12; /* 'SIP-ETag: ' '\r\n' */ + etag.s = etag_hdr.s + 6; /* 'ETag: ' */ + etag.len = etag_hdr.len - 8; /* 'ETag: ' '\r\n' */ if(xcaps_put_db(&turi.user, &turi.host, &xuri, &etag, &body)<0) { @@ -1047,7 +1047,7 @@ done: int xcaps_generate_etag_hdr(str *etag) { etag->len = snprintf(xcaps_etag_buf, XCAPS_ETAG_SIZE, - "SIP-ETag: sr-%d-%d-%d\r\n", xcaps_init_time, my_pid(), + "ETag: sr-%d-%d-%d\r\n", xcaps_init_time, my_pid(), xcaps_etag_counter++); if(etag->len <0) { diff --git a/modules_k/xmpp/xmpp.c b/modules_k/xmpp/xmpp.c index e7a0093e7..ad087e490 100644 --- a/modules_k/xmpp/xmpp.c +++ b/modules_k/xmpp/xmpp.c @@ -118,6 +118,7 @@ #include "../../parser/parse_content.h" #include "../../parser/parse_from.h" #include "../../modules/tm/tm_load.h" +#include "../../cfg/cfg_struct.h" #include "xode.h" #include "xmpp.h" @@ -245,7 +246,8 @@ static int mod_init(void) { /* add space for one extra process */ register_procs(1); - + /* add child to update local config framework structures */ + cfg_register_child(1); return 0; } @@ -263,6 +265,10 @@ static int child_init(int rank) return -1; /* error */ if(pid==0){ /* child */ + /* initialize the config framework */ + if (cfg_child_init()) + return -1; + xmpp_process(1); } } diff --git a/modules_k/xmpp/xmpp_component.c b/modules_k/xmpp/xmpp_component.c index e93b040bd..123f11a24 100644 --- a/modules_k/xmpp/xmpp_component.c +++ b/modules_k/xmpp/xmpp_component.c @@ -49,6 +49,7 @@ #include #include "../../sr_module.h" +#include "../../cfg/cfg_struct.h" #include "xmpp.h" #include "xmpp_api.h" @@ -221,6 +222,9 @@ int xmpp_component_child_process(int data_pipe) maxfd = fd > data_pipe ? fd : data_pipe; rv = select(maxfd + 1, &fdset, NULL, NULL, NULL); + /* update the local config framework structures */ + cfg_update(); + if (rv < 0) { LM_ERR("select() failed: %s\n", strerror(errno)); } else if (!rv) { diff --git a/modules_k/xmpp/xmpp_server.c b/modules_k/xmpp/xmpp_server.c index 74b82a312..cc355b4f7 100644 --- a/modules_k/xmpp/xmpp_server.c +++ b/modules_k/xmpp/xmpp_server.c @@ -91,6 +91,7 @@ #include #include "../../sr_module.h" +#include "../../cfg/cfg_struct.h" #include "xmpp.h" #include "xmpp_api.h" @@ -497,6 +498,10 @@ int xmpp_server_child_process(int data_pipe) } rv = select(FD_SETSIZE, &fdset, NULL, NULL, NULL); + + /* update the local config framework structures */ + cfg_update(); + if (rv < 0) { LM_ERR("select() failed: %s\n", strerror(errno)); } else if (!rv) { diff --git a/parser/parse_param.c b/parser/parse_param.c index c68e237d2..90fe2414a 100644 --- a/parser/parse_param.c +++ b/parser/parse_param.c @@ -125,7 +125,7 @@ static inline void parse_contact_class(param_hooks_t* _h, param_t* _p) return; } if (!_h) { - LOG(L_CRIT, "BUG: parse_uri_class: NULL param hook pointer\n"); + LOG(L_CRIT, "BUG: parse_contact_class: NULL param hook pointer\n"); return; } switch(_p->name.s[0]) { diff --git a/pkg/kamailio/deb/debian/changelog b/pkg/kamailio/deb/debian/changelog index 1c3efcbbf..a74b0364d 100644 --- a/pkg/kamailio/deb/debian/changelog +++ b/pkg/kamailio/deb/debian/changelog @@ -1,3 +1,15 @@ +kamailio (3.1.5) unstable; urgency=low + + * update to 3.1.5 from upstream + + -- Daniel-Constantin Mierla Wed, 14 Sep 2011 18:45:30 +0100 + +kamailio (3.1.4) unstable; urgency=low + + * update to 3.1.4 from upstream + + -- Daniel-Constantin Mierla Thu, 26 May 2011 15:40:40 +0100 + kamailio (3.1.3) unstable; urgency=low * update to 3.1.3 from upstream diff --git a/pkg/kamailio/deb/debian/control b/pkg/kamailio/deb/debian/control index 302a40a1d..e708de998 100644 --- a/pkg/kamailio/deb/debian/control +++ b/pkg/kamailio/deb/debian/control @@ -102,7 +102,7 @@ Package: kamailio-xml-modules Architecture: any Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}) Replaces: kamailio-xml-module, kamailio-xmlrpc-module -Provides: kamailio-xmlrcp-modules +Provides: kamailio-xmlrpc-modules Description: XML based extensions for Kamailio's Management Interface Kamailio is a very fast and flexible SIP (RFC3261) proxy server. Written entirely in C, Kamailio can handle thousands calls diff --git a/pkg/kamailio/deb/debian/rules b/pkg/kamailio/deb/debian/rules index fbaccf609..30feea719 100755 --- a/pkg/kamailio/deb/debian/rules +++ b/pkg/kamailio/deb/debian/rules @@ -44,10 +44,13 @@ PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \ ldap xml perl utils purple memcached tls \ snmpstats carrierroute xmpp cpl lua python geoip +# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b) +LIBDIR ?= lib + # directories with possible duplicate libraries (that should be deleted # from current module* packages) -DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/lib/kamailio \ - $(CURDIR)/debian/kamailio-db-modules/usr/lib/kamailio +DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \ + $(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio # modules names out of modules sp MODULES_SP_NAMES=$(filter-out $(MDIRS),$(subst /, ,$(MODULES_SP))) @@ -80,10 +83,10 @@ define PACKAGE_GRP_INSTALL_template doc-dir=share/doc/kamailio-$(grp)-modules # eliminate duplicate libs -for d in $(DUP_LIBS_DIRS); do \ - test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/lib/kamailio" &&\ + test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\ for r in $$d/lib*; do \ echo "removing $(grp) lib `basename $$r` present also in $$d";\ - rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/lib/kamailio/`basename "$$r"` ; \ + rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \ done ; \ done ) @@ -98,10 +101,10 @@ define PACKAGE_MODULE_INSTALL_template doc-dir=share/doc/kamailio-$(call mod_name,$(mod))-module # eliminate duplicate libs -for d in $(DUP_LIBS_DIRS); do \ - test "$$d" != "$(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/lib/kamailio" &&\ + test "$$d" != "$(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/$(LIBDIR)/kamailio" &&\ for r in $$d/lib*; do \ echo "removing $(call mod_name, $(mod)) lib `basename $$r` present also in $$d";\ - rm -f $(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/lib/kamailio/`basename "$$r"` ; \ + rm -f $(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \ done ; \ done ) diff --git a/pkg/kamailio/deb/lenny/changelog b/pkg/kamailio/deb/lenny/changelog index 5d95b658d..50cb9a089 100644 --- a/pkg/kamailio/deb/lenny/changelog +++ b/pkg/kamailio/deb/lenny/changelog @@ -1,3 +1,21 @@ +kamailio (3.1.5) unstable; urgency=low + + * update to 3.1.5 from upstream + + -- Daniel-Constantin Mierla Wed, 14 Sep 2011 18:45:30 +0100 + +kamailio (3.1.4) unstable; urgency=low + + * update to 3.1.4 from upstream + + -- Daniel-Constantin Mierla Thu, 26 May 2011 15:40:40 +0100 + +kamailio (3.1.3) unstable; urgency=low + + * update to 3.1.3 from upstream + + -- Daniel-Constantin Mierla Mon, 4 Apr 2011 20:29:40 +0100 + kamailio (3.1.1) unstable; urgency=low * update to 3.1.1 from upstream diff --git a/pkg/kamailio/deb/lenny/control b/pkg/kamailio/deb/lenny/control index 73a1e26f6..9d7ccb254 100644 --- a/pkg/kamailio/deb/lenny/control +++ b/pkg/kamailio/deb/lenny/control @@ -102,7 +102,7 @@ Package: kamailio-xml-modules Architecture: any Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}) Replaces: kamailio-xml-module, kamailio-xmlrpc-module -Provides: kamailio-xmlrcp-modules +Provides: kamailio-xmlrpc-modules Description: XML based extensions for Kamailio's Management Interface Kamailio is a very fast and flexible SIP (RFC3261) proxy server. Written entirely in C, Kamailio can handle thousands calls diff --git a/pkg/kamailio/deb/lenny/kamailio.init b/pkg/kamailio/deb/lenny/kamailio.init index e5f50fcbf..ab54d0ce1 100644 --- a/pkg/kamailio/deb/lenny/kamailio.init +++ b/pkg/kamailio/deb/lenny/kamailio.init @@ -4,16 +4,13 @@ # Provides: kamailio # Required-Start: $syslog $network $local_fs $time # Required-Stop: $syslog $network $local_fs +# Should-Start: mysql postgresql freeradius +# Should-Stop: mysql postgresql freeradius # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start the Kamailio SIP proxy server # Description: Start the Kamailio SIP proxy server ### END INIT INFO -# -# TODO: -# The following fields should be added (and completed): -# Should-Start: postgresql mysql radius -# Should-Stop: postgresql mysql radius PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/kamailio diff --git a/pkg/kamailio/deb/lenny/rules b/pkg/kamailio/deb/lenny/rules index d9ec443d5..38066c039 100755 --- a/pkg/kamailio/deb/lenny/rules +++ b/pkg/kamailio/deb/lenny/rules @@ -44,10 +44,13 @@ PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \ ldap xml perl utils purple memcached tls \ snmpstats carrierroute xmpp cpl lua python +# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b) +LIBDIR ?= lib + # directories with possible duplicate libraries (that should be deleted # from current module* packages) -DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/lib/kamailio \ - $(CURDIR)/debian/kamailio-db-modules/usr/lib/kamailio +DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \ + $(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio # modules names out of modules sp MODULES_SP_NAMES=$(filter-out $(MDIRS),$(subst /, ,$(MODULES_SP))) @@ -80,10 +83,10 @@ define PACKAGE_GRP_INSTALL_template doc-dir=share/doc/kamailio-$(grp)-modules # eliminate duplicate libs -for d in $(DUP_LIBS_DIRS); do \ - test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/lib/kamailio" &&\ + test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\ for r in $$d/lib*; do \ echo "removing $(grp) lib `basename $$r` present also in $$d";\ - rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/lib/kamailio/`basename "$$r"` ; \ + rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \ done ; \ done ) @@ -98,10 +101,10 @@ define PACKAGE_MODULE_INSTALL_template doc-dir=share/doc/kamailio-$(call mod_name,$(mod))-module # eliminate duplicate libs -for d in $(DUP_LIBS_DIRS); do \ - test "$$d" != "$(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/lib/kamailio" &&\ + test "$$d" != "$(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/$(LIBDIR)/kamailio" &&\ for r in $$d/lib*; do \ echo "removing $(call mod_name, $(mod)) lib `basename $$r` present also in $$d";\ - rm -f $(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/lib/kamailio/`basename "$$r"` ; \ + rm -f $(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \ done ; \ done ) diff --git a/pkg/kamailio/deb/lucid/changelog b/pkg/kamailio/deb/lucid/changelog index 5d95b658d..50cb9a089 100644 --- a/pkg/kamailio/deb/lucid/changelog +++ b/pkg/kamailio/deb/lucid/changelog @@ -1,3 +1,21 @@ +kamailio (3.1.5) unstable; urgency=low + + * update to 3.1.5 from upstream + + -- Daniel-Constantin Mierla Wed, 14 Sep 2011 18:45:30 +0100 + +kamailio (3.1.4) unstable; urgency=low + + * update to 3.1.4 from upstream + + -- Daniel-Constantin Mierla Thu, 26 May 2011 15:40:40 +0100 + +kamailio (3.1.3) unstable; urgency=low + + * update to 3.1.3 from upstream + + -- Daniel-Constantin Mierla Mon, 4 Apr 2011 20:29:40 +0100 + kamailio (3.1.1) unstable; urgency=low * update to 3.1.1 from upstream diff --git a/pkg/kamailio/deb/lucid/control b/pkg/kamailio/deb/lucid/control index 302a40a1d..e708de998 100644 --- a/pkg/kamailio/deb/lucid/control +++ b/pkg/kamailio/deb/lucid/control @@ -102,7 +102,7 @@ Package: kamailio-xml-modules Architecture: any Depends: ${shlibs:Depends}, kamailio (= ${binary:Version}) Replaces: kamailio-xml-module, kamailio-xmlrpc-module -Provides: kamailio-xmlrcp-modules +Provides: kamailio-xmlrpc-modules Description: XML based extensions for Kamailio's Management Interface Kamailio is a very fast and flexible SIP (RFC3261) proxy server. Written entirely in C, Kamailio can handle thousands calls diff --git a/pkg/kamailio/deb/lucid/kamailio.init b/pkg/kamailio/deb/lucid/kamailio.init index e5f50fcbf..ab54d0ce1 100644 --- a/pkg/kamailio/deb/lucid/kamailio.init +++ b/pkg/kamailio/deb/lucid/kamailio.init @@ -4,16 +4,13 @@ # Provides: kamailio # Required-Start: $syslog $network $local_fs $time # Required-Stop: $syslog $network $local_fs +# Should-Start: mysql postgresql freeradius +# Should-Stop: mysql postgresql freeradius # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start the Kamailio SIP proxy server # Description: Start the Kamailio SIP proxy server ### END INIT INFO -# -# TODO: -# The following fields should be added (and completed): -# Should-Start: postgresql mysql radius -# Should-Stop: postgresql mysql radius PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/kamailio diff --git a/pkg/kamailio/deb/lucid/rules b/pkg/kamailio/deb/lucid/rules index fbaccf609..30feea719 100755 --- a/pkg/kamailio/deb/lucid/rules +++ b/pkg/kamailio/deb/lucid/rules @@ -44,10 +44,13 @@ PACKAGE_GROUPS=mysql postgres berkeley unixodbc radius presence \ ldap xml perl utils purple memcached tls \ snmpstats carrierroute xmpp cpl lua python geoip +# name of libdir in the path for libraries (e.g., lib for 32b, lib64 for 64b) +LIBDIR ?= lib + # directories with possible duplicate libraries (that should be deleted # from current module* packages) -DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/lib/kamailio \ - $(CURDIR)/debian/kamailio-db-modules/usr/lib/kamailio +DUP_LIBS_DIRS=$(CURDIR)/debian/kamailio/usr/$(LIBDIR)/kamailio \ + $(CURDIR)/debian/kamailio-db-modules/usr/$(LIBDIR)/kamailio # modules names out of modules sp MODULES_SP_NAMES=$(filter-out $(MDIRS),$(subst /, ,$(MODULES_SP))) @@ -80,10 +83,10 @@ define PACKAGE_GRP_INSTALL_template doc-dir=share/doc/kamailio-$(grp)-modules # eliminate duplicate libs -for d in $(DUP_LIBS_DIRS); do \ - test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/lib/kamailio" &&\ + test "$$d" != "$(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio" &&\ for r in $$d/lib*; do \ echo "removing $(grp) lib `basename $$r` present also in $$d";\ - rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/lib/kamailio/`basename "$$r"` ; \ + rm -f $(CURDIR)/debian/kamailio-$(grp)-modules/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \ done ; \ done ) @@ -98,10 +101,10 @@ define PACKAGE_MODULE_INSTALL_template doc-dir=share/doc/kamailio-$(call mod_name,$(mod))-module # eliminate duplicate libs -for d in $(DUP_LIBS_DIRS); do \ - test "$$d" != "$(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/lib/kamailio" &&\ + test "$$d" != "$(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/$(LIBDIR)/kamailio" &&\ for r in $$d/lib*; do \ echo "removing $(call mod_name, $(mod)) lib `basename $$r` present also in $$d";\ - rm -f $(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/lib/kamailio/`basename "$$r"` ; \ + rm -f $(CURDIR)/debian/kamailio-$(call mod_name,$(mod))-module/usr/$(LIBDIR)/kamailio/`basename "$$r"` ; \ done ; \ done ) diff --git a/pkg/kamailio/deb/squeeze/changelog b/pkg/kamailio/deb/squeeze/changelog index 7a17688b5..6243aa18a 100644 --- a/pkg/kamailio/deb/squeeze/changelog +++ b/pkg/kamailio/deb/squeeze/changelog @@ -1,3 +1,9 @@ +kamailio (3.1.5+sipwise1) unstable; urgency=low + + * Merge with kamailio 3.1.5 + + -- Jon Bonilla Tue, 27 Sep 2011 15:31:35 +0200 + kamailio (3.1.3+sipwise7) unstable; urgency=low * Fix redis module package creation diff --git a/pkg/kamailio/rpm/kamailio.spec-4.1 b/pkg/kamailio/rpm/kamailio.spec-4.1 index 12b02f0c6..38ef5a60b 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 1.2.0 +%define ver 3.1.5 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc diff --git a/pkg/kamailio/rpm/kamailio.spec.CenOS b/pkg/kamailio/rpm/kamailio.spec.CenOS index 7043489ef..68df9399e 100644 --- a/pkg/kamailio/rpm/kamailio.spec.CenOS +++ b/pkg/kamailio/rpm/kamailio.spec.CenOS @@ -1,5 +1,5 @@ %define name kamailio -%define ver 3.1.3 +%define ver 3.1.5 %define rel 0 %define _sharedir %{_prefix}/share diff --git a/pkg/kamailio/rpm/kamailio.spec.SuSE b/pkg/kamailio/rpm/kamailio.spec.SuSE index 77af94890..bca0ed73f 100644 --- a/pkg/kamailio/rpm/kamailio.spec.SuSE +++ b/pkg/kamailio/rpm/kamailio.spec.SuSE @@ -1,5 +1,5 @@ %define name kamailio -%define ver 1.2.0 +%define ver 3.1.5 %define rel 0 %define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops diff --git a/pkg/ser/gentoo/ChangeLog b/pkg/ser/gentoo/ChangeLog new file mode 100644 index 000000000..b69a047fd --- /dev/null +++ b/pkg/ser/gentoo/ChangeLog @@ -0,0 +1,29 @@ +# ChangeLog for net-misc/sip-router +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*sip-router-3.1.4-r1 (24 Aug 2011) + + 24 Aug 2011; Claudio G. Furrer sip-router-3.1.4-r1.ebuild: + Added kamailio-specific groups (group_k*) in USE flags. + +*sip-router-3.1.4 (31 May 2011) + + 31 May 2011; Claudio G. Furrer sip-router-3.1.4.ebuild: + Version bump. + +*sip-router-3.1.3 (03 May 2011) + + 03 May 2011; Claudio G. Furrer sip-router-3.1.3.ebuild: + Version bump. + +*sip-router-3.1.2 (21 Mar 2011) + + 23 Mar 2011; Claudio G. Furrer sip-router-3.1.2.ebuild, + +metadata.xml: + Added flavours USE setup for kamailio/ser/sip-router options. + Also was added metadata file. + + 22 Mar 2011; Claudio G. Furrer sip-router-3.1.2.ebuild: + Added initial ChangeLog which should be updated whenever the package is + updated in any way. diff --git a/pkg/ser/gentoo/Manifest b/pkg/ser/gentoo/Manifest new file mode 100644 index 000000000..15ed9dd24 --- /dev/null +++ b/pkg/ser/gentoo/Manifest @@ -0,0 +1,11 @@ +AUX siprouter.confd 496 RMD160 1bbdc51c80a1622b0d2cf17540c572590d35a0ad SHA1 deadd28c437edd3cd5a2f7c2ad7add39275d5845 SHA256 f01307979d2ef07b53889a6d17a2b65313ff109ac15bcb16446fb08cf390ee4a +AUX siprouter.init 793 RMD160 6bc17c6d454c0c57a0c8720ac0ec34c3548a2431 SHA1 794dc51028151d2b312c1c9d1c085d68dcbc1b45 SHA256 e4755430ca44e1d7dff7049b130a4a08d99e3149e3842dc4a822795367c5ae88 +DIST kamailio-3.1.2_src.tar.gz 6936249 RMD160 8811bc7b1310e4ca550b40d108002f6a36cd6ab8 SHA1 76b417f9b54575d8ec179558c16953a8e6510809 SHA256 03396f7a202507075d8c81fd1bbc689cedc8bf96941faaa570e007164f2f9550 +DIST kamailio-3.1.3_src.tar.gz 6994333 RMD160 4aac64a217d2344236d5749d103579b0fff1504f SHA1 6675786e3b717f62e4eaa9ff33b4c78ae3a19fdb SHA256 f7e108ac6ee8d8a79cb0b6b37c660597807db2a933991bd982d26405a3ed4f7c +DIST kamailio-3.1.4_src.tar.gz 6959507 RMD160 d0f8746be3bda86c650486ac3a31186778e79dc4 SHA1 d663936e542969b63671dd514e7b368448fbe404 SHA256 669564fe3be9c8439749f6d435d39b5851c7fff61392924e2e6aeb60a8793956 +EBUILD sip-router-3.1.2.ebuild 6665 RMD160 01c9fcdbb400b606ccc74a179ded35aa6fd0bb39 SHA1 bd1f526fd6bdadce4e2894a7ee24f8e9f16679c6 SHA256 7d69ce200547be20b0ca1a5010352995036c2461d921a94aa44964a37a3921e0 +EBUILD sip-router-3.1.3.ebuild 6665 RMD160 01c9fcdbb400b606ccc74a179ded35aa6fd0bb39 SHA1 bd1f526fd6bdadce4e2894a7ee24f8e9f16679c6 SHA256 7d69ce200547be20b0ca1a5010352995036c2461d921a94aa44964a37a3921e0 +EBUILD sip-router-3.1.4-r1.ebuild 8118 RMD160 2f4c70fbfb12d19364d5abf66704f3425ee204a8 SHA1 e7b5b02f840fc1b06b49bf6b3e59a0531344d6be SHA256 ca8e4128372eccc7f1dd92a969bb02aab840864bb48c81d40e34879eb4a4fc9b +EBUILD sip-router-3.1.4.ebuild 7154 RMD160 eb3c99cab58cc54205d93cb094e33898c91aad0d SHA1 3be71ff8e560dfe7f70e938450435afec22c9fe2 SHA256 3449403c22c5b07ddd59e789601ddad57e8252c0e28d14e23c36c6e5b6780ad6 +MISC ChangeLog 954 RMD160 65b97f4702b4445d911a397a202baa0854dafb01 SHA1 7cc7a5d25b403e395162ddc76ec65354c23eee04 SHA256 dc2da375970f6312f490d3b9c4701508fb599c562f11baa7a7ecac3797df3c35 +MISC metadata.xml 234 RMD160 7e65eb5a9a08368288fc1e3608ddb9a4677defdd SHA1 93c38407f533f522647683eb7b7c2121bc6f3707 SHA256 4009ad9d312db0ece6fd53e9dfabda98e2c1037ec540eb64d6ab43fe318c1a25 diff --git a/pkg/ser/gentoo/files/siprouter.confd b/pkg/ser/gentoo/files/siprouter.confd new file mode 100644 index 000000000..38eaa19b0 --- /dev/null +++ b/pkg/ser/gentoo/files/siprouter.confd @@ -0,0 +1,15 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# Additional options to start Sip-Router with. +# +# see "siprouter -h" for a list of options +# +# default: run SER as user:group = siprouter:siprouter +# +SR_USER="siprouter" +SR_GROUP="siprouter" +CONFIGFILE="${CONFIGFILE:-/etc/siprouter/siprouter.cfg}" +CONFIGDEFS="" # eg: "-A WITH_DEBUG -A WITH_NAT -A WITH_TLS" +SR_OPTS="-u $SR_USER -g $SR_GROUP -f ${CONFIGFILE} ${CONFIGDEFS}" diff --git a/pkg/ser/gentoo/files/siprouter.init b/pkg/ser/gentoo/files/siprouter.init new file mode 100755 index 000000000..66e831560 --- /dev/null +++ b/pkg/ser/gentoo/files/siprouter.init @@ -0,0 +1,34 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +depend() { + need net +} + +check_config() { + out=`(/usr/sbin/siprouter -f ${CONFIGFILE} -c > /dev/null || true) 2>&1` + echo "$out" | grep -q 'config file ok, exiting...' + if [ "$?" == 1 ]; then + echo -e "There are errors in the configuration. Please fix them first" + echo -e "\n$out\n" + return 1 + fi +} + +start() { + check_config || return 1 + ebegin "Starting siprouter" + start-stop-daemon --start --quiet --pidfile /var/run/siprouter.pid \ + --exec /usr/sbin/siprouter -- -P /var/run/siprouter.pid \ + ${SR_OPTS} + eend $? +} + +stop() { + ebegin "Stopping siprouter" + start-stop-daemon --stop --quiet --pidfile /var/run/siprouter.pid + eend $? +} + diff --git a/pkg/ser/gentoo/metadata.xml b/pkg/ser/gentoo/metadata.xml new file mode 100644 index 000000000..d48077a34 --- /dev/null +++ b/pkg/ser/gentoo/metadata.xml @@ -0,0 +1,9 @@ + + + + voip + + maintainer-needed@gentoo.org + + + diff --git a/pkg/ser/gentoo/sip-router-3.1.2.ebuild b/pkg/ser/gentoo/sip-router-3.1.2.ebuild new file mode 100644 index 000000000..13bca39a3 --- /dev/null +++ b/pkg/ser/gentoo/sip-router-3.1.2.ebuild @@ -0,0 +1,224 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils flag-o-matic toolchain-funcs multilib + +DESCRIPTION="Sip-Router (Kamailio/SER) is an Open Source SIP Server" +HOMEPAGE="http://sip-router.org/" +MY_P="${P/sip-router/kamailio}" +MY_PN="${PN/-/}" +SRC_URI="http://www.kamailio.org/pub/kamailio/${PV}/src/${MY_P}_src.tar.gz" +S=${WORKDIR}/${MY_P} + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~amd64 ~x86" + +#Documentation can be found here: http://www.kamailio.org/docs/modules/3.1.x/ +IUSE="flavour_kamailio flavour_ser debug ipv6 sctp +group_standard group_standard_dep group_mysql group_radius group_postgres group_presence group_stable group_experimental +acc acc_radius alias_db app_lua app_python auth auth_identity auth_db auth_diameter auth_radius avpops +benchmark blst +call_control carrierroute cfg_db cfg_rpc cfgutils counters cpl-c ctl +db_berkeley db_flatstore db_mysql db_oracle db_postgres db_text db_unixodbc +debugger dialog dialplan dispatcher diversion domain domainpolicy drouting +enum exec +geoip group +h350 htable imc iptrtpproxy jabber kex +lcr ldap +matrix maxfwd mediaproxy memcached misc_radius mi_datagram mi_fifo mi_rpc mi_xmlrpc mqueue msilo mtree +nathelper nat_traversal +osp +path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route +presence presence_conference presence_dialoginfo presence_mwi presence_xml +pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp purple pv +qos +ratelimit regex registrar rls rtimer rr rtpproxy +sanity seas siptrace siputils sl sms snmpstats speeddial sqlops statistics sst +textops textopsx tls tm tmx topoh +uac uac_redirect uri_db userblacklist usrloc utils +xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp" + +#osp? ( net-libs/osptoolkit ) +#pdb? ( pdb-server ) +#seas? ( www.wesip.eu ) + +RDEPEND=" + >=sys-libs/ncurses-5.7 + >=sys-libs/readline-6.1_p2 + group_mysql? ( >=dev-db/mysql-5.1.50 sys-libs/zlib ) + group_radius? ( >=net-dialup/radiusclient-ng-0.5.0 ) + group_presence? ( dev-libs/libxml2 net-misc/curl ) + group_postgres? ( dev-db/postgresql-base ) + group_standard? ( dev-libs/libxml2 dev-libs/openssl net-misc/curl ) + acc_radius? ( net-dialup/radiusclient-ng ) + app_lua? ( dev-lang/lua ) + app_python? ( dev-lang/python ) + auth_identity? ( dev-libs/openssl net-misc/curl ) + carrierroute? ( dev-libs/confuse ) + cpl-c? ( dev-libs/libxml2 ) + db_berkeley? ( >=sys-libs/db-4.6 ) + db_mysql? ( >=dev-db/mysql-5.1.50 ) + db_oracle? ( dev-db/oracle-instantclient-basic ) + db_postgres? ( dev-db/postgresql-base ) + db_unixodbc? ( dev-db/unixODBC ) + dialplan? ( dev-libs/libpcre ) + geoip? ( dev-libs/geoip ) + h350? ( net-nds/openldap ) + jabber? ( dev-libs/expat ) + lcr? ( dev-libs/libpcre ) + ldap? ( net-nds/openldap ) + memcached? ( dev-libs/libmemcache net-misc/memcached ) + mi_xmlrpc? ( dev-libs/libxml2 dev-libs/xmlrpc-c ) + peering? ( net-dialup/radiusclient-ng ) + perl? ( dev-lang/perl dev-perl/perl-ldap ) + presence? ( dev-libs/libxml2 ) + presence_conference? ( dev-libs/libxml2 ) + presence_xml? ( dev-libs/libxml2 ) + pua? ( dev-libs/libxml2 ) + pua_bla? ( dev-libs/libxml2 ) + pua_dialoginfo? ( dev-libs/libxml2 ) + pua_usrloc? ( dev-libs/libxml2 ) + pua_xmpp? ( dev-libs/libxml2 ) + purple? ( net-im/pidgin ) + regex? ( dev-libs/libpcre ) + rls? ( dev-libs/libxml2 ) + snmpstats? ( net-analyzer/net-snmp sys-apps/lm_sensors ) + tls? ( + sys-libs/zlib + >=dev-libs/openssl-1.0.0a-r1 + ) + utils? ( net-misc/curl ) + xcap_client? ( dev-libs/libxml2 net-misc/curl ) + xcap_server? ( dev-libs/libxml2 ) + xmlops? ( dev-libs/libxml2 ) + xmpp? ( dev-libs/expat ) +" +DEPEND="${RDEPEND} + >=sys-devel/bison-1.35 + >=sys-devel/flex-2.5.4a + app-text/docbook2X" + +src_unpack() { + unpack ${A} + cd "${S}" + + use ipv6 || \ + sed -i -e "s/-DUSE_IPV6//g" Makefile.defs || die +} + +src_compile() { + #iptrtpproxy broken as the needed netfilter module is not supported + #local mod_exc="iptrtpproxy" + local mod_exc="" + local group_inc="" + use group_standard && group_inc="${group_inc} standard" + use group_standard_dep && group_inc="${group_inc} standard_dep" + use group_mysql && group_inc="${group_inc} mysql" + use group_radius && group_inc="${group_inc} radius" + use group_postgres && group_inc="${group_inc} postgres" + use group_presence && group_inc="${group_inc} presence" + use group_stable && group_inc="${group_inc} stable" + use group_experimental && group_inc="${group_inc} experimental" + # TODO: skip_modules? + + local mod_inc="" + for i in ${IUSE[@]}; do + for j in ${i[@]}; do + use "${i}" && mod_inc="${mod_inc} ${i}" + done + done + + if use tls; then + tls_hooks=1 + else + tls_hooks=0 + fi + + if use debug; then + mode=debug + else + mode=release + fi + + if use flavour_kamailio; then + flavour=kamailio + elif use flavour_ser; then + flavour=ser # SER compatibility names + else + flavour=sip-router # defaults: Siprouter compatibility names + fi + + if use sctp; then + sctp=1 + else + sctp=0 + fi + + emake \ + CC="$(tc-getCC)" \ + CPU_TYPE="$(get-flag march)" \ + SCTP="${sctp}" \ + CC_EXTRA_OPTS=-I/usr/gnu/include \ + mode="${mode}" \ + TLS_HOOKS="${tls_hooks}" \ + FLAVOUR="${flavour}" \ + group_include="${group_inc}" \ + include_modules="${mod_inc}" \ + exclude_modules="${mod_exc}" \ + prefix="/" \ + all || die "emake all failed" +} + +src_install() { + emake -j1 \ + BASEDIR="${D}" \ + FLAVOUR="${flavour}" \ + prefix="/" \ + bin_dir=/usr/sbin/ \ + cfg_dir=/etc/${MY_PN}/ \ + lib_dir=/usr/$(get_libdir)/${MY_PN}/ \ + modules_dir="/usr/$(get_libdir)/${MY_PN}/" \ + man_dir="/usr/share/man/" \ + doc_dir="/usr/share/doc/${P}/" \ + install || die "emake install failed" + + newinitd "${FILESDIR}/${MY_PN}".init "${MY_PN}" + newconfd "${FILESDIR}/${MY_PN}".confd "${MY_PN}" +} + +pkg_preinst() { + if [[ -z "$(egetent passwd ${MY_PN})" ]]; then + einfo "Adding ${MY_PN} user and group" + enewgroup "${MY_PN}" + enewuser "${MY_PN}" -1 -1 /dev/null "${MY_PN}" + fi + + chown -R root:"${MY_PN}" "${D}/etc/${MY_PN}" + chmod -R u=rwX,g=rX,o= "${D}/etc/${MY_PN}" + + has_version "${CATEGORY}/ser" + previous_installed_version=$? +} + +pkg_postinst() { + if [[ $previous_installed_version = 1 ]] ; then + einfo "You have a previous version of SER on ${ROOT}etc/ser" + einfo "Consider or verify to remove it" + einfo + einfo "Now you've installed Sip-Router ON ${ROOT}etc/${MY_PN}" + fi + if [ use mediaproxy ]; then + echo "You have enabled mediaproxy support. In order to use it, you have + to run it somewhere." + fi + if [ use rtpproxy ]; then + "You have enabled rtpproxy support. In order to use it, you have to run + it somewhere." + fi +} + +pkg_prerm () { + /etc/init.d/"${MY_PN}" stop >/dev/null +} diff --git a/pkg/ser/gentoo/sip-router-3.1.3.ebuild b/pkg/ser/gentoo/sip-router-3.1.3.ebuild new file mode 100644 index 000000000..13bca39a3 --- /dev/null +++ b/pkg/ser/gentoo/sip-router-3.1.3.ebuild @@ -0,0 +1,224 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils flag-o-matic toolchain-funcs multilib + +DESCRIPTION="Sip-Router (Kamailio/SER) is an Open Source SIP Server" +HOMEPAGE="http://sip-router.org/" +MY_P="${P/sip-router/kamailio}" +MY_PN="${PN/-/}" +SRC_URI="http://www.kamailio.org/pub/kamailio/${PV}/src/${MY_P}_src.tar.gz" +S=${WORKDIR}/${MY_P} + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~amd64 ~x86" + +#Documentation can be found here: http://www.kamailio.org/docs/modules/3.1.x/ +IUSE="flavour_kamailio flavour_ser debug ipv6 sctp +group_standard group_standard_dep group_mysql group_radius group_postgres group_presence group_stable group_experimental +acc acc_radius alias_db app_lua app_python auth auth_identity auth_db auth_diameter auth_radius avpops +benchmark blst +call_control carrierroute cfg_db cfg_rpc cfgutils counters cpl-c ctl +db_berkeley db_flatstore db_mysql db_oracle db_postgres db_text db_unixodbc +debugger dialog dialplan dispatcher diversion domain domainpolicy drouting +enum exec +geoip group +h350 htable imc iptrtpproxy jabber kex +lcr ldap +matrix maxfwd mediaproxy memcached misc_radius mi_datagram mi_fifo mi_rpc mi_xmlrpc mqueue msilo mtree +nathelper nat_traversal +osp +path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route +presence presence_conference presence_dialoginfo presence_mwi presence_xml +pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp purple pv +qos +ratelimit regex registrar rls rtimer rr rtpproxy +sanity seas siptrace siputils sl sms snmpstats speeddial sqlops statistics sst +textops textopsx tls tm tmx topoh +uac uac_redirect uri_db userblacklist usrloc utils +xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp" + +#osp? ( net-libs/osptoolkit ) +#pdb? ( pdb-server ) +#seas? ( www.wesip.eu ) + +RDEPEND=" + >=sys-libs/ncurses-5.7 + >=sys-libs/readline-6.1_p2 + group_mysql? ( >=dev-db/mysql-5.1.50 sys-libs/zlib ) + group_radius? ( >=net-dialup/radiusclient-ng-0.5.0 ) + group_presence? ( dev-libs/libxml2 net-misc/curl ) + group_postgres? ( dev-db/postgresql-base ) + group_standard? ( dev-libs/libxml2 dev-libs/openssl net-misc/curl ) + acc_radius? ( net-dialup/radiusclient-ng ) + app_lua? ( dev-lang/lua ) + app_python? ( dev-lang/python ) + auth_identity? ( dev-libs/openssl net-misc/curl ) + carrierroute? ( dev-libs/confuse ) + cpl-c? ( dev-libs/libxml2 ) + db_berkeley? ( >=sys-libs/db-4.6 ) + db_mysql? ( >=dev-db/mysql-5.1.50 ) + db_oracle? ( dev-db/oracle-instantclient-basic ) + db_postgres? ( dev-db/postgresql-base ) + db_unixodbc? ( dev-db/unixODBC ) + dialplan? ( dev-libs/libpcre ) + geoip? ( dev-libs/geoip ) + h350? ( net-nds/openldap ) + jabber? ( dev-libs/expat ) + lcr? ( dev-libs/libpcre ) + ldap? ( net-nds/openldap ) + memcached? ( dev-libs/libmemcache net-misc/memcached ) + mi_xmlrpc? ( dev-libs/libxml2 dev-libs/xmlrpc-c ) + peering? ( net-dialup/radiusclient-ng ) + perl? ( dev-lang/perl dev-perl/perl-ldap ) + presence? ( dev-libs/libxml2 ) + presence_conference? ( dev-libs/libxml2 ) + presence_xml? ( dev-libs/libxml2 ) + pua? ( dev-libs/libxml2 ) + pua_bla? ( dev-libs/libxml2 ) + pua_dialoginfo? ( dev-libs/libxml2 ) + pua_usrloc? ( dev-libs/libxml2 ) + pua_xmpp? ( dev-libs/libxml2 ) + purple? ( net-im/pidgin ) + regex? ( dev-libs/libpcre ) + rls? ( dev-libs/libxml2 ) + snmpstats? ( net-analyzer/net-snmp sys-apps/lm_sensors ) + tls? ( + sys-libs/zlib + >=dev-libs/openssl-1.0.0a-r1 + ) + utils? ( net-misc/curl ) + xcap_client? ( dev-libs/libxml2 net-misc/curl ) + xcap_server? ( dev-libs/libxml2 ) + xmlops? ( dev-libs/libxml2 ) + xmpp? ( dev-libs/expat ) +" +DEPEND="${RDEPEND} + >=sys-devel/bison-1.35 + >=sys-devel/flex-2.5.4a + app-text/docbook2X" + +src_unpack() { + unpack ${A} + cd "${S}" + + use ipv6 || \ + sed -i -e "s/-DUSE_IPV6//g" Makefile.defs || die +} + +src_compile() { + #iptrtpproxy broken as the needed netfilter module is not supported + #local mod_exc="iptrtpproxy" + local mod_exc="" + local group_inc="" + use group_standard && group_inc="${group_inc} standard" + use group_standard_dep && group_inc="${group_inc} standard_dep" + use group_mysql && group_inc="${group_inc} mysql" + use group_radius && group_inc="${group_inc} radius" + use group_postgres && group_inc="${group_inc} postgres" + use group_presence && group_inc="${group_inc} presence" + use group_stable && group_inc="${group_inc} stable" + use group_experimental && group_inc="${group_inc} experimental" + # TODO: skip_modules? + + local mod_inc="" + for i in ${IUSE[@]}; do + for j in ${i[@]}; do + use "${i}" && mod_inc="${mod_inc} ${i}" + done + done + + if use tls; then + tls_hooks=1 + else + tls_hooks=0 + fi + + if use debug; then + mode=debug + else + mode=release + fi + + if use flavour_kamailio; then + flavour=kamailio + elif use flavour_ser; then + flavour=ser # SER compatibility names + else + flavour=sip-router # defaults: Siprouter compatibility names + fi + + if use sctp; then + sctp=1 + else + sctp=0 + fi + + emake \ + CC="$(tc-getCC)" \ + CPU_TYPE="$(get-flag march)" \ + SCTP="${sctp}" \ + CC_EXTRA_OPTS=-I/usr/gnu/include \ + mode="${mode}" \ + TLS_HOOKS="${tls_hooks}" \ + FLAVOUR="${flavour}" \ + group_include="${group_inc}" \ + include_modules="${mod_inc}" \ + exclude_modules="${mod_exc}" \ + prefix="/" \ + all || die "emake all failed" +} + +src_install() { + emake -j1 \ + BASEDIR="${D}" \ + FLAVOUR="${flavour}" \ + prefix="/" \ + bin_dir=/usr/sbin/ \ + cfg_dir=/etc/${MY_PN}/ \ + lib_dir=/usr/$(get_libdir)/${MY_PN}/ \ + modules_dir="/usr/$(get_libdir)/${MY_PN}/" \ + man_dir="/usr/share/man/" \ + doc_dir="/usr/share/doc/${P}/" \ + install || die "emake install failed" + + newinitd "${FILESDIR}/${MY_PN}".init "${MY_PN}" + newconfd "${FILESDIR}/${MY_PN}".confd "${MY_PN}" +} + +pkg_preinst() { + if [[ -z "$(egetent passwd ${MY_PN})" ]]; then + einfo "Adding ${MY_PN} user and group" + enewgroup "${MY_PN}" + enewuser "${MY_PN}" -1 -1 /dev/null "${MY_PN}" + fi + + chown -R root:"${MY_PN}" "${D}/etc/${MY_PN}" + chmod -R u=rwX,g=rX,o= "${D}/etc/${MY_PN}" + + has_version "${CATEGORY}/ser" + previous_installed_version=$? +} + +pkg_postinst() { + if [[ $previous_installed_version = 1 ]] ; then + einfo "You have a previous version of SER on ${ROOT}etc/ser" + einfo "Consider or verify to remove it" + einfo + einfo "Now you've installed Sip-Router ON ${ROOT}etc/${MY_PN}" + fi + if [ use mediaproxy ]; then + echo "You have enabled mediaproxy support. In order to use it, you have + to run it somewhere." + fi + if [ use rtpproxy ]; then + "You have enabled rtpproxy support. In order to use it, you have to run + it somewhere." + fi +} + +pkg_prerm () { + /etc/init.d/"${MY_PN}" stop >/dev/null +} diff --git a/pkg/ser/gentoo/sip-router-3.1.4-r1.ebuild b/pkg/ser/gentoo/sip-router-3.1.4-r1.ebuild new file mode 100644 index 000000000..ccf40830d --- /dev/null +++ b/pkg/ser/gentoo/sip-router-3.1.4-r1.ebuild @@ -0,0 +1,254 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils flag-o-matic toolchain-funcs multilib + +DESCRIPTION="Sip-Router (Kamailio/SER) is an Open Source SIP Server" +HOMEPAGE="http://sip-router.org/" +MY_P="${P/sip-router/kamailio}" +MY_PN="${PN/-/}" +SRC_URI="http://www.kamailio.org/pub/kamailio/${PV}/src/${MY_P}_src.tar.gz" +S=${WORKDIR}/${MY_P} + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~amd64 ~x86" + +#Documentation can be found here: http://www.kamailio.org/docs/modules/3.1.x/ +IUSE="flavour_kamailio flavour_ser debug ipv6 sctp +group_standard group_standard_dep group_mysql group_radius group_postgres group_presence group_stable group_experimental +group_kstandard group_kmysql group_kradius group_kpostgres group_kpresence group_kxml group_kperl group_kldap +acc acc_radius alias_db app_lua app_python auth auth_identity auth_db auth_diameter auth_radius avpops +benchmark blst +call_control carrierroute cfg_db cfg_rpc cfgutils counters cpl-c ctl +db_berkeley db_flatstore db_mysql db_oracle db_postgres db_text db_unixodbc +debugger dialog dialplan dispatcher diversion domain domainpolicy drouting +enum exec +geoip group +h350 htable imc iptrtpproxy jabber kex +lcr ldap +matrix maxfwd mediaproxy memcached misc_radius mi_datagram mi_fifo mi_rpc mi_xmlrpc mqueue msilo mtree +nathelper nat_traversal +osp +path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route +presence presence_conference presence_dialoginfo presence_mwi presence_xml +pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp purple pv +qos +ratelimit regex registrar rls rtimer rr rtpproxy +sanity seas siptrace siputils sl sms snmpstats speeddial sqlops statistics sst +textops textopsx tls tm tmx topoh +uac uac_redirect uri_db userblacklist usrloc utils +xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp" + +#osp? ( net-libs/osptoolkit ) +#pdb? ( pdb-server ) +#seas? ( www.wesip.eu ) + +RDEPEND=" + >=sys-libs/ncurses-5.7 + >=sys-libs/readline-6.1_p2 + group_mysql? ( >=dev-db/mysql-5.1.50 sys-libs/zlib ) + group_radius? ( >=net-dialup/radiusclient-ng-0.5.0 ) + group_presence? ( dev-libs/libxml2 net-misc/curl ) + group_postgres? ( dev-db/postgresql-base ) + group_standard? ( dev-libs/libxml2 dev-libs/openssl net-misc/curl ) + group_kmysql? ( >=dev-db/mysql-5.1.50 sys-libs/zlib ) + group_kradius? ( >=net-dialup/radiusclient-ng-0.5.0 ) + group_kpresence? ( dev-libs/libxml2 net-misc/curl ) + group_kpostgres? ( dev-db/postgresql-base ) + group_kstandard? ( dev-libs/libxml2 dev-libs/openssl net-misc/curl ) + group_kxml? ( dev-libs/libxml2 dev-libs/xmlrpc-c ) + group_kperl? ( dev-lang/perl dev-perl/perl-ldap ) + group_kldap? ( net-nds/openldap ) + acc_radius? ( net-dialup/radiusclient-ng ) + app_lua? ( dev-lang/lua ) + app_python? ( dev-lang/python ) + auth_identity? ( dev-libs/openssl net-misc/curl ) + carrierroute? ( dev-libs/confuse ) + cpl-c? ( dev-libs/libxml2 ) + db_berkeley? ( >=sys-libs/db-4.6 ) + db_mysql? ( >=dev-db/mysql-5.1.50 ) + db_oracle? ( dev-db/oracle-instantclient-basic ) + db_postgres? ( dev-db/postgresql-base ) + db_unixodbc? ( dev-db/unixODBC ) + dialplan? ( dev-libs/libpcre ) + geoip? ( dev-libs/geoip ) + h350? ( net-nds/openldap ) + jabber? ( dev-libs/expat ) + lcr? ( dev-libs/libpcre ) + ldap? ( net-nds/openldap ) + memcached? ( dev-libs/libmemcache net-misc/memcached ) + mi_xmlrpc? ( dev-libs/libxml2 dev-libs/xmlrpc-c ) + peering? ( net-dialup/radiusclient-ng ) + perl? ( dev-lang/perl dev-perl/perl-ldap ) + presence? ( dev-libs/libxml2 ) + presence_conference? ( dev-libs/libxml2 ) + presence_xml? ( dev-libs/libxml2 ) + pua? ( dev-libs/libxml2 ) + pua_bla? ( dev-libs/libxml2 ) + pua_dialoginfo? ( dev-libs/libxml2 ) + pua_usrloc? ( dev-libs/libxml2 ) + pua_xmpp? ( dev-libs/libxml2 ) + purple? ( net-im/pidgin ) + regex? ( dev-libs/libpcre ) + rls? ( dev-libs/libxml2 ) + snmpstats? ( net-analyzer/net-snmp sys-apps/lm_sensors ) + tls? ( + sys-libs/zlib + >=dev-libs/openssl-1.0.0a-r1 + ) + utils? ( net-misc/curl ) + xcap_client? ( dev-libs/libxml2 net-misc/curl ) + xcap_server? ( dev-libs/libxml2 ) + xmlops? ( dev-libs/libxml2 ) + xmpp? ( dev-libs/expat ) +" +DEPEND="${RDEPEND} + >=sys-devel/bison-1.35 + >=sys-devel/flex-2.5.4a + app-text/docbook2X" + +src_unpack() { + unpack ${A} + cd "${S}" + + use ipv6 || \ + sed -i -e "s/-DUSE_IPV6//g" Makefile.defs || die +} + +src_compile() { + # iptrtpproxy broken as the needed netfilter module is not supported + local mod_exc="iptrtpproxy" + local group_inc="" + local k="" + if use flavour_kamailio; then + k="k" + use group_kxml && group_inc="${group_inc} kxml" + use group_kperl && group_inc="${group_inc} kperl" + use group_kldap && group_inc="${group_inc} kldap" + fi + # you can USE flavour=kamailio but also group_standard. It will be converted to group_kstandard + # same as mysql/kmysql, postgres/kpostgres, radius/kradius, presence/kpresence + (use group_standard || use group_kstandard) && group_inc="${group_inc} ${k}standard" + use group_standard_dep && group_inc="${group_inc} standard_dep" + (use group_mysql || use group_kmysql) && group_inc="${group_inc} ${k}mysql" + (use group_radius || use group_kradius) && group_inc="${group_inc} ${k}radius" + (use group_postgres || use group_kpostgres) && group_inc="${group_inc} ${k}postgres" + (use group_presence || use group_kpresence) && group_inc="${group_inc} ${k}presence" + use group_stable && group_inc="${group_inc} stable" + use group_experimental && group_inc="${group_inc} experimental" + # TODO: skip_modules? + + local mod_inc="" + # FIXME: some IUSE flags must not be included here in mod_inc + # e.g.: flavour_kamailio, flavour_ser, debug, sctp, ipv6 + for i in ${IUSE[@]}; do + for j in ${i[@]}; do + [[ ! "${i}" =~ "flavour_" ]] && \ + [ ! "${i}" == "debug" ] && \ + [ ! "${i}" == "ipv6" ] && \ + [ ! "${i}" == "sctp" ] && \ + [[ ! "${i}" =~ "group_" ]] && \ + use "${i}" && mod_inc="${mod_inc} ${i}" + done + done + + if use tls; then + tls_hooks=1 + else + tls_hooks=0 + fi + + if use debug; then + mode=debug + else + mode=release + fi + + if use flavour_kamailio; then + flavour=kamailio + elif use flavour_ser; then + flavour=ser # SER compatibility names + else + flavour=sip-router # defaults: Siprouter compatibility names + fi + + if use sctp; then + sctp=1 + else + sctp=0 + fi + + emake \ + CC="$(tc-getCC)" \ + CPU_TYPE="$(get-flag march)" \ + SCTP="${sctp}" \ + CC_EXTRA_OPTS=-I/usr/gnu/include \ + mode="${mode}" \ + TLS_HOOKS="${tls_hooks}" \ + FLAVOUR="${flavour}" \ + group_include="${group_inc}" \ + include_modules="${mod_inc}" \ + exclude_modules="${mod_exc}" \ + prefix="/" \ + all || die "emake all failed" +} + +src_install() { + emake -j1 \ + BASEDIR="${D}" \ + FLAVOUR="${flavour}" \ + prefix="/" \ + bin_dir=/usr/sbin/ \ + cfg_dir=/etc/${MY_PN}/ \ + lib_dir=/usr/$(get_libdir)/${MY_PN}/ \ + modules_dir="/usr/$(get_libdir)/${MY_PN}/" \ + man_dir="/usr/share/man/" \ + doc_dir="/usr/share/doc/${P}/" \ + install || die "emake install failed" + + [ "${flavour}" == "sip-router" ] || \ + sed -e "s/siprouter/${flavour}/g" \ + ${FILESDIR}/${MY_PN}.init > ${flavour}.init || die + + newinitd "${flavour}".init "${flavour}" + newconfd "${FILESDIR}/${MY_PN}".confd "${flavour}" + + +} + +pkg_preinst() { + if [[ -z "$(egetent passwd ${MY_PN})" ]]; then + einfo "Adding ${MY_PN} user and group" + enewgroup "${MY_PN}" + enewuser "${MY_PN}" -1 -1 /dev/null "${MY_PN}" + fi + + chown -R root:"${MY_PN}" "${D}/etc/${MY_PN}" + chmod -R u=rwX,g=rX,o= "${D}/etc/${MY_PN}" + + has_version "${CATEGORY}/ser" + previous_installed_version=$? +} + +pkg_postinst() { + if [[ $previous_installed_version = 1 ]] ; then + einfo "You have a previous version of SER on ${ROOT}etc/ser" + einfo "Consider or verify to remove it" + einfo + einfo "Now you've installed Sip-Router ON ${ROOT}etc/${MY_PN}" + fi + if [ use mediaproxy ]; then + echo "You have enabled mediaproxy support. In order to use it, you have + to run it somewhere." + fi + if [ use rtpproxy ]; then + "You have enabled rtpproxy support. In order to use it, you have to run + it somewhere." + fi +} + +pkg_prerm () { + /etc/init.d/"${MY_PN}" stop >/dev/null +} diff --git a/pkg/ser/gentoo/sip-router-3.1.4.ebuild b/pkg/ser/gentoo/sip-router-3.1.4.ebuild new file mode 100644 index 000000000..2ade9c496 --- /dev/null +++ b/pkg/ser/gentoo/sip-router-3.1.4.ebuild @@ -0,0 +1,238 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils flag-o-matic toolchain-funcs multilib + +DESCRIPTION="Sip-Router (Kamailio/SER) is an Open Source SIP Server" +HOMEPAGE="http://sip-router.org/" +MY_P="${P/sip-router/kamailio}" +MY_PN="${PN/-/}" +SRC_URI="http://www.kamailio.org/pub/kamailio/${PV}/src/${MY_P}_src.tar.gz" +S=${WORKDIR}/${MY_P} + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~amd64 ~x86" + +#Documentation can be found here: http://www.kamailio.org/docs/modules/3.1.x/ +IUSE="flavour_kamailio flavour_ser debug ipv6 sctp +group_standard group_standard_dep group_mysql group_radius group_postgres group_presence group_stable group_experimental +acc acc_radius alias_db app_lua app_python auth auth_identity auth_db auth_diameter auth_radius avpops +benchmark blst +call_control carrierroute cfg_db cfg_rpc cfgutils counters cpl-c ctl +db_berkeley db_flatstore db_mysql db_oracle db_postgres db_text db_unixodbc +debugger dialog dialplan dispatcher diversion domain domainpolicy drouting +enum exec +geoip group +h350 htable imc iptrtpproxy jabber kex +lcr ldap +matrix maxfwd mediaproxy memcached misc_radius mi_datagram mi_fifo mi_rpc mi_xmlrpc mqueue msilo mtree +nathelper nat_traversal +osp +path pdb pdt peering perl perlvdb permissions pike pipelimit prefix_route +presence presence_conference presence_dialoginfo presence_mwi presence_xml +pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp purple pv +qos +ratelimit regex registrar rls rtimer rr rtpproxy +sanity seas siptrace siputils sl sms snmpstats speeddial sqlops statistics sst +textops textopsx tls tm tmx topoh +uac uac_redirect uri_db userblacklist usrloc utils +xcap_client xcap_server xhttp xlog xmlops xmlrpc xmpp" + +#osp? ( net-libs/osptoolkit ) +#pdb? ( pdb-server ) +#seas? ( www.wesip.eu ) + +RDEPEND=" + >=sys-libs/ncurses-5.7 + >=sys-libs/readline-6.1_p2 + group_mysql? ( >=dev-db/mysql-5.1.50 sys-libs/zlib ) + group_radius? ( >=net-dialup/radiusclient-ng-0.5.0 ) + group_presence? ( dev-libs/libxml2 net-misc/curl ) + group_postgres? ( dev-db/postgresql-base ) + group_standard? ( dev-libs/libxml2 dev-libs/openssl net-misc/curl ) + acc_radius? ( net-dialup/radiusclient-ng ) + app_lua? ( dev-lang/lua ) + app_python? ( dev-lang/python ) + auth_identity? ( dev-libs/openssl net-misc/curl ) + carrierroute? ( dev-libs/confuse ) + cpl-c? ( dev-libs/libxml2 ) + db_berkeley? ( >=sys-libs/db-4.6 ) + db_mysql? ( >=dev-db/mysql-5.1.50 ) + db_oracle? ( dev-db/oracle-instantclient-basic ) + db_postgres? ( dev-db/postgresql-base ) + db_unixodbc? ( dev-db/unixODBC ) + dialplan? ( dev-libs/libpcre ) + geoip? ( dev-libs/geoip ) + h350? ( net-nds/openldap ) + jabber? ( dev-libs/expat ) + lcr? ( dev-libs/libpcre ) + ldap? ( net-nds/openldap ) + memcached? ( dev-libs/libmemcache net-misc/memcached ) + mi_xmlrpc? ( dev-libs/libxml2 dev-libs/xmlrpc-c ) + peering? ( net-dialup/radiusclient-ng ) + perl? ( dev-lang/perl dev-perl/perl-ldap ) + presence? ( dev-libs/libxml2 ) + presence_conference? ( dev-libs/libxml2 ) + presence_xml? ( dev-libs/libxml2 ) + pua? ( dev-libs/libxml2 ) + pua_bla? ( dev-libs/libxml2 ) + pua_dialoginfo? ( dev-libs/libxml2 ) + pua_usrloc? ( dev-libs/libxml2 ) + pua_xmpp? ( dev-libs/libxml2 ) + purple? ( net-im/pidgin ) + regex? ( dev-libs/libpcre ) + rls? ( dev-libs/libxml2 ) + snmpstats? ( net-analyzer/net-snmp sys-apps/lm_sensors ) + tls? ( + sys-libs/zlib + >=dev-libs/openssl-1.0.0a-r1 + ) + utils? ( net-misc/curl ) + xcap_client? ( dev-libs/libxml2 net-misc/curl ) + xcap_server? ( dev-libs/libxml2 ) + xmlops? ( dev-libs/libxml2 ) + xmpp? ( dev-libs/expat ) +" +DEPEND="${RDEPEND} + >=sys-devel/bison-1.35 + >=sys-devel/flex-2.5.4a + app-text/docbook2X" + +src_unpack() { + unpack ${A} + cd "${S}" + + use ipv6 || \ + sed -i -e "s/-DUSE_IPV6//g" Makefile.defs || die +} + +src_compile() { + #iptrtpproxy broken as the needed netfilter module is not supported + #local mod_exc="iptrtpproxy" + local mod_exc="" + local group_inc="" + use group_standard && group_inc="${group_inc} standard" + use group_standard_dep && group_inc="${group_inc} standard_dep" + use group_mysql && group_inc="${group_inc} mysql" + use group_radius && group_inc="${group_inc} radius" + use group_postgres && group_inc="${group_inc} postgres" + use group_presence && group_inc="${group_inc} presence" + use group_stable && group_inc="${group_inc} stable" + use group_experimental && group_inc="${group_inc} experimental" + # TODO: add kamailio specific groups (kstandard, kradius, kxml, etc) + # TODO: skip_modules? + + local mod_inc="" + # FIXME: some IUSE flags must not be included here in mod_inc + # e.g.: flavour_kamailio, flavour_ser, debug, sctp, ipv6 + for i in ${IUSE[@]}; do + for j in ${i[@]}; do + [[ ! "${i}" =~ "flavour_" ]] && \ + [ ! "${i}" == "debug" ] && \ + [ ! "${i}" == "ipv6" ] && \ + [ ! "${i}" == "sctp" ] && \ + [[ ! "${i}" =~ "group_" ]] && \ + use "${i}" && mod_inc="${mod_inc} ${i}" + done + done + + if use tls; then + tls_hooks=1 + else + tls_hooks=0 + fi + + if use debug; then + mode=debug + else + mode=release + fi + + if use flavour_kamailio; then + flavour=kamailio + elif use flavour_ser; then + flavour=ser # SER compatibility names + else + flavour=sip-router # defaults: Siprouter compatibility names + fi + + if use sctp; then + sctp=1 + else + sctp=0 + fi + + emake \ + CC="$(tc-getCC)" \ + CPU_TYPE="$(get-flag march)" \ + SCTP="${sctp}" \ + CC_EXTRA_OPTS=-I/usr/gnu/include \ + mode="${mode}" \ + TLS_HOOKS="${tls_hooks}" \ + FLAVOUR="${flavour}" \ + group_include="${group_inc}" \ + include_modules="${mod_inc}" \ + exclude_modules="${mod_exc}" \ + prefix="/" \ + all || die "emake all failed" +} + +src_install() { + emake -j1 \ + BASEDIR="${D}" \ + FLAVOUR="${flavour}" \ + prefix="/" \ + bin_dir=/usr/sbin/ \ + cfg_dir=/etc/${MY_PN}/ \ + lib_dir=/usr/$(get_libdir)/${MY_PN}/ \ + modules_dir="/usr/$(get_libdir)/${MY_PN}/" \ + man_dir="/usr/share/man/" \ + doc_dir="/usr/share/doc/${P}/" \ + install || die "emake install failed" + + [ "${flavour}" == "sip-router" ] || \ + sed -e "s/siprouter/${flavour}/g" \ + ${FILESDIR}/${MY_PN}.init > ${flavour}.init || die + + newinitd "${flavour}".init "${flavour}" + newconfd "${FILESDIR}/${MY_PN}".confd "${flavour}" + + +} + +pkg_preinst() { + if [[ -z "$(egetent passwd ${MY_PN})" ]]; then + einfo "Adding ${MY_PN} user and group" + enewgroup "${MY_PN}" + enewuser "${MY_PN}" -1 -1 /dev/null "${MY_PN}" + fi + + chown -R root:"${MY_PN}" "${D}/etc/${MY_PN}" + chmod -R u=rwX,g=rX,o= "${D}/etc/${MY_PN}" + + has_version "${CATEGORY}/ser" + previous_installed_version=$? +} + +pkg_postinst() { + if [[ $previous_installed_version = 1 ]] ; then + einfo "You have a previous version of SER on ${ROOT}etc/ser" + einfo "Consider or verify to remove it" + einfo + einfo "Now you've installed Sip-Router ON ${ROOT}etc/${MY_PN}" + fi + if [ use mediaproxy ]; then + echo "You have enabled mediaproxy support. In order to use it, you have + to run it somewhere." + fi + if [ use rtpproxy ]; then + "You have enabled rtpproxy support. In order to use it, you have to run + it somewhere." + fi +} + +pkg_prerm () { + /etc/init.d/"${MY_PN}" stop >/dev/null +} diff --git a/resolve.c b/resolve.c index a10631570..782c15ab9 100644 --- a/resolve.c +++ b/resolve.c @@ -1017,7 +1017,7 @@ char naptr_get_sip_proto(struct naptr_rdata* n) proto=-1; - if ((n->flags_len!=1) || (*n->flags!='s')) + if ((n->flags_len!=1) || ((*n->flags | 0x20 )!='s')) return -1; if (n->regexp_len!=0) return -1; diff --git a/rvalue.c b/rvalue.c index 9195972fd..ea861e6be 100644 --- a/rvalue.c +++ b/rvalue.c @@ -501,12 +501,16 @@ enum rval_type rve_guess_type( struct rval_expr* rve) case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_MINUS_OP: case RVE_MUL_OP: case RVE_DIV_OP: case RVE_MOD_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -565,6 +569,7 @@ int rve_is_constant(struct rval_expr* rve) case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_STRLEN_OP: case RVE_STREMPTY_OP: case RVE_DEFINED_OP: @@ -577,6 +582,9 @@ int rve_is_constant(struct rval_expr* rve) case RVE_MOD_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -625,6 +633,7 @@ static int rve_op_unary(enum rval_expr_op op) case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_STRLEN_OP: case RVE_STREMPTY_OP: case RVE_DEFINED_OP: @@ -637,6 +646,9 @@ static int rve_op_unary(enum rval_expr_op op) case RVE_MOD_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -689,6 +701,7 @@ int rve_check_type(enum rval_type* type, struct rval_expr* rve, case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: *type=RV_INT; if (rve_check_type(&type1, rve->left.rve, bad_rve, bad_t, exp_t)){ if (type1==RV_STR){ @@ -707,6 +720,9 @@ int rve_check_type(enum rval_type* type, struct rval_expr* rve, case RVE_MOD_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -1326,6 +1342,9 @@ inline static int int_intop1(int* res, enum rval_expr_op op, int v) case RVE_LNOT_OP: *res=!v; break; + case RVE_BNOT_OP: + *res=~v; + break; default: BUG("rv unsupported intop1 %d\n", op); return -1; @@ -1371,6 +1390,15 @@ inline static int int_intop2(int* res, enum rval_expr_op op, int v1, int v2) case RVE_BAND_OP: *res=v1&v2; break; + case RVE_BXOR_OP: + *res=v1^v2; + break; + case RVE_BLSHIFT_OP: + *res=v1<>v2; + break; case RVE_LAND_OP: *res=v1 && v2; break; @@ -1870,6 +1898,7 @@ int rval_expr_eval_int( struct run_act_ctx* h, struct sip_msg* msg, case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: if (unlikely( (ret=rval_expr_eval_int(h, msg, &i1, rve->left.rve)) <0) ) break; @@ -1886,6 +1915,9 @@ int rval_expr_eval_int( struct run_act_ctx* h, struct sip_msg* msg, case RVE_IPLUS_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_GT_OP: case RVE_GTE_OP: case RVE_LT_OP: @@ -2154,12 +2186,16 @@ int rval_expr_eval_rvint( struct run_act_ctx* h, case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_MINUS_OP: case RVE_MUL_OP: case RVE_DIV_OP: case RVE_MOD_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -2273,12 +2309,16 @@ struct rvalue* rval_expr_eval(struct run_act_ctx* h, struct sip_msg* msg, case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_MINUS_OP: case RVE_MUL_OP: case RVE_DIV_OP: case RVE_MOD_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -2531,6 +2571,7 @@ struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1, case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_STRLEN_OP: case RVE_STREMPTY_OP: case RVE_DEFINED_OP: @@ -2573,6 +2614,9 @@ struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct rval_expr* rve1, case RVE_MINUS_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: @@ -2616,6 +2660,7 @@ static int rve_op_is_assoc(enum rval_expr_op op) case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_STRLEN_OP: case RVE_STREMPTY_OP: case RVE_DEFINED_OP: @@ -2626,6 +2671,8 @@ static int rve_op_is_assoc(enum rval_expr_op op) case RVE_DIV_OP: case RVE_MOD_OP: case RVE_MINUS_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: return 0; case RVE_PLUS_OP: /* the generic plus is not assoc, e.g. @@ -2636,6 +2683,7 @@ static int rve_op_is_assoc(enum rval_expr_op op) case RVE_MUL_OP: case RVE_BAND_OP: case RVE_BOR_OP: + case RVE_BXOR_OP: return 1; case RVE_LAND_OP: case RVE_LOR_OP: @@ -2667,6 +2715,7 @@ static int rve_op_is_commutative(enum rval_expr_op op) case RVE_UMINUS_OP: case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_STRLEN_OP: case RVE_STREMPTY_OP: case RVE_DEFINED_OP: @@ -2677,6 +2726,8 @@ static int rve_op_is_commutative(enum rval_expr_op op) case RVE_DIV_OP: case RVE_MOD_OP: case RVE_MINUS_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: return 0; case RVE_PLUS_OP: /* non commut. when diff. type @@ -2687,6 +2738,7 @@ static int rve_op_is_commutative(enum rval_expr_op op) case RVE_MUL_OP: case RVE_BAND_OP: case RVE_BOR_OP: + case RVE_BXOR_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_IEQ_OP: @@ -3712,6 +3764,7 @@ int fix_rval_expr(void* p) case RVE_UMINUS_OP: /* unary operators */ case RVE_BOOL_OP: case RVE_LNOT_OP: + case RVE_BNOT_OP: case RVE_STRLEN_OP: case RVE_STREMPTY_OP: case RVE_DEFINED_OP: @@ -3726,6 +3779,9 @@ int fix_rval_expr(void* p) case RVE_MINUS_OP: case RVE_BOR_OP: case RVE_BAND_OP: + case RVE_BXOR_OP: + case RVE_BLSHIFT_OP: + case RVE_BRSHIFT_OP: case RVE_LAND_OP: case RVE_LOR_OP: case RVE_GT_OP: diff --git a/rvalue.h b/rvalue.h index 8e67c2e9a..cc9085c9d 100644 --- a/rvalue.h +++ b/rvalue.h @@ -53,12 +53,16 @@ enum rval_expr_op{ RVE_UMINUS_OP, /* one member expression, returns -(val) */ RVE_BOOL_OP, /* one member evaluate as bool. : (val!=0)*/ RVE_LNOT_OP, /* one member evaluate as bool. : (!val)*/ + RVE_BNOT_OP, /* one member evaluate as binary : (~ val)*/ RVE_MUL_OP, /* 2 members, returns left * right */ RVE_DIV_OP, /* 2 members, returns left / right */ RVE_MOD_OP, /* 2 members, returns left % right */ RVE_MINUS_OP, /* 2 members, returns left - right */ RVE_BAND_OP, /* 2 members, returns left | right */ RVE_BOR_OP, /* 2 members, returns left & right */ + RVE_BXOR_OP, /* 2 members, returns left XOR right */ + RVE_BLSHIFT_OP, /* 2 members, returns left << right */ + RVE_BRSHIFT_OP, /* 2 members, returns left >> right */ RVE_LAND_OP, /* 2 members, returns left && right */ RVE_LOR_OP, /* 2 members, returns left || right */ RVE_GT_OP, /* 2 members, returns left > right */ diff --git a/sctp_server.c b/sctp_server.c index cfd7015db..fbe83ea7f 100644 --- a/sctp_server.c +++ b/sctp_server.c @@ -2460,6 +2460,9 @@ int sctp_rcv_loop() continue; /* goto skip;*/ else goto error; } + /* update the local config */ + cfg_update(); + if (unlikely(msg.msg_flags & MSG_NOTIFICATION)){ /* intercept useful notifications */ sctp_handle_notification(bind_address, &ri.src_su, buf, len); @@ -2518,8 +2521,6 @@ int sctp_rcv_loop() #ifdef USE_COMP ri.comp=COMP_NONE; #endif - /* update the local config */ - cfg_update(); #ifdef SCTP_CONN_REUSE if (likely(cfg_get(sctp, sctp_cfg, assoc_tracking) && sinfo)){ ri.proto_reserved1 = sctp_con_track(sinfo->sinfo_assoc_id, diff --git a/ser_stun.c b/ser_stun.c index 6957a889c..879a7ef7a 100644 --- a/ser_stun.c +++ b/ser_stun.c @@ -224,7 +224,7 @@ int stun_parse_body( struct stun_unknown_att** unknown, USHORT_T* error_code) { - UINT_T not_parsed; + int not_parsed; struct stun_attr attr; USHORT_T attr_size; UINT_T padded_len; @@ -384,6 +384,13 @@ int stun_parse_body( padded_len = ntohs(attr.len); break; } + + /* check if there is enough unparsed space for the padded attribute + (the padded length might be greater then the attribute length) + */ + if (not_parsed < padded_len) { + break; + } buf += padded_len; not_parsed -= padded_len; } /* while */ @@ -772,7 +779,7 @@ int copy_str_to_buffer(struct stun_msg* res, const char* data, UINT_T pad) data_len = strlen(data); memset(&empty, 0, pad); - pad_len = pad - data_len%pad; + pad_len = (pad - data_len%pad) % pad; if (buf_copy(&res->msg, (void *) data, sizeof(UCHAR_T)*data_len) != 0) { #ifdef EXTRA_DEBUG diff --git a/ser_stun.h b/ser_stun.h index 1e6051bc8..c0356bca6 100644 --- a/ser_stun.h +++ b/ser_stun.h @@ -126,8 +126,13 @@ typedef unsigned long ULONG_T; #define XOR 1 #define TRANSACTION_ID 12 -#define PADDED_TO_FOUR(len) (len == 0) ? 0 : len + (PAD4 - len%PAD4) -#define PADDED_TO_SIXTYFOUR(len) (len == 0) ? 0 : len + (PAD64 - len%PAD64) +/** padd len to a multiple of sz. + * sz must be a power of the form 2^k (e.g. 2, 4, 8, 16 ...) + */ +#define PADD_TO(len, sz) (((len) + (sz)-1) & (~((sz) - 1))) + +#define PADDED_TO_FOUR(len) PADD_TO(len, 4) +#define PADDED_TO_SIXTYFOUR(len) PADD_TO(len, 64) struct transaction_id { UINT_T magic_cookie; diff --git a/sr_module.c b/sr_module.c index f975062ac..db6a95e84 100644 --- a/sr_module.c +++ b/sr_module.c @@ -574,8 +574,8 @@ reload: /* we have to reload the module */ dlclose(handle); WARN("%s: exports dlflags interface is deprecated and it will not" - "be supported in newer versions; consider using" - " mod_register() instead", path); + " be supported in newer versions; consider using" + " mod_register() instead\n", path); dlflags=new_dlflags; retries--; if (retries>0) goto reload; diff --git a/tcp_main.c b/tcp_main.c index 31fc0fa40..ac76dc5ab 100644 --- a/tcp_main.c +++ b/tcp_main.c @@ -1396,6 +1396,7 @@ static inline void _tcpconn_detach(struct tcp_connection *c) for (r=0; raliases; r++) tcpconn_listrm(tcpconn_aliases_hash[c->con_aliases[r].hash], &c->con_aliases[r], next, prev); + c->aliases = 0; } @@ -1433,6 +1434,7 @@ void tcpconn_rm(struct tcp_connection* c) for (r=0; raliases; r++) tcpconn_listrm(tcpconn_aliases_hash[c->con_aliases[r].hash], &c->con_aliases[r], next, prev); + c->aliases = 0; TCPCONN_UNLOCK; lock_destroy(&c->write_lock); #ifdef USE_TLS @@ -2167,20 +2169,19 @@ conn_wait_close: su2a(&c->rcv.src_su, sizeof(c->rcv.src_su)), fd, c->flags, strerror(errno), errno); } + /* here the connection is for sure in the hash (tcp_main will not + remove it because it's marked as PENDing) and the refcnt is at least + 2 + */ TCPCONN_LOCK; - if (c->flags & F_CONN_HASHED){ - /* if some other parallel tcp_send did send CONN_ERROR to - * tcp_main, the connection might be already detached */ - _tcpconn_detach(c); - c->flags&=~F_CONN_HASHED; - TCPCONN_UNLOCK; - tcpconn_put(c); - }else - TCPCONN_UNLOCK; + _tcpconn_detach(c); + c->flags&=~F_CONN_HASHED; + tcpconn_put(c); + TCPCONN_UNLOCK; /* dec refcnt -> mark it for destruction */ tcpconn_chld_put(c); return n; -#endif /* TCP_CONNET_WAIT */ +#endif /* TCP_CONNECT_WAIT */ release_c: tcpconn_chld_put(c); /* release c (dec refcnt & free on 0) */ end_no_deref: @@ -2986,6 +2987,7 @@ inline static void tcpconn_destroy(struct tcp_connection* tcpconn) local_timer_del(&tcp_main_ltimer, &tcpconn->timer); TCPCONN_LOCK; _tcpconn_detach(tcpconn); + tcpconn->flags &= ~(F_CONN_HASHED|F_CONN_MAIN_TIMER); TCPCONN_UNLOCK; } if (likely(!(tcpconn->flags & F_CONN_FD_CLOSED))){ @@ -3023,6 +3025,7 @@ inline static int tcpconn_put_destroy(struct tcp_connection* tcpconn) local_timer_del(&tcp_main_ltimer, &tcpconn->timer); TCPCONN_LOCK; _tcpconn_detach(tcpconn); + tcpconn->flags &= ~(F_CONN_HASHED|F_CONN_MAIN_TIMER); TCPCONN_UNLOCK; }else{ LOG(L_CRIT, "BUG: tcpconn_put_destroy: %p flags = %0x\n", @@ -3594,16 +3597,22 @@ inline static int handle_ser_child(struct process_table* p, int fd_i) tcpconn->flags); case CONN_EOF: /* forced EOF after full send, due to send flags */ #ifdef TCP_CONNECT_WAIT - /* if the connection is pending => it might be on the way of - * reaching tcp_main (e.g. CONN_NEW_COMPLETE or - * CONN_NEW_PENDING_WRITE) => it cannot be destroyed here */ - if ( !(tcpconn->flags & F_CONN_PENDING) && - tcpconn_try_unhash(tcpconn) ) - tcpconn_put(tcpconn); -#else /* ! TCP_CONNECT_WAIT */ + /* if the connection is marked as pending => it might be on + * the way of reaching tcp_main (e.g. CONN_NEW_COMPLETE or + * CONN_NEW_PENDING_WRITE) => it cannot be destroyed here, + * it will be destroyed on CONN_NEW_COMPLETE / + * CONN_NEW_PENDING_WRITE or in the send error case by the + * sender process */ + if (unlikely(tcpconn->flags & F_CONN_PENDING)) { + if (tcpconn_put(tcpconn)) + tcpconn_destroy(tcpconn); + /* no need for io_watch_del(), if PENDING it should not + be watched for anything in tcp_main */ + break; + } +#endif /* TCP_CONNECT_WAIT */ if ( tcpconn_try_unhash(tcpconn) ) tcpconn_put(tcpconn); -#endif /* TCP_CONNECT_WAIT */ if ( ((tcpconn->flags & (F_CONN_WRITE_W|F_CONN_READ_W)) ) && (tcpconn->s!=-1)){ io_watch_del(&io_h, tcpconn->s, -1, IO_FD_CLOSING); @@ -4027,8 +4036,8 @@ static inline int handle_new_connect(struct socket_info* si) su2a(&su, sizeof(su)), tcpconn, tcpconn->s, tcpconn->flags); if(unlikely(send2child(tcpconn)<0)){ tcpconn->flags&=~F_CONN_READER; - tcpconn_put(tcpconn); - tcpconn_try_unhash(tcpconn); + if (tcpconn_try_unhash(tcpconn)) + tcpconn_put(tcpconn); tcpconn_put_destroy(tcpconn); } #endif @@ -4217,8 +4226,8 @@ send_to_child: tcpconn->flags&=~F_CONN_WRITE_W; } #endif /* TCP_ASYNC */ - tcpconn_put(tcpconn); - tcpconn_try_unhash(tcpconn); + if (tcpconn_try_unhash(tcpconn)) + tcpconn_put(tcpconn); tcpconn_put_destroy(tcpconn); /* because of the tcpconn_ref() */ } } @@ -4412,6 +4421,7 @@ static inline void tcpconn_destroy_all() tls_close(c, fd); #endif _tcpconn_rm(c); + c->flags &= ~F_CONN_HASHED; if (fd>0) { #ifdef TCP_FD_CACHE if (likely(cfg_get(tcp, tcp_cfg, fd_cache))) diff --git a/timer_proc.c b/timer_proc.c index 09d19d356..a04200817 100644 --- a/timer_proc.c +++ b/timer_proc.c @@ -36,12 +36,25 @@ */ #include "timer_proc.h" +#include "cfg/cfg_struct.h" #include "pt.h" #include "mem/shm_mem.h" #include +/** update internal counters for running new dummy timers + * @param timers - number of dummy timer processes + * @return - 0 on success; -1 on error + */ +int register_dummy_timers(int timers) +{ + if(register_procs(timers)<0) + return -1; + cfg_register_child(timers); + return 0; +} + /** forks a separate simple sleep() periodic timer. * Forks a very basic periodic timer process, that just sleep()s for * the specified interval and then calls the timer function. @@ -66,8 +79,10 @@ int fork_dummy_timer(int child_id, char* desc, int make_sock, if (pid<0) return -1; if (pid==0){ /* child */ + if (cfg_child_init()) return -1; for(;;){ sleep(interval); + cfg_update(); f(get_ticks(), param); /* ticks in s for compatibility with old timers */ } diff --git a/timer_proc.h b/timer_proc.h index 81088d6c3..5e9540032 100644 --- a/timer_proc.h +++ b/timer_proc.h @@ -36,6 +36,9 @@ #include "local_timer.h" +/** @brief register the number of extra dummy timer processes */ +int register_dummy_timers(int timers); + /** @brief forks a separate simple sleep() periodic timer */ int fork_dummy_timer(int child_id, char* desc, int make_sock, timer_function* f, void* param, int interval); diff --git a/utils/db_berkeley/kambdb_recover b/utils/db_berkeley/kambdb_recover new file mode 100755 index 000000000..006ebe7a9 Binary files /dev/null and b/utils/db_berkeley/kambdb_recover differ diff --git a/utils/kamctl/db_berkeley/kamailio/lcr_gw b/utils/kamctl/db_berkeley/kamailio/lcr_gw index 00df7e451..d659ce6a0 100644 --- a/utils/kamctl/db_berkeley/kamailio/lcr_gw +++ b/utils/kamctl/db_berkeley/kamailio/lcr_gw @@ -8,5 +8,3 @@ METADATA_LOGFLAGS 0 METADATA_DEFAULTS NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NULL|0|NULL -lcr_gw| -lcr_gw|1 diff --git a/utils/kamctl/db_berkeley/kamailio/lcr_rule b/utils/kamctl/db_berkeley/kamailio/lcr_rule index dd53806ed..99a12cfd6 100644 --- a/utils/kamctl/db_berkeley/kamailio/lcr_rule +++ b/utils/kamctl/db_berkeley/kamailio/lcr_rule @@ -8,5 +8,3 @@ METADATA_LOGFLAGS 0 METADATA_DEFAULTS NIL|NIL|NULL|NULL|0|1 -lcr_rule| -lcr_rule|1 diff --git a/utils/kamctl/db_berkeley/kamailio/lcr_rule_target b/utils/kamctl/db_berkeley/kamailio/lcr_rule_target index 927e537b2..cffb6eb76 100644 --- a/utils/kamctl/db_berkeley/kamailio/lcr_rule_target +++ b/utils/kamctl/db_berkeley/kamailio/lcr_rule_target @@ -8,5 +8,3 @@ METADATA_LOGFLAGS 0 METADATA_DEFAULTS NIL|NIL|NIL|NIL|NIL|1 -lcr_rule_target| -lcr_rule_target|1 diff --git a/utils/kamctl/db_berkeley/kamailio/mtree b/utils/kamctl/db_berkeley/kamailio/mtree new file mode 100644 index 000000000..ec9b1693b --- /dev/null +++ b/utils/kamctl/db_berkeley/kamailio/mtree @@ -0,0 +1,12 @@ +METADATA_COLUMNS +id(int) tprefix(str) tvalue(str) +METADATA_KEY + +METADATA_READONLY +0 +METADATA_LOGFLAGS +0 +METADATA_DEFAULTS +NIL|''|'' +mtree| +mtree|1 diff --git a/utils/kamctl/db_berkeley/kamailio/pl_pipes b/utils/kamctl/db_berkeley/kamailio/pl_pipes new file mode 100644 index 000000000..01a105e40 --- /dev/null +++ b/utils/kamctl/db_berkeley/kamailio/pl_pipes @@ -0,0 +1,12 @@ +METADATA_COLUMNS +id(int) pipeid(str) algorithm(str) plimit(int) +METADATA_KEY + +METADATA_READONLY +0 +METADATA_LOGFLAGS +0 +METADATA_DEFAULTS +NIL|''|''|0 +pl_pipes| +pl_pipes|1 diff --git a/utils/kamctl/db_berkeley/kamailio/uacreg b/utils/kamctl/db_berkeley/kamailio/uacreg new file mode 100644 index 000000000..2ebc01cf6 --- /dev/null +++ b/utils/kamctl/db_berkeley/kamailio/uacreg @@ -0,0 +1,12 @@ +METADATA_COLUMNS +id(int) l_uuid(str) l_username(str) l_domain(str) r_username(str) r_domain(str) realm(str) auth_username(str) auth_password(str) auth_proxy(str) expires(int) +METADATA_KEY + +METADATA_READONLY +0 +METADATA_LOGFLAGS +0 +METADATA_DEFAULTS +NIL|''|''|''|''|''|''|''|''|''|0 +uacreg| +uacreg|1 diff --git a/utils/kamctl/db_berkeley/kamailio/version b/utils/kamctl/db_berkeley/kamailio/version index 93e3eb1ab..105d1f60a 100644 --- a/utils/kamctl/db_berkeley/kamailio/version +++ b/utils/kamctl/db_berkeley/kamailio/version @@ -16,10 +16,10 @@ address| address|4 aliases| aliases|1004 -carrierfailureroute| -carrierfailureroute|2 carrier_name| carrier_name|1 +carrierfailureroute| +carrierfailureroute|2 carrierroute| carrierroute|3 cpl| @@ -50,16 +50,12 @@ globalblacklist| globalblacklist|1 grp| grp|2 -METADATA_DEFAULTS -NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NIL|NULL|NIL|0|NULL htable| htable|1 imc_members| imc_members|1 imc_rooms| imc_rooms|1 -METADATA_DEFAULTS -NIL|NIL|NULL|NULL|NIL|NIL lcr_gw| lcr_gw|1 lcr_rule| @@ -72,8 +68,6 @@ matrix| matrix|1 missed_calls| missed_calls|3 -mtree| -mtree|1 pdt| pdt|1 presentity| @@ -98,8 +92,6 @@ subscriber| subscriber|6 trusted| trusted|5 -uacreg| -uacreg|1 uri| uri|1 userblacklist| diff --git a/utils/kamctl/dbtext/kamailio/lcr_gw b/utils/kamctl/dbtext/kamailio/lcr_gw index 71f1fb915..deb04d754 100644 --- a/utils/kamctl/dbtext/kamailio/lcr_gw +++ b/utils/kamctl/dbtext/kamailio/lcr_gw @@ -1,2 +1 @@ id(int,auto) lcr_id(int) gw_name(string,null) ip_addr(string,null) hostname(string,null) port(int,null) params(string,null) uri_scheme(int,null) transport(int,null) strip(int,null) tag(string,null) flags(int) defunct(int,null) -lcr_gw:1 diff --git a/utils/kamctl/dbtext/kamailio/lcr_rule b/utils/kamctl/dbtext/kamailio/lcr_rule index 483ce5898..f1dcabd19 100644 --- a/utils/kamctl/dbtext/kamailio/lcr_rule +++ b/utils/kamctl/dbtext/kamailio/lcr_rule @@ -1,2 +1 @@ id(int,auto) lcr_id(int) prefix(string,null) from_uri(string,null) stopper(int) enabled(int) -lcr_rule:1 diff --git a/utils/kamctl/dbtext/kamailio/lcr_rule_target b/utils/kamctl/dbtext/kamailio/lcr_rule_target index d72e6f0c8..54dedd85f 100644 --- a/utils/kamctl/dbtext/kamailio/lcr_rule_target +++ b/utils/kamctl/dbtext/kamailio/lcr_rule_target @@ -1,2 +1 @@ id(int,auto) lcr_id(int) rule_id(int) gw_id(int) priority(int) weight(int) -lcr_rule_target:1 diff --git a/utils/kamctl/dbtext/kamailio/mtree b/utils/kamctl/dbtext/kamailio/mtree new file mode 100644 index 000000000..2b6dcb657 --- /dev/null +++ b/utils/kamctl/dbtext/kamailio/mtree @@ -0,0 +1,2 @@ +id(int,auto) tprefix(string) tvalue(string) +mtree:1 diff --git a/utils/kamctl/dbtext/kamailio/pl_pipes b/utils/kamctl/dbtext/kamailio/pl_pipes new file mode 100644 index 000000000..bc51e86f5 --- /dev/null +++ b/utils/kamctl/dbtext/kamailio/pl_pipes @@ -0,0 +1,2 @@ +id(int,auto) pipeid(string) algorithm(string) plimit(int) +pl_pipes:1 diff --git a/utils/kamctl/dbtext/kamailio/uacreg b/utils/kamctl/dbtext/kamailio/uacreg new file mode 100644 index 000000000..cbb82bb39 --- /dev/null +++ b/utils/kamctl/dbtext/kamailio/uacreg @@ -0,0 +1,2 @@ +id(int,auto) l_uuid(string) l_username(string) l_domain(string) r_username(string) r_domain(string) realm(string) auth_username(string) auth_password(string) auth_proxy(string) expires(int) +uacreg:1 diff --git a/utils/kamctl/dbtext/kamailio/version b/utils/kamctl/dbtext/kamailio/version index 60a7a5f24..f64d079bc 100644 --- a/utils/kamctl/dbtext/kamailio/version +++ b/utils/kamctl/dbtext/kamailio/version @@ -3,8 +3,8 @@ acc:4 active_watchers:9 address:4 aliases:1004 -carrierfailureroute:2 carrier_name:1 +carrierfailureroute:2 carrierroute:3 cpl:1 dbaliases:1 @@ -20,18 +20,15 @@ dr_gw_lists:1 dr_rules:3 globalblacklist:1 grp:2 -id(int,auto) lcr_id(int) gw_name(string) grp_id(int) ip_addr(string) hostname(string,null) port(int,null) uri_scheme(int,null) transport(int,null) strip(int,null) tag(string,null) weight(int,null) flags(int) defunct(int,null) htable:1 imc_members:1 imc_rooms:1 -id(int,auto) lcr_id(int) prefix(string,null) from_uri(string,null) grp_id(int) priority(int) lcr_gw:1 lcr_rule:1 lcr_rule_target:1 location:1004 matrix:1 missed_calls:3 -mtree:1 pdt:1 presentity:3 pua:6 @@ -44,7 +41,6 @@ sip_trace:2 speed_dial:2 subscriber:6 trusted:5 -uacreg:1 uri:1 userblacklist:1 usr_preferences:2 diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl index 2ec550abb..d465d6771 100755 --- a/utils/kamctl/kamctl +++ b/utils/kamctl/kamctl @@ -74,8 +74,7 @@ if [ -z "$SERCMD" ] ; then # try locate it with which SERCMD=`which sercmd` if [ ! -f "$SERCMD" -o ! -x "$SERCMD" ] ; then - merr "sercmd tool not found" - exit -1; + mdbg "sercmd tool not found" fi fi fi @@ -137,6 +136,14 @@ fi ##### ------------------------------------------------ ##### ### CTLENGINE # + +require_sercmd() { + if [ -z "$SERCMD" ] ; then + merr "sercmd tool is missing" + exit -1 + fi +} + CTLENGINELOADED=0 if [ -z "$CTLENGINE" ] ; then CTLENGINE="FIFO" @@ -155,6 +162,7 @@ case $CTLENGINE in fi ;; SER_MI|ser_mi|SERCMD_MI|sercmd_mi|SERCMDMI|sercmdmi) + require_sercmd if [ -f "$MYLIBDIR/kamctl.ser_mi" ]; then . "$MYLIBDIR/kamctl.ser_mi" CTLENGINELOADED=1 @@ -1596,9 +1604,9 @@ openser_start() { exit 1 fi if [ $SYSLOG = 1 ] ; then - $OSERBIN -P $PID_FILE $STARTOPTIONS 1>/dev/null 2>/dev/null + $OSERBIN -P $PID_FILE -f $ETCDIR/kamailio.cfg $STARTOPTIONS 1>/dev/null 2>/dev/null else - $OSERBIN -P $PID_FILE -E $STARTOPTIONS + $OSERBIN -P $PID_FILE -E -f $ETCDIR/kamailio.cfg $STARTOPTIONS fi sleep 3 if [ ! -s $PID_FILE ] ; then @@ -2398,6 +2406,7 @@ case $1 in ;; ser|sercmd) + require_sercmd shift $SERCTLCMD "$@" ;; diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base index acc7d4a56..d0d6fd19c 100644 --- a/utils/kamctl/kamdbctl.base +++ b/utils/kamctl/kamdbctl.base @@ -38,7 +38,7 @@ STANDARD_TABLES=${STANDARD_TABLES:-version acc dbaliases domain grp aliases silo dialog dispatcher dialplan} EXTRA_TABLES=${EXTRA_TABLES:-imc_members imc_rooms cpl sip_trace domainpolicy carrierroute carrier_name domain_name carrierfailureroute userblacklist - globalblacklist htable purplemap uacreg} + globalblacklist htable purplemap uacreg pl_pipes} PRESENCE_TABLES=${PRESENCE_TABLES:-presentity active_watchers watchers xcap pua rls_presentity rls_watchers} @@ -67,7 +67,7 @@ STANDARD_MODULES=${STANDARD_MODULES:-standard acc lcr domain group permissions speeddial avpops auth_db pdt dialog dispatcher dialplan} EXTRA_MODULES=${EXTRA_MODULES:-imc cpl siptrace domainpolicy carrierroute - userblacklist htable purple uac} + userblacklist htable purple uac pipelimit} ############################################################ diff --git a/utils/kamctl/mysql/pipelimit-create.sql b/utils/kamctl/mysql/pipelimit-create.sql new file mode 100644 index 000000000..86fd350f1 --- /dev/null +++ b/utils/kamctl/mysql/pipelimit-create.sql @@ -0,0 +1,8 @@ +INSERT INTO version (table_name, table_version) values ('pl_pipes','1'); +CREATE TABLE pl_pipes ( + id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, + pipeid VARCHAR(64) DEFAULT '' NOT NULL, + algorithm VARCHAR(32) DEFAULT '' NOT NULL, + plimit INT DEFAULT 0 NOT NULL +) ENGINE=MyISAM; + diff --git a/utils/kamctl/mysql/presence-create.sql b/utils/kamctl/mysql/presence-create.sql index 6af8d0afb..b7649764e 100644 --- a/utils/kamctl/mysql/presence-create.sql +++ b/utils/kamctl/mysql/presence-create.sql @@ -24,10 +24,10 @@ CREATE TABLE active_watchers ( event_id VARCHAR(64), to_tag VARCHAR(64) NOT NULL, from_tag VARCHAR(64) NOT NULL, - callid VARCHAR(64) NOT NULL, + callid VARCHAR(128) NOT NULL, local_cseq INT(11) NOT NULL, remote_cseq INT(11) NOT NULL, - contact VARCHAR(64) NOT NULL, + contact VARCHAR(128) NOT NULL, record_route TEXT, expires INT(11) NOT NULL, status INT(11) DEFAULT 2 NOT NULL, @@ -79,7 +79,7 @@ CREATE TABLE pua ( etag VARCHAR(64) NOT NULL, tuple_id VARCHAR(64), watcher_uri VARCHAR(128) NOT NULL, - call_id VARCHAR(64) NOT NULL, + call_id VARCHAR(128) NOT NULL, to_tag VARCHAR(64) NOT NULL, from_tag VARCHAR(64) NOT NULL, cseq INT(11) NOT NULL, diff --git a/utils/kamctl/oracle/pipelimit-create.sql b/utils/kamctl/oracle/pipelimit-create.sql new file mode 100644 index 000000000..09439a49a --- /dev/null +++ b/utils/kamctl/oracle/pipelimit-create.sql @@ -0,0 +1,16 @@ +INSERT INTO version (table_name, table_version) values ('pl_pipes','1'); +CREATE TABLE pl_pipes ( + id NUMBER(10) PRIMARY KEY, + pipeid VARCHAR2(64) DEFAULT '', + algorithm VARCHAR2(32) DEFAULT '', + plimit NUMBER(10) DEFAULT 0 NOT NULL +); + +CREATE OR REPLACE TRIGGER pl_pipes_tr +before insert on pl_pipes FOR EACH ROW +BEGIN + auto_id(:NEW.id); +END pl_pipes_tr; +/ +BEGIN map2users('pl_pipes'); END; +/ diff --git a/utils/kamctl/oracle/presence-create.sql b/utils/kamctl/oracle/presence-create.sql index 6e6daf27e..b0ce5eec3 100644 --- a/utils/kamctl/oracle/presence-create.sql +++ b/utils/kamctl/oracle/presence-create.sql @@ -32,10 +32,10 @@ CREATE TABLE active_watchers ( event_id VARCHAR2(64), to_tag VARCHAR2(64), from_tag VARCHAR2(64), - callid VARCHAR2(64), + callid VARCHAR2(128), local_cseq NUMBER(10), remote_cseq NUMBER(10), - contact VARCHAR2(64), + contact VARCHAR2(128), record_route CLOB, expires NUMBER(10), status NUMBER(10) DEFAULT 2 NOT NULL, @@ -111,7 +111,7 @@ CREATE TABLE pua ( etag VARCHAR2(64), tuple_id VARCHAR2(64), watcher_uri VARCHAR2(128), - call_id VARCHAR2(64), + call_id VARCHAR2(128), to_tag VARCHAR2(64), from_tag VARCHAR2(64), cseq NUMBER(10), diff --git a/utils/kamctl/postgres/pipelimit-create.sql b/utils/kamctl/postgres/pipelimit-create.sql new file mode 100644 index 000000000..6c4917bbc --- /dev/null +++ b/utils/kamctl/postgres/pipelimit-create.sql @@ -0,0 +1,8 @@ +INSERT INTO version (table_name, table_version) values ('pl_pipes','1'); +CREATE TABLE pl_pipes ( + id SERIAL PRIMARY KEY NOT NULL, + pipeid VARCHAR(64) DEFAULT '' NOT NULL, + algorithm VARCHAR(32) DEFAULT '' NOT NULL, + plimit INTEGER DEFAULT 0 NOT NULL +); + diff --git a/utils/kamctl/postgres/presence-create.sql b/utils/kamctl/postgres/presence-create.sql index 9da0eb274..37c8febc4 100644 --- a/utils/kamctl/postgres/presence-create.sql +++ b/utils/kamctl/postgres/presence-create.sql @@ -24,10 +24,10 @@ CREATE TABLE active_watchers ( event_id VARCHAR(64), to_tag VARCHAR(64) NOT NULL, from_tag VARCHAR(64) NOT NULL, - callid VARCHAR(64) NOT NULL, + callid VARCHAR(128) NOT NULL, local_cseq INTEGER NOT NULL, remote_cseq INTEGER NOT NULL, - contact VARCHAR(64) NOT NULL, + contact VARCHAR(128) NOT NULL, record_route TEXT, expires INTEGER NOT NULL, status INTEGER DEFAULT 2 NOT NULL, @@ -79,7 +79,7 @@ CREATE TABLE pua ( etag VARCHAR(64) NOT NULL, tuple_id VARCHAR(64), watcher_uri VARCHAR(128) NOT NULL, - call_id VARCHAR(64) NOT NULL, + call_id VARCHAR(128) NOT NULL, to_tag VARCHAR(64) NOT NULL, from_tag VARCHAR(64) NOT NULL, cseq INTEGER NOT NULL, diff --git a/utils/pdbt/carrier.c b/utils/pdbt/carrier.c index 07de4c69a..24bfa0a96 100644 --- a/utils/pdbt/carrier.c +++ b/utils/pdbt/carrier.c @@ -93,8 +93,8 @@ int load_carrier_names(char *filename) { exit(-1); } - strncpy(cnames[id], p, len); - cnames[id][len]=0; + strncpy(cnames[id], p, len - 1); + cnames[id][len - 1]=0; nextline: n++; diff --git a/utils/pdbt/pdbt.c b/utils/pdbt/pdbt.c index 5cc5689bf..afb952557 100644 --- a/utils/pdbt/pdbt.c +++ b/utils/pdbt/pdbt.c @@ -546,10 +546,12 @@ void query_mmap(char *number, char *comment, void *data) { nmatch=dtm_longest_match(mroot, number, strlen(number), &carrierid); if (nmatch<=0) { - LINFO("%s: not_found: nmatch=%ld, comment='%s'\n", number, (long int)nmatch, comment); + LINFO("%s:%s:%ld:%s\n", number, comment, (long int)carrierid, "not allocated, probably old"); } else { - LINFO("%s: found: carrier_id=%ld, carrier_name='%s', nmatch=%ld, comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid), (long int)nmatch, comment); + LINFO("%s:%s:%ld:%s\n", number, comment, (long int)carrierid, carrierid2name(carrierid)); + /* LINFO("%s: found: carrier_id=%ld, carrier_name='%s', nmatch=%ld, comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid), (long int)nmatch, comment); + */ } } @@ -566,7 +568,9 @@ void query_server(char *number, char *comment, void *data) { LINFO("%s: not_found: comment='%s'\n", number, comment); } else { - LINFO("%s: found: carrier_id=%ld, carrier_name='%s', comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid), comment); + LINFO("%s:%ld:%s\n", number, (long int)carrierid, carrierid2name(carrierid)); + /* LINFO("%s: found: carrier_id=%ld, carrier_name='%s', comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid), comment); + */ } }