diff --git a/ChangeLog b/ChangeLog index 7adaaeeaf6..0ac8dbf055 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,1058 @@ +=========================== Release 1.10.1 ============================== + +2014-03-12 Vlad Paiu + * [1e2622f] : + + Added support for embedded arrays within MongoDB documents + (cherry picked from commit 61e21a0a2d9d79b91e5e8692a7c1f3e7cc77cf83) + + +2014-03-12 Vlad Paiu + * [5a119db] : + + For topo hiding and fix_route_dialog() usage, do not try do add del lumps for already deleted route headers + + +2014-03-11 Liviu Chircu + * [1e32092] : + + residential config: Also define the "xcap" db_url + (cherry picked from commit 4b4ac96e13dc4686172eb4eecb9dee68be2e6f2b) + + +2014-03-11 Razvan Crainea + * [53f6461] : + + db_http: add value_delimiter parameter + Add a new parameter used to specify the fields delimiters for queries + variables + (cherry picked from commit ab80adec1665b6416d92637d10677a696550c1db) + + +2014-03-10 Bogdan Andrei IANCU + * [1ccb254] : + + Merge pull request #174 from wdoekes/wjd-fix_dialogaggr_memleak + presence_dialoginfo: Fix memory leak in dlginfo_agg_nbody. + (cherry picked from commit 1e02b323fa38e81949a3e8e9b3cf4e37dd9fa6e5) + + +2014-03-10 Bogdan-Andrei Iancu + * [916f3ee] : + + When updating the database records, first perform all update and inserts and then check the timeout for expired records -> records to be deleted. Doing first the delete may hide records "expired but to be updated". Credits go to Nick Altmann Closes bug #112. + (cherry picked from commit 3c1164a012204e92150c5df5101aba709e4cb123) + + +2014-03-05 Vlad Paiu + * [42718eb] : + + Fixed the lex for tcp_max_msg_chunks and tcp_max_msg_time + (cherry picked from commit 5cf71c32561c5f47abaf2cab015f7cf707be14e6) + + +2014-03-01 Liviu Chircu + * [6e5ed26] : + + Fix crash when printing $(ct[*]) + (cherry picked from commit aeb4e886d4cd4fde00440671f913605def9db02f) + + +2014-02-13 Bogdan-Andrei Iancu + * [5760ba2] : + + improve docs + + +2014-02-06 Liviu Chircu + * [06a76bb] : + + Fix NULL pointer deref. in "acc_db_request" when "db_url" is not set + (cherry picked from commit 5d61f3789b191c04d0595aed6e1eb94392fc9e0c) + + +2014-02-06 Ovidiu Sas + * [13f4325] : + + cachedb_mongodb: fix BSON_DATE conversion + (cherry picked from commit abdcbaf5731ddea8de37d23a9e7a65b7388db66a) + + +2014-02-05 Bogdan-Andrei Iancu + * [d83619e] : + + Fixed bogus test over the presence of a request route. This was generating bogus warning messages to the logs, but without any negative impact over the actual processing. Credits go to rrb3942 on GITHUB Closes issue #162 + + +2014-02-05 Walter Doekes + * [26044bf] : + + digest+m_auth: Allow a domain in the digest username. + Before this patch, a domain in the digest username was allowed: + + Digest username="abc@domain", realm="domain" + + but only if the domain is equal to the realm. This was introduced in + a92bf789 (Juha Heinanen, Mar. 29 2006). + + The SIP spec. doesn't mention any such restriction. + + This patch undoes that commit and makes sure the whole username is used + when authenticating through `pv_www_authorize` and `pv_proxy_authorize`. + That makes the following valid: + + Digest username="abc@domain", realm="something different" + + +2014-01-30 Liviu Chircu + * [d31d332] : + + Fix "mf_process_maxfwd_header" retcode in case of parsing errors + (cherry picked from commit 707982e4ec75f33a1feb5fb00b8b1b71ef77a6bf) + + +2014-01-15 vladpaiu + * [a36e379] : + + Merge pull request #160 from rrb3942/localcache_counter_expire + Do not reset counter expiration on incr/decr + (cherry picked from commit 11a74d7c6dcf1578672b337923729bf3a0aa4a33) + + +2014-01-15 Bogdan-Andrei Iancu + * [8d725d0] : + + "Interrupted system call" on "select" must not be reported as error/warning + + +2014-01-15 Razvan Crainea + * [1e486f8] : + + properly print statistics while running "-V" + (cherry picked from commit e8195fc099efbd0af6c1b5ebfced857da5dab31d) + + +2014-01-10 Bogdan Andrei IANCU + * [8555a91] : + + Merge pull request #156 from lovelle/1.8 + Add new line in dbt_base.c for info message log + + +2014-01-10 Bogdan Andrei IANCU + * [d51b53f] : + + Merge pull request #159 from nikbyte/1.10 + Fixed bugs with processing m4 in fedora init scripts + + +2014-01-10 Nick Altmann + * [5305565] : + + Fixed bugs with processing m4 in fedora init scripts + + +2013-12-20 Saúl Ibarra Corretgé + * [15f435e] : + + mediaproxy: fixed detecting messages without a body + (cherry picked from e4a334eaba6e7f402fd26a9e354428b066fc6835) + + +2013-12-20 Saúl Ibarra Corretgé + * [3b1761a] : + + mediaproxy: always parse To header + (cherry picked from 359db7f8713921042d14beffd83b5b07e40536fe) + + +2013-12-17 Ovidiu Sas + * [f2d32ec] : + + Makefile.conf.template: add newline at end of file + (cherry picked from commit 55bde1d8e2d3d387a796e2a9ed8fcbd6876185d3) + + +2013-12-15 Bogdan-Andrei Iancu + * [39c76cf] : + + Fixed bogus triggering of PUBLISHing for non-INVITE sequential requests. Credits go to Damien Sandras Closes pull request #149 + (cherry picked from commit e0cc9d009151a086f42c08d7f8092b8c7d5835ed) + + +2013-12-15 Bogdan Andrei IANCU + * [f56a971] : + + Merge pull request #150 from staskobzar/master + opensipsctl is calling ds_relaod for dr instead of dr_reload + (cherry picked from commit 6b6be3057762fb9d0e98bcea104e02d45a30b4c2) + + +2013-12-11 Razvan Crainea + * [fe65336] : + + revert bogus commit for mi_json + + +2013-12-11 Razvan Crainea + * [bd38945] : + + remove bogus flushing for mi_json + TODO: find a proper way for handling flushing, since the current + implementation leads to a infinite loop + (cherry picked from commit 0d47a32d18c656a22aa536f5eeb24e3310ade481) + + +2013-12-11 Razvan Crainea + * [dd6e62a] : + + mi_json: escape '\\' character + also fix incorrect '"' escaping + (cherry picked from commit 28b399bb166a786bb0e943ff072606d2d01d96b6) + + Conflicts: + modules/mi_json/http_fnc.c + + +2013-12-10 Bogdan-Andrei Iancu + * [0bfe616] : + + Generate proper branch param for the NAT ping requests Credits go to Varun (varunvairavan on GITHUB) Closes #145 + (cherry picked from commit 1f18541ced045645f8cbda1c73a85fe52597a1db) + + +2013-12-07 Bogdan Andrei IANCU + * [52cf171] : + + Merge pull request #135 from bat-modulis/master + Renamed permissions parameter 'from_col' to 'pattern_col' + (cherry picked from commit 10763008a99a48c0375f1a5bee32bb05231426b0) + + +2013-12-07 Bogdan Andrei IANCU + * [9134ebf] : + + Merge pull request #129 from dsandras/ds-pua-expires-refresh-fix + Fix bug where a new publication does not extend the desired expire time. + (cherry picked from commit ccac0fac1da8ad663e500148fb7f7d9e43e34fd1) + + +2013-12-06 Bogdan-Andrei Iancu + * [96921f5] : + + Fixed bogus condition in GT, GTE, LT and LTE script tests. Reported by dcb314 on GITHUB Closing issue #146 + + +2013-12-03 Răzvan Crainea + * [6a58fb6] : + + fixed doc avp names + (cherry picked from commit f93bbd32775f72a53b050ca95d31d391d91a27e8) + + +2013-12-03 vladpaiu + * [16af319] : + + Merge pull request #141 from shimaore/db_http_timeout_doc + Corrected db_http example: the timeout is an integer. + (cherry picked from commit 9a807b819927f7bbbe68dd99a483eb6ee9210385) + + +2013-12-02 Razvan Crainea + * [4115aca] : + + drouting: fix drc_table doc default value + (cherry picked from commit f25c8e1e520902fde023613cf86ef0cc675d0e32) + + +2013-12-02 Vlad Paiu + * [8079e64] : + + Properly take into account the dialplan priority in case entry matches both string and regex rules + (cherry picked from commit 0625610376acbc29f5a9f6a7a79ec897ebfe53fa) + + +2013-11-28 Ovidiu Sas + * [0ee2e29] : + + pua_dialoginfo: do not blindly load all dialogs - only dialogs with "dlg_peer" vals should be registered for callbacks + (cherry picked from commit c631abce52ee4fdbcc98434f7067ee849089af76) + + +2013-11-28 Răzvan Crainea + * [8fee8bb] : + + Merge pull request #139 from shimaore/pkg_mem_events + Allow for `event_pkg_threshold` support. + + Credits go to Stéphane Alnet (shimaore) + (cherry picked from commit 25289f0c2b0f2bd3137dc062a031be359d6e8937) + + +2013-11-27 Vlad Paiu + * [37ecc40] : + + fixed README typo + (cherry picked from commit 144e112db1f785875a671f57a727393c2a3b7764) + + +2013-11-26 Ovidiu Sas + * [b7438f2] : + + pua: set db_flag to UPDATEDB_FLAG only if there was a previous update (NO_UPDATEDB_FLAG) - in case of a server restart, if the db_flag went from INSERTDB_FLAG to UPDATEDB_FLAG the record will be lost because the record is marked as to be updated, and since there's no record in the db, the update will fail. - if the db_flag is INSERTDB_FLAG, any updates should leave the flag as is and this will cause the new record to be properly inserted (and not updated) into the db. + (cherry picked from commit 40962ceb87c1c79db5ded5ed36a5ae82bc735bf2) + + +2013-11-24 Saúl Ibarra Corretgé + * [669efaf] : + + Load xcap module, presence_xml depends on it + + +2013-11-24 Saúl Ibarra Corretgé + * [9b786aa] : + + Fixed residential example when using presence + + +2013-11-23 Bogdan Andrei IANCU + * [a5d593a] : + + Merge pull request #122 from dsandras/ds-fix-dialog-info-entity + This patch fixes the entity URI in XML documents to contain "sip:". + (cherry picked from commit 377e7574d411aa974cf469d6df18b6213b43a31f) + + +2013-11-22 Bogdan Andrei IANCU + * [f2264be] : + + Merge pull request #131 from dsandras/ds-pua-mi-warning-fix + Fixes bug where a refreshed PUBLISH request triggers an error message. + (cherry picked from commit ded0559c527f30181e9bbd494f0e63b048059108) + + +2013-11-22 Bogdan-Andrei Iancu + * [68976ca] : + + Fixed bogus warning because of variables not being reset. Reported by Jeff Pyle, part of fixing issue #126. + + +2013-11-22 Ovidiu Sas + * [94a4481] : + + uac_registrant: re-register with expires value imposed by the registrar + (cherry picked from commit f9a8d985829ed1cce3a2f0985a8c72368d0b3325) + + +2013-11-22 Liviu Chircu + * [aead3a7] : + + Fix the DB representation of message flags in the acc module + * storing flags as strings rather than bitmasks prevents flag conflicts + when doing flag modifications in the script, then restarting the proxy + * similar usrloc issue was fixed in commit 98b6b0437 + (cherry picked from commit f90e347e281b555f89ba05226175ac8d9f07c4ed) + + +2013-11-22 Razvan Crainea + * [1aab2e8] : + + revert commit ec0d05a + dialog variables might be binary, therefore strlen should not be used + (cherry picked from commit 7401a7a4a4820706aa05d96d5bebdc93c6db6b40) + + +2013-11-20 Bogdan-Andrei Iancu + * [d5f92dd] : + + Do not free the header string as it is part of the lumps (and freed together with the lumps). Reported by Jeff Pyle. Fixing bug #126 + + +2013-11-20 Bogdan-Andrei Iancu + * [f0816e0] : + + Fixed keeping turns on handling PUBLISHes for the same presentity - when presentity is deleted (due a unPUBLISH) do not do any turn related ops anymore Reported by Damien Sanders + + +2013-11-20 Vlad Paiu + * [f931f0d] : + + Reset the lump cond flags when the condition evaluates to false. + In case there are multiple branches, the conditions can evaluate + differently on each branch - which might lead to bad counting of the + added lumps ( used by the dialog module for dlg validation ) + (cherry picked from commit 24f9366858d0568a2eaa231f37d349efd2d70d96) + + +2013-11-20 Bogdan-Andrei Iancu + * [e8661d1] : + + Fixed restoring SOCKET info from AVP during failover + (cherry picked from commit cc657ffc81e13e66dfba9ffba3e5e9f380e22c1d) + + +2013-11-17 Liviu Chircu + * [a532650] : + + Mask compile-time shift/reduce conflict due to if statement ambiguity + (cherry picked from commit c4b8be1cb86ba6d169ae97b221d4986f8ecad9a4) + + +2013-11-15 Razvan Crainea + * [b4cf13a] : + + rework ratelimit distributed queries + instead of adding -1 to the counter, use the cachedb_sub function exported by + the cachedb module. This prevents ratelimit counters from adding extremely + large values for some backends (ex: memcached). + Thanks go to Brett Nemeroff for reporting and testing. + (cherry picked from commit c06183325e408f47ba4e0a1e1be274fe23581e25) + + +2013-11-04 Bogdan-Andrei Iancu + * [dcb87bc] : + + Proper usage of build_req_buf_from_sip_req() function - socket and proto are required. Closes Bug 664 on SF. + + +2013-11-04 Vlad Paiu + * [dde0516] : + + Allow drouting module to be used for DID matching only ( where you only have prefixes provisioned, no GWs, and call do_routing with the 'C' flag ) + (cherry picked from commit 92a2c9d6061462b2c818da0963e805cbfaa62904) + + +2013-11-04 Vlad Paiu + * [86cbfee] : + + Do proper return code to script from cachedb_* functions ( treat 0 as success ) + (cherry picked from commit 5635d716e0bf1ce8a23688698fe6497fadfe7f23) + + +2013-11-01 Vlad Paiu + * [50463f0] : + + Also trace the CANCEL requests in case we're doing trace_dialog() + + +2013-10-30 Ovidiu Sas + * [f1db3dd] : + + core: enhance error log for un-parsable msg by adding the source IP and port + (cherry picked from commit 57e60928db2ba2a406026565e4569155fb811b6b) + + +2013-10-29 Bogdan-Andrei Iancu + * [f792543] : + + Use proper locking function (via the generic locking API) Reported by Max E. Reyes Vera Juarez. + + +2013-10-29 Bogdan-Andrei Iancu + * [82380ca] : + + Re-install dlg callbacks (for restoring FROM/TO hdr) upon re-loading dialogs on startup. Reported by Jeff Pyle. + + +2013-10-23 Bogdan Andrei IANCU + * [5eeab0f] : + + Merge pull request #109 from rrb3942/shutdown_segfault + Reset prepared statement between query lists on shutdown + + +2013-10-23 Bogdan-Andrei Iancu + * [76bcd17] : + + Fixed the weight-based balancing alg. Credits go to Rob Gagnon (rgagnon24) + + +2013-10-23 Bogdan-Andrei Iancu + * [34d4155] : + + Proper support for BIGINT (as long) in the db_text SQL driver. Many thanks to Jeff Pyle for reporting and troubleshooting this. + + +2013-10-22 Bogdan-Andrei Iancu + * [6b259e6] : + + Removed "auto" flag for the dlg_id in DB_TEXT spec file Reported by Jeff Pyle. + + +2013-10-22 Bogdan-Andrei Iancu + * [aa52721] : + + README files regenerated from XMLs + + +2013-10-18 Bogdan-Andrei Iancu + * [55197a3] : + + Fixed bad prototype for abort when compiling with TM_TIMER_DEBUG. Reported by Mayama Takeshi Closes issue #105 + + +2013-10-18 Bogdan-Andrei Iancu + * [784e87f] : + + Fixed locking on purging profiles for terminated dialogs - in strange cases of concurancy between provisional and final replies, the profile ops for provisional reply may end up iterating on a deleted list. Reported by Trevor Francis (46labs) Closes issue #102 + + +2013-10-18 Bogdan-Andrei Iancu + * [e6f4a51] : + + Fixed accepting "after" changes in lumps attached to the beginning of a del lump Reported by NicK Altmann Solves issues with missing Route hdrs when using the dialog based TH + + +2013-10-18 Earl C. Ruby III + * [403862a] : + + The latest Linux distros from OpenSUSE, Fedora, and other non-Debian based distros no longer add symlinks for libcurses.so -> libncurses.so. Trying to compile menuconfig with -lcurses will not work on these distros, so I changed -lcurses to -lncurses, since -lncurses will work on any modern Linux distro with the ncurses5 libraries installed. + See http://stackoverflow.com/questions/1517756/whats-the-difference-between-lcurses-and-lncurses-when-compiling-c-using-ncur for more info. + (cherry picked from commit 7ae769dac06146253ea07d8d930d73f7ccaa817a) + + +2013-10-17 Razvan Crainea + * [09ab451] : + + fix ratelimit memory corruption + (cherry picked from commit 19cd04ab12fe37a4fd5685e7eabde1d435f8c8b4) + + +2013-10-15 Ovidiu Sas + * [46dbe2b] : + + uac_auth: fix memory leak reported by Jeff Pyle - affected modules: b2b_entities, uac, uac_registrant + (cherry picked from commit 868976769543970844d9001a2c68e11a3eb026b0) + + +2013-10-16 Bogdan-Andrei Iancu + * [62e7692] : + + Make pv_parse_format() more verbous on reporting the causes to fail. Reported by peppolon on IRC + + +2013-10-15 Di-Shi Sun + * [9485224] : + + 1. Added support for appending parameter string in outbound URI. 2. Removed skip plus feature for called number. + (cherry picked from commit 414504077dc72054ae6954f61b998df2ba6ffd53) + + +2013-10-10 Liviu Chircu + * [7e0aa9a] : + + Allow NULL strings to be pushed into binary interface packets + (cherry picked from commit 3a334c3042be2fbc5e7e6019c0f9c8ddef4f6922) + + +2013-10-10 Liviu Chircu + * [728bdef] : + + Fix a particular startup crash + e.g. when defining only 1 tcp interface while specifying + "disable_tcp=true" + (cherry picked from commit 101ee782480af07cd9d056b41b9f33d331d21951) + + +2013-10-07 Vlad Paiu + * [2e6b442] : + + Fixed the re-loading of dlg vars after restart Credits to Nick Altmann + (cherry picked from commit ec0d05aaef41b0a4f30419bbab1295eb4bce7e49) + + +2013-10-07 Vlad Paiu + * [52a732e] : + + Fixed topology_hiding("U") in case of no username in Contact header Credits for report & fix to Nick Altmann + (cherry picked from commit b200e11cf0308ab12c9562c552d69b1a78c52576) + + +2013-10-04 Bogdan-Andrei Iancu + * [606c02e] : + + Fixed is_mod_func_used() (used from is_script_func_used()) to determin if a function is used from script - we need to follow the IF / WHILE / MODULE set of instructions too. Reported by Mayama Takeshi - many thanks for the detailed report on this. Closes issue #98 + + +2013-10-04 Bogdan-Andrei Iancu + * [f6dea9f] : + + In DELAYED mode, flush vars & profile to DB at ACK time too - no timer tick between 200 OK and ACK was droping the update operation to DB. Please note that this "bug" had actually no implications, as dialog data is either used from memory cache, either from DB after a restart (and a shutdown flushes everything to DB). Related to issue #97. + + +2013-10-03 Bogdan-Andrei Iancu + * [c95e902] : + + handle the signals while waiting for the startup route to end (if not, the main proc will never know if the child running startup route crashed and it will hang for ever during startup) + + +2013-10-03 Bogdan-Andrei Iancu + * [8e3b9ee] : + + Merge branch 'master' of github.com:OpenSIPS/opensips + + +2013-10-03 Vlad Paiu + * [2c4b0d3] : + + Fixed menuconfig errors when selecting mi_xmlrpc vs mi_xmlrpc_ng + (cherry picked from commit 7ad1db27dd7bea313beeb97eb276c303d8339fab) + + +2013-10-03 liviuchircu + * [184a746] : + + Properly load contact flags even when NAT pinging is disabled + (cherry picked from commit 39119d1dadb09f3d0999023e41736548a0e446aa) + + +2013-10-03 liviuchircu + * [8f7e4cb] : + + Fix unpatched assignment in commit b33d4b3f + Credits to Nick Altmann for reporting, along with an initial patch + (cherry picked from commit bfcc635c4046bc94017be5166bad8867e98d4f1e) + + +2013-10-03 Bogdan-Andrei Iancu + * [c9bf445] : + + - doc examples fixed Reported by "miha" on IRC + + +2013-10-02 liviuchircu + * [1bd459e] : + + "registered" must also populate the 'attr' avp, if defined + (cherry picked from commit 286f06f2a21c269aebdbeee81d2f5a264be2518d) + + +2013-10-01 liviuchircu + * [ec236bf] : + + Fix some documentation typos + (cherry picked from commit c229d98c3074e3f3c83e99918ed30f9d7e1c8dd6) + + +2013-10-01 liviuchircu + * [6f18ea9] : + + Fix missing GPL headers in event_xmlrpc module + (cherry picked from commit 5bcab3923d0c4ed7d8d613544cc6f1a043dc78c3) + + +2013-09-27 liviuchircu + * [036fea2] : + + Fix invalid pointer when fetching the usrloc extra info column + (cherry picked from commit f2b283de399a58ed3f09f2b46dc9b92958558175) + + +2013-09-25 Bogdan-Andrei Iancu + * [7a3ef04] : + + - fixed double free when building insert fails (in buffered insert mode) Reported by Brett Nemeroff + + +2013-09-25 Bogdan-Andrei Iancu + * [743f48e] : + + - fixed overflow in parsing the content len value Reported by franklyfox on GITHUB Closing issue #78 + + +2013-09-20 Bogdan Andrei IANCU + * [2b22274] : + + Merge pull request #73 from wdoekes/wjd-pua_min_expires_doc + pua.c sets int min_expires= 300, not 0 as documentation states. + + +2013-09-20 Bogdan-Andrei Iancu + * [e16f7e1] : + + - fixed updating the index of the last DEL operation - this is essential for deciding which lumps must be skipped (as overlapping with delete parts of the message) Credits go to Nick Altmann for reporting and helping with troubleshooting. Closes issue #79 + + +2013-09-17 Damien Sandras + * [763ea32] : + + Fix PUA module so that it sends a final PUBLISH on expiration. + A final PUBLISH with expires=0 is now generated when a publication has + expired. This will trigger the transmission of a final state NOTIFY. + + Cherry picked from: c5a57a8d39cf568d6558332ca71ea8344a5a4f57 + + +2013-09-16 liviuchircu + * [85cdc6d] : + + Fix evi crash when defining more than 10 events + (cherry picked from commit ba04cba6d5f7bc945bbc42d2e46694639fea8b79) + + +2013-09-10 Razvan Crainea + * [8d5950c] : + + removed the beta flag + + +2013-09-04 Bogdan-Andrei Iancu + * [bfd86ab] : + + - UAC module does not load (no dependency) on UAC_AUTH if the uac_auth() function is not used. - UAC module does not load RR and DIALOG (with further dependencies on the params of those modules) if no FROM/TO replace ops are done. + + +2013-09-04 Bogdan-Andrei Iancu + * [da85c3a] : + + - new functions added to help a module to check if its functions are used from the script (we cannot rely on the fixup functions as we have functions without parameters or need for fixup). Such function is needed for fixing dependencies between modules (to follow up) + + +2013-09-04 liviuchircu + * [bc3c8e8] : + + Fix: allow rest_client functions in onreply_route + Credits to Jayesh Nambiar for reporting + (cherry picked from commit 6f048e038c4ae6e3e620d1b5f17cf1880fdef246) + + +2013-09-04 Bogdan-Andrei Iancu + * [0ebb2f6] : + + - fixed CANCEL matching in B2B + + +2013-09-04 Bogdan-Andrei Iancu + * [512aaca] : + + - Gracefully detect if the uac_auth modules is available for usage in b2b_entities modules - do not through an error message but rather an info one, as find the uac_auth module is optional. + + +2013-09-04 Bogdan-Andrei Iancu + * [4363dbc] : + + - when starting the FR timer, it should not override any previous setting of a FR or FR_INV timers. Solves Issue #25 (reported and troubleshooted by Mayama Takeshi) when a very fast 100 reply may stop retransmissions, but brake the updating of fr timer from FR to FR_INV state. + + +2013-09-03 Bogdan-Andrei Iancu + * [25629fc] : + + - fixed how lumps can overlap on the edge - an "add" just next to a "delete" Reported by Saul Ibarra Corretge Closes issue #59 + + +2013-09-03 Bogdan-Andrei Iancu + * [b01c688] : + + - fixed incomplete function call (resulted from the merged commit 09a291e) + + +2013-09-03 Bogdan Andrei IANCU + * [a039ec9] : + + Merge pull request #62 from dsandras/ds-dialoginfo-notifications-fixes + Fixed RFC 4235 notifications compliance. + + +2013-09-03 liviuchircu + * [63b158d] : + + Fix several usrloc named flag issues + - fix get_all_db_ucontacts() lookup logic to work with named flags + - fix "Cflags" row of MI *ul_dump* command + - fix DB contact update function to properly store the flags + (cherry picked from commit b33d4b3f019c157a5e63b21a846ad9f891da559e) + + +2013-09-02 liviuchircu + * [444207b] : + + Fix replication of dialog delete events + - instead of sending "deleted" packets based on hash delete operations, + they are now sent when a dialog changes state to "DLG_STATE_DELETED" + - this prevents the receiving instance from replicating the event again + (cherry picked from commit 5a63dcdf87c8d69c3dc9e5d6330f3d58953c28b5) + + +2013-08-30 Bogdan-Andrei Iancu + * [21b91ad] : + + - fixed NULL sockets in external scenarios (this leads to crashing when building the contact hdr) Reported by dexteruk on IRC . + + +2013-08-30 liviuchircu + * [6ee40a5] : + + Fix compilation issue introduced in commit a9fcd84c + (cherry picked from commit 6f8244921231ed837f1d54204cf6b616c33cabc4) + + +2013-08-29 Bogdan Andrei IANCU + * [14b667a] : + + Merge pull request #68 from wdoekes/wjd-fix_nathelper_memleak + Fix memleak in nathelper natping when "failed to fetch contacts". + + +2013-08-29 liviuchircu + * [a9fcd84] : + + Fix replicated dialog profile management in distributed systems + - replication-receiving instances must not do any profile-related + DB queries + (cherry picked from commit 20c92450fac2fd45506f759f7b19473a3dc657f9) + + +2013-08-29 Bogdan Andrei IANCU + * [017274c] : + + Merge pull request #58 from saghul/pua_double_free + Fixed double free issue in pua module + + +2013-08-28 Bogdan-Andrei Iancu + * [f44264a] : + + - complete port of pull request #34 + + +2013-08-28 Bogdan-Andrei Iancu + * [e57330a] : + + - complete backport from 1.8 of pull request #15 + + +2013-08-28 Bogdan-Andrei Iancu + * [062baa3] : + + - complete backport from 1.8 of pull request #15 + + +2013-08-28 Bogdan-Andrei Iancu + * [fa9cb4a] : + + - removed unused variable + + +2013-08-28 Vlad Paiu + * [86a6b3c] : + + Fixed bug introduced by previous commit : - downstream BYEs should go to 200OK leg in order to trigger dialog termination - upstream BYEs have no such limitation ( there's only one caller leg :) ) + (cherry picked from commit 18257f33e71061828493f4232b9dbd8dd7fa6729) + + +2013-08-28 Bogdan-Andrei Iancu + * [8a45cd6] : + + - proper backport of all changes from 1.8 branch + + +2013-08-27 liviuchircu + * [0d38a5a] : + + Fix: also run child_init for bin listeners + - bin listeners are now identified by the PROC_BIN rank + - this way, only the UDP listeners receive positive ranks + (cherry picked from commit 389de529cc7865a475823365cdba90f1a920c1a5) + + +2013-08-26 Bogdan-Andrei Iancu + * [5341c98] : + + - BYE requests received in confirmed state should terminate the dialog only if they match the TO-tag from 200 OK INVITE. This affects parallel forking scenarios where rejected branches are terminated via BYE by caller. Thanks for reporting and testing to Marco Hierl. + + +2013-08-14 Norm Brandinger + * [34fe501] : + + pike: correct spelling + (cherry picked from commit 879eacbb5e2f90f1dba2f9b23165e725a5c754d4) + + +2013-08-14 liviuchircu + * [a9c462d] : + + Fix: sdp_free() bug introduced in commit bde8c0a045 + Credits to csollet for reporting. + (cherry picked from commit a5e9f4bc818a94b282e7ccd10f44dec2d74a794e) + + +2013-08-13 Bogdan Andrei IANCU + * [c55408b] : + + Merge pull request #38 from fabriziopicconi/1.10 + wrong mpath folder (detected by rpmbuild) + + +2013-08-13 Bogdan Andrei IANCU + * [eb9cbfc] : + + Merge pull request #40 from fabriziopicconi/patch-7 + Update to 1.10 + + +2013-08-13 Bogdan Andrei IANCU + * [649c5e7] : + + Merge pull request #53 from nikbyte/1.10 + yum package specs / init-scripts changes for el/fedora + + +2013-08-13 Bogdan-Andrei Iancu + * [5392af6] : + + fixed setting the default min_expires and max_expires module parameters. Credits go to MayamaTakeshi. + + +2013-08-13 Nick Altmann + * [30fb94b] : + + add m4 config support for el/fedora distros, spec file synced with build server + + +2013-08-13 Nick Altmann + * [4597948] : + + add m4 config support for debian distros + + +2013-08-13 Damien Sandras + * [c13a50d] : + + Added documentation for recent changes. + + +2013-08-13 Damien Sandras + * [9d4bc28] : + + PUBLISH requests are now handled in the same order than received. + That is specifically useful for pua dialoginfo which was generating dialog + info notifications that were handled in the wrong order with that patch. + PUBLISH with older documents were sometimes treated after PUBLISH requests + with newer documents, leading to incoherent states. + + +2013-08-13 Nick Altmann + * [8a1c5d9] : + + porting of 8ed2ed: spec file for el/fedora synced with build server + spec file for el/fedora synced with build server + + +2013-08-13 vladpaiu + * [6ff91a1] : + + Merge pull request #47 from fabriziopicconi/patch-9 + remove warning compilation + + +2013-08-12 vladpaiu + * [ddd0c34] : + + Merge pull request #49 from fabriziopicconi/patch-11 + improved parallel compilation + + +2013-08-12 Vlad Paiu + * [6b13b19] : + + Fixed double free issue when reading multiple SIP messages in one TCP chunk Do proper zero-ing out of the tcp_req structure + (cherry picked from commit db24ec00b0d1c48ea109c9609bed81d1f8efa014) + + +2013-08-11 Vlad Paiu + * [e8c3c82] : + + Increased menuconfig parsing buffer to 1024 (Reported by Richard Revels) + Removed mi_http from the excluded modules list - has no external dependencies + (cherry picked from commit 41157e7b911bfb896f4f0a9cb2dc1049a0c2b0c4) + + +2013-08-11 saghul + * [51c5504] : + + Fixed compilation in systems without EPOLL + (cherry picked from 7d727aafa93f79421304121d95f2a038bdbf887c) + + +2013-08-09 liviuchircu + * [4b6531e] : + + Fix: mathops internal parsing bug + Credits to Jayesh Nambiar for reporting + (cherry picked from commit aeddd311d29c9d5cae5017bd59674031089b5574) + + +2013-08-08 Vlad Paiu + * [50b3436] : + + Fixed warning Fixed compilation error for libcurl < 7.16.2 ( due to CURLOPT_TIMEOUT_MS ) + (cherry picked from commit 1ee176a5fadb872cc5015141a118f0398bcb1f8f) + + +2013-08-08 fabriziopicconi + * [33134fe] : + + parallel compilation + speedup compilation on multicore/multicpu machines + + +2013-08-08 fabriziopicconi + * [5d253f8] : + + parallel compilation + speeduo compilation on multicore/multicpu machines + + +2013-08-08 fabriziopicconi + * [314537b] : + + remove warning compilation + remove warning: ‘ret’ may be used uninitialized in this function + + +2013-08-07 saghul + * [09757ce] : + + Cleanup menucnfig files when doing make proper + (cherry picked from commit 4d4d3dbefc084db00c122e499b9299240ed6e0d5) + + +2013-08-07 Saúl Ibarra Corretgé + * [4626525] : + + Fixed crash if send_subscribe fails early + In that case presentity is still NULL, check for it + (cherry picked from commit 6e3b16ec6d3fe59b5a1b415b548394be401e69af) + + +2013-08-06 Vlad Paiu + * [3509fc9] : + + Properly mentioned Steve Frécinaux from Be IP as the module creator + (cherry picked from commit 8f642bab2a47f29c2984f286279f5be4d0d5815a) + + +2013-08-06 Vlad Paiu + * [4bce0cb] : + + Fixed goes_to_gw, is_from_gw and dr_is_gw so that they accept negative gateway types ( to match all gw types) + (cherry picked from commit 3bfd505b72d46ea31930efe31b52e3bd5ea477de) + + +2013-08-06 fabriziopicconi + * [5af905e] : + + Update to 1.10 + Some new rpm optional modules are added: + mi_xmlrpc_ng,sngtc,db_cachedb,mathops,rest_client + + +2013-08-06 fabriziopicconi + * [a031014] : + + wrong mpath folder (detected by rpmbuild) + + =========================== Release 1.10.0 ============================== 2013-08-05 Liviu Chircu @@ -116,7 +1171,7 @@ * [4659c22] : new rpm modules - Some new rpm optional modules are added: + Some new rpm optional modules are added: cachedb_cassandra,cachedb_mongodb,osp,perl,perlvdb,tlsops 2013-07-11 Vlad Paiu @@ -167,12 +1222,12 @@ * [ef3eb8c] : spec file update to CentOS 6 - - CentOS 6 support - Remove rpmbuild warning on BuildPrereq now deprecated for BuildRequires - - opensips 1.9.0 support - Updated list of excluded modules - Updated list of file in rpm of core and modules - - Some new rpm optional modules are added: + - CentOS 6 support + Remove rpmbuild warning on BuildPrereq now deprecated for BuildRequires + - opensips 1.9.0 support + Updated list of excluded modules + Updated list of file in rpm of core and modules + - Some new rpm optional modules are added: db_http pi_http json cachedb_couchbase cachedb_memcached cachedb_redis event_rabbitmq db_berkeley perl db_perlvdb carrierroute mmgeoip ldap h350 identity regex dialplan Xlog mi_xmlrpc db_oracle 2013-06-10 Liviu Chircu @@ -216,14 +1271,14 @@ * [38fab02] : Compilation problem under CentOS 6 - The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. + The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. This path add this folder in the search list. 2013-06-08 Fabrizio Picconi * [0ea16ef] : Compilation problem under CentOS 6 - The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. + The installation of oracle-instantclient11.2-11.2.0.3.0-1.i386.rpm put the libocci into /usr/lib/oracle/11.2/client/lib folder. This path add this folder in the search list. 2013-06-07 Liviu Chircu diff --git a/Makefile b/Makefile index e6e167327f..5c87f675a0 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ modules: if [ -d "$$r" ]; then \ echo "" ; \ echo "" ; \ - $(MAKE) -C $$r ; \ + $(MAKE) -j -C $$r ; \ fi ; \ fi ; \ done diff --git a/Makefile.conf b/Makefile.conf index c1393e0a92..c1b05031ec 100644 --- a/Makefile.conf +++ b/Makefile.conf @@ -24,13 +24,14 @@ #ldap= Implements an LDAP search interface for OpenSIPS | OpenLDAP library & development files, tipically libldap and libldap-dev #lua= Easily implement your own OpenSIPS extensions in Lua | liblua5.1-0-dev, libmemcache-dev and libmysqlclient-dev #httpd= Provides an HTTP transport layer implementation for OpenSIPS. | libmicrohttpd -#mi_http= Provides a simple web interface for running MI comands -#pi_http= Provides a simple web database provisioning interface | XML parsing & building library, tipically libxml-dev -#mi_xmlrpc_ng= Implements a xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml -#mi_xmlrpc= libxmlrpc-c3 version 0.9.10 - 0.9.42. (using other versions may be dangerous and lead to opensips blocking) +#mi_xmlrpc_ng= New version of the xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml +#mi_xmlrpc= Old version of the xmlrpc server that handles xmlrpc requests and generates xmlrpc responses. | parsing/building XML library, tipically libxml +#mi_xmlrpc= libxmlrpc-c3 version 0.9.10 - 0.9.42. (using other versions may be dangerous and lead to opensips blocking) +#mi_xmlrpc= libxmlrpc-c3-dev version 0.9.10 - 0.9.42 #mmgeoip= Lightweight wrapper for the MaxMind GeoIP API | libGeoIP #osp= Enables OpenSIPS to support secure, multi-lateral peering using the OSP standard | OSP development kit, tipically osptoolkit #perl= Easily implement your own OpenSIPS extensions in Perl | Perl library development files, tipically libperl-dev +#pi_http= Provides a simple web database provisioning interface | XML parsing & building library, tipically libxml-dev #presence= Handles PUBLISH and SUBSCRIBE messages and generates NOTIFY messages in a general, event independent way | XML parsing & Building library, tipically libxml-dev #presence_dialoginfo= Enables the handling of "Event: dialog" (as defined in RFC 4235) | XML parsing & building library, tipically libxml-dev #presence_mwi= Does specific handling for notify-subscribe message-summary (message waiting indication) events as specified in RFC 3842 | XML parsing & building library, tipically libxml-dev @@ -50,7 +51,7 @@ #xcap_client= XCAP client for OpenSIPS.It fetches XCAP elements, either documents or part of them, by sending HTTP GET requests | libxml-dev and libcurl-dev #xmpp= Gateway between OpenSIPS and a jabber server. It enables the exchange of IMs between SIP clients and XMPP(jabber) clients. | parsing/building XML files, tipically libexpat1-devel -exclude_modules?= aaa_radius b2b_logic cachedb_couchbase cachedb_cassandra cachedb_memcached cachedb_mongodb cachedb_redis carrierroute cpl-c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_unixodbc dialplan event_rabbitmq h350 regex identity jabber json ldap lua httpd pi_http mi_http mi_xmlrpc mi_xmlrpc_ng mmgeoip osp perl presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls sngtc snmpstats xcap xcap_client xmpp +exclude_modules?= aaa_radius b2b_logic cachedb_cassandra cachedb_couchbase cachedb_memcached cachedb_mongodb cachedb_redis carrierroute cpl-c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_unixodbc dialplan event_rabbitmq h350 regex identity jabber json ldap lua httpd mi_xmlrpc_ng mi_xmlrpc mmgeoip osp perl pi_http presence presence_dialoginfo presence_mwi presence_xml pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python rest_client rls sngtc snmpstats xcap xcap_client xmpp include_modules?= @@ -82,3 +83,5 @@ DEFS+= -DUSE_TCP #Compiles in TCP support #DEFS+= -DNOSMP #Do not use SMP sompliant locking. Faster but won't work on SMP machines #DEFS+= -DEXTRA_DEBUG #Compiles in some extra debugging code #DEFS+= -DORACLE_USRLOC #Uses Oracle compatible queries for USRLOC + +PREFIX=/usr/ diff --git a/Makefile.defs b/Makefile.defs index 4e7af9057c..9b15ea9ea0 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -63,8 +63,8 @@ MAIN_NAME=opensips #version number VERSION = 1 PATCHLEVEL = 10 -SUBLEVEL = 0 -EXTRAVERSION = dev +SUBLEVEL = 1 +EXTRAVERSION = RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) ifneq ($(OPENSIPS_RELEASE),) # allow override thru environment diff --git a/Makefile.rules b/Makefile.rules index f06de41e31..c21b53590f 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -100,6 +100,7 @@ proper realclean distclean: clean $(MAKE) -C $$r proper ; \ fi ; \ done + -@if [ -d menuconfig ]; then $(MAKE) -C menuconfig proper; fi -@if [ -d utils/opensipsunix ]; then $(MAKE) -C utils/opensipsunix proper; fi -@if [ -d utils/db_berkeley ]; then $(MAKE) -C utils/db_berkeley proper; fi -@if [ -d utils/db_oracle ]; then $(MAKE) -C utils/db_oracle proper; fi diff --git a/NEWS b/NEWS index 302c6c7962..2a5d10daaa 100644 --- a/NEWS +++ b/NEWS @@ -50,7 +50,7 @@ What is new in 1.6.0 2.4 Transformations * added a new nameaddr transformation: param; it extract the value of a certain parameter - o example: avp(i:4) = $(hdr(From){nameaddr.param, tag}); + o example: avp(from) = $(hdr(From){nameaddr.param, tag}); 2.5 AAA API and enhancement of RADIUS support(NEW) AAA API @@ -201,7 +201,7 @@ important - Renamed as AUTH_AAA module - see the AAA API and module changes. * example: modparam("call_control", "init", "call-id=$ci to=$tu from=$fu - authruri=$du another_field = $avp(i:10)") + authruri=$du another_field = $avp(extra)") * the message sent if one of these parameter is set will be the string resulted after expanding the pvars diff --git a/bin_interface.c b/bin_interface.c index dc68bcdfa2..76e7c5e093 100644 --- a/bin_interface.c +++ b/bin_interface.c @@ -25,6 +25,7 @@ #include "bin_interface.h" #include "udp_server.h" #include "config.h" +#include "daemonize.h" #include "pt.h" struct socket_info *bin; @@ -81,15 +82,17 @@ int bin_init(str *mod_name, int cmd_type) /* * copies the given string at the 'cpos' position in the buffer + * allows null strings (NULL content or NULL param) * * @return: 0 on success */ int bin_push_str(const str *info) { - if (!cpos || (cpos - send_buffer + info->len + LEN_FIELD_SIZE) > BUF_SIZE) + if (!cpos || (cpos - send_buffer + LEN_FIELD_SIZE + (info ? info->len : 0)) + > BUF_SIZE) return -1; - if (!info || info->len == 0) { + if (!info || info->len == 0 || !info->s) { memset(cpos, 0, LEN_FIELD_SIZE); cpos += LEN_FIELD_SIZE; return 0; @@ -434,6 +437,14 @@ int start_bin_receivers(void) bin->sock_str.s); bind_address = bin; + if (init_child(PROC_BIN) < 0) { + LM_ERR("init_child failed for BIN listener\n"); + if (send_status_code(-1) < 0) + LM_ERR("failed to send status code\n"); + clean_write_pipeend(); + exit(-1); + } + bin_receive_loop(); exit(-1); } else diff --git a/bin_interface.h b/bin_interface.h index f0e9195a0f..c1beb2b809 100644 --- a/bin_interface.h +++ b/bin_interface.h @@ -74,15 +74,16 @@ int bin_init(str *mod_name, int packet_type); /* * adds a new string value to the packet being currently built + * @info: may also be NULL * - * @return: 0 on success + * @return: 0 on success, otherwise buffer limit reached */ int bin_push_str(const str *info); /* * adds a new integer value to the packet being currently built * - * @return: 0 on success + * @return: 0 on success, otherwise buffer limit reached */ int bin_push_int(int info); diff --git a/cachedb/cachedb.c b/cachedb/cachedb.c index 691df46887..c07a3e3cc8 100644 --- a/cachedb/cachedb.c +++ b/cachedb/cachedb.c @@ -299,6 +299,7 @@ int cachedb_remove(str* cachedb_name, str* attr) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -338,7 +339,11 @@ int cachedb_remove(str* cachedb_name, str* attr) return -1; } - return cde->cdb_func.remove(con,attr)<0?-1:1; + ret = cde->cdb_func.remove(con,attr); + if (ret == 0) + ret++; + + return ret; } int cachedb_store(str* cachedb_name, str* attr, str* val,int expires) @@ -347,6 +352,7 @@ int cachedb_store(str* cachedb_name, str* attr, str* val,int expires) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL || val == NULL) { @@ -386,7 +392,11 @@ int cachedb_store(str* cachedb_name, str* attr, str* val,int expires) return -1; } - return cde->cdb_func.set(con,attr,val,expires)<0?-1:1; + ret = cde->cdb_func.set(con,attr,val,expires); + if (ret ==0) + ret++; + + return ret; } int cachedb_fetch(str* cachedb_name, str* attr, str* val) @@ -395,6 +405,7 @@ int cachedb_fetch(str* cachedb_name, str* attr, str* val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL || val == NULL) { @@ -434,7 +445,11 @@ int cachedb_fetch(str* cachedb_name, str* attr, str* val) return -1; } - return cde->cdb_func.get(con,attr,val)<0?-1:1; + ret = cde->cdb_func.get(con,attr,val); + if (ret == 0) + ret++; + + return ret; } int cachedb_counter_fetch(str* cachedb_name, str* attr, int* val) @@ -443,6 +458,7 @@ int cachedb_counter_fetch(str* cachedb_name, str* attr, int* val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL || val == NULL) { @@ -482,7 +498,11 @@ int cachedb_counter_fetch(str* cachedb_name, str* attr, int* val) return -1; } - return cde->cdb_func.get_counter(con,attr,val)<0?-1:1; + ret = cde->cdb_func.get_counter(con,attr,val); + if (ret == 0) + ret++; + + return ret; } int cachedb_add(str* cachedb_name, str* attr, int val,int expires,int *new_val) @@ -491,6 +511,7 @@ int cachedb_add(str* cachedb_name, str* attr, int val,int expires,int *new_val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -536,7 +557,11 @@ int cachedb_add(str* cachedb_name, str* attr, int val,int expires,int *new_val) return -1; } - return cde->cdb_func.add(con,attr,val,expires,new_val)<0?-1:1; + ret = cde->cdb_func.add(con,attr,val,expires,new_val); + if (ret == 0) + ret++; + + return ret; } int cachedb_sub(str* cachedb_name, str* attr, int val,int expires,int *new_val) @@ -545,6 +570,7 @@ int cachedb_sub(str* cachedb_name, str* attr, int val,int expires,int *new_val) str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -590,7 +616,11 @@ int cachedb_sub(str* cachedb_name, str* attr, int val,int expires,int *new_val) return -1; } - return cde->cdb_func.sub(con,attr,val,expires,new_val)<0?-1:1; + ret = cde->cdb_func.sub(con,attr,val,expires,new_val); + if (ret == 0) + ret++; + + return ret; } cachedb_con* cachedb_do_init(str *url,void* (*new_connection)(struct cachedb_id *)) @@ -672,6 +702,7 @@ int cachedb_raw_query(str* cachedb_name, str* attr, cdb_raw_entry*** reply,int e str cde_engine,grp_name; char *p; cachedb_con *con; + int ret; if(cachedb_name == NULL || attr == NULL) { @@ -716,7 +747,11 @@ int cachedb_raw_query(str* cachedb_name, str* attr, cdb_raw_entry*** reply,int e return -1; } - return cde->cdb_func.raw_query(con,attr,reply,expected_kv_no,rpl_no)<0?-1:1; + ret = cde->cdb_func.raw_query(con,attr,reply,expected_kv_no,rpl_no); + if (ret == 0) + ret++; + + return ret; } void free_raw_fetch(cdb_raw_entry **reply,int no_key,int no_val) diff --git a/cfg.lex b/cfg.lex index f6ab4b2b2b..6ef1c05332 100644 --- a/cfg.lex +++ b/cfg.lex @@ -639,6 +639,8 @@ IMPORTFILE "import_file" {TCP_KEEPCOUNT} { count(); yylval.strval=yytext; return TCP_KEEPCOUNT; } {TCP_KEEPIDLE} { count(); yylval.strval=yytext; return TCP_KEEPIDLE; } {TCP_KEEPINTERVAL} { count(); yylval.strval=yytext; return TCP_KEEPINTERVAL; } +{TCP_MAX_MSG_CHUNKS} { count(); yylval.strval=yytext; return TCP_MAX_MSG_CHUNKS; } +{TCP_MAX_MSG_TIME} { count(); yylval.strval=yytext; return TCP_MAX_MSG_TIME; } {DISABLE_TLS} { count(); yylval.strval=yytext; return DISABLE_TLS; } {TLSLOG} { count(); yylval.strval=yytext; return TLS_PORT_NO; } {TLS_PORT_NO} { count(); yylval.strval=yytext; return TLS_PORT_NO; } diff --git a/cfg.y b/cfg.y index 856ed4c235..e27c50e1cc 100644 --- a/cfg.y +++ b/cfg.y @@ -482,6 +482,11 @@ extern int line; %type route_name %type route_param +/* + * since "if_cmd" is inherently ambiguous, + * skip 1 harmless shift/reduce conflict when compiling our grammar + */ +%expect 1 %% @@ -695,7 +700,7 @@ assign_stm: DEBUG EQUAL snumber { } | EVENT_SHM_THRESHOLD EQUAL error { yyerror("int value expected"); } | EVENT_PKG_THRESHOLD EQUAL NUMBER { - #ifdef PKG_MEM + #ifdef PKG_MALLOC #ifdef STATISTICS if ($3 < 0 || $3 > 100) yyerror("PKG threshold has to be a percentage between 0 and 100"); @@ -703,7 +708,7 @@ assign_stm: DEBUG EQUAL snumber { #else yyerror("statistics support not compiled in"); #endif - #else /* PKG_MEM */ + #else /* PKG_MALLOC */ yyerror("pkg memory support not compiled in"); #endif } diff --git a/db/db_insertq.c b/db/db_insertq.c index 16ecc26295..a36b85561a 100644 --- a/db/db_insertq.c +++ b/db/db_insertq.c @@ -125,6 +125,10 @@ void flush_query_list(void) } it->dbf.use_table(it->conn,&it->table); + + //Reset prepared statement between query lists/connections + my_ps = NULL; + CON_PS_REFERENCE(it->conn) = &my_ps; /* and let's insert the rows */ diff --git a/db/db_query.c b/db/db_query.c index 78e7a258ec..cc762ace00 100644 --- a/db/db_query.c +++ b/db/db_query.c @@ -246,8 +246,10 @@ int db_do_insert(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v, /* if we have a PS, leave the function handling prep stmts in the module to free the rows once it's done */ - if (!CON_HAS_PS(_h)) + if (!CON_HAS_PS(_h)) { shm_free(buffered_rows[i]); + buffered_rows[i] = NULL; + } } if (off + 1 > SQL_BUF_LEN) goto error0; diff --git a/db/schema/dialog.xml b/db/schema/dialog.xml index 5aa611f72f..45b9a79a0c 100644 --- a/db/schema/dialog.xml +++ b/db/schema/dialog.xml @@ -22,7 +22,7 @@ unsigned long &table_id_len; - long,auto + long h_entry | h_id diff --git a/db/schema/silo.xml b/db/schema/silo.xml index 5c0a1fc849..2560ae3e96 100644 --- a/db/schema/silo.xml +++ b/db/schema/silo.xml @@ -92,7 +92,6 @@ body binary - Body of the message diff --git a/evi/event_interface.c b/evi/event_interface.c index 296d29c5e5..2f6ee8ec99 100644 --- a/evi/event_interface.c +++ b/evi/event_interface.c @@ -65,7 +65,7 @@ event_id_t evi_publish_event(str event_name) } } else if (events_no == max_alloc_events) { max_alloc_events *= 2; - events = shm_realloc(events, max_alloc_events); + events = shm_realloc(events, max_alloc_events * sizeof(evi_event_t)); if (!events) { LM_ERR("no more shm memory to hold %d events\n", max_alloc_events); return EVI_ERROR; diff --git a/flags.c b/flags.c index 077ddbd2e5..7ec2c89855 100644 --- a/flags.c +++ b/flags.c @@ -109,6 +109,7 @@ str bitmask_to_flag_list(enum flag_type type, int bitmask) int flag_list_to_bitmask(str *flags, enum flag_type type, char delim) { char *p, *lim; + char *crt_flag; str name; struct flag_entry *e; int ret = 0; @@ -117,14 +118,15 @@ int flag_list_to_bitmask(str *flags, enum flag_type type, char delim) return 0; lim = flags->s + flags->len; + crt_flag = flags->s; for (p = flags->s; p <= lim; p++) { if (p == lim || *p == delim) { - name.s = flags->s; - name.len = p - flags->s; + name.s = crt_flag; + name.len = p - crt_flag; for (e = flag_lists[type]; e; e = e->next) { - if (e->name.len == p - flags->s && + if (e->name.len == p - crt_flag && str_strcmp(&e->name, &name) == 0) { ret |= 1 << e->bit; @@ -132,7 +134,7 @@ int flag_list_to_bitmask(str *flags, enum flag_type type, char delim) } } - flags->s = p + 1; + crt_flag = p + 1; } } @@ -190,6 +192,7 @@ int get_flag_id_by_name(int flag_type, char *flag_name) it->next = *flag_list; *flag_list = it; + LM_DBG("New flag: [ %.*s : %d ][%d]\n", fn.len, fn.s, it->bit, flag_type); return it->bit; } diff --git a/io_wait.h b/io_wait.h index 704c51598a..eef60a420c 100644 --- a/io_wait.h +++ b/io_wait.h @@ -86,6 +86,7 @@ #include #include "dprint.h" +#include "globals.h" /* tcp_async */ #include "poll_types.h" /* poll_types*/ #ifdef HAVE_SIGIO_RT @@ -318,6 +319,7 @@ inline static int io_watch_add( io_wait_h* h, struct fd_map* e; + int already; #ifdef HAVE_EPOLL struct epoll_event ep_event; #endif @@ -329,7 +331,6 @@ inline static int io_watch_add( io_wait_h* h, int idx; int check_io; struct pollfd pf; - int already; check_io=0; /* set to 1 if we need to check for pre-existing queued io/data on the fd */ diff --git a/main.c b/main.c index f162657d9b..9993c24c24 100644 --- a/main.c +++ b/main.c @@ -920,7 +920,7 @@ static int main_loop(void) else { /* wait for first proc to finish the startup route */ if(chd_rank == 1 && startup_done!=NULL) - while( !(*startup_done) ) usleep(5); + while( !(*startup_done) ) {usleep(5);handle_sigs();} } } } @@ -977,7 +977,7 @@ static int main_loop(void) } else { /* wait for first proc to finish the startup route */ if( (si==sctp_listen && i==0) && startup_done!=NULL) - while( !(*startup_done) ) usleep(5); + while( !(*startup_done) ) {usleep(5);handle_sigs();} } } } @@ -999,7 +999,7 @@ static int main_loop(void) if (tcp_init_children(&chd_rank, startup_done)<0) goto error; /* wait for the startup route to be executed */ if( startup_done!=NULL) - while( !(*startup_done) ) usleep(5); + while( !(*startup_done) ) {usleep(5);handle_sigs();} /* start tcp+tls master proc */ if ( (pid=internal_fork( "TCP main"))<0 ) { LM_CRIT("cannot fork tcp main process\n"); diff --git a/menuconfig/Makefile b/menuconfig/Makefile index 9faa5f4529..90e967311f 100644 --- a/menuconfig/Makefile +++ b/menuconfig/Makefile @@ -5,7 +5,7 @@ MENUCONFIG_HAVE_SOURCES?=1 CFLAGS=-g -Wall -DMENUCONFIG_CFG_PATH=\"$(MENUCONFIG_CFG_PATH)\" \ -DMENUCONFIG_GEN_PATH=\"$(MENUCONFIG_GEN_PATH)\" \ -DMENUCONFIG_HAVE_SOURCES=$(MENUCONFIG_HAVE_SOURCES) $(CC_EXTRA_OPTS) -MY_LDFLAGS=-lcurses $(LD_EXTRA_OPTS) +MY_LDFLAGS=-lncurses $(LD_EXTRA_OPTS) EXEC_NAME=configure all: $(MENUCONFIG_FILES) $(CC) -o $(EXEC_NAME) $(CFLAGS) $^ $(MY_LDFLAGS) diff --git a/menuconfig/configs/opensips_residential.m4 b/menuconfig/configs/opensips_residential.m4 index faf7a3e4e5..504e943a53 100644 --- a/menuconfig/configs/opensips_residential.m4 +++ b/menuconfig/configs/opensips_residential.m4 @@ -172,9 +172,10 @@ modparam("auth_db|usrloc|uri", "use_domain", 1) ', `') ifelse(USE_PRESENCE,`yes',`#### PRESENCE modules +loadmodule "xcap.so" loadmodule "presence.so" loadmodule "presence_xml.so" -modparam("presence|presence_xml", "db_url", +modparam("xcap|presence", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") # CUSTOMIZE ME modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060") # CUSTOMIZE ME diff --git a/menuconfig/parser.c b/menuconfig/parser.c index 2a3b37f162..744d1e6a1b 100644 --- a/menuconfig/parser.c +++ b/menuconfig/parser.c @@ -35,6 +35,7 @@ #define MENUCONFIG_CFG_PATH_LEN strlen(MENUCONFIG_CFG_PATH) static char prev_module[MAX_MODULE_NAME_SIZE]; +static int prev_module_len=0; static select_item *prev_item; /* Parses a single module dependency line */ @@ -56,7 +57,21 @@ int parse_dep_line(char *line,select_menu *parent) mod_name[name_len]=0; /* Is this still the previous module ? */ - if (memcmp(prev_module,mod_name,name_len) != 0) { + if (name_len == prev_module_len && memcmp(prev_module,mod_name,name_len) == 0) { + /* Previously found module with multiple deps. + * Just add the new dependency */ + fprintf(output,"found prev module %s with extra deps\n",mod_name); + + mod_dep = p+1; + dep_len = (line+len) - mod_dep; + mod_dep[dep_len]=0; + + if (add_dependency(prev_item,mod_dep) < 0) { + fprintf(output,"Failed to add dependency\n"); + return -1; + } + } else { + fprintf(output,"found new module %s\n",mod_name); /* nope, new module, get description */ mod_desc=p+1; @@ -90,19 +105,8 @@ int parse_dep_line(char *line,select_menu *parent) prev_item = item; strcpy(prev_module,mod_name); - } else { - /* Previously found module with multiple deps. - * Just add the new dependency */ - - mod_dep = p+1; - dep_len = (line+len) - mod_dep; - mod_dep[dep_len]=0; - - if (add_dependency(prev_item,mod_dep) < 0) { - fprintf(output,"Failed to add dependency\n"); - return -1; - } - } + prev_module_len = name_len; + } return 0; } @@ -245,7 +249,7 @@ int parse_prefix_line(char *line,select_menu *menu) } /* Parse an m4 defs line for a cfg entry */ -#define READ_BUF_SIZE 512 +#define READ_BUF_SIZE 1024 static char read_buf[READ_BUF_SIZE]; int parse_defs_m4_line(char *line,select_menu *menu) { diff --git a/mod_fix.c b/mod_fix.c index 22bbdb5dd7..e118f21723 100644 --- a/mod_fix.c +++ b/mod_fix.c @@ -203,7 +203,6 @@ int fixup_uint_uint(void** param, int param_no) return fixup_uint(param); } -#if 0 /*! \brief * - helper function * Convert char* parameter to signed int @@ -220,7 +219,7 @@ int fixup_sint( void** param) if(str2sint(&s, &si)==0) { pkg_free(*param); - *param=(void *)si; + *param=(void *)(unsigned long)si; return 0; } LM_ERR("bad number <%s>\n", (char *)(*param)); @@ -256,6 +255,7 @@ int fixup_sint_sint(void** param, int param_no) return fixup_sint(param); } +#if 0 /*! \brief * fixup for functions that get two parameters * - first parameter is converted to signed int diff --git a/mod_fix.h b/mod_fix.h index 4b28ac983d..e9e6512ddb 100644 --- a/mod_fix.h +++ b/mod_fix.h @@ -58,9 +58,9 @@ int fixup_free_str_str(void** param, int param_no); int fixup_uint_null(void** param, int param_no); int fixup_uint_uint(void** param, int param_no); -#if 0 int fixup_sint_null(void** param, int param_no); int fixup_sint_sint(void** param, int param_no); +#if 0 int fixup_sint_uint(void** param, int param_no); int fixup_uint_sint(void** param, int param_no); #endif @@ -102,6 +102,7 @@ int fixup_spve(void** param); int fixup_pvar(void **param); int fixup_str(void **param); int fixup_uint(void** param); +int fixup_sint(void** param); int fixup_igp(void** param); int fixup_sgp(void** param); diff --git a/modules/acc/README b/modules/acc/README index 6b986495ff..f0697c245c 100644 --- a/modules/acc/README +++ b/modules/acc/README @@ -502,7 +502,7 @@ modparam("acc", "multi_leg_info", "leg_src=$avp(src);leg_dst=$avp(dst)") # for AAA-based accounting, use the names of the AAA AVPs modparam("acc", "multi_leg_info", - "AAA_LEG_SRC=$avp(src);AAA_LEG_SRC=$avp(dst)") + "AAA_LEG_SRC=$avp(src);AAA_LEG_DST=$avp(dst)") # for DIAMETER-based accounting, use the DIAMETER AVP ID (as integer) modparam("acc", "multi_leg_info", "2345=$avp(src);2346=$avp(dst)") diff --git a/modules/acc/acc.c b/modules/acc/acc.c index 7750a2ae73..d8051d8c3c 100644 --- a/modules/acc/acc.c +++ b/modules/acc/acc.c @@ -1417,22 +1417,18 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl) int n; int i; int backup_idx = -1, ret = -1; - event_id_t event = EVI_ERROR; /* * if the code is not set, choose the missed calls event * otherwise, check if the code is negative */ - event = (!acc_env.code || acc_env.code > 300) ? - acc_missed_event : acc_event; - - if (event == EVI_ERROR) { + if (acc_env.event == EVI_ERROR) { LM_ERR("event not registered %d\n", acc_event); return -1; } /* check if someone is interested in this event */ - if (!evi_probe_event(event)) + if (!evi_probe_event(acc_env.event)) return 1; m = core2strar( rq, val_arr ); @@ -1466,7 +1462,7 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl) backup_idx = m - 1; evi_params[backup_idx]->next = NULL; - if (evi_raise_event(event, acc_event_params) < 0) { + if (evi_raise_event(acc_env.event, acc_event_params) < 0) { LM_ERR("cannot raise ACC event\n"); goto end; } @@ -1482,7 +1478,7 @@ int acc_evi_request( struct sip_msg *rq, struct sip_msg *rpl) backup_idx = i - 1; evi_params[backup_idx]->next = NULL; - if (evi_raise_event(event, acc_event_params) < 0) { + if (evi_raise_event(acc_env.event, acc_event_params) < 0) { LM_ERR("cannot raise ACC event\n"); goto end; } diff --git a/modules/acc/acc.h b/modules/acc/acc.h index 74e71844a1..3bb29e8cc6 100644 --- a/modules/acc/acc.h +++ b/modules/acc/acc.h @@ -112,6 +112,9 @@ int acc_evi_request( struct sip_msg *req, struct sip_msg *rpl); int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg); int store_evi_extra_values(struct dlg_cell *dlg, struct sip_msg *req, struct sip_msg *reply); +extern event_id_t acc_cdr_event; +extern event_id_t acc_event; +extern event_id_t acc_missed_event; @@ -120,4 +123,5 @@ int acc_diam_init(); int acc_diam_request( struct sip_msg *req, struct sip_msg *rpl); #endif + #endif diff --git a/modules/acc/acc_logic.c b/modules/acc/acc_logic.c index ae9c34dce4..764167b4ea 100644 --- a/modules/acc/acc_logic.c +++ b/modules/acc/acc_logic.c @@ -158,6 +158,11 @@ static inline void env_set_comment(struct acc_param *accp) acc_env.reason = accp->reason; } +static inline void env_set_event(event_id_t ev) +{ + acc_env.event = ev; +} + static inline int acc_preparse_req(struct sip_msg *req) { @@ -210,7 +215,7 @@ int w_acc_aaa_request(struct sip_msg *rq, pv_elem_t* comment, char* foo) int w_acc_db_request(struct sip_msg *rq, pv_elem_t* comment, char *table) { struct acc_param accp; - int table_len = strlen(table); + int table_len; if (!table) { LM_ERR("db support not configured\n"); @@ -220,11 +225,13 @@ int w_acc_db_request(struct sip_msg *rq, pv_elem_t* comment, char *table) if (acc_preparse_req(rq)<0) return -1; + table_len = strlen(table); + acc_pvel_to_acc_param(rq, comment, &accp); env_set_to( rq->to ); env_set_comment( &accp ); - env_set_text(table, strlen(table)); + env_set_text(table, table_len); if (table_len == db_table_mc.len && (strncmp(table, db_table_mc.s, table_len) == 0)) { return acc_db_request(rq, NULL, &mc_ins_list); @@ -420,6 +427,7 @@ static inline void on_missed(struct cell *t, struct sip_msg *req, */ if (is_evi_mc_on(req)) { + env_set_event(acc_missed_event); acc_evi_request( req, reply ); flags_to_reset |= evi_missed_flag; } @@ -477,7 +485,7 @@ void acc_loaded_callback(struct dlg_cell *dlg, int type, LM_DBG("flags were not saved in dialog\n"); return; } - flags_l = (unsigned int)*flags_s.s; + flags_l = flag_list_to_bitmask(&flags_s, FLAG_TYPE_MSG, FLAG_DELIM); /* register database callbacks */ if (dlg_api.register_dlgcb(dlg, DLGCB_TERMINATED | @@ -566,9 +574,8 @@ static inline void acc_onreply( struct cell* t, struct sip_msg *req, return; } - flags_s.s = (char*)&req->flags; - flags_s.len = sizeof(unsigned int); - + flags_s = bitmask_to_flag_list(FLAG_TYPE_MSG, req->flags); + /* store flags into dlg */ if ( dlg_api.store_dlg_value(dlg, &flags_str, &flags_s) < 0) { LM_ERR("cannot store flag value into dialog\n"); @@ -588,8 +595,10 @@ static inline void acc_onreply( struct cell* t, struct sip_msg *req, } } else { /* do old accounting */ - if ( is_evi_acc_on(req) ) + if ( is_evi_acc_on(req) ) { + env_set_event(acc_cdr_event); acc_evi_request( req, reply ); + } if ( is_log_acc_on(req) ) { env_set_text( ACC_ANSWERED, ACC_ANSWERED_LEN); @@ -630,7 +639,7 @@ static void acc_dlg_callback(struct dlg_cell *dlg, int type, flags = (unsigned int)(long)(*_params->param); if (flags & evi_flag) { - + env_set_event(acc_cdr_event); if (acc_evi_cdrs(dlg, _params->msg) < 0) { LM_ERR("cannot send accounting events\n"); return; diff --git a/modules/acc/acc_logic.h b/modules/acc/acc_logic.h index e2393d075d..50f42a783d 100644 --- a/modules/acc/acc_logic.h +++ b/modules/acc/acc_logic.h @@ -43,6 +43,7 @@ struct acc_enviroment { struct hdr_field *to; str text; time_t ts; + event_id_t event; }; /* param trasnporter*/ diff --git a/modules/acc/doc/acc_admin.xml b/modules/acc/doc/acc_admin.xml index 0807badb4a..3b66dce91c 100644 --- a/modules/acc/doc/acc_admin.xml +++ b/modules/acc/doc/acc_admin.xml @@ -506,7 +506,7 @@ modparam("acc", "multi_leg_info", "leg_src=$avp(src);leg_dst=$avp(dst)") # for AAA-based accounting, use the names of the AAA AVPs modparam("acc", "multi_leg_info", - "AAA_LEG_SRC=$avp(src);AAA_LEG_SRC=$avp(dst)") + "AAA_LEG_SRC=$avp(src);AAA_LEG_DST=$avp(dst)") # for DIAMETER-based accounting, use the DIAMETER AVP ID (as integer) modparam("acc", "multi_leg_info", "2345=$avp(src);2346=$avp(dst)") diff --git a/modules/auth/README b/modules/auth/README index 1073c97478..396de91026 100644 --- a/modules/auth/README +++ b/modules/auth/README @@ -24,8 +24,7 @@ Jan Janak Copyright © 2005 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/auth/auth_mod.c b/modules/auth/auth_mod.c index 80f399fe31..9f397889bf 100644 --- a/modules/auth/auth_mod.c +++ b/modules/auth/auth_mod.c @@ -366,11 +366,11 @@ static inline int auth_get_ha1(struct sip_msg *msg, struct username* _username, pv_value_destroy(&sval); return 1; } - if(sval.rs.len!= _username->user.len - || strncasecmp(sval.rs.s, _username->user.s, sval.rs.len)) + if(sval.rs.len!= _username->whole.len + || strncasecmp(sval.rs.s, _username->whole.s, sval.rs.len)) { LM_DBG("username mismatch [%.*s] [%.*s]\n", - _username->user.len, _username->user.s, sval.rs.len, sval.rs.s); + _username->whole.len, _username->whole.s, sval.rs.len, sval.rs.s); pv_value_destroy(&sval); return 1; } diff --git a/modules/auth_aaa/README b/modules/auth_aaa/README index 0e072ccdcc..f022886d27 100644 --- a/modules/auth_aaa/README +++ b/modules/auth_aaa/README @@ -32,8 +32,7 @@ Irina-Maria Stanescu Copyright © 2005, 2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/auth_db/README b/modules/auth_db/README index fcc1345acc..053e510f11 100644 --- a/modules/auth_db/README +++ b/modules/auth_db/README @@ -23,8 +23,7 @@ Jan Janak Copyright © 2005 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/auth_diameter/README b/modules/auth_diameter/README index a2545dc021..8f8c09f4d5 100644 --- a/modules/auth_diameter/README +++ b/modules/auth_diameter/README @@ -10,8 +10,7 @@ Elena-Ramona Modroiu Copyright © 2003, 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/avpops/README b/modules/avpops/README index eed3c6d5e8..e50fedc236 100644 --- a/modules/avpops/README +++ b/modules/avpops/README @@ -12,8 +12,7 @@ Ramona-Elena Modroiu Copyright © 2004-2008 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents @@ -323,6 +322,7 @@ avp_db_load("$fu", "$avp(678)"); avp_db_load("$ru/domain", "i/domain_preferences"); avp_db_load("$avp(uuid)", "$avp(404fwd)/fwd_table"); avp_db_load("$ru", "$avp(123)/$some_scheme"); + # use DB URL id 3 avp_db_load("$ru", "$avp(1)", "3"); diff --git a/modules/b2b_entities/README b/modules/b2b_entities/README index 0fd2ee92c2..79bac4b643 100644 --- a/modules/b2b_entities/README +++ b/modules/b2b_entities/README @@ -15,8 +15,7 @@ Ovidiu Sas Copyright © 2009 Anca-Maria Vamanu Revision History - Revision $Revision: 8103 $ $Date: 2011-06-30 18:48:57 +0300 - (Thu, 30 Jun 2011) $ + Revision $Revision: 8103 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/b2b_entities/b2b_entities.c b/modules/b2b_entities/b2b_entities.c index f07c9295b6..4d64e8c258 100644 --- a/modules/b2b_entities/b2b_entities.c +++ b/modules/b2b_entities/b2b_entities.c @@ -167,7 +167,7 @@ static int mod_init(void) * if authentication is required */ if(load_uac_auth_api(&uac_auth_api)<0) { - LM_DBG("authentication functionality disabled:" + LM_INFO("authentication functionality disabled:" " load uac_auth first to enable it\n"); uac_auth_loaded = 0; } diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index 6b6dc698a1..5d916e2ff8 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -636,7 +636,7 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) /* if a CANCEL request - search iteratively in the server_htable*/ if(method_value == METHOD_CANCEL) { - str ruri= msg->first_line.u.request.uri; + /*str ruri= msg->first_line.u.request.uri;*/ str reply_text={"canceling", 9}; /* This makes no sense - why not accepting a CANCEL that was generated by other b2b instance ? or ourselves ? - bogdan @@ -648,7 +648,12 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) */ hash_index = core_hash(&callid, &from_tag, server_hsize); - dlg = b2bl_search_iteratively(&callid, &from_tag, &ruri, hash_index); + /* As per RFC3261, the RURI must be used when matching the CANCEL + against the INVITE, but we should not do it here as B2B learns + a RURI that may have been changed in script (before invoking the + B2B module), while the CANCEL has the original RURI (as received) + */ + dlg = b2bl_search_iteratively(&callid, &from_tag, NULL/*&ruri*/, hash_index); if(dlg == NULL) { lock_release(&server_htable[hash_index].lock); @@ -790,7 +795,7 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam) logic_notify: etype = (table==server_htable?B2B_SERVER:B2B_CLIENT); - if(req_routeid) + if(req_routeid > 0) { lock_release(&table[hash_index].lock); run_top_route(rlist[req_routeid].a, msg); @@ -2319,6 +2324,8 @@ void b2b_tm_cback(struct cell *t, b2b_table htable, struct tmcb_params *ps) extra_headers.len = new_hdr->len + t->uac[0].extra_headers.len; LM_DBG("[%.*s]\n", extra_headers.len, extra_headers.s); + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; b2b_send_indlg_req(dlg, B2B_CLIENT, b2b_key, &t->method, &extra_headers, &t->uac[0].body, 0); @@ -2786,10 +2793,10 @@ int b2b_apply_lumps(struct sip_msg* msg) if (msg->first_line.type==SIP_REQUEST) obuf.s = build_req_buf_from_sip_req(msg, (unsigned int*)&obuf.len, - NULL, 0, MSG_TRANS_NOVIA_FLAG ); + msg->rcv.bind_address, msg->rcv.proto, MSG_TRANS_NOVIA_FLAG ); else obuf.s = build_res_buf_from_sip_res(msg, (unsigned int*)&obuf.len, - NULL); + msg->rcv.bind_address); if (!obuf.s) { LM_ERR("no more shm mem\n"); diff --git a/modules/b2b_logic/logic.c b/modules/b2b_logic/logic.c index ba78ce1cfc..30807b0423 100644 --- a/modules/b2b_logic/logic.c +++ b/modules/b2b_logic/logic.c @@ -584,8 +584,9 @@ b2bl_entity_id_t* b2bl_new_client(str* to_uri, str* from_uri, ci.extra_headers = tuple->extra_headers; ci.body = (tuple->sdp.s?&tuple->sdp:NULL); ci.from_tag = NULL; - ci.send_sock = msg?(msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address):NULL;; - get_local_contact( ci.send_sock, &ci.local_contact); + ci.send_sock = msg?(msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address):NULL; + if (ci.send_sock) get_local_contact( ci.send_sock, &ci.local_contact); + else ci.local_contact = server_address; if(msg) { @@ -679,7 +680,7 @@ int process_bridge_200OK(struct sip_msg* msg, str* extra_headers, ci.extra_headers = extra_headers; ci.body = body; ci.from_tag = NULL; - ci.send_sock = msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address;; + ci.send_sock = msg->force_send_socket?msg->force_send_socket:msg->rcv.bind_address; get_local_contact( ci.send_sock, &ci.local_contact); if (str2int( &(get_cseq(msg)->number), &ci.cseq)!=0 ) @@ -3525,7 +3526,7 @@ int b2bl_bridge(str* key, str* new_dst, str* new_from_dname, int entity_no) ci.extra_headers = tuple->extra_headers; ci.body = tuple->b1_sdp.s?&tuple->b1_sdp:0; ci.cseq = 1; - get_local_contact( ci.send_sock, &ci.local_contact); + ci.local_contact = tuple->local_contact; client_id = b2b_api.client_new(&ci, b2b_client_notify, b2b_add_dlginfo, tuple->key); diff --git a/modules/benchmark/README b/modules/benchmark/README index 1b4e47b704..dcc164728d 100644 --- a/modules/benchmark/README +++ b/modules/benchmark/README @@ -19,8 +19,7 @@ Bastian Friedrich Copyright © 2007 Voice System SRL Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/cachedb_cassandra/Makefile b/modules/cachedb_cassandra/Makefile index dc812346df..9326177ef0 100644 --- a/modules/cachedb_cassandra/Makefile +++ b/modules/cachedb_cassandra/Makefile @@ -5,7 +5,7 @@ NAME=cachedb_cassandra.so CXX=g++ LD=g++ LIBS=cachedb_cassandra_dbase.o cassandra_constants.o cassandra_types.o Cassandra.o -L/usr/local/lib -lthrift -CXXFLAGS=$(CFLAGS:-Wno-deprecated option=) +CXXFLAGS=$(CFLAGS:-Wno-deprecated option=) -DHAVE_NETINET_IN_H # suppress a TON of warnings CXXFLAGS+= -Wno-write-strings -Wno-deprecated -Wno-unused-function -Wno-sign-compare -Wno-strict-aliasing diff --git a/modules/cachedb_local/README b/modules/cachedb_local/README index baa4d626e6..4d0a4af12d 100644 --- a/modules/cachedb_local/README +++ b/modules/cachedb_local/README @@ -15,8 +15,7 @@ Vladut-Stefan Paiu Copyright © 2009 Anca-Maria Vamanu Revision History - Revision $Revision: 5901 $ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/cachedb_local/hash.c b/modules/cachedb_local/hash.c index f474893348..2618dbbc7b 100644 --- a/modules/cachedb_local/hash.c +++ b/modules/cachedb_local/hash.c @@ -221,6 +221,7 @@ int lcache_htable_add(cachedb_con *con,str *attr,int val,int expires,int *new_va } old_value+=val; + expires = it->expires; new_value = sint2str(old_value,&new_len); it = shm_realloc(it,sizeof(lcache_entry_t) + attr->len +new_len); if (it == NULL) { @@ -236,13 +237,10 @@ int lcache_htable_add(cachedb_con *con,str *attr,int val,int expires,int *new_va it->attr.s = (char*)(it + 1); it->value.s =(char *)(it + 1) + attr->len; - + it->expires = expires; + memcpy(it->value.s,new_value,new_len); it->value.len = new_len; - if( expires != 0) { - LM_DBG("key %.*s will expire in %d s\n",attr->len,attr->s,expires); - it->expires = get_ticks() + expires; - } lock_release(&cache_htable[hash_code].lock); if (new_val) *new_val = old_value; diff --git a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c index ecf163921e..d4399a6b14 100644 --- a/modules/cachedb_mongodb/cachedb_mongodb_dbase.c +++ b/modules/cachedb_mongodb/cachedb_mongodb_dbase.c @@ -584,7 +584,11 @@ int mongo_raw_find(cachedb_con *connection,bson *raw_query,cdb_raw_entry ***repl continue; } LM_ERR("Failed to run query. Err = %d, %d , %d \n",conn->err,conn->errcode,conn->lasterrcode); - mongo_cmd_get_last_error(conn,MONGO_DATABASE(connection),&err_b); + ret = mongo_cmd_get_last_error(conn,MONGO_DATABASE(connection),&err_b); + if (ret == MONGO_OK) { + LM_ERR("We had error - can't tell what it was - we're really bogus - probably mongos down\n"); + return -1; + } bson_iterator_init(&i,&err_b); while( bson_iterator_next(&i)) { LM_ERR("Fetched ERR key [%s]. Val = ",bson_iterator_key(&i)); @@ -1456,30 +1460,38 @@ int mongo_db_query_trans(cachedb_con *con,const str *table,const db_key_t* _k, c /* we treat null values as DB string */ VAL_TYPE(cur_val) = DB_STRING; VAL_NULL(cur_val) = 1; + LM_DBG("Found empty [%.*s]\n", _c[j]->len, _c[j]->s); } else { switch( bson_iterator_type( &it ) ) { case BSON_INT: VAL_TYPE(cur_val) = DB_INT; VAL_INT(cur_val) = bson_iterator_int(&it); - LM_DBG("found int %d\n",bson_iterator_int(&it)); + LM_DBG("Found int [%.*s]=[%d]\n", + _c[j]->len, _c[j]->s, VAL_INT(cur_val)); break; case BSON_DOUBLE: VAL_TYPE(cur_val) = DB_DOUBLE; VAL_DOUBLE(cur_val) = bson_iterator_double(&it); - LM_DBG("found double %f\n",bson_iterator_double(&it)); + LM_DBG("Found double [%.*s]=[%f]\n", + _c[j]->len, _c[j]->s, VAL_DOUBLE(cur_val)); break; case BSON_STRING: VAL_TYPE(cur_val) = DB_STRING; VAL_STRING(cur_val) = bson_iterator_string(&it); - LM_DBG("Found string %s\n",bson_iterator_string(&it)); + LM_DBG("Found string [%.*s]=[%s]\n", + _c[j]->len, _c[j]->s, VAL_STRING(cur_val)); break; case BSON_LONG: VAL_TYPE(cur_val) = DB_BIGINT; VAL_BIGINT(cur_val) = bson_iterator_long(&it); + LM_DBG("Found long [%.*s]=[%lld]\n", + _c[j]->len, _c[j]->s, VAL_BIGINT(cur_val)); break; case BSON_DATE: VAL_TYPE(cur_val) = DB_DATETIME; - VAL_TYPE(cur_val) = bson_iterator_time_t(&it); + VAL_TIME(cur_val) = bson_iterator_time_t(&it); + LM_DBG("Found time [%.*s]=[%d]\n", + _c[j]->len, _c[j]->s, (int)VAL_TIME(cur_val)); break; default: LM_WARN("Unsupported type %d - treating as NULL\n",bson_iterator_type(&it)); diff --git a/modules/cachedb_mongodb/cachedb_mongodb_json.c b/modules/cachedb_mongodb/cachedb_mongodb_json.c index 397aa9def4..304c5cfcf3 100644 --- a/modules/cachedb_mongodb/cachedb_mongodb_json.c +++ b/modules/cachedb_mongodb/cachedb_mongodb_json.c @@ -191,12 +191,86 @@ int json_to_bson(char *json,bson *bb) return -1; } +void bson_to_json_generic(struct json_object *obj,bson_iterator *it,int type) +{ + const char *curr_key; + char *s; + int len; + struct json_object *obj2=NULL; + bson_iterator it2; + + while (bson_iterator_next(it)) { + curr_key=bson_iterator_key(it); + + switch( bson_iterator_type(it) ) { + case BSON_INT: + LM_DBG("Found key %s with type int\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_int(bson_iterator_int(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_int(bson_iterator_int(it))); + break; + case BSON_LONG: + LM_DBG("Found key %s with type long\n",curr_key); + /* no intrinsic support in OpenSIPS for 64bit integers - + * converting to string */ + s = int2str(bson_iterator_long(it),&len); + s[len]=0; + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key,json_object_new_string(s)); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_string(s)); + break; + case BSON_DOUBLE: + /* no intrinsic support in OpenSIPS for floating point numbers + * converting to int */ + LM_DBG("Found key %s with type double\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_int((int)bson_iterator_double(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_int((int)bson_iterator_double(it))); + break; + case BSON_STRING: + LM_DBG("Found key %s with type string\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_string(bson_iterator_string(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_string(bson_iterator_string(it))); + break; + case BSON_BOOL: + LM_DBG("Found key %s with type bool\n",curr_key); + if (type == BSON_OBJECT) + json_object_object_add(obj,curr_key, + json_object_new_int((int)bson_iterator_bool(it))); + else if (type == BSON_ARRAY) + json_object_array_add(obj,json_object_new_int((int)bson_iterator_bool(it))); + break; + case BSON_ARRAY: + LM_DBG("Found key %s with type array\n",curr_key); + obj2 = json_object_new_array(); + bson_iterator_subiterator(it, &it2 ); + bson_to_json_generic(obj2,&it2,BSON_ARRAY); + json_object_object_add(obj,curr_key,obj2); + //json_object_put(obj2); + break; + default: + /* TODO - support embedded documents */ + LM_DBG("Unsupported type %d for key %s - skipping\n", + bson_iterator_type(it),curr_key); + break; + } + } +} + int mongo_cursor_to_json(mongo_cursor *m_cursor, cdb_raw_entry ***reply,int expected_kv_no,int *reply_no) { struct json_object *obj=NULL; bson_iterator it; - const char *curr_key,*p; + const char *p; int current_size=0,len; /* start with a single returned document */ @@ -229,30 +303,8 @@ int mongo_cursor_to_json(mongo_cursor *m_cursor, } obj = json_object_new_object(); - bson_iterator_init(&it,mongo_cursor_bson(m_cursor)); - while (bson_iterator_next(&it)) { - curr_key=bson_iterator_key(&it); - - switch( bson_iterator_type( &it ) ) { - case BSON_INT: - json_object_object_add(obj,curr_key, - json_object_new_int(bson_iterator_int(&it))); - break; - case BSON_DOUBLE: - json_object_object_add(obj,curr_key, - json_object_new_int((int)bson_iterator_double(&it))); - break; - case BSON_STRING: - json_object_object_add(obj,curr_key, - json_object_new_string(bson_iterator_string(&it))); - break; - default: - /* TODO - support embedded documents */ - LM_WARN("Unsupported type %d - skipping\n",bson_iterator_type(&it)); - break; - } - } + bson_to_json_generic(obj,&it,BSON_OBJECT); p = json_object_to_json_string(obj); if (!p) { @@ -279,7 +331,10 @@ int mongo_cursor_to_json(mongo_cursor *m_cursor, *reply_no = current_size; LM_DBG("Fetched %d results\n",current_size); - return 0; + if (current_size == 0) + return -2; + + return 1; error_cleanup: if (obj) diff --git a/modules/cachedb_sql/cachedb_sql.c b/modules/cachedb_sql/cachedb_sql.c index afb76efc6c..e077ea5eea 100644 --- a/modules/cachedb_sql/cachedb_sql.c +++ b/modules/cachedb_sql/cachedb_sql.c @@ -1,5 +1,7 @@ /* - * Copyright (C) 2011 OpenSIPS Solutions + * Copyright (C) 2013 Steve Frécinaux + * Be IP s.a. http://www.beip.be + * Copyright (C) 2013 OpenSIPS Solutions * * This file is part of opensips, a free SIP server. * @@ -20,7 +22,8 @@ * * history: * --------- - * 2013-01-xx created (vlad-paiu) + * 2013-01-xx created (Steve Frécinaux) + * 2013-01-xx improved implementation of cachedb (vlad-paiu) */ @@ -293,7 +296,9 @@ static int dbcache_add(cachedb_con *con, str *attr, int val, int expires, int *n else expires = 0; - i = snprintf(query_buf, sizeof(query_buf), "insert into %.*s (%.*s, %.*s, %.*s) values ('%.*s', %d, %d) on duplicate key update %.*s=%.*s %c %d, %.*s=%d", + i = snprintf(query_buf, sizeof(query_buf), + "insert into %.*s (%.*s, %.*s, %.*s) values ('%.*s', %d, %d)" + "on duplicate key update %.*s=%.*s %c %d, %.*s=%d", db_table.len, db_table.s, key_column.len, key_column.s, counter_column.len, counter_column.s, diff --git a/modules/call_control/README b/modules/call_control/README index be8fcb2524..bfa84d8f6a 100644 --- a/modules/call_control/README +++ b/modules/call_control/README @@ -18,8 +18,7 @@ Irina-Maria Stanescu Copyright © 2005-2008 Dan Pascu Revision History - Revision $Revision$ $Date: 2009-09-17 15:45:11 +0300 - (Thu, 17 Sep 2009) $ + Revision $Revision: 6149 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/cfgutils/README b/modules/cfgutils/README index 1af1f4d472..d9a8b132a8 100644 --- a/modules/cfgutils/README +++ b/modules/cfgutils/README @@ -21,8 +21,7 @@ Sergio Gutierrez Copyright © 2007, 2008 1und1 Internet AG, BASIS AudioNet GmbH, Elena-Ramona Modroiu Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/closeddial/README b/modules/closeddial/README index 4237049361..1494d7be97 100644 --- a/modules/closeddial/README +++ b/modules/closeddial/README @@ -8,7 +8,7 @@ Sergio Gutierrez Copyright © 2009 Revision History - Revision $Revision$ $Date: 2009-02-07 18:00:00 -0500$ + Revision $Revision: 5901 $ $Date: 2009-02-07 18:00:00 -0500$ __________________________________________________________ Table of Contents diff --git a/modules/db_flatstore/README b/modules/db_flatstore/README index 2a3b466d30..148b8469f1 100644 --- a/modules/db_flatstore/README +++ b/modules/db_flatstore/README @@ -10,8 +10,7 @@ Jan Janak Copyright © 2004, 2005 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/db_http/README b/modules/db_http/README index 739aec28b3..4109244597 100644 --- a/modules/db_http/README +++ b/modules/db_http/README @@ -10,8 +10,7 @@ Andrei Dragus Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision: 8740 $ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -34,7 +33,8 @@ Andrei Dragus 1.3.6. field_delimiter (str) 1.3.7. row_delimiter (str) 1.3.8. quote_delimiter (str) - 1.3.9. timeout (int) + 1.3.9. value_delimiter (str) + 1.3.10. timeout (int) 1.4. Exported Functions 1.5. Server specifications @@ -59,13 +59,14 @@ Andrei Dragus 1.7. Set field_delimiter parameter 1.8. Set row_delimiter parameter 1.9. Set quote_delimiter parameter - 1.10. Set timeout parameter - 1.11. Example query. - 1.12. Example query with variables. - 1.13. More query examples. - 1.14. NULL query example. - 1.15. Example Reply. - 1.16. Quoting Example. + 1.10. Set value_delimiter parameter + 1.11. Set timeout parameter + 1.12. Example query. + 1.13. Example query with variables. + 1.14. More query examples. + 1.15. NULL query example. + 1.16. Example Reply. + 1.17. Quoting Example. Chapter 1. Admin Guide @@ -207,16 +208,29 @@ modparam("db_http", "row_delimiter","\n") modparam("db_http", "quote_delimiter","|") ... -1.3.9. timeout (int) +1.3.9. value_delimiter (str) + + The delimiter used to separate multiple fields of a single + variable (see Section 1.5.2, “Variables”). Only one char may be + set. + + Default value is “,” + + Example 1.10. Set value_delimiter parameter +... +modparam("db_http", "value_delimiter",";") +... + +1.3.10. timeout (int) The maximum number of milliseconds that the HTTP ops are allowed to last Default value is “30000 ( 30 seconds )” - Example 1.10. Set timeout parameter + Example 1.11. Set timeout parameter ... -modparam("db_http", "timeout","5000") +modparam("db_http", "timeout",5000) ... 1.4. Exported Functions @@ -237,7 +251,7 @@ modparam("db_http", "timeout","5000") apart by the query_type variable. Each type of query uses specific variables simillar to those in the opensips db_api. - Example 1.11. Example query. + Example 1.12. Example query. ... GET /presentity/?c=username,domain,event,expires HTTP/1.1 ... @@ -282,7 +296,7 @@ GET /presentity/?c=username,domain,event,expires HTTP/1.1 value. Will be present in all queries except the "SELECT" (normal query). - Example 1.12. Example query with variables. + Example 1.13. Example query with variables. ... GET /presentity/?c=username,domain,event,expires HTTP/1.1 GET /version/?k=table_name&v=xcap&c=table_version HTTP/1.1 @@ -323,7 +337,7 @@ k=id&v=100&query_type=insert Uses the q variable. This is an optional type of query. If the module is not configured to use it it will not. - Example 1.13. More query examples. + Example 1.14. More query examples. ... POST /active_watchers HTTP/1.1 @@ -343,7 +357,7 @@ k=id&op=%3D&v=100&uk=id&uv=101&query_type=update NULL values in queries are represented as a string of length 1 containing a single character with value '\0'. - Example 1.14. NULL query example. + Example 1.15. NULL query example. ... POST /active_watchers HTTP/1.1 @@ -378,7 +392,7 @@ k=id&op=%3D&v=%00&query_type=delete If the query produced an error the server must reply with a HTTP 500 reply, or with a corresponding error code (404, 401). - Example 1.15. Example Reply. + Example 1.16. Example Reply. ... int;string;blob 6;something=something;1000 @@ -398,7 +412,7 @@ int;string;blob be placed under quotes. A quote delimiter inside a value must be preceeded by another quote delimiter. - Example 1.16. Quoting Example. + Example 1.17. Quoting Example. ... int;string;blob 6;|ana;maria|;1000 diff --git a/modules/db_http/db_http.c b/modules/db_http/db_http.c index 65b9333234..6bcaa4608a 100644 --- a/modules/db_http/db_http.c +++ b/modules/db_http/db_http.c @@ -73,6 +73,7 @@ static param_export_t params[] = { {"field_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_col_delim}, {"row_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_line_delim}, {"quote_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_quote_delim}, + {"value_delimiter", STR_PARAM | USE_FUNC_PARAM ,set_value_delim}, {"timeout", INT_PARAM,&db_http_timeout}, {0, 0, 0} }; diff --git a/modules/db_http/doc/db_http_admin.xml b/modules/db_http/doc/db_http_admin.xml index 3c549d40d5..94222c733d 100644 --- a/modules/db_http/doc/db_http_admin.xml +++ b/modules/db_http/doc/db_http_admin.xml @@ -221,6 +221,27 @@ modparam("db_http", "quote_delimiter","|") +
+ <varname>value_delimiter</varname> (str) + + The delimiter used to separate multiple fields of a single + variable (see ). + Only one char may be set. + + + Default value is , + + + + Set <varname>value_delimiter</varname> parameter + +... +modparam("db_http", "value_delimiter",";") +... + + +
+
<varname>timeout</varname> (int) @@ -234,7 +255,7 @@ modparam("db_http", "quote_delimiter","|") Set <varname>timeout</varname> parameter ... -modparam("db_http", "timeout","5000") +modparam("db_http", "timeout",5000) ... @@ -280,7 +301,7 @@ GET /presentity/?c=username,domain,event,expires HTTP/1.1
-
+
Variables A description of all the variables. Each variable can have diff --git a/modules/db_http/http_dbase.c b/modules/db_http/http_dbase.c index d416d77740..dbe2274a48 100644 --- a/modules/db_http/http_dbase.c +++ b/modules/db_http/http_dbase.c @@ -74,7 +74,7 @@ int next_state[3][256]; char line_delim = '\n'; char col_delim = ';'; -char *col_delim_s = ";"; +char *val_delim_s = ","; char quote_delim = '|'; extern int use_ssl; @@ -101,7 +101,6 @@ int set_col_delim( unsigned int type, void *val) return -1; } col_delim = v[0]; - col_delim_s = val; return 0; } @@ -135,6 +134,18 @@ int set_quote_delim( unsigned int type, void *val) } +int set_value_delim( unsigned int type, void *val) +{ + if( strlen(val) != 1) + { + LM_ERR("Only one values delimiter may be set\n"); + return -1; + } + val_delim_s = val; + + return 0; +} + str value_to_string(const db_val_t * v); @@ -194,7 +205,7 @@ static int append_keys (var_str * q,const char * name, const db_key_t* k, CHECK(append_str(q,url_encode(*k[i])),0,error); if( i < n-1) - CHECK(append_const(q,col_delim_s),0,error); + CHECK(append_const(q,val_delim_s),0,error); } *started = 1; } @@ -223,7 +234,7 @@ static int append_values (var_str * q,const char * name, const db_val_t* v, { CHECK(append_str(q,url_encode(value_to_string(&v[i]))),0,error); if( i < n-1) - CHECK(append_const(q,col_delim_s),0,error); + CHECK(append_const(q,val_delim_s),0,error); } *started = 1; @@ -262,7 +273,7 @@ static int append_ops(var_str * q,const char * name, const db_op_t* op, if( i < n-1) - CHECK(append_const(q,col_delim_s),0,error); + CHECK(append_const(q,val_delim_s),0,error); } *started = 1; } @@ -456,7 +467,7 @@ int form_result(var_str buff, db_res_t** r) db_res_t * res; char * cur, * dest, * start, * end; int col_count, cur_col, line_count, cur_line, delim_count, len; - int state, next, first_line, consume; + int state, next, consume; LM_DBG("Called with : %.*s\n",buff.len,buff.s); @@ -559,7 +570,6 @@ int form_result(var_str buff, db_res_t** r) cur_col = 0; cur_line = -1; - first_line = 1; start = dest; while( cur < end ) @@ -1035,9 +1045,10 @@ db_con_t* db_http_init(const str* url) curl_easy_setopt(curl->handle,CURLOPT_HTTPAUTH,CURLAUTH_ANY); curl_easy_setopt(curl->handle,CURLOPT_ERRORBUFFER,error_buffer); +#if LIBCURL_VERSION_NUM >= 0x071002 LM_DBG("timeout set to %d", db_http_timeout); curl_easy_setopt(curl->handle,CURLOPT_TIMEOUT_MS,db_http_timeout); - +#endif strcat(path,"http"); if ( use_ssl ) diff --git a/modules/db_http/http_dbase.h b/modules/db_http/http_dbase.h index da8cae2456..3a711e623f 100644 --- a/modules/db_http/http_dbase.h +++ b/modules/db_http/http_dbase.h @@ -43,6 +43,7 @@ int set_col_delim( unsigned int type, void *val); int set_line_delim( unsigned int type, void *val); int set_quote_delim( unsigned int type, void *val); +int set_value_delim( unsigned int type, void *val); diff --git a/modules/db_text/README b/modules/db_text/README index 0db73e61a9..dfcd59d5ae 100644 --- a/modules/db_text/README +++ b/modules/db_text/README @@ -18,8 +18,7 @@ Daniel-Constantin Mierla Copyright © 2003, 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-12-15 09:11:44 +0400 - (Sat, 15 Dec 2012) $ + Revision $Revision: 9528 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/db_text/dbt_base.c b/modules/db_text/dbt_base.c index d12371607b..e63d9af0ad 100644 --- a/modules/db_text/dbt_base.c +++ b/modules/db_text/dbt_base.c @@ -95,7 +95,7 @@ db_con_t* dbt_init(const str* _sqlurl) memset(_res, 0, sizeof(db_con_t) + sizeof(dbt_con_t)); _res->tail = (unsigned long)((char*)_res+sizeof(db_con_t)); - LM_INFO("using database at: %.*s", _s.len, _s.s); + LM_INFO("using database at: %.*s\n", _s.len, _s.s); DBT_CON_CONNECTION(_res) = dbt_cache_get_db(&_s); if (!DBT_CON_CONNECTION(_res)) { diff --git a/modules/db_text/dbt_file.c b/modules/db_text/dbt_file.c index 0c571f470c..86c0743d7b 100644 --- a/modules/db_text/dbt_file.c +++ b/modules/db_text/dbt_file.c @@ -318,8 +318,8 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn) case DB_INT: case DB_BIGINT: case DB_DATETIME: - //LM_DBG("INT value!\n"); - dtval.val.int_val = 0; + //LM_DBG("INT/BIGINT/DATETIME value!\n"); + dtval.val.bigint_val = 0; dtval.type = dtp->colv[ccol]->type; if(c==DBT_DELIM || @@ -339,12 +339,12 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn) goto clean; while(c>='0' && c<='9') { - dtval.val.int_val=dtval.val.int_val*10+c-'0'; + dtval.val.bigint_val=dtval.val.bigint_val*10+c-'0'; c = fgetc(fin); } - dtval.val.int_val *= sign; + dtval.val.bigint_val *= sign; //LM_DBG("data[%d,%d]=%d\n", crow, - // ccol, dtval.val.int_val); + // ccol, dtval.val.bigint_val); } if(c!=DBT_DELIM && c!=DBT_DELIM_R && c!=EOF) goto clean; @@ -352,8 +352,10 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn) ccol)) goto clean; if(ccol == dtp->auto_col) - max_auto = (max_autoname.len, colp->name.s); break; case DB_BIGINT: - fprintf(fout, "%.*s(bigint", colp->name.len, colp->name.s); + fprintf(fout, "%.*s(long", colp->name.len, colp->name.s); break; case DB_DOUBLE: fprintf(fout, "%.*s(double", colp->name.len, colp->name.s); diff --git a/modules/db_virtual/README b/modules/db_virtual/README index 06c4d05494..096afbccf9 100644 --- a/modules/db_virtual/README +++ b/modules/db_virtual/README @@ -12,8 +12,7 @@ Razvan Pistolea Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision: 5917 $ $Date: 2009-07-29 19:12:14 +0300 - (Wed, 29 Jul 2009) $ + Revision $Revision: 5917 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/dialog/README b/modules/dialog/README index 98ac959ba1..b0d575b949 100644 --- a/modules/dialog/README +++ b/modules/dialog/README @@ -781,14 +781,14 @@ modparam("dialog", "db_flush_vals_profiles", 1) 1.6.37. own_timer_proc (int) - Whether the dialog timer should be a sepparate process or if - the tasks should be done in the global timer process. + Whether the dialog timer should be a separate process or if the + tasks should be done in the global timer process. Default value is “0”, run the timer in the global process. Example 1.37. Set own_timer_proc parameter ... -modparam("dialog", "dlg_id_column", 1) +modparam("dialog", "own_timer_proc", 1) ... 1.6.38. timer_bulk_del_no (int) @@ -1051,10 +1051,10 @@ $dlg_val(callee) = $ru; 1.7.6. set_dlg_profile(profile,[value]) - Inserts the current dialog into a profile. Note that the - profile does not supports values, this will be silently - discarded. Also, there is no check for inserting the same - dialog in the same profile for multiple times. + Inserts the current dialog into a profile. Note that if the + profile does not support values, this will be silently + discarded. A dialog may be inserted in the same profile + multiple times. NOTE: the dialog must be created before using this function (use create_dialog() function before). diff --git a/modules/dialog/dialog.c b/modules/dialog/dialog.c index eca7a8b98c..9958314470 100644 --- a/modules/dialog/dialog.c +++ b/modules/dialog/dialog.c @@ -1052,13 +1052,13 @@ static int w_set_dlg_profile(struct sip_msg *msg, char *profile, char *value) return -1; } if ( set_dlg_profile( msg, &val_s, - (struct dlg_profile_table*)profile) < 0 ) { + (struct dlg_profile_table*)profile, 0) < 0 ) { LM_ERR("failed to set profile\n"); return -1; } } else { if ( set_dlg_profile( msg, NULL, - (struct dlg_profile_table*)profile) < 0 ) { + (struct dlg_profile_table*)profile, 0) < 0 ) { LM_ERR("failed to set profile\n"); return -1; } diff --git a/modules/dialog/dlg_db_handler.c b/modules/dialog/dlg_db_handler.c index 17b4b4f619..4a7d7a11b9 100644 --- a/modules/dialog/dlg_db_handler.c +++ b/modules/dialog/dlg_db_handler.c @@ -387,7 +387,8 @@ void read_dialog_vars(char *b, int l, struct dlg_cell *dlg) } -void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check) +void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check, + char is_replicated) { struct dlg_profile_table *profile; struct dlg_profile_link *it; @@ -458,7 +459,8 @@ void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg,int double_check) continue; } } - if (set_dlg_profile( NULL, profile->has_value?&val:NULL, profile) < 0 ) + if (set_dlg_profile( NULL, profile->has_value ? &val : NULL, profile, + is_replicated) < 0 ) LM_ERR("failed to add to profile, skipping....\n"); next: ; @@ -566,7 +568,7 @@ static int load_dialog_info_from_db(int dlg_hash_size) LM_ERR("inconsistent hash data in the dialog database: " "you may have restarted opensips using a different " "hash_size: please erase %.*s database and restart\n" - "db : %u, dlg : %u\n", + "dlg : %u, db : %u\n", dialog_table_name.len, dialog_table_name.s, dlg->h_entry,hash_entry); shm_free(dlg); @@ -624,7 +626,7 @@ static int load_dialog_info_from_db(int dlg_hash_size) /* profiles */ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), dlg,0); + strlen(VAL_STR(values+18).s), dlg, 0, 0); /* script flags */ @@ -1305,7 +1307,8 @@ void dialog_update_db(unsigned int ticks, void * param) SET_INT_VALUE(values+19, cell->legs[DLG_CALLER_LEG].last_gen_cseq); SET_INT_VALUE(values+20, cell->legs[callee_leg].last_gen_cseq); - set_final_update_cols(values+21, cell, on_shutdown); + set_final_update_cols(values+21, cell, + (on_shutdown) || (cell->flags&DLG_FLAG_CHANGED) ); SET_INT_VALUE(values+24, cell->flags & ~(DLG_FLAG_NEW|DLG_FLAG_CHANGED|DLG_FLAG_VP_CHANGED)); CON_PS_REFERENCE(dialog_db_handle) = &my_ps_insert; @@ -1565,7 +1568,7 @@ static int sync_dlg_db_mem(void) /* profiles */ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), dlg,0); + strlen(VAL_STR(values+18).s), dlg, 0, 0); /* script flags */ @@ -1729,7 +1732,7 @@ static int sync_dlg_db_mem(void) * is dlg is already in that profile*/ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), known_dlg,1); + strlen(VAL_STR(values+18).s), known_dlg, 1, 0); dlg_unlock( d_table, d_entry); } else { @@ -1806,7 +1809,7 @@ static int sync_dlg_db_mem(void) * is dlg is already in that profile*/ if (!VAL_NULL(values+18)) read_dialog_profiles( VAL_STR(values+18).s, - strlen(VAL_STR(values+18).s), known_dlg,1); + strlen(VAL_STR(values+18).s), known_dlg, 1, 0); dlg_unlock( d_table, d_entry); } diff --git a/modules/dialog/dlg_db_handler.h b/modules/dialog/dlg_db_handler.h index 227cb772d4..973adb008d 100644 --- a/modules/dialog/dlg_db_handler.h +++ b/modules/dialog/dlg_db_handler.h @@ -111,7 +111,8 @@ int update_dialog_dbinfo(struct dlg_cell * cell); void dialog_update_db(unsigned int ticks, void * param); void read_dialog_vars(char *b, int l, struct dlg_cell *dlg); -void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg, int double_check); +void read_dialog_profiles(char *b, int l, struct dlg_cell *dlg, + int double_check, char is_replicated); str* write_dialog_vars(struct dlg_val *vars); str* write_dialog_profiles(struct dlg_profile_link *links); diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 2c1f4dcc61..3461ec2185 100644 --- a/modules/dialog/dlg_handlers.c +++ b/modules/dialog/dlg_handlers.c @@ -389,6 +389,7 @@ static inline void push_reply_in_dialog(struct sip_msg *rpl, struct cell* t, ((t->relaied_reply_branch>=0)? (t->uac[t->relaied_reply_branch].added_rr):0); + LM_DBG("Skipping %d ,%d, %d, %d \n",skip_rrs, dlg->from_rr_nb,t->relaied_reply_branch,t->uac[t->relaied_reply_branch].added_rr); get_routing_info(rpl, 0, &skip_rrs, &contact, &rr_set); dlg_update_routing( dlg, leg, &rr_set, &contact ); if( rr_set.s ) @@ -469,7 +470,9 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) else event = DLG_EVENT_RPL3xx; - next_state_dlg( dlg, event, &old_state, &new_state, &unref); + last_dst_leg = DLG_CALLER_LEG; + next_state_dlg(dlg, event, DLG_DIR_UPSTREAM, &old_state, &new_state, + &unref, 0); if (new_state==DLG_STATE_EARLY && old_state!=DLG_STATE_EARLY) { run_dlg_callbacks(DLGCB_EARLY, dlg, rpl, DLG_DIR_UPSTREAM, 0); @@ -538,8 +541,10 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param) LM_DBG("dialog %p failed (negative reply)\n", dlg); /*destroy linkers */ - destroy_linkers(dlg->profile_links); + dlg_lock_dlg(dlg); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); /* dialog setup not completed (3456XX) */ run_dlg_callbacks( DLGCB_FAILED, dlg, rpl, DLG_DIR_UPSTREAM, 0); @@ -1123,8 +1128,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) /* save last_dst_leg before running state machine * helpful for logging various bogus cases according to the RFC */ last_dst_leg = dst_leg; - - next_state_dlg( dlg, event, &old_state, &new_state, &unref); + next_state_dlg( dlg, event, dir, &old_state, &new_state, &unref, 0); /* set current dialog - it will keep a ref! */ set_current_dialog(dlg); @@ -1140,8 +1144,10 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) old_state!=DLG_STATE_DELETED) { /*destroy linkers */ - destroy_linkers(dlg->profile_links); + dlg_lock_dlg(dlg); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); if (!dlg->terminate_reason.s) { if (last_dst_leg == 0) @@ -1230,13 +1236,17 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) LM_DBG("sequential request successfully processed (dst_leg=%d)\n", dst_leg); + /* if there is a lifetime update, the dlg_callbacks will want + * to know. fetch it before running the callbacks */ + timeout = get_dlg_timeout_update(req); + if (timeout != 0) + dlg->lifetime = timeout; + /* within dialog request */ run_dlg_callbacks( DLGCB_REQ_WITHIN, dlg, req, dir, 0); - timeout = get_dlg_timeout_update(req); /* update timer during sequential request? */ if (timeout != 0) { - dlg->lifetime = timeout; if (update_dlg_timer( &dlg->tl, dlg->lifetime )==-1) LM_ERR("failed to update dialog lifetime\n"); } @@ -1266,7 +1276,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param) dlg_lock (d_table, d_entry); if (dlg->legs[dst_leg].last_gen_cseq) { - + update_val = ++(dlg->legs[dst_leg].last_gen_cseq); dlg_unlock( d_table, d_entry ); @@ -1428,7 +1438,10 @@ void dlg_ontimeout( struct dlg_tl *tl) return ; } - next_state_dlg( dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref); + /* act like as if we've received a BYE from caller */ + last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; + next_state_dlg( dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, + &new_state, &unref, 0); if (new_state==DLG_STATE_DELETED && old_state!=DLG_STATE_DELETED) { LM_DBG("timeout for dlg with CallID '%.*s' and tags '%.*s' '%.*s'\n", @@ -1439,8 +1452,10 @@ void dlg_ontimeout( struct dlg_tl *tl) ZSW(dlg->legs[callee_idx(dlg)].tag.s)); /*destroy linkers */ - destroy_linkers(dlg->profile_links); + dlg_lock_dlg(dlg); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); /* dialog timeout */ run_dlg_callbacks( DLGCB_EXPIRED, dlg, 0, DLG_DIR_NONE, 0); @@ -1537,11 +1552,14 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg) buf = req->buf; if (req->route) { - for (it=req->route;it;it=it->sibling) + for (it=req->route;it;it=it->sibling) { + if (it->parsed && ((rr_t*)it->parsed)->deleted) + continue; if ((lmp = del_lump(req,it->name.s - buf,it->len,HDR_ROUTE_T)) == 0) { LM_ERR("del_lump failed \n"); return -1; } + } } if ( leg->route_set.len !=0 && leg->route_set.s) { @@ -1604,6 +1622,8 @@ int fix_route_dialog(struct sip_msg *req,struct dlg_cell *dlg) if (req->route) { for (it=req->route;it;it=it->sibling) + if (it->parsed && ((rr_t*)it->parsed)->deleted) + continue; if ((lmp = del_lump(req,it->name.s - buf,it->len,HDR_ROUTE_T)) == 0) { LM_ERR("del_lump failed \n"); return -1; diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c index 986604134a..75073c895f 100644 --- a/modules/dialog/dlg_hash.c +++ b/modules/dialog/dlg_hash.c @@ -162,7 +162,7 @@ static inline void free_dlg_dlg(struct dlg_cell *dlg) destroy_dlg_callbacks_list(dlg->cbs.first); if (dlg->profile_links) - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 0); if (dlg->legs) { for( i=0 ; ilegs_no[DLG_LEGS_USED] ; i++) { @@ -219,9 +219,6 @@ inline void destroy_dlg(struct dlg_cell *dlg) run_dlg_callbacks( DLGCB_DESTROY , dlg, 0, DLG_DIR_NONE, 0); - if (replication_dests) - replicate_dialog_deleted(dlg); - free_dlg_dlg(dlg); } @@ -763,8 +760,8 @@ static inline void log_next_state_dlg(const int event, } -void next_state_dlg(struct dlg_cell *dlg, int event, - int *old_state, int *new_state, int *unref) +void next_state_dlg(struct dlg_cell *dlg, int event, int dir, int *old_state, + int *new_state, int *unref, char is_replicated) { struct dlg_entry *d_entry; @@ -856,6 +853,10 @@ void next_state_dlg(struct dlg_cell *dlg, int event, switch (dlg->state) { case DLG_STATE_CONFIRMED_NA: case DLG_STATE_CONFIRMED: + if (dir == DLG_DIR_DOWNSTREAM && last_dst_leg!=dlg->legs_no[DLG_LEG_200OK] ) + /* to end the call, the BYE must be received + * on the same leg as the 200 OK for INVITE */ + break; dlg->flags |= DLG_FLAG_HASBYE; dlg->state = DLG_STATE_DELETED; *unref = 1; /* unref from hash -> dialog ended */ @@ -904,6 +905,9 @@ void next_state_dlg(struct dlg_cell *dlg, int event, dlg_unlock( d_table, d_entry); + if (!is_replicated && replication_dests && dlg->state == DLG_STATE_DELETED) + replicate_dialog_deleted(dlg); + LM_DBG("dialog %p changed from state %d to " "state %d, due event %d\n",dlg,*old_state,*new_state,event); } diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h index e3c7d9a88b..f8176135e8 100644 --- a/modules/dialog/dlg_hash.h +++ b/modules/dialog/dlg_hash.h @@ -275,7 +275,7 @@ void unref_dlg(struct dlg_cell *dlg, unsigned int cnt); void ref_dlg(struct dlg_cell *dlg, unsigned int cnt); void next_state_dlg(struct dlg_cell *dlg, int event, - int *old_state, int *new_state, int *unref); + int dir, int *old_state, int *new_state, int *unref, char is_replicated); struct mi_root * mi_print_dlgs(struct mi_root *cmd, void *param ); struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd, void *param ); diff --git a/modules/dialog/dlg_load.h b/modules/dialog/dlg_load.h index 53664bed0d..600a42d208 100644 --- a/modules/dialog/dlg_load.h +++ b/modules/dialog/dlg_load.h @@ -44,7 +44,7 @@ struct dlg_binds { add_profiles_f add_profiles; search_dlg_profile_f search_profile; set_dlg_profile_f set_profile; - set_dlg_profile_f unset_profile; + unset_dlg_profile_f unset_profile; get_profile_size_f get_profile_size; store_dlg_value_f store_dlg_value; fetch_dlg_value_f fetch_dlg_value; diff --git a/modules/dialog/dlg_profile.c b/modules/dialog/dlg_profile.c index 0088107a41..d0f21816f3 100644 --- a/modules/dialog/dlg_profile.c +++ b/modules/dialog/dlg_profile.c @@ -540,7 +540,7 @@ void destroy_dlg_profiles(void) -void destroy_linkers(struct dlg_profile_link *linker) +void destroy_linkers(struct dlg_profile_link *linker, char is_replicated) { map_t entry; struct dlg_profile_link *l; @@ -573,7 +573,7 @@ void destroy_linkers(struct dlg_profile_link *linker) l->profile->counts[l->hash_idx]--; lock_set_release( l->profile->locks, l->hash_idx ); - } else { + } else if (!is_replicated) { if (!cdbc) { LM_WARN("CacheDB not initialized - some information might" " not be deleted from the cachedb engine\n"); @@ -632,7 +632,7 @@ inline static unsigned int calc_hash_profile( str *value, struct dlg_cell *dlg, static void link_dlg_profile(struct dlg_profile_link *linker, - struct dlg_cell *dlg) + struct dlg_cell *dlg, char is_replicated) { unsigned int hash; map_t p_entry; @@ -674,7 +674,7 @@ static void link_dlg_profile(struct dlg_profile_link *linker, linker->profile->counts[hash]++; lock_set_release( linker->profile->locks,hash ); - } else { + } else if (!is_replicated) { if (!cdbc) { LM_WARN("Cachedb not initialized yet - cannot update profile\n"); LM_WARN("Make sure that the dialog profile information is persistent\n"); @@ -717,7 +717,7 @@ static void link_dlg_profile(struct dlg_profile_link *linker, int set_dlg_profile(struct sip_msg *msg, str *value, - struct dlg_profile_table *profile) + struct dlg_profile_table *profile, char is_replicated) { struct dlg_cell *dlg; struct dlg_profile_link *linker; @@ -749,7 +749,7 @@ int set_dlg_profile(struct sip_msg *msg, str *value, } /* add linker to the dialog and profile */ - link_dlg_profile( linker, dlg); + link_dlg_profile( linker, dlg, is_replicated); dlg->flags |= DLG_FLAG_VP_CHANGED; return 0; @@ -804,7 +804,7 @@ int unset_dlg_profile(struct sip_msg *msg, str *value, dlg->flags |= DLG_FLAG_VP_CHANGED; dlg_unlock( d_table, d_entry); /* remove linker from profile table and free it */ - destroy_linkers(linker); + destroy_linkers(linker, 0); return 1; } diff --git a/modules/dialog/dlg_profile.h b/modules/dialog/dlg_profile.h index bf58bafddf..d7e352e30e 100644 --- a/modules/dialog/dlg_profile.h +++ b/modules/dialog/dlg_profile.h @@ -80,7 +80,10 @@ struct dlg_profile_table { }; typedef int (*set_dlg_profile_f)(struct sip_msg *msg, str *value, - struct dlg_profile_table *profile); + struct dlg_profile_table *profile, char is_replicated); + +typedef int (*unset_dlg_profile_f)(struct sip_msg *msg, str *value, + struct dlg_profile_table *profile); typedef unsigned int (*get_profile_size_f)(struct dlg_profile_table *profile, str *value); @@ -102,10 +105,10 @@ void destroy_dlg_profiles(); struct dlg_profile_table* search_dlg_profile(str *name); -void destroy_linkers(struct dlg_profile_link *linker); +void destroy_linkers(struct dlg_profile_link *linker, char is_replicated); int set_dlg_profile(struct sip_msg *msg, str *value, - struct dlg_profile_table *profile); + struct dlg_profile_table *profile, char is_replicated); int unset_dlg_profile(struct sip_msg *msg, str *value, struct dlg_profile_table *profile); diff --git a/modules/dialog/dlg_replication.c b/modules/dialog/dlg_replication.c index b6a91b3a77..420dae2ef3 100644 --- a/modules/dialog/dlg_replication.c +++ b/modules/dialog/dlg_replication.c @@ -33,6 +33,8 @@ extern int active_dlgs_cnt; extern int early_dlgs_cnt; +extern int last_dst_leg; + extern int dlg_enable_stats; extern stat_var *active_dlgs; @@ -243,7 +245,7 @@ int dlg_replicated_create(struct dlg_cell *cell, str *ftag, str *ttag, int safe) dlg_unlock(d_table, d_entry); if (profiles.s && profiles.len != 0) - read_dialog_profiles(profiles.s, profiles.len, dlg, 0); + read_dialog_profiles(profiles.s, profiles.len, dlg, 0, 1); if_update_stat(dlg_enable_stats, active_dlgs, 1); @@ -344,7 +346,7 @@ int dlg_replicated_update(void) dlg_unlock(d_table, d_entry); if (profiles.s && profiles.len != 0) - read_dialog_profiles(profiles.s, profiles.len, dlg, 1); + read_dialog_profiles(profiles.s, profiles.len, dlg, 1, 1); return 0; @@ -377,10 +379,13 @@ int dlg_replicated_delete(void) return -1; } - destroy_linkers(dlg->profile_links); + destroy_linkers(dlg->profile_links, 1); dlg->profile_links = NULL; - next_state_dlg(dlg, DLG_EVENT_REQBYE, &old_state, &new_state, &unref); + /* simulate BYE received from caller */ + last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; + next_state_dlg(dlg, DLG_EVENT_REQBYE, DLG_DIR_DOWNSTREAM, &old_state, + &new_state, &unref, 1); if (old_state == new_state) { LM_ERR("duplicate dialog delete request (callid: |%.*s|" diff --git a/modules/dialog/dlg_req_within.c b/modules/dialog/dlg_req_within.c index 8545a470e4..d33f3b208c 100644 --- a/modules/dialog/dlg_req_within.c +++ b/modules/dialog/dlg_req_within.c @@ -212,7 +212,9 @@ static void dual_bye_event(struct dlg_cell* dlg, struct sip_msg *req, int extra_ int event, old_state, new_state, unref, ret; event = DLG_EVENT_REQBYE; - next_state_dlg(dlg, event, &old_state, &new_state, &unref); + last_dst_leg = dlg->legs_no[DLG_LEG_200OK]; + next_state_dlg(dlg, event, DLG_DIR_DOWNSTREAM, &old_state, &new_state, + &unref, 0); unref += extra_unref; if(new_state == DLG_STATE_DELETED && old_state != DLG_STATE_DELETED){ @@ -221,8 +223,10 @@ static void dual_bye_event(struct dlg_cell* dlg, struct sip_msg *req, int extra_ dlg->h_entry, dlg->h_id); /*destroy linkers */ - destroy_linkers(dlg->profile_links); + dlg_lock_dlg(dlg); + destroy_linkers(dlg->profile_links, 0); dlg->profile_links = NULL; + dlg_unlock_dlg(dlg); /* remove from timer */ ret = remove_dlg_timer(&dlg->tl); diff --git a/modules/dialog/dlg_tophiding.c b/modules/dialog/dlg_tophiding.c index 9d46ae9044..8ab3dc1fad 100644 --- a/modules/dialog/dlg_tophiding.c +++ b/modules/dialog/dlg_tophiding.c @@ -113,7 +113,8 @@ int dlg_replace_contact(struct sip_msg* msg, struct dlg_cell* dlg) ct_username_len = ctu.user.len; LM_DBG("Trying to propagate username [%.*s] \n",ct_username_len, ct_username); - prefix_len += 1 + /* @ */ + ct_username_len; + if (ct_username_len > 0) + prefix_len += 1 + /* @ */ + ct_username_len; } } } diff --git a/modules/dialog/doc/dialog_admin.xml b/modules/dialog/doc/dialog_admin.xml index 8ed5ea72a2..7cf4c5d4cc 100644 --- a/modules/dialog/doc/dialog_admin.xml +++ b/modules/dialog/doc/dialog_admin.xml @@ -969,7 +969,7 @@ modparam("dialog", "db_flush_vals_profiles", 1) <varname>own_timer_proc</varname> (int) Whether the dialog timer should be a - sepparate process or if the tasks should be done in the + separate process or if the tasks should be done in the global timer process. @@ -982,7 +982,7 @@ modparam("dialog", "db_flush_vals_profiles", 1) Set <varname>own_timer_proc</varname> parameter ... -modparam("dialog", "dlg_id_column", 1) +modparam("dialog", "own_timer_proc", 1) ... @@ -1411,10 +1411,9 @@ $dlg_val(callee) = $ru; set_dlg_profile(profile,[value]) - Inserts the current dialog into a profile. Note that the profile does - not supports values, this will be silently discarded. Also, there is - no check for inserting the same dialog in the same profile for multiple - times. + Inserts the current dialog into a profile. Note that if the profile does + not support values, this will be silently discarded. A dialog may be + inserted in the same profile multiple times. NOTE: the dialog must be created before using this function (use diff --git a/modules/dialplan/dp_repl.c b/modules/dialplan/dp_repl.c index 82aaa17a44..9bf99f2398 100644 --- a/modules/dialplan/dp_repl.c +++ b/modules/dialplan/dp_repl.c @@ -334,7 +334,10 @@ int translate(struct sip_msg *msg, str input, str * output, dpl_id_p idp, /* pick the rule with lowest table index if both match and prio are equal */ if ((string_res | regexp_res) == 0) { - if (rrulep->table_id < rulep->table_id) { + if (rulep->pr < rrulep->pr) { + rulep = rrulep; + } else if (rrulep->pr == rulep->pr && + rrulep->table_id < rulep->table_id) { rulep = rrulep; } } diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c index f586919923..e0621208b4 100644 --- a/modules/dispatcher/dispatch.c +++ b/modules/dispatcher/dispatch.c @@ -1425,12 +1425,13 @@ int ds_next_dst(struct sip_msg *msg, int mode) /* get AVP with next destination socket */ tmp_avp = search_first_avp(sock_avp_type, sock_avp_name, &sock_avp_value, 0); - if (tmp_avp) { + if (!tmp_avp) { /* this shuold not happen, it is a bogus state */ sock = NULL; } else { if (sscanf( sock_avp_value.s.s, "%p", (void**)&sock ) != 1) sock = NULL; + destroy_avp(tmp_avp); } if(ds_update_dst(msg, &avp_value.s, sock, mode)!=0) diff --git a/modules/diversion/README b/modules/diversion/README index c65e1561aa..d538e27265 100644 --- a/modules/diversion/README +++ b/modules/diversion/README @@ -14,8 +14,7 @@ Saul Ibarra Corretge Copyright © 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-05-30 20:07:17 +0300 - (Wed, 30 May 2012) $ + Revision $Revision: 9064 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/domain/README b/modules/domain/README index d350ec32d5..ab3fb0c51b 100644 --- a/modules/domain/README +++ b/modules/domain/README @@ -12,8 +12,7 @@ Juha Heinanen Copyright © 2002-2008 Juha Heinanen Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/domainpolicy/README b/modules/domainpolicy/README index e36672e37f..47663b12d9 100644 --- a/modules/domainpolicy/README +++ b/modules/domainpolicy/README @@ -23,8 +23,7 @@ Klaus Darilion Copyright © 2002, 2003, 2006 Juha Heinanen, Otmar Lendl, Klaus Darilion Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/drouting/README b/modules/drouting/README index bc8baf440d..8f1658b678 100644 --- a/modules/drouting/README +++ b/modules/drouting/README @@ -16,8 +16,7 @@ Anca-Maria Vamanu Copyright © 2009-2012 www.opensips-solutions.com Revision History - Revision $Revision$ $Date: 2012-03-22 20:43:49 +0200 - (Thu, 22 Mar 2012) $ + Revision $Revision: 8834 $ $Date$ __________________________________________________________ Table of Contents @@ -68,7 +67,9 @@ Anca-Maria Vamanu 1.4. Exported Functions - 1.4.1. do_routing([[[groupID],flags],gw_whitelist]) + 1.4.1. do_routing([groupID[, flags[, + gw_whitelist]]]) + 1.4.2. route_to_carrier(carrier_id) 1.4.3. route_to_gw(gw_id) 1.4.4. use_next_gw()/next_routing() @@ -434,7 +435,7 @@ modparam("drouting", "drg_table", "groups") The name of the db table storing definitions of the carriers that will be used directly by the routing rules. - Default value is “dr_gw_lists”. + Default value is “dr_carriers”. Example 1.5. Set drc_table parameter ... @@ -699,7 +700,7 @@ modparam("drouting", "drg_grpid_col", "grpid") 1.4. Exported Functions -1.4.1. do_routing([[[groupID],flags],gw_whitelist]) +1.4.1. do_routing([groupID[, flags[, gw_whitelist]]]) Function to trigger routing of the message according to the rules in the database table and the configured parameters. @@ -723,7 +724,7 @@ modparam("drouting", "drg_grpid_col", "grpid") flag, the enging will fallback and use rules with less priority or shorter prefix when all the destination from the current rules failed. - + L - Do strict lenght matching over the prefix - + + L - Do strict length matching over the prefix - actually DR engine will do full number maching and not prefix matching anymore. + C - Only check if the dialed number matches any diff --git a/modules/drouting/doc/drouting_admin.xml b/modules/drouting/doc/drouting_admin.xml index c6232479a4..7fa98e52cb 100644 --- a/modules/drouting/doc/drouting_admin.xml +++ b/modules/drouting/doc/drouting_admin.xml @@ -501,7 +501,7 @@ modparam("drouting", "drg_table", "groups") be used directly by the routing rules. - Default value is dr_gw_lists. + Default value is dr_carriers. @@ -946,7 +946,7 @@ modparam("drouting", "drg_grpid_col", "grpid") Exported Functions
- <function moreinfo="none">do_routing([[[groupID],flags],gw_whitelist])</function> + <function moreinfo="none">do_routing([groupID[, flags[, gw_whitelist]]])</function> Function to trigger routing of the message according to the @@ -983,7 +983,7 @@ modparam("drouting", "drg_grpid_col", "grpid") destination from the current rules failed. - L - Do strict lenght matching over the + L - Do strict length matching over the prefix - actually DR engine will do full number maching and not prefix matching anymore. diff --git a/modules/drouting/drouting.c b/modules/drouting/drouting.c index 01b365021b..4e6f00cb3f 100644 --- a/modules/drouting/drouting.c +++ b/modules/drouting/drouting.c @@ -1168,7 +1168,7 @@ static int sort_rt_dst(pgw_list_t *pgwl, unsigned short size, LM_DBG("random number is %d\n",rand_no); /* select the element */ for( i=first ; i=rand_no) break; + if (running_sum[i]>rand_no) break; if (i==size) { LM_CRIT("bug in weight sort\n"); return -1; @@ -1326,7 +1326,8 @@ static int do_routing(struct sip_msg* msg, dr_group_t *drg, int flags, wl_list = NULL; rt_info = NULL; - if ( (*rdata)==0 || (*rdata)->pgw_l==0 ) { + /* allow no GWs if we're only trying to use DR for checking purposes */ + if ( (*rdata)==0 || ((flags & DR_PARAM_ONLY_CHECK) == 0 && (*rdata)->pgw_l==0 )) { LM_DBG("empty routing table\n"); goto error1; } @@ -1956,7 +1957,7 @@ static int fixup_from_gw( void** param, int param_no) { if (param_no == 1) { /* GW type*/ - return fixup_uint(param); + return fixup_sint(param); } else if (param_no == 2) { /* GW ops */ return fixup_spve(param); @@ -1971,7 +1972,7 @@ static int fixup_is_gw( void** param, int param_no) return fixup_pvar(param); } else if (param_no == 2) { /* GW type*/ - return fixup_uint(param); + return fixup_sint(param); } else if (param_no == 3) { /* GW ops */ return fixup_spve(param); diff --git a/modules/enum/README b/modules/enum/README index e983440f3b..363e22896d 100644 --- a/modules/enum/README +++ b/modules/enum/README @@ -10,8 +10,7 @@ Otmar Lendl Copyright © 2002, 2003 Juha Heinanen Revision History - Revision $Revision$ $Date: 2010-01-18 10:45:05 +0100 - (Mon, 18 Jan 2010) $ + Revision $Revision: 5907 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/event_xmlrpc/event_xmlrpc.c b/modules/event_xmlrpc/event_xmlrpc.c index d48b96edbc..0898dc2516 100644 --- a/modules/event_xmlrpc/event_xmlrpc.c +++ b/modules/event_xmlrpc/event_xmlrpc.c @@ -1,3 +1,28 @@ +/* + * Copyright (C) 2012 OpenSIPS Solutions + * + * This file is part of opensips, a free SIP server. + * + * opensips 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. + * + * opensips 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. + * + * + * history: + * --------- + * 2012-05-xx created (razvancrainea) + */ + #include "../../sr_module.h" #include "../../resolve.h" #include "../../evi/evi_transport.h" diff --git a/modules/event_xmlrpc/event_xmlrpc.h b/modules/event_xmlrpc/event_xmlrpc.h index c488fb0562..007116b375 100644 --- a/modules/event_xmlrpc/event_xmlrpc.h +++ b/modules/event_xmlrpc/event_xmlrpc.h @@ -1,3 +1,27 @@ +/* + * Copyright (C) 2012 OpenSIPS Solutions + * + * This file is part of opensips, a free SIP server. + * + * opensips 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. + * + * opensips 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. + * + * + * history: + * --------- + * 2012-05-xx created (razvancrainea) + */ #ifndef _EV_XMLRPC_H_ #define _EV_XMLRPC_H_ diff --git a/modules/exec/README b/modules/exec/README index 63f92263d1..23ff119b70 100644 --- a/modules/exec/README +++ b/modules/exec/README @@ -10,8 +10,7 @@ Jan Janak Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents @@ -173,7 +172,8 @@ exec_dset("echo TEST > /tmp/$rU.txt"); character in it, the var needs to be placed inside quotes, for ex: exec_msg("print-contact.sh '$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, + LOCAL_ROUTE, TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. Example 1.5. exec_msg usage ... @@ -198,7 +198,8 @@ exec_msg("echo TEST > /tmp/$rU.txt"); ex: exec_avp("print-contact.sh '$ct'"); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, - LOCAL_ROUTE, STARTUP_ROUTE. + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, + ONREPLY_ROUTE. Example 1.6. exec_avp usage ... @@ -222,7 +223,8 @@ exec_avp("echo TEST", "$avp(test)"); ex: exec_getenv("'$ct'"); This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, - LOCAL_ROUTE, STARTUP_ROUTE. + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, + ONREPLY_ROUTE. Example 1.7. exec_getenv usage ... diff --git a/modules/exec/doc/exec_admin.xml b/modules/exec/doc/exec_admin.xml index 248ad63fa0..352e8ca559 100644 --- a/modules/exec/doc/exec_admin.xml +++ b/modules/exec/doc/exec_admin.xml @@ -232,7 +232,8 @@ exec_dset("echo TEST > /tmp/$rU.txt"); exec_msg("print-contact.sh '$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, LOCAL_ROUTE, + TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. <function moreinfo="none">exec_msg</function> usage @@ -272,7 +273,8 @@ exec_msg("echo TEST > /tmp/$rU.txt"); exec_avp("print-contact.sh '$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, LOCAL_ROUTE, STARTUP_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. <function moreinfo="none">exec_avp</function> usage @@ -313,7 +315,8 @@ exec_avp("echo TEST", "$avp(test)"); exec_getenv("'$ct'"); - This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, LOCAL_ROUTE, STARTUP_ROUTE. + This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, + LOCAL_ROUTE, STARTUP_ROUTE, TIMER_ROUTE, EVENT_ROUTE, ONREPLY_ROUTE. <function moreinfo="none">exec_getenv</function> usage diff --git a/modules/gflags/README b/modules/gflags/README index 224a90f997..8682aae532 100644 --- a/modules/gflags/README +++ b/modules/gflags/README @@ -16,8 +16,7 @@ Daniel-Constantin Mierla Copyright © 2004 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/group/README b/modules/group/README index 19eb50d162..c343c9bfb3 100644 --- a/modules/group/README +++ b/modules/group/README @@ -20,8 +20,7 @@ Irina-Maria Stanescu Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2009-08-17 19:03:14 +0300 - (Mon, 17 Aug 2009) $ + Revision $Revision: 5969 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/httpd/httpd_proc.c b/modules/httpd/httpd_proc.c index 3c57927008..bbbe56affc 100644 --- a/modules/httpd/httpd_proc.c +++ b/modules/httpd/httpd_proc.c @@ -687,7 +687,7 @@ void httpd_proc(int rank) return; break; case EINTR: - LM_WARN("error returned by select: EINTR [%d] " + LM_DBG("failure returned by select: EINTR [%d] " "(Non blocked signal caught)\n", status); break; case EINVAL: diff --git a/modules/imc/README b/modules/imc/README index 3e1fd5eec4..fc0a9d62ac 100644 --- a/modules/imc/README +++ b/modules/imc/README @@ -12,8 +12,7 @@ Anca-Maria Vamanu Copyright © 2006-2008 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/json/README b/modules/json/README index 80443f8ad9..25c9ff3b13 100644 --- a/modules/json/README +++ b/modules/json/README @@ -2,7 +2,7 @@ JSON Module Andrei Dragus - Voice Sistem SRL + OpenSIPS Solutions> Edited by @@ -10,8 +10,7 @@ Andrei Dragus Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision: 6078 $ $Date: 2009-09-04 15:16:18 +0300 - (Fri, 04 Sep 2009) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -77,7 +76,7 @@ Chapter 1. Admin Guide 1.2.2. External Libraries or Applications - * libjson The libjson library can be downloaded from: + * libjson The libjson C library can be downloaded from: http://oss.metaparadigm.com/json-c/ 1.3. Exported Parameters @@ -89,7 +88,7 @@ Chapter 1. Admin Guide This module exports the $json(id) variable. The json variable provides methods to access fields in json - objects and to access indexes in json arrays. + objects and indexes in json arrays. 1.4.1. Variable lifetime diff --git a/modules/json/doc/json_admin.xml b/modules/json/doc/json_admin.xml index dddc41a008..e1df0465d3 100644 --- a/modules/json/doc/json_admin.xml +++ b/modules/json/doc/json_admin.xml @@ -44,7 +44,7 @@ libjson - The libjson library can be downloaded from: + The libjson C library can be downloaded from: http://oss.metaparadigm.com/json-c/ @@ -72,7 +72,7 @@ The json variable provides methods to access fields - in json objects and to access indexes in json arrays. + in json objects and indexes in json arrays.
diff --git a/modules/load_balancer/README b/modules/load_balancer/README index 098bc0eb4c..bbf8938f6b 100644 --- a/modules/load_balancer/README +++ b/modules/load_balancer/README @@ -328,7 +328,7 @@ if (t_check_status("(408)|(5[0-9][0-9])")) { Example 1.10. lb_is_destination usage ... -if (is_destination("$si","$sp") ) { +if (lb_is_destination("$si","$sp") ) { # request from a LB destination } ... diff --git a/modules/load_balancer/doc/load_balancer_admin.xml b/modules/load_balancer/doc/load_balancer_admin.xml index 85b6969a2c..151d96828d 100644 --- a/modules/load_balancer/doc/load_balancer_admin.xml +++ b/modules/load_balancer/doc/load_balancer_admin.xml @@ -428,7 +428,7 @@ if (t_check_status("(408)|(5[0-9][0-9])")) { <function>lb_is_destination</function> usage ... -if (is_destination("$si","$sp") ) { +if (lb_is_destination("$si","$sp") ) { # request from a LB destination } ... diff --git a/modules/load_balancer/lb_data.c b/modules/load_balancer/lb_data.c index fe88d3c30f..147703570d 100644 --- a/modules/load_balancer/lb_data.c +++ b/modules/load_balancer/lb_data.c @@ -509,7 +509,7 @@ int do_load_balance(struct sip_msg *req, int grp, struct lb_res_str_list *rl, /* lock the resources */ for( i=0 ; in ; i++) - get_lock( call_res[i]->lock ); + lock_get( call_res[i]->lock ); /* do the load-balancing */ load = 0; @@ -550,14 +550,14 @@ int do_load_balance(struct sip_msg *req, int grp, struct lb_res_str_list *rl, /* add to the profiles */ for( i=0 ; in ; i++) { if (lb_dlg_binds.set_profile( req, &dst->profile_id, - call_res[i]->profile)!=0) + call_res[i]->profile, 0)!=0) LM_ERR("failed to add to profile\n"); } } /* unlock the resources*/ for( i=0 ; in ; i++) - release_lock( call_res[i]->lock ); + lock_release( call_res[i]->lock ); if (dst) { LM_DBG("winning destination <%.*s> selected for LB set with free=%d\n", @@ -736,18 +736,18 @@ int lb_count_call(struct lb_data *data, struct sip_msg *req, /* lock the resources */ for( i=0 ; in ; i++) - get_lock( call_res[i]->lock ); + lock_get( call_res[i]->lock ); /* add to the profiles */ for( i=0 ; in ; i++) { if (lb_dlg_binds.set_profile( req, &dst->profile_id, - call_res[i]->profile)!=0) + call_res[i]->profile, 0)!=0) LM_ERR("failed to add to profile\n"); } /* unlock the resources*/ for( i=0 ; in ; i++) - release_lock( call_res[i]->lock ); + lock_release( call_res[i]->lock ); return 0; } diff --git a/modules/mangler/README b/modules/mangler/README index b8150245c2..7ae57bee79 100644 --- a/modules/mangler/README +++ b/modules/mangler/README @@ -10,8 +10,7 @@ Gabriel Vasile Copyright © 2003 Fill in here Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mathops/README b/modules/mathops/README index c9ce00bb3d..38118777ca 100644 --- a/modules/mathops/README +++ b/modules/mathops/README @@ -78,7 +78,7 @@ Chapter 1. Admin Guide Default value is “6”. Example 1.1. Setting the decimal_digits module parameter -modparam("mathops", "decimal_digits", "10") +modparam("mathops", "decimal_digits", 10) 1.4. Exported Functions @@ -94,8 +94,8 @@ modparam("mathops", "decimal_digits", "10") Meaning of the parameters is as follows: * expression - String containing a mathematical expression. - It can also include pseudo variables. The string parameter - can only be given as a string. + It can also include pseudo variables. The expression + parameter can only be given as a string. * result_pvar - pseudo-variable which will hold the result of the evaluation. Specified as a quoted string. diff --git a/modules/mathops/doc/mathops_admin.xml b/modules/mathops/doc/mathops_admin.xml index 3a0f01599f..6d38758f03 100644 --- a/modules/mathops/doc/mathops_admin.xml +++ b/modules/mathops/doc/mathops_admin.xml @@ -59,7 +59,7 @@ Setting the decimal_digits module parameter -modparam("mathops", "decimal_digits", "10") +modparam("mathops", "decimal_digits", 10)
@@ -92,7 +92,7 @@ modparam("mathops", "decimal_digits", "10") expression - String containing a mathematical expression. It can also include pseudo variables. The - string parameter can only be given as a string. + expression parameter can only be given as a string. diff --git a/modules/mathops/math_funcs.c b/modules/mathops/math_funcs.c index 783831e022..2ad393e869 100644 --- a/modules/mathops/math_funcs.c +++ b/modules/mathops/math_funcs.c @@ -179,7 +179,7 @@ static int convert_to_rpn(str *exp) while (s.len) { - if (*s.s > '0' && *s.s < '9') { + if (*s.s >= '0' && *s.s <= '9') { errno = 0; d = strtod(s.s, &p); diff --git a/modules/maxfwd/README b/modules/maxfwd/README index 283f459f7d..314f8806fe 100644 --- a/modules/maxfwd/README +++ b/modules/maxfwd/README @@ -8,8 +8,7 @@ Bogdan-Andrei Iancu Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/maxfwd/maxfwd.c b/modules/maxfwd/maxfwd.c index 395fe3559d..bb0e569650 100644 --- a/modules/maxfwd/maxfwd.c +++ b/modules/maxfwd/maxfwd.c @@ -152,7 +152,7 @@ static int w_process_maxfwd_header(struct sip_msg* msg, char* str1,char* str2) return 2; /* error */ case -2: - break; + goto error; /* found */ case 0: return -1; diff --git a/modules/mediaproxy/README b/modules/mediaproxy/README index 4b4e77eb2c..418510e10b 100644 --- a/modules/mediaproxy/README +++ b/modules/mediaproxy/README @@ -12,8 +12,7 @@ Dan Pascu Copyright © 2004 Dan Pascu Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mediaproxy/mediaproxy.c b/modules/mediaproxy/mediaproxy.c index 56e4c50fcb..625372bd26 100644 --- a/modules/mediaproxy/mediaproxy.c +++ b/modules/mediaproxy/mediaproxy.c @@ -510,6 +510,11 @@ get_to_uri(struct sip_msg *msg) str uri; char *ptr; + if (parse_headers(msg, HDR_TO_F, 0) == -1) { + LM_ERR("failed to parse To header\n"); + return unknown; + } + if (!msg->to) { LM_ERR("missing To header\n"); return unknown; @@ -564,6 +569,11 @@ get_to_tag(struct sip_msg *msg) return undefined; } + if (parse_headers(msg, HDR_TO_F, 0) == -1) { + LM_ERR("failed to parse To header\n"); + return undefined; + } + if (!msg->to) { LM_ERR("missing To header\n"); return undefined; @@ -680,8 +690,8 @@ check_content_type(struct sip_msg *msg) static int get_sdp_message(struct sip_msg *msg, str *sdp) { - if ( get_body(msg, sdp)!=0 || sdp->len==0) - return -1; + if (get_body(msg, sdp)!=0 || sdp->len==0) + return -2; if (!check_content_type(msg)) return -1; diff --git a/modules/mi_fifo/README b/modules/mi_fifo/README index 0e653d5d6a..b517fcbd38 100644 --- a/modules/mi_fifo/README +++ b/modules/mi_fifo/README @@ -10,8 +10,7 @@ Bogdan-Andrei Iancu Copyright © 2006 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mi_http/README b/modules/mi_http/README index 51e265ffeb..a426705b5b 100644 --- a/modules/mi_http/README +++ b/modules/mi_http/README @@ -10,8 +10,7 @@ Ovidiu Sas Copyright © 2011-2013 VoIP Embedded, Inc. Revision History - Revision $Rev: 8688 $ $Date: 2013-01-29 07:35:11 -0500 (Tue, 29 - Jan 2013) $ + Revision $Rev: 8688 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/mi_xmlrpc/xr_server.c b/modules/mi_xmlrpc/xr_server.c index 1362b182b2..2a84767da9 100644 --- a/modules/mi_xmlrpc/xr_server.c +++ b/modules/mi_xmlrpc/xr_server.c @@ -177,6 +177,8 @@ xmlrpc_value* default_method (xmlrpc_env* env, LM_DBG("starting up.....\n"); + xr_writer_reset(); + f = lookup_mi_cmd((char*)methodName, strlen(methodName)); if ( f == 0 ) { diff --git a/modules/mi_xmlrpc/xr_writer.c b/modules/mi_xmlrpc/xr_writer.c index b756f59508..0fed91cdf2 100644 --- a/modules/mi_xmlrpc/xr_writer.c +++ b/modules/mi_xmlrpc/xr_writer.c @@ -49,6 +49,11 @@ int xr_writer_init( unsigned int size ) return 0; } +void xr_writer_reset(void) +{ + *reply_buffer = '\0'; +} + #ifndef XMLRPC_HAS_FORCE_CHARS #define XMLRPC_NONXML_CHAR 0x7F @@ -217,10 +222,7 @@ static int recur_flush_response_array(xmlrpc_env * env, struct mi_node *tree, kid = kid->next; tree->kids = kid; - if(!tmp->kids){ - /* this node does not have any kids */ - free_mi_node(tmp); - } + free_mi_node(tmp); } else{ /* the node will have more kids => to keep the tree shape, do not @@ -286,11 +288,11 @@ static int recur_build_response( xmlrpc_env * env, struct mi_node * tree, LM_ERR("failed to get MI node data!\n"); return -1; } - - /* we are sure that this node has been written - * => avoid writing it again */ - tree->flags |= MI_WRITTEN; } + + /* we are sure that this node has been written + * => avoid writing it again */ + tree->flags |= MI_WRITTEN; } if ( tree->kids ) { @@ -305,9 +307,11 @@ static int recur_build_response( xmlrpc_env * env, struct mi_node * tree, char* xr_build_response( xmlrpc_env * env, struct mi_root * tree ) { str buf; - - buf.s = reply_buffer; - buf.len = reply_buffer_len; + int len; + + len = strlen(reply_buffer); + buf.s = reply_buffer + len; + buf.len = reply_buffer_len - len; if ( tree->code<200 || tree->code>=300 ){ LM_DBG("command processing failure: %s\n", tree->reason.s); @@ -335,7 +339,16 @@ static int recur_flush_response(xmlrpc_env * env, struct mi_node *tree, str *buf struct mi_node *kid, *tmp; int ret; - for(kid = tree->kids ; kid ; ){ + if (!rpl_opt) { + if (recur_build_response(env, tree, buf) != 0) { + LM_ERR("failed to read from the MI tree!\n"); + return -1; + } + + return 0; + } + + for(kid = tree->kids ; kid ; ){ /* write the current kid */ if (!(kid->flags & MI_WRITTEN)){ if (xr_write_node( buf, kid)!=0) { @@ -371,10 +384,7 @@ static int recur_flush_response(xmlrpc_env * env, struct mi_node *tree, str *buf kid = kid->next; tree->kids = kid; - if(!tmp->kids){ - /* this node does not have any kids */ - free_mi_node(tmp); - } + free_mi_node(tmp); } else{ /* the node will have more kids => to keep the tree shape, do not @@ -389,9 +399,11 @@ static int recur_flush_response(xmlrpc_env * env, struct mi_node *tree, str *buf char* xr_flush_response( xmlrpc_env * env, struct mi_root * tree ) { str buf; - - buf.s = reply_buffer; - buf.len = reply_buffer_len; + int len; + + len = strlen(reply_buffer); + buf.s = reply_buffer + len; + buf.len = reply_buffer_len - len; if ( tree->code<200 || tree->code>=300 ){ LM_DBG("command processing failure: %s\n", tree->reason.s); diff --git a/modules/mi_xmlrpc/xr_writer.h b/modules/mi_xmlrpc/xr_writer.h index 5ad208fa44..aef9e393db 100644 --- a/modules/mi_xmlrpc/xr_writer.h +++ b/modules/mi_xmlrpc/xr_writer.h @@ -34,6 +34,7 @@ #include "../../mi/tree.h" int xr_writer_init( unsigned int size ); +void xr_writer_reset(void); char * xr_build_response( xmlrpc_env * env, struct mi_root * tree ); char * xr_flush_response( xmlrpc_env * env, struct mi_root * tree ); int xr_build_response_array( xmlrpc_env * env, struct mi_root * tree ); diff --git a/modules/msilo/README b/modules/msilo/README index 783d99f196..b9832878c3 100644 --- a/modules/msilo/README +++ b/modules/msilo/README @@ -12,8 +12,7 @@ Daniel-Constantin Mierla Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/nat_traversal/README b/modules/nat_traversal/README index e1c0c22d05..94a12a42f4 100644 --- a/modules/nat_traversal/README +++ b/modules/nat_traversal/README @@ -12,8 +12,7 @@ Dan Pascu Copyright © 2008 Dan Pascu Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/nat_traversal/nat_traversal.c b/modules/nat_traversal/nat_traversal.c index c563e996a2..3d9380100c 100644 --- a/modules/nat_traversal/nat_traversal.c +++ b/modules/nat_traversal/nat_traversal.c @@ -1574,6 +1574,8 @@ ClientNatTest(struct sip_msg *msg, unsigned int tests) static void send_keepalive(NAT_Contact *contact) { +#define MAX_BRANCHID 9999999 +#define MIN_BRANCHID 1000000 char buffer[8192], *from_uri, *ptr; static char from[64] = FROM_PREFIX; static char *from_ip = from + sizeof(FROM_PREFIX) - 1; @@ -1596,7 +1598,7 @@ send_keepalive(NAT_Contact *contact) len = snprintf(buffer, sizeof(buffer), "%s %s SIP/2.0\r\n" - "Via: SIP/2.0/UDP %.*s:%d;branch=0\r\n" + "Via: SIP/2.0/UDP %.*s:%d;branch=z9hG4bK%ld\r\n" "From: %s;tag=%x\r\n" "To: %s\r\n" "Call-ID: %s-%x-%x@%.*s\r\n" @@ -1606,6 +1608,7 @@ send_keepalive(NAT_Contact *contact) keepalive_params.method, contact->uri, contact->socket->address_str.len, contact->socket->address_str.s, contact->socket->port_no, + (long)(rand()/(float)RAND_MAX * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID), from_uri, keepalive_params.from_tag++, contact->uri, keepalive_params.callid_prefix, keepalive_params.callid_counter++, get_ticks(), diff --git a/modules/nathelper/nathelper.c b/modules/nathelper/nathelper.c index a7093c4611..85963eacf7 100644 --- a/modules/nathelper/nathelper.c +++ b/modules/nathelper/nathelper.c @@ -1151,7 +1151,8 @@ nh_timer(unsigned int ticks, void *timer_idx) { static unsigned int iteration = 0; int rval; - void *buf, *cp; + void *buf = NULL; + void *cp; str c; str opt; str path; @@ -1164,7 +1165,6 @@ nh_timer(unsigned int ticks, void *timer_idx) if((*natping_state) == 0) goto done; - buf = NULL; if (cblen > 0) { buf = pkg_malloc(cblen); if (buf == NULL) { @@ -1192,7 +1192,6 @@ nh_timer(unsigned int ticks, void *timer_idx) ((unsigned int)(unsigned long)timer_idx)*natping_interval+iteration, natping_processes*natping_interval); if (rval != 0) { - pkg_free(buf); goto done; } } @@ -1283,8 +1282,9 @@ nh_timer(unsigned int ticks, void *timer_idx) tcp_no_new_conn = 0; #endif - pkg_free(buf); done: + if (buf) + pkg_free(buf); iteration++; if (iteration==natping_interval) iteration = 0; diff --git a/modules/nathelper/sip_pinger.h b/modules/nathelper/sip_pinger.h index 6d368c662f..fdc344a8b6 100644 --- a/modules/nathelper/sip_pinger.h +++ b/modules/nathelper/sip_pinger.h @@ -129,6 +129,9 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path, int *len_p) { #define s_len(_s) (sizeof(_s)-1) +#define MAX_BRANCHID 9999999 +#define MIN_BRANCHID 1000000 +#define LEN_BRANCHID 7 /* NOTE: this must be sync with the MX and MIN values !! */ static char buf[MAX_SIPPING_SIZE]; char *p, proto_str[4]; str address, port; @@ -158,7 +161,7 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path, if ( sipping_method.len + 1 + curi->len + s_len(" SIP/2.0"CRLF) + s_len("Via: SIP/2.0/") + st.len + address.len + - 1 + port.len + s_len(";branch=0") + + 1 + port.len + s_len(";branch=z9hG4bK") + LEN_BRANCHID + (path->len ? (s_len(CRLF"Route: ") + path->len) : 0) + s_len(CRLF"From: ") + sipping_from.len + s_len(";tag=") + 8 + s_len(CRLF"To: ") + curi->len + @@ -182,13 +185,16 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path, append_str( p, address); *(p++) = ':'; append_str( p, port); + append_fix( p, ";branch=z9hG4bK"); + int2bstr( + (long)(rand()/(float)RAND_MAX * (MAX_BRANCHID-MIN_BRANCHID) + MIN_BRANCHID), + p+LEN_BRANCHID-INT2STR_MAX_LEN+1, NULL); + p += LEN_BRANCHID; if (path->len) { - append_fix( p, ";branch=0"CRLF"Route: "); + append_fix( p, CRLF"Route: "); append_str( p, *path); - append_fix( p, CRLF"From: "); - } else { - append_fix( p, ";branch=0"CRLF"From: "); } + append_fix( p, CRLF"From: "); append_str( p, sipping_from); append_fix( p, ";tag="); len = 8; diff --git a/modules/options/README b/modules/options/README index 81e89565dd..e7d84bf283 100644 --- a/modules/options/README +++ b/modules/options/README @@ -10,8 +10,7 @@ Nils Ohlmeier Copyright © 2003 FhG Fokus Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/osp/Makefile b/modules/osp/Makefile index ce11371f44..b1a2c3b313 100644 --- a/modules/osp/Makefile +++ b/modules/osp/Makefile @@ -1,4 +1,3 @@ - # osp module makefile # WARNING: do not run this directly, it should be run by the master Makefile @@ -33,7 +32,7 @@ include ../../Makefile.modules install_module_custom: echo "OSP module overwrites the default configuration file" sed \ - -e "s#/usr/local/lib/opensips#$(modules-prefix)/$(lib-dir)#g" \ + -e "s#/usr/local/lib/opensips#$(modules-target)/$(lib-dir)#g" \ < etc/sample-osp-opensips.cfg \ > $(cfg-prefix)/$(cfg-dir)/opensips.cfg diff --git a/modules/osp/README b/modules/osp/README index 04d86bc38a..a8c3f3e51d 100644 --- a/modules/osp/README +++ b/modules/osp/README @@ -16,7 +16,7 @@ Di-Shi Sun Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 15:45:05 +0800 + Revision $Revision: 5901 $ $Date: 2009-07-21 09:45:05 +0200 (Tue, 21 Jul 2009) $ __________________________________________________________ @@ -52,9 +52,11 @@ Di-Shi Sun 1.3.20. append_userphone 1.3.21. networkid_location 1.3.22. networkid_parameter - 1.3.23. source_device_avp - 1.3.24. source_networkid_avp - 1.3.25. custom_info_avp + 1.3.23. parameterstring_location + 1.3.24. parameterstring_value + 1.3.25. source_device_avp + 1.3.26. source_networkid_avp + 1.3.27. custom_info_avp 1.4. Exported Functions @@ -96,18 +98,20 @@ Di-Shi Sun 1.20. Append user=phone parameter 1.21. Append networkid location 1.22. Networkid parameter name - 1.23. Setting the source device IP AVP - 1.24. Setting the source network ID AVP - 1.25. Setting the custom info AVP - 1.26. checkospheader usage - 1.27. validateospheader usage - 1.28. requestosprouting usage - 1.29. checkosproute usage - 1.30. prepareosproute usage - 1.31. prepareredirectosproutes usage - 1.32. prepareallosproutes usage - 1.33. checkcallingtranslation usage - 1.34. reportospusage usage + 1.23. Append parameter string location + 1.24. Parameter string value + 1.25. Setting the source device IP AVP + 1.26. Setting the source network ID AVP + 1.27. Setting the custom info AVP + 1.28. checkospheader usage + 1.29. validateospheader usage + 1.30. requestosprouting usage + 1.31. checkosproute usage + 1.32. prepareosproute usage + 1.33. prepareredirectosproutes usage + 1.34. prepareallosproutes usage + 1.35. checkcallingtranslation usage + 1.36. reportospusage usage Chapter 1. Admin Guide @@ -187,7 +191,8 @@ modparam("osp","service_type",0) included. Example 1.3. Setting the OSP servers -modparam("osp","sp1_uri","http://osptestserver.transnexus.com:5045/osp") +modparam("osp","sp1_uri","http://osptestserver.transnexus.com:5045/osp" +) modparam("osp","sp2_uri","https://[1.2.3.4]:1443/osp") 1.3.4. sp1_weight, sp2_weight, ..., sp16_weight @@ -275,8 +280,8 @@ modparam("osp","token_format",2) If the default CFG_DIR value was used at compile time, the files will be loaded from: modparam("osp","private_key","/usr/local/etc/opensips/pkey.pem") -modparam("osp","local_certificate","/usr/local/etc/opensips/localcert.pe -m") +modparam("osp","local_certificate","/usr/local/etc/opensips/localcert.p +em") modparam("osp","ca_certificates","/usr/local/etc/opensips/cacert.pem") 1.3.9. enable_crypto_hardware_support @@ -445,7 +450,31 @@ modparam("osp","networkid_location",2) Example 1.22. Networkid parameter name modparam("osp","networkid_param","networkid") -1.3.23. source_device_avp +1.3.23. parameterstring_location + + The parameterstring_location (integer) parameter instructs the + OSP module where the parameter string should be appended. The + default value is 0 + + 0 - parameter string is not appended. + + 1 - parameter string is appended as userinfo parameter. + + 2 - parameter string is appended as URI parameter. + + Example 1.23. Append parameter string location +modparam("osp","parameterstring_location",0) + +1.3.24. parameterstring_value + + The parameterstring_value (string) parameter instructs the OSP + module to append the parameter string in outbound URIs. The + default value is "" + + Example 1.24. Parameter string value +modparam("osp","parameterstring_value","") + +1.3.25. source_device_avp The source_device_avp (string) parameter instructs the OSP module to use the defined AVP to pass the source device IP @@ -455,10 +484,10 @@ modparam("osp","networkid_param","networkid") pseudo variables are described in http://www.opensips.org/Resources/DocsCoreVar. - Example 1.23. Setting the source device IP AVP + Example 1.25. Setting the source device IP AVP modparam("osp","source_device_avp","$avp(srcdev)") -1.3.24. source_networkid_avp +1.3.26. source_networkid_avp The source_networkid_avp (string) parameter instructs the OSP module to use the defined AVP to pass the source network ID @@ -468,10 +497,10 @@ modparam("osp","source_device_avp","$avp(srcdev)") variables are described in http://www.opensips.org/Resources/DocsCoreVar. - Example 1.24. Setting the source network ID AVP + Example 1.26. Setting the source network ID AVP modparam("osp","source_networkid_avp","$avp(snid)") -1.3.25. custom_info_avp +1.3.27. custom_info_avp The custom_info_avp (string) parameter instructs the OSP module to use the defined AVP to pass the custom information values. @@ -480,7 +509,7 @@ modparam("osp","source_networkid_avp","$avp(snid)") pseudo-variables". All pseudo variables are described in http://www.opensips.org/Resources/DocsCoreVar. - Example 1.25. Setting the custom info AVP + Example 1.27. Setting the custom info AVP modparam("osp","custom_info_avp","$avp(cinfo)") 1.4. Exported Functions @@ -492,7 +521,7 @@ modparam("osp","custom_info_avp","$avp(cinfo)") This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.26. checkospheader usage + Example 1.28. checkospheader usage ... if (checkospheader()) { log(1,"OSP header field found.\n"); @@ -511,7 +540,7 @@ if (checkospheader()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.27. validateospheader usage + Example 1.29. validateospheader usage ... if (validateospheader()) { log(1,"valid OSP header found\n"); @@ -540,7 +569,7 @@ if (validateospheader()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.28. requestosprouting usage + Example 1.30. requestosprouting usage ... if (requestosprouting()) { log(1,"successfully queried OSP server, now relaying call\n"); @@ -556,7 +585,7 @@ if (requestosprouting()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.29. checkosproute usage + Example 1.31. checkosproute usage ... if (checkosproute()) { log(1,"There is at least one route for the call\n"); @@ -579,7 +608,7 @@ if (checkosproute()) { This function can be used from BRANCH_ROUTE. - Example 1.30. prepareosproute usage + Example 1.32. prepareosproute usage ... if (prepareosproute()) { log(1,"successfully prepared the route, now relaying call\n"); @@ -598,7 +627,7 @@ if (prepareosproute()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.31. prepareredirectosproutes usage + Example 1.33. prepareredirectosproutes usage ... if (prepareredirectosproutes()) { log(1,"Routes are prepared, now redirecting the call\n"); @@ -616,7 +645,7 @@ if (prepareredirectosproutes()) { This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - Example 1.32. prepareallosproutes usage + Example 1.34. prepareallosproutes usage ... if (prepareallosproutes()) { log(1,"Routes are prepared, now forking the call\n"); @@ -638,7 +667,7 @@ if (prepareallosproutes()) { This function can be used from BRANCH_ROUTE. - Example 1.33. checkcallingtranslation usage + Example 1.35. checkcallingtranslation usage ... if (checkcallingtranslation()) { # Remove the Remote_Party-ID from the received message @@ -667,7 +696,7 @@ if (checkcallingtranslation()) { This function can be used from REQUEST_ROUTE. - Example 1.34. reportospusage usage + Example 1.36. reportospusage usage ... if (is_direction("downstream")) { log(1,"This BYE message is from SOURCE\n"); diff --git a/modules/osp/doc/osp_admin.xml b/modules/osp/doc/osp_admin.xml index 42736bc7ff..5c29a6a766 100644 --- a/modules/osp/doc/osp_admin.xml +++ b/modules/osp/doc/osp_admin.xml @@ -288,6 +288,29 @@ modparam("osp","networkid_param","networkid")
+
+ <varname>parameterstring_location</varname> + The parameterstring_location (integer) parameter instructs the OSP module where the parameter string should be appended. The default value is 0 + 0 - parameter string is not appended. + 1 - parameter string is appended as userinfo parameter. + 2 - parameter string is appended as URI parameter. + + Append parameter string location + +modparam("osp","parameterstring_location",0) + + +
+
+ <varname>parameterstring_value</varname> + The parameterstring_value (string) parameter instructs the OSP module to append the parameter string in outbound URIs. The default value is "" + + Parameter string value + +modparam("osp","parameterstring_value","") + + +
<varname>source_device_avp</varname> The source_device_avp (string) parameter instructs the OSP module to use the defined AVP to pass the source device IP value in the indirect work mode. The default value is "$avp(_osp_source_device_)". Then the source device IP can be set by "$avp(_osp_source_device_) = pseudo-variables". All pseudo variables are described in http://www.opensips.org/Resources/DocsCoreVar. diff --git a/modules/osp/etc/sample-osp-opensips.cfg b/modules/osp/etc/sample-osp-opensips.cfg index 5f21e94750..e313c97f4f 100644 --- a/modules/osp/etc/sample-osp-opensips.cfg +++ b/modules/osp/etc/sample-osp-opensips.cfg @@ -229,6 +229,27 @@ modparam("osp", "sp1_uri", "http://osptestserver.transnexus.com:5045/osp") # # modparam("osp", "networkid_parameter", "networkid") +# +# Parameter String Location +# ==================================================================== +# This parameter is used to tell the OSP module where the parameter +# string should be appended in the outbound URI. The default value is +# 0. +# +# 0 - parameter string is not appended. +# 1 - parameter string is appended as userinfo parameter. +# 2 - parameter string is appended as URI parameter. +# +# modparam("osp", "parameterstring_location", 0) + +# +# Parameter String Value +# ==================================================================== +# This parameter is used to tell the OSP module the parameter string +# that is appended in outbound URI. The default value is empty. +# +# modparam("osp", "parameterstring_value", "") + # # Source Device IP AVP # ==================================================================== diff --git a/modules/osp/globals.c b/modules/osp/globals.c index abba2f9bbd..32fd8a1469 100644 --- a/modules/osp/globals.c +++ b/modules/osp/globals.c @@ -68,6 +68,8 @@ int _osp_use_np = OSP_DEF_USENP; int _osp_append_userphone = OSP_DEF_USERPHONE; int _osp_dnid_location = OSP_DEF_DNIDLOC; char* _osp_dnid_param = OSP_DEF_DNIDPARAM; +int _osp_paramstr_location = OSP_DEF_PARAMSTRLOC; +char* _osp_paramstr_value = OSP_DEF_PARAMSTRVAL; char _osp_PRIVATE_KEY[OSP_STRBUF_SIZE]; char _osp_LOCAL_CERTIFICATE[OSP_STRBUF_SIZE]; char _osp_CA_CERTIFICATE[OSP_STRBUF_SIZE]; diff --git a/modules/osp/osp_mod.c b/modules/osp/osp_mod.c index 8ec82d4bde..afbc096932 100644 --- a/modules/osp/osp_mod.c +++ b/modules/osp/osp_mod.c @@ -71,6 +71,8 @@ extern int _osp_use_np; extern int _osp_append_userphone; extern int _osp_dnid_location; extern char* _osp_dnid_param; +extern int _osp_paramstr_location; +extern char* _osp_paramstr_value; extern char _osp_PRIVATE_KEY[]; extern char _osp_LOCAL_CERTIFICATE[]; extern char _osp_CA_CERTIFICATE[]; @@ -163,6 +165,8 @@ static param_export_t params[]={ { "append_userphone", INT_PARAM, &_osp_append_userphone }, { "networkid_location", INT_PARAM, &_osp_dnid_location}, { "networkid_parameter", STR_PARAM, &_osp_dnid_param }, + { "parameterstring_location", INT_PARAM, &_osp_paramstr_location}, + { "parameterstring_value", STR_PARAM, &_osp_paramstr_value }, { "source_device_avp", STR_PARAM, &_osp_srcdev_avp }, { "source_networkid_avp", STR_PARAM, &_osp_snid_avp }, { "custom_info_avp", STR_PARAM, &_osp_cinfo_avp }, @@ -342,6 +346,15 @@ static int ospVerifyParameters(void) _osp_dnid_param = OSP_DEF_DNIDPARAM; } + if ((_osp_paramstr_location < 0) || (_osp_paramstr_location > 2)) { + _osp_paramstr_location = OSP_DEF_PARAMSTRLOC; + LM_WARN("parameterstring_location is out of range, reset to %d\n", OSP_DEF_PARAMSTRLOC); + } + + if (!(_osp_paramstr_value && *_osp_paramstr_value)) { + _osp_paramstr_value = OSP_DEF_PARAMSTRVAL; + } + if ((_osp_work_mode == 1) && _osp_srcdev_avp && *_osp_srcdev_avp) { avp_str.s = _osp_srcdev_avp; avp_str.len = strlen(_osp_srcdev_avp); @@ -429,6 +442,8 @@ static void ospDumpParameters(void) LM_INFO(" append_userphone '%d' ", _osp_append_userphone); LM_INFO(" networkid_location '%d' ", _osp_dnid_location); LM_INFO(" networkid_parameter '%s' ", _osp_dnid_param); + LM_INFO(" parameterstring_location '%d' ", _osp_paramstr_location); + LM_INFO(" parameterstring_value '%s' ", _osp_paramstr_value); LM_INFO(" max_destinations '%d'\n", _osp_max_dests); LM_INFO(" report_networkid '%d'\n", _osp_report_nid); LM_INFO(" support_nonsip_protocol '%d'\n", _osp_non_sip); diff --git a/modules/osp/osp_mod.h b/modules/osp/osp_mod.h index e43430501f..708c051018 100644 --- a/modules/osp/osp_mod.h +++ b/modules/osp/osp_mod.h @@ -57,6 +57,8 @@ #define OSP_DEF_USERPHONE 0 #define OSP_DEF_DNIDLOC 2 #define OSP_DEF_DNIDPARAM "networkid" +#define OSP_DEF_PARAMSTRLOC 0 +#define OSP_DEF_PARAMSTRVAL "" #define OSP_DEF_SRCIPAVP "$avp(_osp_source_device_)" #define OSP_DEF_SNIDAVP "$avp(_osp_source_networkid_)" #define OSP_DEF_CINFOS 8 diff --git a/modules/osp/sipheader.c b/modules/osp/sipheader.c index 9742e6cc03..85b832759f 100644 --- a/modules/osp/sipheader.c +++ b/modules/osp/sipheader.c @@ -49,10 +49,11 @@ extern int _osp_use_np; extern int _osp_append_userphone; extern int _osp_dnid_location; extern char* _osp_dnid_param; +extern int _osp_paramstr_location; +extern char* _osp_paramstr_value; extern int _osp_srcdev_avpid; extern unsigned short _osp_srcdev_avptype; -static void ospSkipPlus(char* e164); static void ospSkipUserParam(char* userinfo); static int ospAppendHeader(struct sip_msg* msg, str* header); @@ -83,22 +84,6 @@ void ospCopyStrToBuffer( buffer[copybytes] = '\0'; } -/* - * Remove '+' in E164 string - * param e164 E164 string - */ -static void ospSkipPlus( - char* e164) -{ - int size; - - if (*e164 == '+') { - size = strlen(e164); - memmove(e164, e164 + 1, size - 1); - e164[size - 1] = '\0'; - } -} - /* * Remove user parameters from userinfo * param userinfo User info @@ -141,7 +126,6 @@ int ospGetFromUserpart( if (parse_uri(from->uri.s, from->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, fromuser, bufsize); ospSkipUserParam(fromuser); - ospSkipPlus(fromuser); result = 0; } else { LM_ERR("failed to parse From uri\n"); @@ -183,7 +167,6 @@ int ospGetRpidUserpart( if (parse_uri(rpid->uri.s, rpid->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, rpiduser, bufsize); ospSkipUserParam(rpiduser); - ospSkipPlus(rpiduser); result = 0; } else { LM_ERR("failed to parse RPID uri\n"); @@ -226,7 +209,6 @@ int ospGetPaiUserpart( if (parse_uri(pai->uri.s, pai->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, paiuser, bufsize); ospSkipUserParam(paiuser); - ospSkipPlus(paiuser); result = 0; } else { LM_ERR("failed to parse PAI uri\n"); @@ -283,7 +265,6 @@ int ospGetPChargeInfoUserpart( if (parse_uri(pci->uri.s, pci->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, pciuser, bufsize); ospSkipUserParam(pciuser); - ospSkipPlus(pciuser); result = 0; } else { LM_ERR("failed to parse P-Charge-Info uri\n"); @@ -333,7 +314,6 @@ int ospGetToUserpart( if (parse_uri(to->uri.s, to->uri.len, &uri) == 0) { ospCopyStrToBuffer(&uri.user, touser, bufsize); ospSkipUserParam(touser); - ospSkipPlus(touser); result = 0; } else { LM_ERR("failed to parse To uri\n"); @@ -417,7 +397,6 @@ int ospGetUriUserpart( if (parse_sip_msg_uri(msg) >= 0) { ospCopyStrToBuffer(&msg->parsed_uri.user, uriuser, bufsize); ospSkipUserParam(uriuser); - ospSkipPlus(uriuser); result = 0; } else { LM_ERR("failed to parse Request-Line URI\n"); @@ -771,6 +750,7 @@ int ospRebuildDestinationUri( int uriparamsize; int userparamsize; int dnidsize; + int paramstrsize; int count; calledsize = strlen(dest->called); @@ -797,6 +777,8 @@ int ospRebuildDestinationUri( uriparamsize = _osp_append_userphone ? USERPHONE.len : 0; /* destination network ID parameter */ dnidsize = (_osp_dnid_location && dest->dnid[0]) ? 1 + strlen(_osp_dnid_param) + 1 + strlen(dest->dnid) : 0; + /* parameter string */ + paramstrsize = (_osp_paramstr_location && _osp_paramstr_value[0]) ? 1 + strlen(_osp_paramstr_value) : 0; LM_DBG("'%s' (%d) '%s' (%d) '%s' '%s' '%d' '%s' '%s' '%s' '%s' '%s' '%s' (%d) '%s' (%d)\n", dest->called, @@ -819,7 +801,7 @@ int ospRebuildDestinationUri( /* "sip:" + called + NP + "@" + host + ";user=phone" + ";_osp_dnid_param=" + dnid + " SIP/2.0" or "sip:" + called + NP + ";_osp_dnid_param=" + dnid + "@" + host + ";user=phone" SIP/2.0" */ /* OpenSIPS will add "<>" for the Contact headers of SIP 3xx messages */ - if (newuri->len < (4 + calledsize + userparamsize + 1 + hostsize + uriparamsize + dnidsize + 1 + 7 + TRANS.len)) { + if (newuri->len < (4 + calledsize + userparamsize + 1 + hostsize + uriparamsize + dnidsize + paramstrsize + 1 + 7 + TRANS.len)) { LM_ERR("new uri buffer is too small\n"); newuri->len = 0; return -1; @@ -877,6 +859,11 @@ int ospRebuildDestinationUri( buffer += count; } + if ((_osp_paramstr_location == 1) && (_osp_paramstr_value[0] != '\0')) { + count = sprintf(buffer, ";%s", _osp_paramstr_value); + buffer += count; + } + *buffer++ = '@'; strncpy(buffer, dest->host, newuri->len - (buffer - newuri->s)); @@ -892,6 +879,11 @@ int ospRebuildDestinationUri( buffer += count; } + if ((_osp_paramstr_location == 2) && (_osp_paramstr_value[0] != '\0')) { + count = sprintf(buffer, ";%s", _osp_paramstr_value); + buffer += count; + } + /* *buffer++ = ' '; *buffer++ = 'S'; diff --git a/modules/path/README b/modules/path/README index 5f38e2823d..d93df5f175 100644 --- a/modules/path/README +++ b/modules/path/README @@ -10,8 +10,7 @@ Andreas Granig Copyright © 2006 Inode GmbH Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/peering/README b/modules/peering/README index c27d5e0468..33bf790ba6 100644 --- a/modules/peering/README +++ b/modules/peering/README @@ -18,8 +18,7 @@ Irina-Maria Stanescu Copyright © 2008 Juha Heinanen Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5952 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/permissions/README b/modules/permissions/README index fb89eebe3d..01c797a783 100644 --- a/modules/permissions/README +++ b/modules/permissions/README @@ -24,8 +24,7 @@ Irina-Maria Stanescu Copyright © 2009 Irina-Maria Stanescu Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/permissions/permissions.c b/modules/permissions/permissions.c index 66881e7ee8..ccc5ea1867 100644 --- a/modules/permissions/permissions.c +++ b/modules/permissions/permissions.c @@ -167,7 +167,7 @@ static param_export_t params[] = { {"address_table", STR_PARAM, &address_table.s }, {"ip_col", STR_PARAM, &ip_col.s }, {"proto_col", STR_PARAM, &proto_col.s }, - {"from_col", STR_PARAM, &pattern_col.s }, + {"pattern_col", STR_PARAM, &pattern_col.s }, {"info_col", STR_PARAM, &info_col.s }, {"grp_col", STR_PARAM, &grp_col.s }, {"mask_col", STR_PARAM, &mask_col.s }, diff --git a/modules/pi_http/http_fnc.c b/modules/pi_http/http_fnc.c index c4b4aea451..6105e1ee23 100644 --- a/modules/pi_http/http_fnc.c +++ b/modules/pi_http/http_fnc.c @@ -260,31 +260,31 @@ do{ \ case '<': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_LT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '>': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_GT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '&': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_AMP); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '"': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_QUOT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ case '\'': \ (temp_holder).len = (temp_counter) - (temp_holder).len; \ PI_HTTP_COPY_2(p, (temp_holder), PI_HTTP_ESC_SQUOT); \ - (temp_holder).s += (temp_counter) + 1; \ + (temp_holder).s = (str).s + (temp_counter) + 1; \ (temp_holder).len = (temp_counter) + 1; \ break; \ } \ @@ -1366,7 +1366,7 @@ int ph_getCmds(ph_db_table_t *ph_db_tables, int ph_db_tables_size, NULL, &cmds->o_keys, NULL, - &cmds->q_vals, + NULL, &cmds->o_keys_size, cmd_cols)!=0) return -1; diff --git a/modules/pike/README b/modules/pike/README index 19b338c548..2e7cffca6f 100644 --- a/modules/pike/README +++ b/modules/pike/README @@ -10,8 +10,7 @@ Bogdan-Andrei Iancu Copyright © 2005-2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -112,7 +111,7 @@ Chapter 1. Admin Guide Time period used for sampling (or the sampling accuracy ;-) ). The smaller the better, but slower. If you want to detect - peeks, use a small one. To limit the access (like total number + peaks, use a small one. To limit the access (like total number of requests on a long period of time) to a proxy resource (a gateway for ex), use a bigger value of this parameter. diff --git a/modules/pike/doc/pike_admin.xml b/modules/pike/doc/pike_admin.xml index 9c2caed3d5..e992b91b6f 100644 --- a/modules/pike/doc/pike_admin.xml +++ b/modules/pike/doc/pike_admin.xml @@ -90,7 +90,7 @@ <varname>sampling_time_unit</varname> (integer) Time period used for sampling (or the sampling accuracy ;-) ). The - smaller the better, but slower. If you want to detect peeks, use a + smaller the better, but slower. If you want to detect peaks, use a small one. To limit the access (like total number of requests on a long period of time) to a proxy resource (a gateway for ex), use a bigger value of this parameter. diff --git a/modules/presence/hash.c b/modules/presence/hash.c index e520029a14..e7042fa9e5 100644 --- a/modules/presence/hash.c +++ b/modules/presence/hash.c @@ -355,7 +355,7 @@ int update_shtable(shtable_t htable,unsigned int hash_code, else { subs->local_cseq= s->local_cseq++; - s->version= subs->version+ 1; + subs->version= s->version++; } if(strncmp(s->contact.s, subs->contact.s, subs->contact.len)) @@ -506,7 +506,7 @@ void update_pres_etag(pres_entry_t* p, str* etag) p->etag_count++; } -int insert_phtable(str* pres_uri, int event, str* etag, char* sphere) +pres_entry_t* insert_phtable(str* pres_uri, int event, str* etag, char* sphere, int init_turn) { unsigned int hash_code; pres_entry_t* p= NULL; @@ -543,14 +543,16 @@ int insert_phtable(str* pres_uri, int event, str* etag, char* sphere) p->next= pres_htable[hash_code].entries->next; pres_htable[hash_code].entries->next= p; + p->last_turn = init_turn; + lock_release(&pres_htable[hash_code].lock); - return 0; + return p; error: if(p) shm_free(p); - return -1; + return NULL; } int delete_phtable_query(str *pres_uri, int event, str* etag) @@ -572,6 +574,26 @@ int delete_phtable_query(str *pres_uri, int event, str* etag) return 0; } + +void next_turn_phtable(pres_entry_t* p_p, unsigned int hash_code) +{ + pres_entry_t* p; + + lock_get(&pres_htable[hash_code].lock); + for ( p=pres_htable[hash_code].entries->next ; p ; p=p->next ) { + if(p==p_p) { + p->current_turn++; + LM_DBG("new current turn is %d for <%.*s>\n",p->current_turn, + p_p->pres_uri.len, p_p->pres_uri.s); + break; + } + } + + lock_release(&pres_htable[hash_code].lock); + return; +} + + int delete_phtable(pres_entry_t* p, unsigned int hash_code) { pres_entry_t* prev_p= NULL; diff --git a/modules/presence/hash.h b/modules/presence/hash.h index d09df1a244..0f120c4e2c 100644 --- a/modules/presence/hash.h +++ b/modules/presence/hash.h @@ -127,6 +127,9 @@ typedef struct pres_entry char* sphere; char etag[ETAG_LEN]; int etag_len; + /* ordering */ + unsigned int current_turn; + unsigned int last_turn; struct pres_entry* next; }pres_entry_t; @@ -144,10 +147,12 @@ pres_entry_t* search_phtable_etag(str* pres_uri, int event, void update_pres_etag(pres_entry_t* p, str* etag); -int insert_phtable(str* pres_uri, int event, str* etag, char* sphere); +pres_entry_t* insert_phtable(str* pres_uri, int event, str* etag, char* sphere, int init_turn); int update_phtable(struct presentity* presentity, str pres_uri, str body); +void next_turn_phtable(pres_entry_t* p_p, unsigned int hash_code); + int delete_phtable(pres_entry_t* p, unsigned int hash_code); int delete_phtable_query(str *pres_uri, int event, str* etag); diff --git a/modules/presence/notify.c b/modules/presence/notify.c index ee548cf281..14fd27d2a2 100644 --- a/modules/presence/notify.c +++ b/modules/presence/notify.c @@ -922,7 +922,7 @@ str* get_presence_from_dialog(str* pres_uri, struct sip_uri* uri, } str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag, str* publ_body, - str* contact, str* dbody, str* extra_hdrs, free_body_t** free_fct) + str* contact, str* dbody, str* extra_hdrs, free_body_t** free_fct, int from_publish) { int body_col, extra_hdrs_col, expires_col, etag_col= 0; db_res_t *result = NULL; @@ -1257,6 +1257,25 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag, str* publ_body body_array[build_off_n] = publ_body; build_off_n = -1; } + + /* RFC 4235 states that a NOTIFY generated after an initial + * or refreshed SUBSCRIBE request must contain a full-state notification. + * In other cases, only the modified state should be notified using + * a partial state notification. + */ + if (event->evp->parsed == EVENT_DIALOG && from_publish && publ_body) { + + /* Presence dialoginfo knows that special n value of -2 means we publish + * a partial state. Calling the agg_nbody method is however required because + * it builds the full NOTIFY body as described in the RFC (it adds the version + * field to the body, defines if state is partial or full, ...). + */ + notify_body = event->agg_nbody(&uri.user, &uri.host, &publ_body, -2, build_off_n); + if(notify_body) { + goto done; + } + } + notify_body = event->agg_nbody(&uri.user, &uri.host, body_array, body_cnt, build_off_n); if(notify_body == NULL) { @@ -1715,7 +1734,7 @@ subs_t* get_subs_dialog(str* pres_uri, pres_ev_t* event, str* sender) } int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, - str* rules_doc, str* dialog_body) + str* rules_doc, str* dialog_body, int from_publish) { str *notify_body = NULL; str notify_extra_hdrs = {NULL, 0}; @@ -1736,7 +1755,8 @@ int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, { notify_body = get_p_notify_body(pres_uri, p->event , offline_etag, body, NULL, dialog_body, - p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs, &free_fct); + p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs, &free_fct, + from_publish); } s= subs_array; @@ -1745,7 +1765,7 @@ int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, s->auth_rules_doc= rules_doc; LM_INFO("notify\n"); if(notify(s, NULL, notify_body?notify_body:body, - 0, p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs)< 0 ) + 0, p->extra_hdrs?p->extra_hdrs:¬ify_extra_hdrs, from_publish)< 0 ) { LM_ERR("Could not send notify for %.*s\n", p->event->name.len, p->event->name.s); @@ -1793,7 +1813,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs) if(event->type & PUBL_TYPE) { notify_body = get_p_notify_body(*pres_uri, event, 0, 0, 0, 0, - ¬ify_extra_hdrs, &free_fct); + ¬ify_extra_hdrs, &free_fct, 0); } s= subs_array; @@ -1801,7 +1821,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs) while(s) { LM_INFO("notify\n"); - if(notify(s, watcher_subs, notify_body, 0, NULL)< 0 ) + if(notify(s, watcher_subs, notify_body, 0, NULL, 0)< 0 ) { LM_ERR("Could not send notify for [event]=%.*s\n", event->name.len, event->name.s); @@ -1836,7 +1856,7 @@ int query_db_notify(str* pres_uri, pres_ev_t* event, subs_t* watcher_subs) } int send_notify_request(subs_t* subs, subs_t * watcher_subs, - str* n_body,int force_null_body, str* extra_hdrs) + str* n_body,int force_null_body, str* extra_hdrs, int from_publish) { dlg_t* td = NULL; str met = {"NOTIFY", 6}; @@ -1899,9 +1919,13 @@ int send_notify_request(subs_t* subs, subs_t * watcher_subs, } else { - notify_body = get_p_notify_body(subs->pres_uri, - subs->event, 0, 0, (subs->contact.s)?&subs->contact:NULL, - NULL, extra_hdrs?extra_hdrs:¬ify_extra_hdrs, &free_fct); + if (from_publish && n_body!= 0 && n_body->s!= 0) + notify_body = n_body; + else + notify_body = get_p_notify_body(subs->pres_uri, + subs->event, 0, 0, (subs->contact.s)?&subs->contact:NULL, + NULL, extra_hdrs?extra_hdrs:¬ify_extra_hdrs, + &free_fct, from_publish); if(notify_body == NULL || notify_body->s== NULL) { LM_DBG("Could not get the notify_body\n"); @@ -2058,7 +2082,7 @@ int send_notify_request(subs_t* subs, subs_t * watcher_subs, } -int notify(subs_t* subs, subs_t * watcher_subs, str* n_body, int force_null_body, str* extra_hdrs) +int notify(subs_t* subs, subs_t * watcher_subs, str* n_body, int force_null_body, str* extra_hdrs, int from_publish) { /* update first in hash table and the send Notify */ if(subs->expires!= 0 && subs->status != TERMINATED_STATUS) @@ -2086,7 +2110,7 @@ int notify(subs_t* subs, subs_t * watcher_subs, str* n_body, int force_null_body force_null_body = 1; } - if(send_notify_request(subs, watcher_subs, n_body, force_null_body, extra_hdrs)< 0) + if(send_notify_request(subs, watcher_subs, n_body, force_null_body, extra_hdrs, from_publish)< 0) { LM_ERR("sending Notify not successful\n"); return -1; diff --git a/modules/presence/notify.h b/modules/presence/notify.h index 5a76564fd3..6e908f8748 100644 --- a/modules/presence/notify.h +++ b/modules/presence/notify.h @@ -100,12 +100,12 @@ void printf_subs(subs_t* subs); int query_db_notify(str* pres_uri,pres_ev_t* event, subs_t* watcher_subs ); int publ_notify(presentity_t* p, str pres_uri, str* body, str* offline_etag, - str* rules_doc, str* dialog_publish); + str* rules_doc, str* dialog_publish, int from_publish); -int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body, str* extra_hdrs); +int notify(subs_t* subs, subs_t* watcher_subs, str* n_body,int force_null_body, str* extra_hdrs, int from_publish); int send_notify_request(subs_t* subs, subs_t * watcher_subs, - str* n_body,int force_null_body, str* extra_hdrs); + str* n_body,int force_null_body, str* extra_hdrs, int from_publish); char* get_status_str(int flag); void free_watcher_list(watcher_t* w); diff --git a/modules/presence/presence.c b/modules/presence/presence.c index 38c048448e..92615376b8 100644 --- a/modules/presence/presence.c +++ b/modules/presence/presence.c @@ -1186,7 +1186,7 @@ int update_watchers_status(str pres_uri, pres_ev_t* ev, str* rules_doc) while(s) { - if(notify(s, NULL, NULL, 0, NULL)< 0) + if(notify(s, NULL, NULL, 0, NULL, 0)< 0) { LM_ERR( "sending Notify request\n"); goto done; @@ -1276,7 +1276,7 @@ int refresh_send_winfo_notify(watcher_t* watchers, str pres_uri, goto error; } - if(notify(s, NULL, winfo_nbody, 0, NULL)< 0 ) + if(notify(s, NULL, winfo_nbody, 0, NULL, 0)< 0 ) { LM_ERR("Could not send notify for [event]=%.*s\n", s->event->name.len, s->event->name.s); diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c index 1417c68a6f..15d67f0da7 100644 --- a/modules/presence/presentity.c +++ b/modules/presence/presentity.c @@ -411,6 +411,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r str pres_uri= {NULL, 0}; pres_entry_t* p= NULL; unsigned int hash_code; + unsigned int turn; str body = presentity->body; str *extra_hdrs = presentity->extra_hdrs; db_res_t *result= NULL; @@ -462,6 +463,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r n_query_cols++; result_cols[0] = &str_etag_col; + hash_code= core_hash(&pres_uri, NULL, phtable_size); if(presentity->etag_new) { @@ -473,8 +475,9 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r *sent_reply= 1; /* insert new record in hash_table */ - if(insert_phtable(&pres_uri, presentity->event->evp->parsed, - &presentity->etag, presentity->sphere)< 0) + p = insert_phtable(&pres_uri, presentity->event->evp->parsed, + &presentity->etag, presentity->sphere, 1); + if (p==NULL) { LM_ERR("inserting record in hash table\n"); goto error; @@ -542,14 +545,28 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r } else { - hash_code= core_hash(&pres_uri, NULL, phtable_size); lock_get(&pres_htable[hash_code].lock); - p = search_phtable_etag(&pres_uri, presentity->event->evp->parsed, &presentity->etag, hash_code); + if (p) { + + turn = p->last_turn++; + LM_DBG("pres <%.*s> my turn is %d, current turn is %d\n",pres_uri.len, + pres_uri.s, turn, p->current_turn); + + /* wait to get our turn as order of handling pubishs + (need to wait the ongoing published to terminate + before starting */ + while (p && turn!=p->current_turn) { + lock_release(&pres_htable[hash_code].lock); + sleep_us(100); + lock_get(&pres_htable[hash_code].lock); + p = search_phtable_etag(&pres_uri, presentity->event->evp->parsed, + &presentity->etag, hash_code); + } + + } else { - if(!p) - { lock_release(&pres_htable[hash_code].lock); /* search also in db */ if (pa_dbf.use_table(pa_db, &presentity_table) < 0) @@ -580,7 +597,6 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r goto done; } - pa_dbf.free_result(pa_db, result); LM_INFO("*** found in db but not in htable [%.*s]\n", presentity->etag.len, presentity->etag.s); @@ -594,6 +610,8 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r { LM_ERR("deleting record from hash table failed\n"); } + /* presentity removed, pointer no longer valid */ + p = NULL; lock_release(&pres_htable[hash_code].lock); if(msg && publ_send200ok(msg,presentity->expires,presentity->etag)<0) @@ -604,7 +622,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r *sent_reply= 1; if(publ_notify(presentity, pres_uri, body.s ? &body : 0, - &presentity->etag, rules_doc, NULL) < 0) + &presentity->etag, rules_doc, NULL, 1) < 0) { LM_ERR("while sending notify\n"); goto error; @@ -626,7 +644,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r /* Send another NOTIFY, this time rely on whatever is on the DB, * so in case there are no documents an empty * NOTIFY will be sent to the watchers */ - if(publ_notify(presentity, pres_uri, NULL, NULL, rules_doc, NULL) < 0) + if(publ_notify(presentity, pres_uri, NULL, NULL, rules_doc, NULL, 1) < 0) { LM_ERR("while sending notify\n"); goto error; @@ -652,8 +670,9 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r else { lock_release(&pres_htable[hash_code].lock); - if(insert_phtable(&pres_uri, presentity->event->evp->parsed, - &presentity->etag, presentity->sphere)< 0) + p = insert_phtable(&pres_uri, presentity->event->evp->parsed, + &presentity->etag, presentity->sphere, 1); + if ( p==NULL ) { LM_ERR("inserting record in hash table\n"); goto error; @@ -775,7 +794,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r send_notify: if (publ_notify(presentity, pres_uri, body.s?&body:0, - NULL, rules_doc, NULL)<0) + NULL, rules_doc, NULL, 1)<0) { LM_ERR("while sending Notify requests to watchers\n"); goto error; @@ -795,7 +814,7 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r { /* send Notify for presence */ presentity->event = *pres_event_p; - if (publ_notify(presentity, pres_uri, 0, NULL, 0, dialog_body)<0) + if (publ_notify(presentity, pres_uri, 0, NULL, 0, dialog_body, 1)<0) { LM_ERR("while sending Notify requests to watchers\n"); if(dialog_body && dialog_body!=FAKED_BODY) @@ -814,6 +833,10 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r } done: + /* allow next publish to be handled */ + if (p) + next_turn_phtable( p, hash_code); + if (notify_body.s) xmlFree(notify_body.s); @@ -828,6 +851,10 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, int* sent_r return 0; error: + /* allow next publish to be handled */ + if (p) + next_turn_phtable( p, hash_code); + if(result) pa_dbf.free_result(pa_db, result); if(etag.s) @@ -982,7 +1009,7 @@ int pres_htable_restore(void) sphere= extract_sphere(body); } - if(insert_phtable(&uri, event, &etag, sphere)< 0) + if(insert_phtable(&uri, event, &etag, sphere, 0)== NULL) { LM_ERR("inserting record in presentity hash table"); pkg_free(uri.s); diff --git a/modules/presence/publish.c b/modules/presence/publish.c index 9b12f9bdde..56b905880f 100644 --- a/modules/presence/publish.c +++ b/modules/presence/publish.c @@ -259,7 +259,7 @@ void msg_presentity_clean(unsigned int ticks,void *param) LM_ERR("getting rules doc\n"); goto error; } - if(publ_notify( p[i].p, p[i].uri, NULL, &p[i].p->etag, rules_doc, NULL)< 0) + if(publ_notify( p[i].p, p[i].uri, NULL, &p[i].p->etag, rules_doc, NULL, 0)< 0) { LM_ERR("sending Notify request\n"); goto error; diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c index 84ee81e7e2..460f33774c 100644 --- a/modules/presence/subscribe.c +++ b/modules/presence/subscribe.c @@ -448,7 +448,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int init_req) } } LM_INFO("notify\n"); - if(notify(subs, NULL, NULL, 0 , NULL)< 0) + if(notify(subs, NULL, NULL, 0 , NULL, 0)< 0) { LM_ERR("Failed to send notify request\n"); goto error; @@ -1284,7 +1284,7 @@ int handle_expired_subs(subs_t* s) s->expires= 0; LM_INFO("notify\n"); - if(send_notify_request(s, NULL, NULL, 1, NULL)< 0) + if(send_notify_request(s, NULL, NULL, 1, NULL, 0)< 0) { LM_ERR("send Notify not successful\n"); return -1; @@ -1471,27 +1471,12 @@ void update_db_subs(db_con_t *db,db_func_t dbf, shtable_t hash_table, update_vals[u_version_col].nul = 0; n_update_cols++; - if(db== NULL) - { + if (db==NULL){ LM_ERR("null database connection\n"); return; } - LM_DBG("delete expired\n"); - update_vals[0].val.int_val= (int)time(NULL); - update_ops[0]= OP_LT; - CON_PS_REFERENCE(db) = &my_ps_delete; - if(dbf.use_table(db, &active_watchers_table) < 0) - { - LM_ERR("deleting expired information from database\n"); - } - - if(dbf.delete(db, update_cols, update_ops, update_vals, 1) < 0) - { - LM_ERR("deleting expired information from database\n"); - } - - for(i=0; is == NULL) { @@ -425,7 +425,7 @@ int callinfo_add_events(void) event.evs_publ_handl = callinfo_hdr_checker; /* register the dummy Call-Info header builder */ - event.build_empty_pres_info = build_callinfo_dumy_header; + event.build_empty_pres_info = build_callinfo_dummy_header; if (pres.add_event(&event) < 0) { LM_ERR("failed to add event \"call-info\"\n"); diff --git a/modules/presence_dialoginfo/notify_body.c b/modules/presence_dialoginfo/notify_body.c index b2aa2ac1f6..d29244473b 100644 --- a/modules/presence_dialoginfo/notify_body.c +++ b/modules/presence_dialoginfo/notify_body.c @@ -43,10 +43,12 @@ #include "notify_body.h" #include "pidf.h" -str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n); +str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, int partial); str* build_dialoginfo(str* pres_user, str* pres_domain); extern int force_single_dialog; +static str* _build_empty_dialoginfo(const char* pres_uri_char, str* extra_hdrs); + #define VERSION_HOLDER "00000000000" void free_xml_body(char* body) @@ -55,18 +57,39 @@ void free_xml_body(char* body) xmlFree(body); } +/* Joins user and domain into "sip:USER@DOMAIN". + * dst must fit at least MAX_URI_SIZE+1 characters! */ +static inline int sipuri_cat(char* dst, const str* user, const str* domain) { + if ((4 + user->len + 1 + domain->len) > MAX_URI_SIZE) { + LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); + return -1; + } + memcpy(dst, "sip:", 4); + memcpy(dst + 4, user->s, user->len); + dst[user->len + 4] = '@'; + memcpy(dst + user->len + 5, domain->s, domain->len); + dst[user->len + 5 + domain->len] = '\0'; + return 0; +} str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n, int off_index) { str* n_body= NULL; + char pres_uri_char[MAX_URI_SIZE+1]; - LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n", - pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n); + if (sipuri_cat(pres_uri_char, pres_user, pres_domain) != 0) + return NULL; + LM_DBG("[pres_uri] %s (%d), [n]=%d\n", pres_uri_char, + pres_user->len + 5 + pres_domain->len, n); + + if(body_array == NULL) + return _build_empty_dialoginfo(pres_uri_char, NULL); - if(body_array== NULL) - return build_dialoginfo(pres_user, pres_domain); + if (n == -2) + n_body= agregate_xmls(pres_user, pres_domain, body_array, 1, 1); + else + n_body= agregate_xmls(pres_user, pres_domain, body_array, n, 0); - n_body= agregate_xmls(pres_user, pres_domain, body_array, n); LM_DBG("[n_body]=%p\n", n_body); if(n_body) { LM_DBG("[*n_body]=%.*s\n", @@ -78,14 +101,14 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n } xmlCleanupParser(); - xmlMemoryDump(); + xmlMemoryDump(); if (n_body== NULL) - n_body= build_dialoginfo(pres_user, pres_domain); + n_body = _build_empty_dialoginfo(pres_uri_char, NULL); return n_body; } -str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) +str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n, int partial) { int i, j= 0; @@ -100,7 +123,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) int winner_priority = -1, priority ; xmlNodePtr winner_dialog_node = NULL ; str *body= NULL; - char buf[MAX_URI_SIZE+1]; + char buf[MAX_URI_SIZE+1]; LM_DBG("[pres_user]=%.*s [pres_domain]= %.*s, [n]=%d\n", pres_user->len, pres_user->s, pres_domain->len, pres_domain->s, n); @@ -146,14 +169,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) /* LM_DBG("number of bodies in total [n]=%d, number of useful bodies [j]=%d\n", n, j ); */ /* create the new NOTIFY body */ - if ( (pres_user->len + pres_domain->len + 1) > MAX_URI_SIZE) { - LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); - return NULL; - } - memcpy(buf, pres_user->s, pres_user->len); - buf[pres_user->len] = '@'; - memcpy(buf + pres_user->len + 1, pres_domain->s, pres_domain->len); - buf[pres_user->len + 1 + pres_domain->len]= '\0'; + if (sipuri_cat(buf, pres_user, pres_domain) != 0) + goto error; doc = xmlNewDoc(BAD_CAST "1.0"); if(doc==0) @@ -180,8 +197,11 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n) signed int) has max. 10 characters + 1 character for the sign */ xmlNewProp(root_node, BAD_CAST "version", BAD_CAST VERSION_HOLDER); - xmlNewProp(root_node, BAD_CAST "state", BAD_CAST "partial" ); xmlNewProp(root_node, BAD_CAST "entity", BAD_CAST buf); + if (!partial) + xmlNewProp(root_node, BAD_CAST "state", BAD_CAST "full" ); + else + xmlNewProp(root_node, BAD_CAST "state", BAD_CAST "partial" ); /* loop over all bodies and create the aggregated body */ for(i=0; ilen + pres_domain->len + 1) > MAX_URI_SIZE) { - LM_ERR("entity URI too long, maximum=%d\n", MAX_URI_SIZE); - return NULL; - } - memcpy(buf, "sip:", 4); - memcpy(buf+4, pres_user->s, pres_user->len); - buf[pres_user->len+4] = '@'; - memcpy(buf + pres_user->len + 5, pres_domain->s, pres_domain->len); - buf[pres_user->len + 5 + pres_domain->len]= '\0'; - - pres_uri = (str*)pkg_malloc(sizeof(str)); - if(pres_uri == NULL) - { - LM_ERR("while allocating memory\n"); + if (sipuri_cat(buf, pres_user, pres_domain) != 0) return NULL; - } - memset(pres_uri, 0, sizeof(str)); - pres_uri->s = buf; - pres_uri->len = pres_user->len + 5 + pres_domain->len; + pres_uri.s = buf; + pres_uri.len = 4 + pres_user->len + 1 + pres_domain->len; + LM_DBG("[pres_uri] %.*s\n", pres_uri.len, pres_uri.s); - LM_DBG("[pres_uri] %.*s\n", pres_uri->len, pres_uri->s); - - if ( pres_contains_presence(pres_uri)<0 ) { + if (pres_contains_presence(&pres_uri) < 0) { LM_DBG("No record exists in hash_table\n"); goto error; } - /* create the Publish body */ + /* create the Publish body */ doc = xmlNewDoc(BAD_CAST "1.0"); if(doc==0) goto error; @@ -394,8 +398,10 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) LM_ERR("while adding child [dialog]\n"); goto error; } + + /* reuse buf for user-part only */ memcpy(buf, pres_user->s, pres_user->len); - buf[pres_user->len]= '\0'; + buf[pres_user->len] = '\0'; xmlNewProp(dialog_node, BAD_CAST "id", BAD_CAST buf); @@ -423,10 +429,6 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) xmlCleanupParser(); return body; error: - if ( pres_uri ) - { - pkg_free(pres_uri); - } if(body) { if(body->s) @@ -438,12 +440,11 @@ str* build_dialoginfo(str* pres_user, str* pres_domain) return NULL; } -str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) +static str* _build_empty_dialoginfo(const char* pres_uri_char, str* extra_hdrs) { str* nbody= 0; xmlDocPtr doc = NULL; xmlNodePtr node; - char* pres_uri_char = NULL; nbody= (str*) pkg_malloc(sizeof(str)); if(nbody== NULL) @@ -471,16 +472,7 @@ str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) xmlNewProp(node, BAD_CAST "version", BAD_CAST VERSION_HOLDER); xmlNewProp(node, BAD_CAST "state", BAD_CAST "full"); - pres_uri_char = (char*)pkg_malloc(pres_uri->len + 1); - if(pres_uri_char == NULL) - { - LM_ERR("No more memory\n"); - goto error; - } - memcpy(pres_uri_char, pres_uri->s, pres_uri->len); - pres_uri_char[pres_uri->len] = '\0'; xmlNewProp(node, BAD_CAST "entity", BAD_CAST pres_uri_char); - pkg_free(pres_uri_char); xmlDocDumpMemory(doc,(xmlChar**)(void*)&nbody->s, &nbody->len); @@ -498,3 +490,24 @@ str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) return 0; } +str* build_empty_dialoginfo(str* pres_uri, str* extra_hdrs) +{ + char* pres_uri_char; + str* ret; + + pres_uri_char = (char*)pkg_malloc(pres_uri->len + 1); + if(pres_uri_char == NULL) + { + LM_ERR("No more memory\n"); + return NULL; + } + memcpy(pres_uri_char, pres_uri->s, pres_uri->len); + pres_uri_char[pres_uri->len] = '\0'; + + /* do the call with a null-terminated pres_uri */ + ret = _build_empty_dialoginfo(pres_uri_char, extra_hdrs); + + pkg_free(pres_uri_char); + + return ret; +} diff --git a/modules/presence_xcapdiff/README b/modules/presence_xcapdiff/README index 52e5d23e4c..62fc67da7a 100644 --- a/modules/presence_xcapdiff/README +++ b/modules/presence_xcapdiff/README @@ -12,8 +12,7 @@ Denis Bilenko Copyright © 2008 AG Projects Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 (Tue, 21 - Jul 2009) $ + Revision $Revision$ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/pua/README b/modules/pua/README index 01c7c0409c..3c8b17a162 100644 --- a/modules/pua/README +++ b/modules/pua/README @@ -15,7 +15,7 @@ Saul Ibarra Corretge Copyright © 2006 Voice Sistem SRL Revision History Revision $Revision$ $Date: 2012-10-22 13:41:25 +0200 - (Mon, 22 Oct 2012) $ + (Mon, 22 Oct 2012) __________________________________________________________ Table of Contents @@ -147,7 +147,7 @@ modparam("pua", "db_table", "pua") The inferior expires limit for both Publish and Subscribe. - Default value is “0”. + Default value is “300”. Example 1.4. Set min_expires parameter ... diff --git a/modules/pua/doc/pua_admin.xml b/modules/pua/doc/pua_admin.xml index 7b4e159ef3..10b90fb2c9 100644 --- a/modules/pua/doc/pua_admin.xml +++ b/modules/pua/doc/pua_admin.xml @@ -130,7 +130,7 @@ modparam("pua", "db_table", "pua") The inferior expires limit for both Publish and Subscribe. - Default value is 0. + Default value is 300. diff --git a/modules/pua/hash.c b/modules/pua/hash.c index c54ef527d9..0fda19bfea 100644 --- a/modules/pua/hash.c +++ b/modules/pua/hash.c @@ -504,13 +504,11 @@ void free_htable_entry(ua_pres_t* p) pua_db_delete(p); if(p->etag.s) - { shm_free(p->etag.s); - } - else if(p->remote_contact.s) shm_free(p->remote_contact.s); - if(p->extra_headers.s) shm_free(p->extra_headers.s); + if(p->extra_headers.s) + shm_free(p->extra_headers.s); shm_free(p); } @@ -789,8 +787,6 @@ int update_contact(struct sip_msg* msg, char* str1, char* str2) return -1; } - shm_free(p->remote_contact.s); - if(!(p->remote_contact.len== contact.len && strncmp(p->remote_contact.s, contact.s, contact.len)==0)) { diff --git a/modules/pua/pua.c b/modules/pua/pua.c index 93e0182f41..f03449e2cb 100644 --- a/modules/pua/pua.c +++ b/modules/pua/pua.c @@ -98,7 +98,7 @@ static int mod_init(void); static int child_init(int); static void destroy(void); -static int update_pua(ua_pres_t* p, unsigned int hash_code); +static int update_pua(ua_pres_t* p, unsigned int hash_code, unsigned int final); static int db_restore(void); static void db_update(unsigned int ticks,void *param); @@ -620,7 +620,7 @@ static void hashT_clean(unsigned int ticks,void *param) "refresh PUBLISH desired_expires=%d - expires=%d\n", p->desired_expires, p->expires); - if(update_pua(p, i)< 0) + if(update_pua(p, i, 0)< 0) { LM_ERR("while updating record\n"); lock_release(&HashT->p_records[i].lock); @@ -632,6 +632,10 @@ static void hashT_clean(unsigned int ticks,void *param) LM_DBG("Found expired: uri= %.*s\n", p->pres_uri->len, p->pres_uri->s); + if(update_pua(p, i, 1)< 0) + { + LM_ERR("while updating record\n"); + } /* delete it */ q = p->next; delete_htable_safe(p, p->hash_index); @@ -644,20 +648,27 @@ static void hashT_clean(unsigned int ticks,void *param) } } -int update_pua(ua_pres_t* p, unsigned int hash_code) +int update_pua(ua_pres_t* p, unsigned int hash_code, unsigned int final) { str* str_hdr= NULL; int expires; int result; - - if(p->desired_expires== 0) - expires= 3600; - else - expires= p->desired_expires- (int)time(NULL); - if(expires < min_expires) - expires = min_expires; + if(final > 0) + { + expires= 0; + p->desired_expires= 0; + } + else + { + if(p->desired_expires== 0) + expires= 3600; + else + expires= p->desired_expires- (int)time(NULL); + if(expires < min_expires) + expires = min_expires; + } if(p->watcher_uri== NULL) { str met= {"PUBLISH", 7}; @@ -678,7 +689,7 @@ int update_pua(ua_pres_t* p, unsigned int hash_code) LM_ERR("while building extra_headers\n"); goto error; } - LM_DBG("str_hdr:\n%.*s\n ", str_hdr->len, str_hdr->s); + LM_DBG("str_hdr:\n%.*s expires:%d\n ", str_hdr->len, str_hdr->s, expires); cb_param = PRES_HASH_ID(p); diff --git a/modules/pua/send_publish.c b/modules/pua/send_publish.c index 831fc1605a..42cde5b83a 100644 --- a/modules/pua/send_publish.c +++ b/modules/pua/send_publish.c @@ -409,6 +409,7 @@ int send_publish_int(ua_pres_t* presentity, publ_info_t* publ, pua_event_t* ev, memcpy(tuple_id.s, presentity->tuple_id.s, presentity->tuple_id.len); tuple_id.len = presentity->tuple_id.len; } + presentity->desired_expires= publ->expires + (int)time(NULL); presentity->waiting_reply = 1; presentity->cb_param = publ->cb_param; @@ -568,7 +569,8 @@ int send_publish( publ_info_t* publ ) publ->extra_headers->len); presentity->extra_headers.len= publ->extra_headers->len; } - presentity->db_flag= UPDATEDB_FLAG; + if(presentity->db_flag == NO_UPDATEDB_FLAG) + presentity->db_flag= UPDATEDB_FLAG; if (presentity->waiting_reply) { LM_DBG("Presentity is waiting for reply, queue this PUBLISH\n"); diff --git a/modules/pua/send_subscribe.c b/modules/pua/send_subscribe.c index a886ccfba3..5696e91633 100644 --- a/modules/pua/send_subscribe.c +++ b/modules/pua/send_subscribe.c @@ -525,7 +525,8 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) presentity->extra_headers.s= (char*)shm_malloc(hentity->extra_headers.len* sizeof(char)); if(presentity->extra_headers.s== NULL) { - ERR_MEM(SHARE_MEM); + LM_ERR("no more share memory\n"); + goto mem_error; } memcpy(presentity->extra_headers.s, hentity->extra_headers.s, hentity->extra_headers.len); presentity->extra_headers.len= hentity->extra_headers.len; @@ -535,7 +536,8 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) presentity->remote_contact.s= (char*)shm_malloc(contact.len* sizeof(char)); if(presentity->remote_contact.s== NULL) { - ERR_MEM(SHARE_MEM); + LM_ERR("no more share memory\n"); + goto mem_error; } memcpy(presentity->remote_contact.s, contact.s, contact.len); presentity->remote_contact.len= contact.len; @@ -561,15 +563,22 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps) hentity->flag= flag; run_pua_callbacks( hentity, msg); } + error: - if(hentity) - { - if(presentity->extra_headers.s) shm_free(presentity->extra_headers.s); - if(presentity->remote_contact.s) shm_free(presentity->remote_contact.s); - shm_free(hentity); - hentity= NULL; - } + if(hentity->extra_headers.s) + shm_free(hentity->extra_headers.s); + shm_free(hentity); return; + +mem_error: + if(presentity->extra_headers.s) + shm_free(presentity->extra_headers.s); + if(presentity->remote_contact.s) + shm_free(presentity->remote_contact.s); + shm_free(presentity); + if(hentity->extra_headers.s) + shm_free(hentity->extra_headers.s); + shm_free(hentity); } ua_pres_t* subscribe_cbparam(subs_info_t* subs, int ua_flag) @@ -880,6 +889,8 @@ int send_subscribe(subs_info_t* subs) if(result< 0) { LM_ERR("while sending request with t_request\n"); + if (hentity->extra_headers.s) + shm_free(hentity->extra_headers.s); shm_free(hentity); goto done; } diff --git a/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml b/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml index e847fb8332..cfaeafafc0 100644 --- a/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml +++ b/modules/pua_dialoginfo/doc/pua_dialoginfo_admin.xml @@ -73,10 +73,10 @@ - The dialog element can contain optional "local" and "remote" elements which - describes the local and the remote party in more detail, for example: + The dialog element can contain optional "local" and "remote" elements which + describes the local and the remote party in more detail, for example: - + - The local and remote elements are needed to implement call pickup. For example if + The local and remote elements are needed to implement call pickup. For example if the above XML document is received by somebody who SUBSCRIBEd the dialog-info of Alice, then it can pick-up the call by sending an INVITE to Bob (actually I am not sure if it should use the URI in the identity element or the URI in the target @@ -293,6 +293,51 @@ modparam("pua_dialoginfo", "caller_confirmed", 1)
+
+ <varname>publish_on_trying</varname> (int) + + Usually the dialog-info of the caller will be + "trying -> early -> confirmed". "trying" will be triggered as soon + as you call dialoginfo_set on the caller, while "early" is triggered + as soon as the callee is ringing. + Sometimes, it is advisable to be notified only when the callee reaches + the early state and not before. In other cases, it is advisable to + notify the early state. This setting allows controlling the behavior. + + + Default value is 0. + + + Set <varname>publish_on_trying</varname> parameter + +... +modparam("pua_dialoginfo", "publish_on_trying", 1) +... + + +
+ +
+ <varname>nopublish_flag</varname> (int) + + By default, reINVITEs will trigger a PUBLISH. They are actually + the only in-dialog request for which it makes sense. + In some cases, it does not make sense to republish a dialog state. + (e.g. when handling a B2BUA reINVITE). + This setting defines the flag that needs to be set in the request + route to prevent the generation of a PUBLISH request in case of a + specific reINVITE. + + + Set <varname>nopublish_flag</varname> parameter + +... +modparam("pua_dialoginfo", "nopublish_flag", 5) +... + + +
+
<varname>presence_server</varname> (string) diff --git a/modules/pua_dialoginfo/pua_dialoginfo.c b/modules/pua_dialoginfo/pua_dialoginfo.c index 8647da4979..ee21f5d1d3 100644 --- a/modules/pua_dialoginfo/pua_dialoginfo.c +++ b/modules/pua_dialoginfo/pua_dialoginfo.c @@ -88,7 +88,7 @@ static pv_spec_t caller_spec; static pv_spec_t callee_spec; static int osips_ps = 1; static int publish_on_trying = 0; -static int publish_on_reinvite = 0; +static int nopublish_flag = -1; /** module functions */ @@ -110,12 +110,12 @@ static param_export_t params[]={ {"include_localremote", INT_PARAM, &include_localremote }, {"include_tags", INT_PARAM, &include_tags }, {"caller_confirmed", INT_PARAM, &caller_confirmed }, - {"publish_on_reinvite", INT_PARAM, &publish_on_reinvite }, {"publish_on_trying", INT_PARAM, &publish_on_trying }, {"presence_server", STR_PARAM, &presence_server.s }, {"caller_spec_param", STR_PARAM, &caller_spec_param.s }, {"callee_spec_param", STR_PARAM, &callee_spec_param.s }, {"osips_ps", INT_PARAM, &osips_ps }, + {"nopublish_flag", INT_PARAM, &nopublish_flag }, {0, 0, 0 } }; @@ -245,6 +245,7 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para struct to_body peer_to_body; str entity_uri= {0, 0}; int buf_len = 255; + struct sip_msg* msg = _params->msg; flag_str.s = &flag; flag_str.len = 1; @@ -312,7 +313,17 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para if(flag == DLG_PUB_AB || flag == DLG_PUB_B) dialog_publish("terminated", &peer_to_body, &from, &(dlg->callid), 0, 0, 0, 0); break; - case DLGCB_REQ_WITHIN: + case DLGCB_RESPONSE_WITHIN: + if (get_cseq(msg)->method_id==METHOD_INVITE) { + if (msg->flags & nopublish_flag) { + LM_DBG("nopublish flag was set for this INVITE\n"); + break; + } + LM_DBG("nopublish flag not set for this INVITE, will publish\n"); + } else { + /* no publish for non-INVITEs */ + break; + } case DLGCB_CONFIRMED: LM_DBG("dialog confirmed, from=%.*s\n", dlg->from_uri.len, dlg->from_uri.s); if(flag == DLG_PUB_AB || flag == DLG_PUB_A) @@ -392,24 +403,16 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para static void __dialog_loaded(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) { - /* register dialog callbacks which triggers sending PUBLISH */ - if (publish_on_reinvite) { - if (dlg_api.register_dlgcb(dlg, - DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | - DLGCB_REQ_WITHIN | DLGCB_EARLY, - __dialog_sendpublish, 0, 0) != 0) { - LM_ERR("cannot register callback for interesting dialog types\n"); - } - } - else { - if (dlg_api.register_dlgcb(dlg, - DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | - DLGCB_EARLY, - __dialog_sendpublish, 0, 0) != 0) { - LM_ERR("cannot register callback for interesting dialog types\n"); - } - } - LM_ERR("ici: LOADED DB CB\n"); + str peer_uri= {0, 0}; + if(dlg_api.fetch_dlg_value(dlg, &peer_dlg_var, &peer_uri, 1)==0 && peer_uri.len!=0) { + /* register dialog callbacks which triggers sending PUBLISH */ + if (dlg_api.register_dlgcb(dlg, + DLGCB_FAILED| DLGCB_CONFIRMED | DLGCB_TERMINATED | DLGCB_EXPIRED | + DLGCB_RESPONSE_WITHIN | DLGCB_EARLY, + __dialog_sendpublish, 0, 0) != 0) { + LM_ERR("cannot register callback for interesting dialog types\n"); + } + } } @@ -498,6 +501,12 @@ static int mod_init(void) } pua_send_publish= pua.send_publish; + if (nopublish_flag!= -1 && nopublish_flag > MAX_FLAG) { + LM_ERR("invalid nopublish flag %d!!\n", nopublish_flag); + return -1; + } + nopublish_flag = (nopublish_flag!=-1)?(1<cb_param== NULL) + if(reply== NULL || hentity== NULL) { LM_ERR("NULL parameter\n"); return -1; } + if(hentity->cb_param== NULL) + { + LM_DBG("NULL callback parameter, probably a refresh\n"); + return -1; + } if(reply== FAKED_REPLY) { statuscode= 408; diff --git a/modules/qos/README b/modules/qos/README index 19a2c656f0..1e7a2583c6 100644 --- a/modules/qos/README +++ b/modules/qos/README @@ -10,8 +10,7 @@ Ovidiu Sas Copyright © 2008 SOMA Networks, Inc. Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/ratelimit/README b/modules/ratelimit/README index cf1f19c3bc..ad7e03f1c4 100644 --- a/modules/ratelimit/README +++ b/modules/ratelimit/README @@ -30,8 +30,7 @@ Razvan Crainea Copyright © 2011 OpenSIPS Foundation Revision History - Revision $Revision: 5901 $ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/ratelimit/ratelimit_helper.c b/modules/ratelimit/ratelimit_helper.c index 6151e7d99f..6a69e65436 100644 --- a/modules/ratelimit/ratelimit_helper.c +++ b/modules/ratelimit/ratelimit_helper.c @@ -105,17 +105,31 @@ static inline int rl_set_name(str * name) static int rl_change_counter(str *name, rl_pipe_t *pipe, int c) { int new_counter; + int ret; if (rl_set_name(name) < 0) return -1; - if (pipe->my_counter + c <= 0) { + if (pipe->my_counter + c < 0) { LM_DBG("Counter going negative\n"); return 1; } - if (cdbf.add(cdbc, &rl_name_buffer, c ? c : -(pipe->my_counter), - rl_expire_time, &new_counter) < 0){ + if (c) { + if (c < 0) + ret = cdbf.sub(cdbc, &rl_name_buffer, -c, rl_expire_time, &new_counter); + else + ret = cdbf.add(cdbc, &rl_name_buffer, c, rl_expire_time, &new_counter); + } else { + if (pipe->my_counter) { + ret = cdbf.sub(cdbc, &rl_name_buffer, pipe->my_counter, rl_expire_time, + &new_counter); + } else { + ret = cdbf.get_counter(cdbc, &rl_name_buffer, &new_counter); + } + } + + if (ret < 0) { LM_ERR("cannot change counter for pipe %.*s with %d\n", name->len, name->s, c); return -1; @@ -413,6 +427,7 @@ void rl_timer(unsigned int ticks, void *param) map_iterator_t it, del; rl_pipe_t **pipe; str *key; + void *value; unsigned long now = time(0); /* get CPU load */ @@ -455,10 +470,8 @@ void rl_timer(unsigned int ticks, void *param) if ((*pipe)->last_used + rl_expire_time < now) { /* this pipe is engaged in a transaction */ del = it; - if (iterator_prev(&it) < 0) { - LM_DBG("cannot find previous iterator\n"); - goto next_pipe; - } + if (iterator_next(&it) < 0) + LM_DBG("cannot find next iterator\n"); if ((*pipe)->algo == PIPE_ALGO_NETWORK) { lock_get(rl_lock); (*rl_network_count)--; @@ -466,17 +479,16 @@ void rl_timer(unsigned int ticks, void *param) } LM_DBG("Deleting ratelimit pipe key \"%.*s\"\n", key->len, key->s); - if (*pipe != iterator_delete(&del)) { - LM_ERR("error while deleting key\n"); - } + value = iterator_delete(&del); /* free resources */ - shm_free(*pipe); + if (value) + shm_free(value); + continue; } else { /* leave the lock if a cachedb query should be done*/ if (RL_USE_CDB(*pipe)) { if (rl_get_counter(key, *pipe) < 0) { LM_ERR("cannot get pipe counter\n"); - RL_GET_LOCK(i); goto next_pipe; } } @@ -499,7 +511,6 @@ void rl_timer(unsigned int ticks, void *param) if (RL_USE_CDB(*pipe)) { if (rl_change_counter(key, *pipe, 0) < 0) { LM_ERR("cannot reset counter\n"); - RL_GET_LOCK(i); } } else { (*pipe)->counter = 0; diff --git a/modules/registrar/lookup.c b/modules/registrar/lookup.c index d67c71f6ab..18c88ac002 100644 --- a/modules/registrar/lookup.c +++ b/modules/registrar/lookup.c @@ -291,6 +291,7 @@ int registered(struct sip_msg* _m, char* _t, char* _s, char *_c) pv_value_t val; str callid; int res; + int_str istr; /* get the AOR */ if (_s) { @@ -351,6 +352,15 @@ int registered(struct sip_msg* _m, char* _t, char* _s, char *_c) for( ; ptr ; ptr=ptr->next ) { if (callid.len==0 || (callid.len==ptr->callid.len && memcmp(callid.s,ptr->callid.s,callid.len)==0 ) ) { + + /* also populate the 'attributes' avp */ + if (attr_avp_name != -1) { + istr.s = ptr->attr; + + if (add_avp_last(AVP_VAL_STR, attr_avp_name, istr) != 0) + LM_ERR("Failed to populate attr avp!\n"); + } + ul.unlock_udomain((udomain_t*)_t, &aor); LM_DBG("'%.*s' found in usrloc\n", aor.len, ZSW(aor.s)); return 1; diff --git a/modules/registrar/save.c b/modules/registrar/save.c index 4e30f0d4fa..f58baa7707 100644 --- a/modules/registrar/save.c +++ b/modules/registrar/save.c @@ -749,6 +749,8 @@ int save_aux(struct sip_msg* _m, str* forced_binding, char* _d, char* _f, char* sctx.max_contacts = -1; sctx.flags = 0; + sctx.min_expires = min_expires; + sctx.max_expires = max_expires; if ( _f ) { if (fixup_get_svalue( _m, (gparam_p)_f, &flags_s)!=0) { LM_ERR("invalid flags parameter"); diff --git a/modules/rest_client/rest_client.c b/modules/rest_client/rest_client.c index 2c44575f43..a5bc36ab32 100644 --- a/modules/rest_client/rest_client.c +++ b/modules/rest_client/rest_client.c @@ -69,17 +69,23 @@ static int w_rest_post(struct sip_msg *msg, char *gp_url, char *gp_body, */ static cmd_export_t cmds[] = { { "rest_get",(cmd_function)w_rest_get, 2, fixup_rest_get, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, { "rest_get",(cmd_function)w_rest_get, 3, fixup_rest_get, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, { "rest_get",(cmd_function)w_rest_get, 4, fixup_rest_get, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, - { "rest_post",(cmd_function)w_rest_post, 4, fixup_rest_post, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, - { "rest_post",(cmd_function)w_rest_post, 5, fixup_rest_post, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, - { "rest_post",(cmd_function)w_rest_post, 6, fixup_rest_post, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + { "rest_post",(cmd_function)w_rest_post, 4, fixup_rest_post, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + { "rest_post",(cmd_function)w_rest_post, 5, fixup_rest_post, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, + { "rest_post",(cmd_function)w_rest_post, 6, fixup_rest_post, 0, + REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE| + ONREPLY_ROUTE|STARTUP_ROUTE|TIMER_ROUTE }, { 0, 0, 0, 0, 0, 0 } }; diff --git a/modules/rr/README b/modules/rr/README index a65edadef7..a390c95246 100644 --- a/modules/rr/README +++ b/modules/rr/README @@ -88,8 +88,8 @@ Chapter 1. Admin Guide OpenSIPS is basically only a transaction statefull proxy, without any dialog support build in. There are many - features/services which actually requires a dialog awareness, - like storing the information in the dialog creation stage, + features/services which actually require dialog awareness, like + storing the information in the dialog creation stage, information which will be used during the whole dialog existence. diff --git a/modules/rr/doc/rr_admin.xml b/modules/rr/doc/rr_admin.xml index 8e0654f6ac..77c0526308 100644 --- a/modules/rr/doc/rr_admin.xml +++ b/modules/rr/doc/rr_admin.xml @@ -14,7 +14,7 @@ Dialog support &osips; is basically only a transaction statefull proxy, without any dialog support build in. There are many features/services - which actually requires a dialog awareness, like storing the information in + which actually require dialog awareness, like storing the information in the dialog creation stage, information which will be used during the whole dialog existence. diff --git a/modules/rtpproxy/doc/rtpproxy_admin.xml b/modules/rtpproxy/doc/rtpproxy_admin.xml index 731a0f93c5..27b66b0d37 100644 --- a/modules/rtpproxy/doc/rtpproxy_admin.xml +++ b/modules/rtpproxy/doc/rtpproxy_admin.xml @@ -501,7 +501,7 @@ xlog("Used rtpproxy $avp(rtp_sock) for callid $ci"); This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, - BRANCH_ROUTE. + BRANCH_ROUTE, FAILURE_ROUTE and LOCAL_ROUTE. <function>fix_nated_contact</function> usage diff --git a/modules/signaling/README b/modules/signaling/README index ac9f562651..5ea5c72d35 100644 --- a/modules/signaling/README +++ b/modules/signaling/README @@ -8,8 +8,7 @@ Anca-Maria Vamanu Copyright © 2008 FhG FOKUS Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sipmsgops/README b/modules/sipmsgops/README index a21e395632..c86d420fa2 100644 --- a/modules/sipmsgops/README +++ b/modules/sipmsgops/README @@ -31,8 +31,7 @@ Razvan Crainea Copyright © 2003 FhG FOKUS Revision History - Revision $Revision: 7480 $ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 7480 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sipmsgops/codecs.c b/modules/sipmsgops/codecs.c index e502140192..ac6b14f948 100644 --- a/modules/sipmsgops/codecs.c +++ b/modules/sipmsgops/codecs.c @@ -561,6 +561,15 @@ static int stream_process(struct sip_msg * msg, struct sdp_stream_cell *cell, found.len++; } + /* when trimming the very last payload, avoid trailing ws */ + if (cur == lmp->u.value + lmp->len) { + tmp = found.s; + while (*(--tmp) == ' ') { + found.s--; + found.len++; + } + } + /* delete the string and update iterators */ for(tmp=found.s ; tmp< lmp->u.value + lmp->len ; tmp++ ) *tmp = *(tmp+found.len); diff --git a/modules/sipmsgops/sipmsgops.c b/modules/sipmsgops/sipmsgops.c index a704b5f4cb..8ac5b00002 100644 --- a/modules/sipmsgops/sipmsgops.c +++ b/modules/sipmsgops/sipmsgops.c @@ -1864,6 +1864,10 @@ static int w_sip_validate(struct sip_msg *msg, char *flags_s, char* pv_result) } } + /* set reason to empty (covers cases where we + * exit via CHECK_HEADER) */ + reason[0] = 0; + /* Cseq */ ret = SV_NO_CSEQ; CHECK_HEADER("", cseq); @@ -1898,9 +1902,10 @@ static int w_sip_validate(struct sip_msg *msg, char *flags_s, char* pv_result) } } /* Max-Forwards */ - if (!(flags & SIP_PARSE_NOMF)) + if (!(flags & SIP_PARSE_NOMF)) { ret = SV_NO_MF; CHECK_HEADER("", maxforwards); + } if (msg->REQ_METHOD == METHOD_INVITE) { ret = SV_NO_CONTACT; diff --git a/modules/siptrace/README b/modules/siptrace/README index c41139d64a..803417ce7a 100644 --- a/modules/siptrace/README +++ b/modules/siptrace/README @@ -12,8 +12,7 @@ Daniel-Constantin Mierla Copyright © 2006 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/siptrace/siptrace.c b/modules/siptrace/siptrace.c index b1274f640a..22d16dc5c4 100644 --- a/modules/siptrace/siptrace.c +++ b/modules/siptrace/siptrace.c @@ -44,6 +44,7 @@ #include "../dialog/dlg_load.h" #include "../sl/sl_cb.h" #include "../../str.h" +#include "../../script_cb.h" #include "../sipcapture/sipcapture.h" @@ -100,6 +101,10 @@ static struct mi_root* trace_to_database_mi(struct mi_root* cmd, void* param ); static int trace_send_hep_duplicate(str *body, str *fromip, str *toip); static int pipport2su (str *pipport, union sockaddr_union *tmp_su, unsigned int *proto); +static int do_dlg_siptrace = 0; +static void siptrace_dlg_created(struct dlg_cell *did, int type,struct dlg_cb_params * params); +static int siptrace_cleanup( struct sip_msg *msg, void *param ); +static void siptrace_dlg_cancel(struct cell* t, int type, struct tmcb_params *param); static str db_url = {NULL, 0}; static str siptrace_table = str_init("sip_trace"); @@ -241,6 +246,16 @@ static int fixup_trace_dialog(void** param, int param_no) return -1; } + if (dlgb.register_dlgcb(NULL, DLGCB_CREATED, siptrace_dlg_created, NULL, NULL) < 0) { + LM_ERR("Failed to register dialog created callback \n"); + return -1; + } + + if (register_script_cb( siptrace_cleanup, POST_SCRIPT_CB|REQ_TYPE_CB,0)<0) { + LM_ERR("Failed to register postcript cleanup cb\n"); + return -1; + } + return 0; } @@ -605,7 +620,7 @@ static str* generate_val_name(unsigned char n) static void trace_transaction(struct dlg_cell* dlg, int type, - struct dlg_cb_params * params) + struct dlg_cb_params * params) { unsigned char n; static int_str avp_value; @@ -716,9 +731,48 @@ static int trace_dialog(struct sip_msg *msg) /* trace current request */ sip_trace(msg); + do_dlg_siptrace=1; return 1; } +static int siptrace_cleanup( struct sip_msg *msg, void *param ) +{ + do_dlg_siptrace=0; + return 0; +} + +static void siptrace_dlg_created(struct dlg_cell *did, int type, + struct dlg_cb_params * params) +{ + struct sip_msg *req; + struct cell *t; + + if (do_dlg_siptrace == 1) { + req = params->msg; + t = tmb.t_gett(); + + // we also want to catch the incoming cancel + if ( tmb.register_tmcb( req, t,TMCB_TRANS_CANCELLED, + siptrace_dlg_cancel, NULL, NULL)<0 ) { + LM_ERR("failed to register trans cancelled TMCB\n"); + return; + } + } +} + +static void siptrace_dlg_cancel(struct cell* t, int type, struct tmcb_params *param) +{ + struct sip_msg *req; + req = param->req; + + LM_DBG("Tracing incoming cancel due to trace_dialog() \n"); + + /* set the flag */ + req->flags |= trace_flag; + req->msg_flags |= FL_USE_SIPTRACE; + /* trace current request */ + sip_trace(req); +} static inline int siptrace_copy_proto(int proto, char *buf) { diff --git a/modules/sl/README b/modules/sl/README index 77ce4a950f..40e9957e96 100644 --- a/modules/sl/README +++ b/modules/sl/README @@ -8,8 +8,7 @@ Bogdan Iancu Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sms/README b/modules/sms/README index 296e143205..9e4c166aee 100644 --- a/modules/sms/README +++ b/modules/sms/README @@ -8,8 +8,7 @@ Bogdan-Andrei Iancu Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/speeddial/README b/modules/speeddial/README index 8fe4f801e7..6779d63078 100644 --- a/modules/speeddial/README +++ b/modules/speeddial/README @@ -12,8 +12,7 @@ Elena-Ramona Modroiu Copyright © 2004 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sst/README b/modules/sst/README index 54fde80847..1cacf8d67c 100644 --- a/modules/sst/README +++ b/modules/sst/README @@ -10,8 +10,7 @@ Ron Winacott Copyright © 2006 SOMA Networks, Inc. Revision History - Revision $Revision$ $Date: 2009-07-21 10:45:05 +0300 - (Tue, 21 Jul 2009) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/sst/sst_handlers.c b/modules/sst/sst_handlers.c index 84bf0f5680..4d551b56d3 100644 --- a/modules/sst/sst_handlers.c +++ b/modules/sst/sst_handlers.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: sst_handlers.c 7046 2010-07-22 14:07:23Z bogdan_iancu $ * * Copyright (C) 2006 SOMA Networks, Inc. * Written by Ron Winacott (karwin) @@ -342,7 +342,8 @@ void sst_dialog_created_CB(struct dlg_cell *did, int type, } } setup_dialog_callbacks(did, info); - set_timeout_avp(msg, info->interval); + /* Early setup of default timeout */ + set_timeout_avp(msg, info->interval); return; } @@ -432,28 +433,26 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type, // FIXME: need an error message here return; } - /* Early resetting of the value here */ + /* Early resetting of the value here */ if (minfo.se > 0) { if (sst_interval > minfo.min_se) - info->interval = sst_interval; + info->interval = sst_interval; else info->interval = MAX(minfo.se, sst_min_se); } info->supported = (minfo.supported?SST_UAC:SST_UNDF); - set_timeout_avp(msg, info->interval); - } else if (msg->first_line.u.request.method_value == METHOD_PRACK) { + set_timeout_avp(msg, info->interval); + } + else if (msg->first_line.u.request.method_value == METHOD_PRACK + || msg->first_line.u.request.method_value == METHOD_ACK) { /* Special case here. The PRACK will cause the dialog * module to reset the timeout value to the ldg->lifetime * value and look for the new AVP value bound to the * 1XX/PRACK/200OK/ACK transaction and not to the * INVITE/200OK avp value. So we need to set the AVP - * again! I think this is a bug in the dialog module, - * either it should ignore PRACK like it ignored ACK, or - * the setting of the timeout value when returning to the - * confiremed callback code should look for the new AVP - * value, which is does not. + * again! */ - LM_DBG("PRACK workaround applied!\n"); + LM_DBG("ACK/PRACK workaround applied!%d\n", info->interval); set_timeout_avp(msg, info->interval); } } @@ -473,7 +472,7 @@ static void sst_dialog_request_within_CB(struct dlg_cell* did, int type, return; } set_timeout_avp(msg, minfo.se); - info->supported = (minfo.supported?SST_UAC:SST_UNDF); + info->supported = (minfo.supported?SST_UAC:SST_UNDF); info->interval = minfo.se; } } @@ -492,6 +491,7 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, struct dlg_cb_params * params) { struct sip_msg* msg = params->msg; + int *param; /* * This test to see if the message is a response sould ALWAYS be @@ -542,13 +542,13 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, } LM_DBG("parsing 200 OK response %d / %d\n", minfo.supported, minfo.se); if (info->supported != SST_UAC) { - info->supported = (minfo.supported?SST_UAS:SST_UNDF); + info->supported = (minfo.supported?SST_UAS:SST_UNDF); } if (minfo.se != 0) { if (sst_interval > minfo.min_se) - info->interval = sst_interval; + info->interval = sst_interval; else - info->interval = MAX(minfo.se, sst_min_se); + info->interval = MAX(minfo.se, sst_min_se); LM_DBG("UAS supports timer\n"); if (set_timeout_avp(msg, info->interval)) { // FIXME: need an error message here @@ -560,7 +560,7 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, if (info->supported == SST_UAC) { char se_buf[80]; - LM_DBG("UAC supports timer\n"); + LM_DBG("UAC supports timer\n"); LM_DBG("appending the Session-Expires: header to the 2XX reply." " UAC will deal with it.\n"); /* @@ -569,9 +569,9 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, * deal with refreshing the session. */ if (sst_interval > minfo.min_se) - info->interval = sst_interval; + info->interval = sst_interval; else - info->interval = MAX(minfo.se, sst_min_se); + info->interval = MAX(minfo.se, sst_min_se); snprintf(se_buf, 80, "Session-Expires: %d;refresher=uac\r\n", info->interval); if (append_header(msg, se_buf)) { @@ -588,8 +588,9 @@ static void sst_dialog_response_fwded_CB(struct dlg_cell* did, int type, * does not support it */ LM_DBG("UAC and UAS do not support timers!" " No session timers for this session.\n"); - /* Disable the dialog timeout HERE */ - if (set_timeout_avp(msg, 0)) { + param = find_param_export("dialog", "default_timeout", INT_PARAM); + info->interval = param?*param:12*3600; + if (set_timeout_avp(msg, info->interval)) { return; } } @@ -847,7 +848,7 @@ static int set_timeout_avp(struct sip_msg *msg, unsigned int value) if (pv_set_value(msg,timeout_avp,EQ_T,&pv_val)!=0) { LM_ERR("failed to set new dialog timeout value\n"); } else { - LM_DBG("set dialog timeout value to %d\n", value); + LM_DBG("set dialog timeout value to %d\n", value); rtn = 0; } } @@ -893,8 +894,8 @@ static int parse_msg_for_sst_info(struct sip_msg *msg, sst_msg_info_t *minfo) * if not found or an error parsing the one it did find! So assume * it is not found if unsuccessfull. */ - if (msg->supported && parse_supported(msg) == 0 && - (get_supported(msg) & F_SUPPORTED_TIMER)) + if (msg->supported && parse_supported(msg) == 0 && + (get_supported(msg) & F_SUPPORTED_TIMER)) minfo->supported = 1; /* diff --git a/modules/statistics/README b/modules/statistics/README index 8561dc3e72..a2c00b221a 100644 --- a/modules/statistics/README +++ b/modules/statistics/README @@ -8,8 +8,7 @@ Bogdan Iancu Copyright © 2006 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/stun/README b/modules/stun/README index 24d21fc4a9..290d95bf03 100644 --- a/modules/stun/README +++ b/modules/stun/README @@ -12,7 +12,7 @@ Razvan Pistolea Copyright © 2009 Voice Sistem SRL Revision History - Revision $Revision:$ $Date:$ + Revision $Revision:$ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/textops/README b/modules/textops/README index 00a4bb6728..ab4aa2a78c 100644 --- a/modules/textops/README +++ b/modules/textops/README @@ -25,8 +25,7 @@ Ovidiu Sas Copyright © 2003 FhG FOKUS Revision History - Revision $Revision$ $Date: 2010-12-07 19:37:12 +0200 - (Tue, 07 Dec 2010) $ + Revision $Revision: 7480 $ $Date$ __________________________________________________________ Table of Contents @@ -268,7 +267,7 @@ if(has_body() && replace_body_atonce("^.+$", "")) (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, @@ -297,7 +296,7 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\ (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, @@ -328,7 +327,7 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\ (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, @@ -356,7 +355,7 @@ if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$ (match newline don't treat it as end of line). 're' - is regular expresion 'repl' - is replacement string - may contain - pseudo-varibales + pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, diff --git a/modules/textops/doc/textops_admin.xml b/modules/textops/doc/textops_admin.xml index 0a01324c76..c07d20dcc0 100644 --- a/modules/textops/doc/textops_admin.xml +++ b/modules/textops/doc/textops_admin.xml @@ -371,7 +371,7 @@ if(has_body() && replace_body_atonce("^.+$", "")) 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) @@ -416,7 +416,7 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig') ) 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) @@ -463,7 +463,7 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\0/i')){$ 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) @@ -508,7 +508,7 @@ if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$ 're' - is regular expresion - 'repl' - is replacement string - may contain pseudo-varibales + 'repl' - is replacement string - may contain pseudo-variables 'flags' - substitution flags (i - ignore case, g - global) diff --git a/modules/tm/README b/modules/tm/README index df7855bf1c..8172e5a0d4 100644 --- a/modules/tm/README +++ b/modules/tm/README @@ -868,7 +868,7 @@ t_write_unix("logger/append2","/var/run/logger.sock"); Returns true if the current request is associated to a transaction. The relationship between the request and - transaction is defined as follow: + transaction is defined as follows: * non-CANCEL/non-ACK requests - if the request belongs to a transaction (it's a retransmision), the function will do a standard processing of the retransmission and will diff --git a/modules/tm/doc/tm_admin.xml b/modules/tm/doc/tm_admin.xml index 2e2de57799..49c1582f0a 100644 --- a/modules/tm/doc/tm_admin.xml +++ b/modules/tm/doc/tm_admin.xml @@ -1151,7 +1151,7 @@ t_write_unix("logger/append2","/var/run/logger.sock"); Returns true if the current request is associated to a transaction. The relationship between the request and transaction is defined as - follow: + follows: diff --git a/modules/tm/t_funcs.h b/modules/tm/t_funcs.h index 90827ef480..36a6a8de7b 100644 --- a/modules/tm/t_funcs.h +++ b/modules/tm/t_funcs.h @@ -144,9 +144,9 @@ inline static void _set_fr_retr( struct retr_buf *rb, int retr ) if (!fr_avp2timer(&timer)) { LM_DBG("FR_TIMER = %llu\n", timer); - set_timer(&rb->fr_timer, FR_TIMER_LIST, &timer); + set_1timer(&rb->fr_timer, FR_TIMER_LIST, &timer); } else { - set_timer(&rb->fr_timer, FR_TIMER_LIST, 0); + set_1timer(&rb->fr_timer, FR_TIMER_LIST, 0); } } diff --git a/modules/tm/timer.c b/modules/tm/timer.c index 8897a48bdf..e6c97a469d 100644 --- a/modules/tm/timer.c +++ b/modules/tm/timer.c @@ -614,15 +614,15 @@ static void check_timer_list(enum lists list_id, char *txt ) struct timer_link *tl1 ; if (list_id<0 || list_id>=NR_OF_TIMER_LISTS) { - LM_CRIT("------- list [%d] bug [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] bug [%s]\n",list_id, txt); + abort(); } tl = timer_list->last_tl.prev_tl; while (tl!=&timer_list->first_tl) { if (tl->prev_tl==0) { - LM_CRIT("------- list [%d] prev_tl==0 [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] prev_tl==0 [%s]\n",list_id, txt); + abort(); } tl = tl->prev_tl; } @@ -630,8 +630,8 @@ static void check_timer_list(enum lists list_id, char *txt ) tl = timer_list->first_tl.next_tl; while (tl!=&timer_list->last_tl) { if (tl->next_tl==0) { - LM_CRIT("------- list [%d] next_tl==0 [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] next_tl==0 [%s]\n",list_id, txt); + abort(); } tl = tl->next_tl; } @@ -639,22 +639,22 @@ static void check_timer_list(enum lists list_id, char *txt ) tl = timer_list->first_tl.next_tl; while (tl!=&timer_list->last_tl) { if (tl->ld_tl==0) { - LM_CRIT("------- list [%d] currupted - ld=0 [%s]\n",list_id, txt); - abort(0); + LM_CRIT("TM TIMER list [%d] currupted - ld=0 [%s]\n",list_id, txt); + abort(); } if (tl->ld_tl->ld_tl!=tl) { - LM_CRIT("------- list [%d] currupted - ld cycle broken [%s]\n", + LM_CRIT("TM TIMER list [%d] currupted - ld cycle broken [%s]\n", list_id, txt); - abort(0); + abort(); } if (tl->ld_tl!=tl) { tl1 = tl->next_tl; while(tl1!=tl->ld_tl) { if (tl1->ld_tl) { - LM_CRIT("------- list [%d] currupted - ld!=0 inside " + LM_CRIT("TM TIMER list [%d] currupted - ld!=0 inside " "cycle [%s]\n", list_id, txt); - abort(0); + abort(); } tl1 = tl1->next_tl; } diff --git a/modules/tm/uac.c b/modules/tm/uac.c index df4dd9d4ad..bff89b77c8 100644 --- a/modules/tm/uac.c +++ b/modules/tm/uac.c @@ -211,6 +211,7 @@ int t_uac(str* method, str* headers, str* body, dlg_t* dialog, unsigned int hi; struct socket_info *send_sock, *new_send_sock; str h_to, h_from, h_cseq, h_callid; + unsigned short dst_changed; ret=-1; @@ -321,13 +322,16 @@ int t_uac(str* method, str* headers, str* body, dlg_t* dialog, set_avp_list( backup ); /* check for changes - if none, do not regenerate the buffer */ - if (req->new_uri.s || req->add_rm || req->body_lumps || - req->dst_uri.len != dialog->hooks.next_hop->len || - memcmp(req->dst_uri.s,dialog->hooks.next_hop->s,req->dst_uri.len) != 0) { + dst_changed = 1; + if (req->new_uri.s || req->force_send_socket!=dialog->send_sock || + req->dst_uri.len != dialog->hooks.next_hop->len || + memcmp(req->dst_uri.s,dialog->hooks.next_hop->s,req->dst_uri.len) || + (dst_changed=0)==0 || req->add_rm || req->body_lumps){ + new_send_sock = NULL; /* do we also need to change the destination? */ - if (req->dst_uri.s || req->new_uri.s) { + if (dst_changed) { /* calculate the socket corresponding to next hop */ new_send_sock = uri2sock(req, req->dst_uri.s ? &(req->dst_uri) : &req->new_uri, diff --git a/modules/uac/auth.c b/modules/uac/auth.c index ef27f3d8c6..c7c367d9fb 100644 --- a/modules/uac/auth.c +++ b/modules/uac/auth.c @@ -179,12 +179,12 @@ int uac_auth( struct sip_msg *msg) if ( apply_urihdr_changes( msg, &t->uac[branch].uri, new_hdr)<0 ) { LM_ERR("failed to apply changes\n"); + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; goto error; } - /* increas the Cseq nr */ - - + new_hdr->s = NULL; new_hdr->len = 0; return 0; error: return -1; diff --git a/modules/uac/replace.c b/modules/uac/replace.c index 07c82d6f03..7df8d92963 100644 --- a/modules/uac/replace.c +++ b/modules/uac/replace.c @@ -579,6 +579,35 @@ int restore_uri( struct sip_msg *msg, int to, int check_from) /************************** Dialog functions ******************************/ +void dlg_restore_callback(struct dlg_cell* dlg, int type, struct dlg_cb_params * params) +{ + str val; + + /* check if the UAC corresponding values are present */ + + if ( dlg_api.fetch_dlg_value( dlg, &rr_to_param_new, &val, 0)==0 ) { + /* TO variable found -> TO URI changed */ + LM_DBG("UAC TO related DLG vals found -> installing callback\n"); + if ( dlg_api.register_dlgcb(dlg, DLGCB_REQ_WITHIN|DLGCB_TERMINATED, + replace_callback, (void*)1/*to*/, 0) != 0) { + LM_ERR("cannot register callback\n"); + } + } + + if ( dlg_api.fetch_dlg_value( dlg, &rr_from_param_new, &val, 0)==0 ) { + /* FROM variable found -> FROM URI changed */ + LM_DBG("UAC FROM related DLG vals found -> installing callback\n"); + if ( dlg_api.register_dlgcb(dlg, DLGCB_REQ_WITHIN|DLGCB_TERMINATED, + replace_callback, (void*)0/*from*/, 0) != 0) { + LM_ERR("cannot register callback\n"); + } + } + + return; +} + + + static void replace_callback(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params) { diff --git a/modules/uac/replace.h b/modules/uac/replace.h index 12cc69433b..37c2f36243 100644 --- a/modules/uac/replace.h +++ b/modules/uac/replace.h @@ -48,5 +48,6 @@ int restore_uri( struct sip_msg *msg, int to, int check_from); /* RR callback functions */ void rr_checker(struct sip_msg *msg, str *r_param, void *cb_param); +void dlg_restore_callback(struct dlg_cell* dlg, int type, struct dlg_cb_params * params); #endif diff --git a/modules/uac/uac.c b/modules/uac/uac.c index 7f70de7638..6602178604 100644 --- a/modules/uac/uac.c +++ b/modules/uac/uac.c @@ -109,7 +109,7 @@ static cmd_export_t cmds[]={ {"uac_restore_to", (cmd_function)w_restore_to, 0, 0, 0, REQUEST_ROUTE|BRANCH_ROUTE|FAILURE_ROUTE }, - {"uac_auth", (cmd_function)w_uac_auth, 0, + {"uac_auth", (cmd_function)w_uac_auth, 0, 0, 0, FAILURE_ROUTE }, {0,0,0,0,0,0} @@ -168,6 +168,21 @@ static int mod_init(void) { LM_INFO("initializing...\n"); + if ( is_script_func_used("uac_auth", -1) ) { + /* load the UAC_AUTH API as uac_auth() is invoked from script */ + if(load_uac_auth_api(&uac_auth_api)<0){ + LM_ERR("can't load UAC_AUTH API, needed for uac_auth()\n"); + goto error; + } + } + + /* load the TM API - FIXME it should be loaded only + * if NO_RESTORE and AUTH */ + if (load_tm_api(&uac_tmb)!=0) { + LM_ERR("can't load TM API\n"); + goto error; + } + if (restore_mode_str && *restore_mode_str) { if (strcasecmp(restore_mode_str,"none")==0) { restore_mode = UAC_NO_RESTORE; @@ -182,72 +197,70 @@ static int mod_init(void) } } - rr_from_param.len = strlen(rr_from_param.s); - rr_to_param.len = strlen(rr_to_param.s); - if ( (rr_from_param.len==0 || rr_to_param.len==0) && - restore_mode!=UAC_NO_RESTORE) - { - LM_ERR("rr_store_param cannot be empty if FROM is restoreable\n"); - goto error; - } - - uac_passwd.len = strlen(uac_passwd.s); - - /* load the TM API - FIXME it should be loaded only - * if NO_RESTORE and AUTH */ - if (load_tm_api(&uac_tmb)!=0) { - LM_ERR("can't load TM API\n"); - goto error; - } + if ( is_script_func_used("uac_replace_from", -1) || + is_script_func_used("uac_replace_to", -1) ) { - /* load the UAC_AUTH API - FIXME it should be loaded only - * if uac_auth() is invoked from script */ - if(load_uac_auth_api(&uac_auth_api)<0){ - LM_ERR("can't load UAC_AUTH API\n"); - goto error; - } + /* replace TO/FROM stuff is used, get prepared */ - if (restore_mode!=UAC_NO_RESTORE) { - /* load the RR API */ - if (load_rr_api(&uac_rrb)!=0) { - LM_ERR("can't load RR API\n"); + rr_from_param.len = strlen(rr_from_param.s); + rr_to_param.len = strlen(rr_to_param.s); + if ( (rr_from_param.len==0 || rr_to_param.len==0) && + restore_mode!=UAC_NO_RESTORE) { + LM_ERR("rr_store_param cannot be empty if FROM is restoreable\n"); goto error; } - if (restore_mode==UAC_AUTO_RESTORE) { - /* we need the append_fromtag on in RR */ - if (!force_dialog && !uac_rrb.append_fromtag) { - LM_ERR("'append_fromtag' RR param is not enabled!" - " - required by AUTO restore mode\n"); + uac_passwd.len = strlen(uac_passwd.s); + + if (restore_mode!=UAC_NO_RESTORE) { + /* load the RR API */ + if (load_rr_api(&uac_rrb)!=0) { + LM_ERR("can't load RR API\n"); goto error; } - /* trying to load dialog module */ - memset(&dlg_api, 0, sizeof(struct dlg_binds)); - if (load_dlg_api(&dlg_api)!=0) { - if (force_dialog) { - LM_ERR("cannot force dialog. dialog module not loaded\n"); + if (restore_mode==UAC_AUTO_RESTORE) { + /* we need the append_fromtag on in RR */ + if (!force_dialog && !uac_rrb.append_fromtag) { + LM_ERR("'append_fromtag' RR param is not enabled!" + " - required by AUTO restore mode\n"); goto error; } - LM_DBG("failed to find dialog API - is dialog module loaded?\n"); - } else { - if ( (parse_store_bavp(&store_to_bavp, &to_bavp_spec) || - parse_store_bavp(&store_from_bavp, &from_bavp_spec))) { - LM_ERR("cannot set correct store parameters\n"); - goto error; + + /* trying to load dialog module */ + memset(&dlg_api, 0, sizeof(struct dlg_binds)); + if (load_dlg_api(&dlg_api)!=0) { + if (force_dialog) { + LM_ERR("cannot force dialog. dialog module not loaded\n"); + goto error; + } + LM_DBG("failed to find dialog API - is dialog module loaded?\n"); + } else { + if ( (parse_store_bavp(&store_to_bavp, &to_bavp_spec) || + parse_store_bavp(&store_from_bavp, &from_bavp_spec))) { + LM_ERR("cannot set correct store parameters\n"); + goto error; + } + /* install calback to catch all loaded dialogs */ + if ( dlg_api.register_dlgcb( NULL, DLGCB_LOADED, + dlg_restore_callback, NULL, NULL) != 0 ) { + LM_ERR("failed to install dialog restore callback\n"); + goto error; + } } - } - /* get all requests doing loose route */ - if (uac_rrb.register_rrcb( rr_checker, 0, 2)!=0) { - LM_ERR("failed to install RR callback\n"); - goto error; + /* get all requests doing loose route */ + if (uac_rrb.register_rrcb( rr_checker, 0, 2)!=0) { + LM_ERR("failed to install RR callback\n"); + goto error; + } } } - } - /* init from replacer */ - init_from_replacer(); + /* init from replacer */ + init_from_replacer(); + + } return 0; error: diff --git a/modules/uac_auth/auth.c b/modules/uac_auth/auth.c index b0a094a16e..d8f45e9ca8 100644 --- a/modules/uac_auth/auth.c +++ b/modules/uac_auth/auth.c @@ -54,6 +54,7 @@ extern unsigned short pwd_avp_type; static str nc = {"00000001", 8}; static str cnonce = {"o", 1}; +static str auth_hdr = {NULL, 0}; static struct uac_credential *crd_list = NULL; @@ -462,7 +463,6 @@ str* build_authorization_hdr(int code, str *uri, struct uac_credential *crd, struct authenticate_body *auth, struct authenticate_nc_cnonce *auth_nc_cnonce, char *response) { - static str hdr; char *p; int len; int response_len; @@ -485,14 +485,17 @@ str* build_authorization_hdr(int code, str *uri, NC_FIELD_LEN + auth_nc_cnonce->nc->len + FIELD_SEPARATOR_UQ_LEN + CNONCE_FIELD_LEN + auth_nc_cnonce->cnonce->len + FIELD_SEPARATOR_LEN; - hdr.s = (char*)pkg_malloc( len + 1); - if (hdr.s==0) + if (auth_hdr.s || auth_hdr.len) + LM_WARN("potential memory leak at addr: %p\n", auth_hdr.s); + + auth_hdr.s = (char*)pkg_malloc( len + 1); + if (auth_hdr.s==NULL) { LM_ERR("no more pkg mem\n"); goto error; } - p = hdr.s; + p = auth_hdr.s; /* header start */ if (code==401) { @@ -543,20 +546,20 @@ str* build_authorization_hdr(int code, str *uri, add_string( p, FIELD_SEPARATOR_S ALGORITHM_FIELD_S CRLF, FIELD_SEPARATOR_LEN+ALGORITHM_FIELD_LEN+CRLF_LEN); - hdr.len = p - hdr.s; + auth_hdr.len = p - auth_hdr.s; - if (hdr.len!=len) + if (auth_hdr.len!=len) { LM_CRIT("BUG: bad buffer computation " - "(%d<>%d)\n",len,hdr.len); - pkg_free( hdr.s ); + "(%d<>%d)\n",len,auth_hdr.len); + pkg_free( auth_hdr.s ); + auth_hdr.s = NULL; auth_hdr.len = 0; goto error; } - LM_DBG("hdr is <%.*s>\n", - hdr.len,hdr.s); + LM_DBG("auth_hdr is <%.*s>\n", auth_hdr.len, auth_hdr.s); - return &hdr; + return &auth_hdr; error: return 0; } diff --git a/modules/uac_auth/uac_auth.h b/modules/uac_auth/uac_auth.h index b47fd8e53f..2069057817 100644 --- a/modules/uac_auth/uac_auth.h +++ b/modules/uac_auth/uac_auth.h @@ -94,7 +94,6 @@ static inline int load_uac_auth_api( uac_auth_api_t *uac_auth_api) /* import the uac_auth auto-loading function */ if ( !(load_uac_auth=(load_uac_auth_f)find_export("load_uac_auth", 1, 0))) { - LM_ERR("can't import load_uac_auth\n"); return -1; } diff --git a/modules/uac_redirect/README b/modules/uac_redirect/README index e5382df381..fc155b969a 100644 --- a/modules/uac_redirect/README +++ b/modules/uac_redirect/README @@ -8,8 +8,7 @@ Bogdan-Andrei Iancu Copyright © 2005 Voice Sistem Revision History - Revision $Revision$ $Date: 2012-02-22 19:29:43 +0200 - (Wed, 22 Feb 2012) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/uac_registrant/README b/modules/uac_registrant/README index 3d8df346e8..19662c06c1 100644 --- a/modules/uac_registrant/README +++ b/modules/uac_registrant/README @@ -12,8 +12,7 @@ Ovidiu Sas Copyright © 2011-2013 VoIP Embedded, Inc. Revision History - Revision $Revision$ $Date: 2013-01-29 07:35:11 -0500 (Tue, 29 - Jan 2013) $ + Revision $Revision$ $Date$ __________________________________________________________ Table of Contents @@ -152,8 +151,8 @@ modparam("uac_registrant", "timer_interval", 120) Example 1.3. Set “db_url” parameter ... -modparam("uac_registrant", "db_url", "mysql://user:passw@localhost/data -base") +modparam("uac_registrant", "db_url", "mysql://user:passw@localhost/datab +ase") ... 1.3.4. table_name (string) diff --git a/modules/uac_registrant/registrant.c b/modules/uac_registrant/registrant.c index 65a77bb8b7..7d16efe316 100644 --- a/modules/uac_registrant/registrant.c +++ b/modules/uac_registrant/registrant.c @@ -353,11 +353,8 @@ int run_reg_tm_cback(void *e_data, void *data, void *r_data) } } rec->state = REGISTERED_STATE; - if (exp) { - rec->registration_timeout = now + exp - timer_interval; - } else { - rec->registration_timeout = now + rec->expires - timer_interval; - } + if (exp) rec->expires = exp; + rec->registration_timeout = now + rec->expires - timer_interval; break; case WWW_AUTH_CODE: @@ -438,6 +435,8 @@ int run_reg_tm_cback(void *e_data, void *data, void *r_data) } else { rec->state = INTERNAL_ERROR_STATE; } + pkg_free(new_hdr->s); + new_hdr->s = NULL; new_hdr->len = 0; break; case 423: /* Interval Too Brief */ diff --git a/modules/uri/README b/modules/uri/README index 5157985e30..27461a4d49 100644 --- a/modules/uri/README +++ b/modules/uri/README @@ -20,8 +20,7 @@ Irina-Maria Stanescu Copyright © 2005, 2009 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents @@ -277,8 +276,8 @@ if (db_check_from()) { Check if username in the request URI belongs to an existing user. - As the checking is done against URI table (if use_uri_table is - set) or subscriber table. + Matching is done against the URI table (if use_uri_table is + set) or the subscriber table. This function can be used from REQUEST_ROUTE. diff --git a/modules/uri/doc/uri_admin.xml b/modules/uri/doc/uri_admin.xml index 259102f009..7a3e50b3cb 100644 --- a/modules/uri/doc/uri_admin.xml +++ b/modules/uri/doc/uri_admin.xml @@ -317,8 +317,9 @@ if (db_check_from()) { Check if username in the request &uri; belongs to an existing user. - As the checking is done against &uri; table (if use_uri_table is set) - or subscriber table. + Matching is done against the &uri; table (if + use_uri_table is set) + or the subscriber table. This function can be used from REQUEST_ROUTE. diff --git a/modules/userblacklist/README b/modules/userblacklist/README index da7c946b16..05ea48199b 100644 --- a/modules/userblacklist/README +++ b/modules/userblacklist/README @@ -13,8 +13,7 @@ Henning Westerholt Copyright © 2008 1&1 Internet AG Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 5901 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/usrloc/README b/modules/usrloc/README index be4a84376d..0c083de28a 100644 --- a/modules/usrloc/README +++ b/modules/usrloc/README @@ -16,8 +16,7 @@ Bogdan-Andrei Iancu Copyright © 2005-2008 Voice Sistem SRL Revision History - Revision $Revision$ $Date: 2013-01-29 14:35:11 +0200 - (Tue, 29 Jan 2013) $ + Revision $Revision: 8740 $ $Date$ __________________________________________________________ Table of Contents diff --git a/modules/usrloc/dlist.c b/modules/usrloc/dlist.c index 9a0ffe86ad..0b6103f9b2 100644 --- a/modules/usrloc/dlist.c +++ b/modules/usrloc/dlist.c @@ -92,53 +92,61 @@ static inline int find_dlist(str* _n, dlist_t** _d) ptr = ptr->next; } - + return 1; } - - -static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags, - unsigned int part_idx, unsigned int part_max) +static int get_all_db_ucontacts(void *buf, int len, unsigned int flags, + unsigned int part_idx, unsigned int part_max) { static char query_buf[512]; static str query_str; struct socket_info *sock; - unsigned int dbflags; - db_res_t* res = NULL; + db_res_t *res = NULL; db_row_t *row; + db_val_t *val; dlist_t *dom; - char *p, *p1; - char now_s[25]; + str host, flag_list; + int i, no_rows = 10; int now_len; + char now_s[25]; + char *p, *p1; int port, proto, p_len, p1_len; - str host; - int i; - void *cp; - int shortage, needed; + unsigned int dbflags; + int needed; + int shortage = 0; - cp = buf; shortage = 0; /* Reserve space for terminating 0000 */ - len -= sizeof(p_len); + len -= sizeof p_len; /* get the current time in DB format */ now_len = 25; - if (db_time2str( time(0), now_s, &now_len)!=0) { + if (db_time2str(time(NULL), now_s, &now_len) != 0) { LM_ERR("failed to print now time\n"); return -1; } - for (dom = root; dom!=NULL ; dom=dom->next) { - /* build query */ - i = snprintf( query_buf, sizeof(query_buf), "select %.*s, %.*s, %.*s," + LM_DBG("buf: %p. flags: %d\n", buf, flags); + + /* for each table */ + for (dom = root; dom; dom = dom->next) { + if (db_check_table_version(&ul_dbf, ul_dbh, dom->d->name, UL_TABLE_VERSION)) + goto error; + + /* read the destinations */ + if (ul_dbf.use_table(ul_dbh, dom->d->name) < 0) { + LM_ERR("cannot select table \"%.*s\"\n", dom->d->name->len, + dom->d->name->s); + goto error; + } + + i = snprintf(query_buf, sizeof query_buf, "select %.*s, %.*s, %.*s," #ifdef ORACLE_USRLOC - " %.*s, %.*s from %s where %.*s > %.*s and " - "bitand(%.*s, %d) = %d and mod(id, %u) = %u", + " %.*s, %.*s from %s where %.*s > %.*s and mod(id, %u) = %u", #else - " %.*s, %.*s from %s where %.*s > %.*s and %.*s & %d = %d and " - "id %% %u = %u", + " %.*s, %.*s from %s where %.*s > %.*s and id %% %u = %u", #endif received_col.len, received_col.s, contact_col.len, contact_col.s, @@ -148,112 +156,156 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags, dom->d->name->s, expires_col.len, expires_col.s, now_len, now_s, - cflags_col.len, cflags_col.s, - flags, flags, part_max, part_idx); - if ( i>=sizeof(query_buf) ) { + part_max, part_idx); + + LM_DBG("query: %.*s\n", (int)(sizeof query_buf), query_buf); + if (i >= sizeof query_buf) { LM_ERR("DB query too long\n"); - return -1; + goto error; } + query_str.s = query_buf; query_str.len = i; - if ( ul_dbf.raw_query( ul_dbh, &query_str, &res)<0 ) { + + if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) { + if (ul_dbf.raw_query(ul_dbh, &query_str, 0) < 0) { + LM_ERR("raw_query failed\n"); + goto error; + } + + no_rows = estimate_available_rows(20+128+20+128+64, 5); + if (no_rows == 0) + no_rows = 10; + + LM_DBG("fetching %d rows\n", no_rows); + + if (ul_dbf.fetch_result(ul_dbh, &res, no_rows) < 0) { + LM_ERR("Error fetching rows\n"); + goto error; + } + } else if (ul_dbf.raw_query(ul_dbh, &query_str, &res) < 0) { LM_ERR("raw_query failed\n"); - return -1; - } - if( RES_ROW_N(res)==0 ) { - ul_dbf.free_result(ul_dbh, res); - continue; + goto error; } - for(i = 0; i < RES_ROW_N(res); i++) { - row = RES_ROWS(res) + i; + do { + for (i = 0; i < RES_ROW_N(res); i++) { + row = RES_ROWS(res) + i; + val = ROW_VALUES(row) + 3; /* cflags */ + flag_list.s = (char *)VAL_STRING(val); + flag_list.len = strlen(flag_list.s); + + LM_DBG("contact cflags: '%.*s'\n", flag_list.len, flag_list.s); + LM_DBG("masks: param: %d --- %d :db\n", flags, dbflags); - /* received */ - p = (char*)VAL_STRING(ROW_VALUES(row)); - if ( VAL_NULL(ROW_VALUES(row)) || p==0 || p[0]==0 ) { - /* contact */ - p = (char*)VAL_STRING(ROW_VALUES(row)+1); - if (VAL_NULL(ROW_VALUES(row)+1) || p==0 || p[0]==0) { - LM_ERR("empty contact -> skipping\n"); + /* contact is not flagged at all */ + if (flags && (val->nul || !flag_list.s)) continue; + + dbflags = flag_list_to_bitmask(&flag_list, + FLAG_TYPE_BRANCH, FLAG_DELIM); + + /* check if contact flags match the given bitmask */ + if ((dbflags & flags) != flags) + continue; + + /* received */ + p = (char*)VAL_STRING(ROW_VALUES(row)); + if (VAL_NULL(ROW_VALUES(row)) || !p || !p[0]) { + /* contact */ + p = (char*)VAL_STRING(ROW_VALUES(row) + 1); + if (VAL_NULL(ROW_VALUES(row) + 1) || !p || *p == '\0') { + LM_ERR("empty contact -> skipping\n"); + continue; + } } - } - p_len = strlen(p); - - /* path */ - p1 = (char*)VAL_STRING(ROW_VALUES(row)+4); - if (VAL_NULL(ROW_VALUES(row)+4) || p1==0 || p1[0]==0){ - p1 = NULL; - p1_len = 0; - } else { - p1_len = strlen(p1); - } + p_len = strlen(p); - needed = (int)(sizeof(p_len)+p_len+sizeof(sock)+sizeof(dbflags)+ - sizeof(p1_len)+p1_len); - if (len < needed) { - shortage += needed ; - continue; - } + /* path */ + p1 = (char*)VAL_STRING(ROW_VALUES(row) + 4); + if (VAL_NULL(ROW_VALUES(row) + 4) || !p1 || *p1 == '\0') { + p1 = NULL; + p1_len = 0; + } else + p1_len = strlen(p1); + + needed = (int)(p_len + sizeof p_len + sizeof sock + + sizeof dbflags + p1_len + sizeof p1_len); + + LM_DBG("len: %d, needed: %d\n", len, needed); + + if (len < needed) { + shortage += needed; + continue; + } - /* write received/contact */ - memcpy(cp, &p_len, sizeof(p_len)); - cp = (char*)cp + sizeof(p_len); - memcpy(cp, p, p_len); - cp = (char*)cp + p_len; - - /* sock */ - p = (char*)VAL_STRING(ROW_VALUES(row) + 2); - if (VAL_NULL(ROW_VALUES(row)+2) || p==0 || p[0]==0){ - sock = 0; - } else { - if (parse_phostport( p, strlen(p), &host.s, &host.len, - &port, &proto)!=0) { - LM_ERR("bad socket <%s>...ignoring\n", p); - sock = 0; + /* write received/contact */ + memcpy(buf, &p_len, sizeof p_len); + buf += sizeof p_len; + memcpy(buf, p, p_len); + buf += p_len; + + /* sock */ + p = (char*)VAL_STRING(ROW_VALUES(row) + 2); + if (VAL_NULL(ROW_VALUES(row)+2) || !p || *p == '\0') { + sock = NULL; } else { - sock = grep_sock_info( &host, (unsigned short)port, proto); - if (sock==0) { - LM_DBG("non-local socket <%s>...ignoring\n", p); + if (parse_phostport(p, strlen(p), &host.s, &host.len, + &port, &proto) != 0) { + LM_ERR("bad socket <%s>...ignoring\n", p); + sock = NULL; + } else { + sock = grep_sock_info(&host, (unsigned short)port, proto); + if (!sock) + LM_DBG("non-local socket <%s>...ignoring\n", p); } } - } - /* flags */ - dbflags = VAL_BITMAP(ROW_VALUES(row) + 3); + /* write sock and flags */ + memcpy(buf, &sock, sizeof sock); + buf += sizeof sock; + memcpy(buf, &dbflags, sizeof dbflags); + buf += sizeof dbflags; - /* write sock and flags */ - memcpy(cp, &sock, sizeof(sock)); - cp = (char*)cp + sizeof(sock); - memcpy(cp, &dbflags, sizeof(dbflags)); - cp = (char*)cp + sizeof(dbflags); + /* write path */ + memcpy(buf, &p1_len, sizeof p1_len); + buf += sizeof p1_len; + memcpy(buf, p1, p1_len); + buf += p1_len; - /* write path */ - memcpy(cp, &p1_len, sizeof(p1_len)); - cp = (char*)cp + sizeof(p1_len); - memcpy(cp, p1, p1_len); - cp = (char*)cp + p1_len; + len -= needed; + } - len -= needed; - } /* row cycle */ + if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) { + if (ul_dbf.fetch_result(ul_dbh, &res, no_rows) < 0) { + LM_ERR("fetching rows (1)\n"); + goto error; + } + } else + break; + + } while (RES_ROW_N(res) > 0); ul_dbf.free_result(ul_dbh, res); - } /* domain cycle */ + } - /* len < 0 is possible, if size of the buffer < sizeof(c->c.len) */ + /* len < 0 is possible, if size of the buffer < sizeof c->c.len */ if (len >= 0) - memset(cp, 0, sizeof(p_len)); + memset(buf, 0, sizeof p_len); /* Shouldn't happen */ - if (shortage > 0 && len > shortage) { + if (shortage > 0 && len > shortage) abort(); - } shortage -= len; return shortage > 0 ? shortage : 0; -} +error: + if (res) + ul_dbf.free_result(ul_dbh, res); + return -1; +} static inline int get_all_mem_ucontacts(void *buf, int len, unsigned int flags, diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c index 749c788d24..f399ddc068 100644 --- a/modules/usrloc/ucontact.c +++ b/modules/usrloc/ucontact.c @@ -461,7 +461,6 @@ int db_insert_ucontact(ucontact_t* _c,query_list_t **ins_list, int update) vals[7].type = DB_STR; vals[7].nul = 0; vals[7].val.str_val = bitmask_to_flag_list(FLAG_TYPE_BRANCH, _c->cflags); - vals[7].val.str_val.len = vals[7].val.str_val.len; vals[8].type = DB_STR; vals[8].nul = 0; @@ -633,9 +632,9 @@ int db_update_ucontact(ucontact_t* _c) vals2[3].nul = 0; vals2[3].val.bitmap_val = _c->flags; - vals2[4].type = DB_BITMAP; + vals2[4].type = DB_STR; vals2[4].nul = 0; - vals2[4].val.bitmap_val = _c->cflags; + vals2[4].val.str_val = bitmask_to_flag_list(FLAG_TYPE_BRANCH, _c->cflags); vals2[5].type = DB_STR; vals2[5].nul = 0; diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c index 5b0d0568f5..2f092f7897 100644 --- a/modules/usrloc/udomain.c +++ b/modules/usrloc/udomain.c @@ -375,6 +375,7 @@ static inline ucontact_info_t* dbrow2info( db_val_t *vals, str *contact) } ci.instance = instance; + attr.s = (char*)VAL_STRING(vals+14); if (VAL_NULL(vals+14) || !attr.s) { attr.s = NULL; attr.len = 0; diff --git a/modules/usrloc/ul_mi.c b/modules/usrloc/ul_mi.c index 5d31112968..b0a766385b 100644 --- a/modules/usrloc/ul_mi.c +++ b/modules/usrloc/ul_mi.c @@ -95,6 +95,7 @@ static inline int mi_add_aor_node(struct mi_node *parent, urecord_t* r, time_t t struct mi_node *node; struct mi_attr *attr; ucontact_t* c; + str st; char *p; int len; @@ -189,8 +190,8 @@ static inline int mi_add_aor_node(struct mi_node *parent, urecord_t* r, time_t t return -1; /* cflags */ - p = int2str((unsigned long)c->cflags, &len); - node = add_mi_node_child( cnode, MI_DUP_VALUE, "Cflags", 5, p, len); + st = bitmask_to_flag_list(FLAG_TYPE_BRANCH, c->cflags); + node = add_mi_node_child( cnode, MI_DUP_VALUE, "Cflags", 6, st.s, st.len); if (node==0) return -1; diff --git a/modules/xcap_client/xcap_callbacks.c b/modules/xcap_client/xcap_callbacks.c index 0bbbf8817a..e27b00d1cb 100644 --- a/modules/xcap_client/xcap_callbacks.c +++ b/modules/xcap_client/xcap_callbacks.c @@ -78,6 +78,6 @@ void destroy_xcapcb_list(void) { prev_xcb= xcb; xcb= xcb->next; - shm_free(xcb); + shm_free(prev_xcb); } } diff --git a/modules/xcap_client/xcap_functions.c b/modules/xcap_client/xcap_functions.c index 6b4a689e80..c65c208c1f 100644 --- a/modules/xcap_client/xcap_functions.c +++ b/modules/xcap_client/xcap_functions.c @@ -85,8 +85,8 @@ void xcapFreeNodeSel(xcap_node_sel_t* node) { m= n; n= n->next; - pkg_free(n->value.s); - pkg_free(n); + pkg_free(m->value.s); + pkg_free(m); } pkg_free(node); diff --git a/msg_translator.c b/msg_translator.c index 4467109324..8f51c13947 100644 --- a/msg_translator.c +++ b/msg_translator.c @@ -389,28 +389,42 @@ static inline int lump_check_opt( struct lump *l, get_ip_port_proto; /* faster tests first */ if ((port==snd_s->port_no)&&(proto==snd_s->proto)&& - (ip_addr_cmp(ip, &snd_s->address))) + (ip_addr_cmp(ip, &snd_s->address))) { + l->flags &= ~LUMPFLAG_COND_TRUE; return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_AF: get_ip_port_proto; - if (ip->af==snd_s->address.af) return 0; + if (ip->af==snd_s->address.af) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_PROTO: get_ip_port_proto; - if (proto==snd_s->proto) return 0; + if (proto==snd_s->proto) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_PORT: get_ip_port_proto; - if (port==snd_s->port_no) return 0; + if (port==snd_s->port_no) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; case COND_IF_DIFF_IP: get_ip_port_proto; - if (ip_addr_cmp(ip, &snd_s->address)) return 0; + if (ip_addr_cmp(ip, &snd_s->address)) { + l->flags &= ~LUMPFLAG_COND_TRUE; + return 0; + } l->flags |= LUMPFLAG_COND_TRUE; return 1; default: @@ -427,6 +441,7 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, struct socket_info* send_sock) { unsigned int s_offset, new_len; + unsigned int last_del; struct lump *t, *r; str *send_address_str, *send_port_str; str *rcv_address_str=NULL; @@ -572,9 +587,11 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, LM_CRIT("unknown subst type %d\n", \ (subst_l)->u.subst); \ } - + + s_offset=0; new_len=0; + last_del=0; /* init send_address_str & send_port_str */ if(send_sock && send_sock->adv_name_str.len) send_address_str=&(send_sock->adv_name_str); @@ -601,8 +618,13 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, rcv_port_str=&(msg->rcv.bind_address->port_no_str); } - for(t=lumps;t;t=t->next){ + /* is this lump still valid? (it must not be anchored in a deleted area */ + if (s_offset > t->u.offset && t->u.offset!=last_del) { + LM_DBG("skip a %d, buffer offset=%d, lump offset=%d, last_del=%d\n", + t->op,s_offset, t->u.offset,last_del); + continue; + } /* if a SKIP lump, go to the last in the list*/ if (t->op==LUMP_SKIP) { if (!t->next) break; @@ -648,31 +670,11 @@ int lumps_len(struct sip_msg* msg, struct lump* lumps, * before & after */ break; case LUMP_DEL: - /* fix overlapping deleted zones */ - //if (t->u.offset < s_offset){ - // /* change len */ - // if (t->len>s_offset-t->u.offset) - // t->len-=s_offset-t->u.offset; - // else t->len=0; - // t->u.offset=s_offset; - //} - /* lump inside a deleted area ? */ - if (s_offset > t->u.offset) { - continue; - } + last_del=t->u.offset; s_offset=t->u.offset+t->len; new_len-=t->len; break; case LUMP_NOP: - /* fix offset if overlapping on a deleted zone */ - //if (t->u.offset < s_offset){ - // t->u.offset=s_offset; - //}else - // s_offset=t->u.offset; - /* lump inside a deleted area ? */ - if (s_offset > t->u.offset) { - continue; - } /* do nothing */ break; default: @@ -723,6 +725,7 @@ void process_lumps( struct sip_msg* msg, struct lump *t, *r; char* orig; unsigned int size, offset, s_offset; + unsigned int last_del; str *send_address_str, *send_port_str; str *rcv_address_str=NULL; str *rcv_port_str=NULL; @@ -928,7 +931,7 @@ void process_lumps( struct sip_msg* msg, (subst_l)->u.subst); \ } \ \ - + /* init send_address_str & send_port_str */ if(send_sock && send_sock->adv_name_str.len) send_address_str=&(send_sock->adv_name_str); @@ -959,8 +962,16 @@ void process_lumps( struct sip_msg* msg, orig=msg->buf; offset=*new_buf_offs; s_offset=*orig_offs; + last_del=0; for (t=lumps;t;t=t->next){ + /* skip this lump if the "offset" is still in a "deleted" area */ + if (s_offset > t->u.offset && last_del!= t->u.offset) { + LM_DBG("skip a %d, buffer offset=%d, lump offset=%d, last_del=%d\n", + t->op,s_offset, t->u.offset,last_del); + continue; + } + switch(t->op){ case LUMP_SKIP: /* if a SKIP lump, go to the last in the list*/ @@ -1051,24 +1062,15 @@ void process_lumps( struct sip_msg* msg, break; case LUMP_NOP: case LUMP_DEL: - /* skip this lump if the "offset" is still in a "deleted" area */ - if (s_offset > t->u.offset) { - continue; - } - /* copy till offset */ - if (s_offset>t->u.offset){ /* this should never happen !! */ - LM_WARN("(%d) overlapped lumps offsets," - " ignoring(%x, %x)\n", t->op, s_offset,t->u.offset); - /* this should've been fixed above (when computing len) */ - /* just ignore it*/ - break; - } - size=t->u.offset-s_offset; - if (size){ + /* copy till offset (if any) */ + if (s_offsetu.offset){ + size=t->u.offset-s_offset; memcpy(new_buf+offset, orig+s_offset,size); offset+=size; s_offset+=size; } + if (t->op==LUMP_DEL) + last_del=t->u.offset; /* process before */ for(r=t->before;r;r=r->before){ switch (r->op){ diff --git a/packaging/debian-lenny/changelog b/packaging/debian-lenny/changelog index e311a377c2..1b85768239 100644 --- a/packaging/debian-lenny/changelog +++ b/packaging/debian-lenny/changelog @@ -1,3 +1,58 @@ +opensips (1.10.1-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Wed, 12 Mar 2014 17:42:54 +0200 + + +opensips (1.10.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Mon, 05 Aug 2013 16:26:40 +0200 + + +opensips (1.9.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Tue, 29 Jan 2013 15:39:34 +0200 + + +opensips (1.8.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Thu, 22 Mar 2012 09:00:00 +0200 + + +opensips (1.7.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Thu, 12 Jul 2011 09:00:00 +0200 + + +opensips (1.6.0-1) unstable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Thu, 15 Oct 2009 09:00:00 +0200 + + +opensips (1.5.0-1) unstable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Mon, 21 Mar 2009 09:00:00 +0200 + + +opensips (1.4.0-1) unstable; urgency=low + + * First Public Release. + + -- Bogdan-Andrei Iancu Mon, 21 Jul 2008 09:00:00 +0200 + opensips (1.9.0-1) stable; urgency=low * Major Public Release. diff --git a/packaging/debian-lenny/opensips.init b/packaging/debian-lenny/opensips.init index 173e2b9d57..5aecf2003d 100644 --- a/packaging/debian-lenny/opensips.init +++ b/packaging/debian-lenny/opensips.init @@ -19,6 +19,9 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/opensips NAME=opensips DESC=opensips +CFGFILE=/etc/opensips/opensips.cfg +M4CFGFILE=/etc/opensips/opensips.m4 +M4ARCHIVEDIR=/etc/opensips/archive HOMEDIR=/var/run/opensips PIDFILE=$HOMEDIR/$NAME.pid DEFAULTS=/etc/default/opensips @@ -28,7 +31,7 @@ RUN_OPENSIPS=no # otherwise the boot process will just stop check_fork () { - if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/opensips/opensips.cfg; then + if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/opensips debug instead" exit 1 fi @@ -112,6 +115,28 @@ case "$1" in check_fork fi + # Generate config from M4 + if [ -f $M4CFGFILE ]; then + m4 -Q $M4CFGFILE >$CFGFILE.tmp + if [ $? != 0 ]; then + echo "Cannot process m4 macro" + rm "$CFGFILE.tmp" + exit 1 + fi + + [ -e $CFGFILE ] || touch $CFGFILE + + # compare configs + if [ `md5sum $CFGFILE|awk '{print $1}'` != `md5sum $CFGFILE.tmp|awk '{print $1}'` ]; then + mkdir -p "$M4ARCHIVEDIR" + mv "$CFGFILE" "$M4ARCHIVEDIR/$NAME.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "$CFGFILE.tmp" "$CFGFILE" + chown $USER:$GROUP $CFGFILE + chmod 640 $CFGFILE + fi + echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $OPTIONS || echo -n " already running" diff --git a/packaging/debian/changelog b/packaging/debian/changelog index af0c75a99e..d52ab2113d 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,3 +1,17 @@ +opensips (1.10.1-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Wed, 12 Mar 2014 17:42:54 +0200 + + +opensips (1.10.0-1) stable; urgency=low + + * Major Public Release. + + -- Bogdan-Andrei Iancu Mon, 05 Aug 2013 16:26:40 +0200 + + opensips (1.9.0-1) stable; urgency=low * Major Public Release. diff --git a/packaging/debian/opensips.init b/packaging/debian/opensips.init index 6a5d3cc8a1..d9c35718d6 100644 --- a/packaging/debian/opensips.init +++ b/packaging/debian/opensips.init @@ -19,6 +19,9 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/opensips NAME=opensips DESC=opensips +CFGFILE=/etc/opensips/opensips.cfg +M4CFGFILE=/etc/opensips/opensips.m4 +M4ARCHIVEDIR=/etc/opensips/archive HOMEDIR=/var/run/opensips PIDFILE=$HOMEDIR/$NAME.pid DEFAULTS=/etc/default/opensips @@ -28,7 +31,7 @@ RUN_OPENSIPS=no # otherwise the boot process will just stop check_fork () { - if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" /etc/opensips/opensips.cfg; then + if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFGFILE; then echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/opensips debug instead" exit 1 fi @@ -119,6 +122,28 @@ case "$1" in chmod 775 "$HOMEDIR" chown "$USER:$GROUP" "$HOMEDIR" >/dev/null 2>&1 || true + # Generate config from M4 + if [ -f $M4CFGFILE ]; then + m4 -Q $M4CFGFILE >$CFGFILE.tmp + if [ $? != 0 ]; then + echo "Cannot process m4 macro" + rm "$CFGFILE.tmp" + exit 1 + fi + + [ -e $CFGFILE ] || touch $CFGFILE + + # compare configs + if [ `md5sum $CFGFILE|awk '{print $1}'` != `md5sum $CFGFILE.tmp|awk '{print $1}'` ]; then + mkdir -p "$M4ARCHIVEDIR" + mv "$CFGFILE" "$M4ARCHIVEDIR/$NAME.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "$CFGFILE.tmp" "$CFGFILE" + chown $USER:$GROUP $CFGFILE + chmod 640 $CFGFILE + fi + echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $OPTIONS || echo -n " already running" diff --git a/packaging/fedora/opensips.init b/packaging/fedora/opensips.init index 7e8ac40fcd..b2f0a2256a 100644 --- a/packaging/fedora/opensips.init +++ b/packaging/fedora/opensips.init @@ -21,10 +21,13 @@ . /etc/rc.d/init.d/functions prog=opensips -oser=/usr/sbin/$prog +opensips=/usr/sbin/$prog +cfgdir="/etc/$prog" pidfile="/var/run/$prog.pid" lockfile="/var/lock/subsys/$prog" -configfile="/etc/$prog/$prog.cfg" +configfile="$cfgdir/$prog.cfg" +m4configfile="$cfgdir/$prog.m4" +m4archivedir="$cfgdirg/archive" OPTIONS="" RETVAL=0 @@ -39,9 +42,32 @@ start() { return 0 fi + # Generate config from M4 + if [ -f $m4configfile ]; then + cd "$cfgdir" + m4 -Q $m4configfile >$configfile.tmp + if [ $? != 0 ]; then + echo -n "cannot process m4 macro" && failure && echo + rm "$configfile.tmp" + return 1 + fi + + [ -e $configfile ] || touch $configfile + + # compare configs + if [ `md5sum $configfile|awk '{print $1}'` != `md5sum $configfile.tmp|awk '{print $1}'` ]; then + mkdir -p "$m4archivedir" + mv "$configfile" "$m4archivedir/$prog.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "$configfile.tmp" "$configfile" + chown $prog:$prog $configfile + chmod 640 $configfile + fi + # there is something at end of this output which is needed to # report proper [ OK ] status in Fedora scripts - daemon $oser -P $pidfile -f $configfile $OPTIONS 2>/dev/null | tail -1 + daemon $opensips -u $prog -g $prog -P $pidfile -f $configfile $OPTIONS 2>/dev/null | tail -1 RETVAL=$? echo [ $RETVAL = 0 ] && touch $lockfile diff --git a/packaging/fedora/opensips.m4cfg b/packaging/fedora/opensips.m4cfg new file mode 100644 index 0000000000..e871e35205 --- /dev/null +++ b/packaging/fedora/opensips.m4cfg @@ -0,0 +1,32 @@ +#!/bin/bash + +prog=opensips +cfgdir="/etc/$prog" +configfile="$cfgdir/$prog.cfg" +m4configfile="$cfgdir/$prog.m4" +m4archivedir="$cfgdir/archive" + +# Generate config from M4 +if [ -f $m4configfile ]; then + cd "$cfgdir" + m4 -Q $m4configfile >$configfile.tmp + if [ $? != 0 ]; then + echo "cannot process m4 macro" + rm "$configfile.tmp" + exit 1 + fi + + [ -e $configfile ] || touch $configfile + + # compare configs + if [ `md5sum ${configfile}|awk '{print $1}'` != `md5sum ${configfile}.tmp|awk '{print $1}'` ]; then + mkdir -p "${m4archivedir}" + mv "${configfile}" "${m4archivedir}/${prog}.cfg-`date +%Y%m%d_%H%M%S`" + fi + + mv "${configfile}.tmp" "${configfile}" + chown ${prog}:${prog} ${configfile} + chmod 640 ${configfile} +fi + +exit 0 diff --git a/packaging/fedora/opensips.service b/packaging/fedora/opensips.service index c69f164379..7b0ea3a4b9 100644 --- a/packaging/fedora/opensips.service +++ b/packaging/fedora/opensips.service @@ -9,6 +9,7 @@ Group=opensips EnvironmentFile=-/etc/sysconfig/opensips PIDFile=/var/run/opensips/opensips.pid ExecStart=/usr/sbin/opensips -P /var/run/opensips/opensips.pid -f /etc/opensips/opensips.cfg $OPTIONS +ExecStartPre=/usr/sbin/opensips-m4cfg [Install] WantedBy=multi-user.target diff --git a/packaging/fedora/opensips.spec b/packaging/fedora/opensips.spec index 8c3a260aba..9e8b224aee 100644 --- a/packaging/fedora/opensips.spec +++ b/packaging/fedora/opensips.spec @@ -1,29 +1,27 @@ %if 0%{?rhel} # copied from lm_sensors exclusive arch %ifnarch alpha i386 i486 i586 i686 pentium3 pentium4 athlon x86_64 -%define disable_snmpstats snmpstats +%global disable_snmpstats snmpstats %endif %endif -%define EXCLUDE_MODULES mi_xmlrpc osp json %{?disable_snmpstats} %{!?_with_oracle:db_oracle} +%global EXCLUDE_MODULES sngtc osp cachedb_cassandra cachedb_couchbase cachedb_mongodb %{?disable_snmpstats} %{?el5:db_perlvdb} %{?el5:cachedb_redis} %{!?_with_oracle:db_oracle} lua Summary: Open Source SIP Server Name: opensips -Version: 1.9.0 -Release: 4%{?dist} +Version: 1.10.1 +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: http://opensips.org/pub/%{name}/%{version}/src/%{name}-%{version}-tls_src.tar.gz -Source1: %{name}.sysconfig -Patch1: opensips--init.patch -Patch2: opensips--openssl10.patch URL: http://opensips.org BuildRequires: expat-devel BuildRequires: libxml2-devel BuildRequires: bison BuildRequires: flex -#BuildRequires: subversion +BuildRequires: subversion +BuildRequires: which # needed by snmpstats BuildRequires: radiusclient-ng-devel BuildRequires: mysql-devel @@ -37,20 +35,38 @@ BuildRequires: net-snmp-devel BuildRequires: unixODBC-devel BuildRequires: openssl-devel BuildRequires: expat-devel -#BuildRequires: xmlrpc-c-devel +BuildRequires: xmlrpc-c-devel BuildRequires: libconfuse-devel +%if 0%{?rhel} BuildRequires: db4-devel +%else +BuildRequires: libdb-devel +%endif BuildRequires: openldap-devel BuildRequires: curl-devel -BuildRequires: libmemcached-devel BuildRequires: GeoIP-devel BuildRequires: pcre-devel - - +BuildRequires: python-devel +%if 0%{?fedora} > 16 +BuildRequires: systemd-units +%endif +BuildRequires: libxslt +BuildRequires: lynx +BuildRequires: ncurses-devel +BuildRequireS: json-c-devel + +#Initscripts +%if 0%{?fedora} > 16 +# Users and groups +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%else Requires(post): chkconfig Requires(preun):chkconfig -# for /sbin/service Requires(preun):initscripts +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -118,7 +134,7 @@ Summary: Routing extension suitable for carriers Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} -%description carrierroute +%description carrierroute A module which provides routing, balancing and blacklisting capabilities. %package cpl-c @@ -132,7 +148,7 @@ Support for uploading/downloading/removing scripts via SIP REGISTER method is present. %package db_berkeley -Summary: Berkley DB backend support +Summary: Berkeley DB backend support Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} @@ -149,6 +165,64 @@ Requires: %{name} = %{version}-%{release} This module provides access to a database that is implemented as a HTTP server. +%if %{undefined el5} +%package db_perlvdb +Summary: Perl virtual database engine +Group: System Environment/Daemons +# require perl-devel for >F7 and perl for <=F6 +BuildRequires: perl(ExtUtils::MakeMaker) +Requires: %{name} = %{version}-%{release} +Requires: %{name}-perl +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%description db_perlvdb +The Perl Virtual Database (VDB) provides a virtualization framework for +OpenSIPS's database access. It does not handle a particular database engine +itself but lets the user relay database requests to arbitrary Perl functions. +%endif + +%package event_datagram +Summary: Event datagram module +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description event_datagram +This is a module which provides a UNIX/UDP SOCKET transport layer +implementation for the Event Interface. + +%package event_rabbitmq +Summary: Event RabbitMQ module +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +BuildRequires: librabbitmq-devel + +%description event_rabbitmq +This module provides the implementation of a RabbitMQ client for the Event Interface. +It is used to send AMQP messages to a RabbitMQ server each time the Event Interface +triggers an event subscribed for. + +%package event_route +Summary: Route triggering based on events +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description event_route +This module provides a simple way for handling different events, triggered through +the OpenSIPS Event Interface, directly from the OpenSIPS script. For a specific event, +a special route (event_route) has to be declared in the script, and should contain +the code that handles the event. The route is executed by the module when the +corresponding event is raised by the OpenSIPS Event Interface. + +%package event_xmlrpc +Summary: Event XMLRPC client module +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description event_xmlrpc +This module is an implementation of an XMLRPC client used to notify XMLRPC servers +whenever certain notifications are raised by OpenSIPS. It acts as a transport layer +for the Event Notification Interface. + %package h350 Summary: H350 implementation Group: System Environment/Daemons @@ -159,6 +233,15 @@ The OpenSIPS H350 module enables an OpenSIPS SIP proxy server to access SIP account data stored in an LDAP [RFC4510] directory containing H.350 [H.350] commObjects. +%package httpd +Summary: HTTP transport layer implementation +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +BuildRequires: libmicrohttpd-devel + +%description httpd +This module provides an HTTP transport layer for OpenSIPS. + %package jabber Summary: Gateway between OpenSIPS and a jabber server Group: System Environment/Daemons @@ -167,6 +250,15 @@ Requires: %{name} = %{version}-%{release} %description jabber Jabber module that integrates XODE XML parser for parsing Jabber messages. +%package json +Summary: A JSON variables within the script +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description json +This module introduces a new type of variable that provides both serialization and +de-serialization from JSON format. + %package ldap Summary: LDAP connector Group: System Environment/Daemons @@ -179,6 +271,7 @@ The LDAP module implements an LDAP search interface for OpenSIPS. Summary: Memcached connector Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} +BuildRequires: libmemcached-devel %description memcached Memcached module is an implementation of a cache system designed to @@ -193,26 +286,36 @@ Requires: %{name} = %{version}-%{release} Mmgeoip is a lightweight wrapper for the MaxMind GeoIP API. It adds IP address-to-location lookup capability to OpenSIPS scripts. -%if %{defined db_oracle} +%package mysql +Summary: MySQL Storage Support for the OpenSIPS +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description mysql +The %{name}-mysql package contains the MySQL plugin for %{name}, which allows +a MySQL-Database to be used for persistent storage. + +%if 0%{?_with_oracle} %package oracle Summary: Oracle Storage Support for the OpenSIPS Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} +BuildRequires: oracle-instantclient-devel -%description oracle +%description oracle The %{name}-oracle package contains the Oracle plugin for %{name}, which allows a Oracle-Database to be used for persistent storage. %endif -%package mysql -Summary: MySQL Storage Support for the OpenSIPS +%package peering +Summary: Radius peering Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} - -%description mysql -The %{name}-mysql package contains the MySQL plugin for %{name}, which allows -a MySQL-Database to be used for persistent storage. +%description peering +Peering module allows SIP providers (operators or organizations) +to verify from a broker if source or destination of a SIP request +is a trusted peer. %package perl Summary: Helps implement your own OpenSIPS extensions in Perl @@ -222,7 +325,11 @@ BuildRequires: perl(ExtUtils::MakeMaker) %if 0%{?rhel} BuildRequires: perl(ExtUtils::Embed) %else +%if 0%{?redhat} == 5 BuildRequires: perl(ExtUtils::Embed), perl-devel +%else +BuildRequires: perl(ExtUtils::Embed) +%endif %endif Requires: %{name} = %{version}-%{release} Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) @@ -236,29 +343,15 @@ simple access to the full world of CPAN modules. SIP URI rewriting could be implemented based on regular expressions; accessing arbitrary data backends, e.g. LDAP or Berkeley DB files, is now extremely simple. -%package perlvdb -Summary: Perl virtual database engine +%package pi_http +Summary: Provisioning Interface module Group: System Environment/Daemons -# require perl-devel for >F7 and perl for <=F6 -BuildRequires: perl(ExtUtils::MakeMaker) Requires: %{name} = %{version}-%{release} -Requires: %{name}-perl -Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) -%description perlvdb -The Perl Virtual Database (VDB) provides a virtualization framework for -OpenSIPS's database access. It does not handle a particular database engine -itself but lets the user relay database requests to arbitrary Perl functions. - -%package peering -Summary: Radius peering -Group: System Environment/Daemons -Requires: %{name} = %{version}-%{release} - -%description peering -Peering module allows SIP providers (operators or organizations) -to verify from a broker if source or destination of a SIP request -is a trusted peer. +%description pi_http +This module provides an HTTP provisioning interface for OpenSIPS. It is using the +OpenSIPS's internal database API to provide a simple way of manipulating records +inside OpenSIPS's tables. %package postgresql Summary: PostgreSQL Storage Support for the OpenSIPS @@ -281,6 +374,19 @@ of published presence information for the same presentity using more devices. It can also filter the information provided to watchers according to privacy rules. +%package presence_callinfo +Summary: SIMPLE Presence extension +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +Requires: %{name}-presence + +%description presence_callinfo +The module enables the handling of "call-info" and "line-seize" events inside +the presence module. It is used with the general event handling module: +presence and it constructs and adds "Call-Info" headers to notification events. +To send "call-info" notification to watchers, a third-party application must +publish "call-info" events to the presence server. + %package presence_dialoginfo Summary: Extension to Presence server for Dialog-Info Group: System Environment/Daemons @@ -320,7 +426,6 @@ Summary: SIMPLE Presence extension Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} Requires: %{name}-presence -Requires: %{name}-xcap Requires: %{name}-xcap_client %description presence_xml @@ -336,6 +441,17 @@ Requires: %{name} = %{version}-%{release} This module offer the functionality of a presence user agent client, sending Subscribe and Publish messages. +%package pua_bla +Summary: BLA extension for PUA +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +Requires: %{name}-pua +Requires: %{name}-presence + +%description pua_bla +The pua_bla module enables Bridged Line Appearances support according to the +specifications in draft-anil-sipping-bla-03.txt. + %package pua_dialoginfo Summary: Dialog-Info extension for PUA Group: System Environment/Daemons @@ -349,17 +465,6 @@ pua module. Thus, in combination with the presence_xml module this can be used to derive dialog-info from the dialog module and NOTIFY the subscribed watchers about dialog-info changes. -%package pua_bla -Summary: BLA extension for PUA -Group: System Environment/Daemons -Requires: %{name} = %{version}-%{release} -Requires: %{name}-pua -Requires: %{name}-presence - -%description pua_bla -The pua_bla module enables Bridged Line Appearances support according to the -specifications in draft-anil-sipping-bla-03.txt. - %package pua_mi Summary: Connector between usrloc and MI interface Group: System Environment/Daemons @@ -399,6 +504,26 @@ This module is a gateway for presence between SIP and XMPP. It translates one format into another and uses xmpp, pua and presence modules to manage the transmition of presence state information. +%package python +Summary: Python scripting support +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description python +Helps implement your own OpenSIPS extensions in Python + +%if %{undefined el5} +%package redis +Summary: Redis connector +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +BuildRequires: hiredis-devel + +%description redis +This module is an implementation of a cache system designed to work +with a Redis server. +%endif + %package regex Summary: RegExp via PCRE library Group: System Environment/Daemons @@ -408,12 +533,22 @@ Requires: %{name} = %{version}-%{release} This module offers matching operations against regular expressions using the powerful PCRE library. +%package rest_client +Summary: Implementation of an HTTP client +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description rest_client +The rest_client module provides a means of interacting with an HTTP server +by doing RESTful queries, such as GET and POST. + %package rls Summary: Resource List Server Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} -Requires: %{name}-pua -Requires: %{name}-presence +Requires: %{name}-pua +Requires: %{name}-presence +Requires: %{name}-xcap %description rls The modules is a Resource List Server implementation following the @@ -481,17 +616,18 @@ The %{name}-unixodbc package contains the unixODBC plugin for %{name}, which allows a unixODBC to be used for persistent storage %package xcap -Summary: XCAP utilities +Summary: XCAP API provider Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} %description xcap -The modules contains XCAP related utilities for OpenSIPS +The module contains several parameters and functions common to all modules using XCAP capabilities. %package xcap_client Summary: XCAP client Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} +Requires: %{name}-xcap %description xcap_client The modules is an XCAP client for OpenSIPS that can be used by other modules. @@ -499,6 +635,15 @@ It fetches XCAP elements, either documents or part of them, by sending HTTP GET requests. It also offers support for conditional queries. It uses libcurl library as a client-side HTTP transfer library. +%package xmlrpc +Summary: A xmlrpc server +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description xmlrpc +This module implements a xmlrpc server that handles xmlrpc requests and generates +xmlrpc responses. When a xmlrpc message is received a default method is executed. + %package xmpp Summary: Gateway between OpenSIPS and a jabber server Group: System Environment/Daemons @@ -511,14 +656,12 @@ clients. %prep %setup -q -n %{name}-%{version}-tls -%patch1 -p1 -%patch2 -p1 %build -LOCALBASE=/usr CFLAGS="%{optflags}" %{__make} all %{?_smp_mflags} TLS=1 \ +LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ exclude_modules="%EXCLUDE_MODULES" \ cfg-target=%{_sysconfdir}/opensips/ \ - modules-prefix=%{buildroot}/%{_prefix} \ + modules-prefix=%{buildroot}%{_prefix} \ modules-dir=%{_lib}/%{name}/modules %install @@ -532,6 +675,9 @@ rm -rf $RPM_BUILD_ROOT DBTEXTON=yes # fixed dbtext documentation installation # clean some things +%if 0%{?el5} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/opensips/perl/OpenSIPS/VDB* +%endif mkdir -p $RPM_BUILD_ROOT/%{perl_vendorlib} if [ -d "$RPM_BUILD_ROOT/%{_prefix}/perl" ]; then # for fedora>=11 @@ -554,54 +700,104 @@ for i in docdir/*; do rm -f $i.old done -mkdir -p $RPM_BUILD_ROOT%{_initrddir} -%{__install} -p -D -m 755 packaging/fedora/opensips.init \ - $RPM_BUILD_ROOT%{_initrddir}/opensips +%if 0%{?fedora} > 16 +# install systemd files +install -D -m 0644 -p packaging/fedora/%{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service +install -D -m 0644 -p packaging/fedora/%{name}.tmpfiles.conf $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf +install -D -m 0755 -p packaging/fedora/%{name}.m4cfg $RPM_BUILD_ROOT%{_sbindir}/%{name}-m4cfg +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name} +%else +install -p -D -m 755 packaging/fedora/opensips.init $RPM_BUILD_ROOT%{_initrddir}/opensips +%endif echo -e "\nETCDIR=\"%{_sysconfdir}/opensips\"\n" \ >> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/opensipsctlrc #install sysconfig file -install -D -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} +install -D -p -m 644 packaging/fedora/%{name}.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} %clean rm -rf $RPM_BUILD_ROOT + +%pre +getent group %{name} >/dev/null || groupadd -r %{name} +getent passwd %{name} >/dev/null || \ +useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ +-c "OpenSIPS SIP Server" %{name} 2>/dev/null || : + %post -/sbin/chkconfig --add opensips +%if 0%{?fedora} > 16 +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi +%else +/sbin/chkconfig --add %{name} +%endif %preun +%if 0%{?fedora} > 16 +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : + /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : +fi +%else if [ $1 = 0 ]; then - /sbin/service opensips stop > /dev/null 2>&1 - /sbin/chkconfig --del opensips + /sbin/service %{name} stop > /dev/null 2>&1 + /sbin/chkconfig --del %{name} fi +%endif + +%if 0%{?fedora} > 16 +%triggerun -- %{name} < 1.7.2-1 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply opensips +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del %{name} >/dev/null 2>&1 || : +/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : + +%triggerun -- opensips < 1.7.2-4 +chown -R %{name}:%{name} %{_sysconfdir}/%{name} +%endif %files -%defattr(-,root,root,-) %{_sbindir}/opensips %{_sbindir}/opensipsctl %{_sbindir}/opensipsdbctl %{_sbindir}/opensipsunix +%{_sbindir}/osipsconfig %{_sbindir}/osipsconsole -%attr(750,root,root) %dir %{_sysconfdir}/opensips -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/rootCA -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/rootCA/certs -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/rootCA/private -%attr(750,root,root) %dir %{_sysconfdir}/opensips/tls/user +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/rootCA +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/rootCA/certs +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/rootCA/private +%attr(750,%{name},%{name}) %dir %{_sysconfdir}/opensips/tls/user %dir %{_libdir}/opensips/ %dir %{_libdir}/opensips/modules/ %dir %{_libdir}/opensips/opensipsctl/ -%dir %{_libdir}/opensips/opensipsctl/dbtextdb +%dir %{_libdir}/opensips/opensipsctl/dbtextdb/ +%if 0%{?fedora} > 16 +%{_unitdir}/%{name}.service +%{_sysconfdir}/tmpfiles.d/%{name}.conf +%{_sbindir}/%{name}-m4cfg +%dir %attr(0755, %{name}, %{name}) %{_localstatedir}/run/%{name} +%else %attr(755,root,root) %{_initrddir}/opensips +%endif %config(noreplace) %{_sysconfdir}/opensips/dictionary.opensips %config(noreplace) %{_sysconfdir}/sysconfig/%{name} -%attr(640,root,root) %config(noreplace) %{_sysconfdir}/opensips/opensips.cfg -%attr(640,root,root) %config(noreplace) %{_sysconfdir}/opensips/opensipsctlrc -%attr(640,root,root) %config(noreplace) %{_sysconfdir}/opensips/osipsconsolerc -# these files are just an example so no need to restrict access to them +%attr(640,%{name},%{name}) %config(noreplace) %{_sysconfdir}/opensips/opensips.cfg +%attr(640,%{name},%{name}) %config(noreplace) %{_sysconfdir}/opensips/opensipsctlrc +%attr(640,%{name},%{name}) %config(noreplace) %{_sysconfdir}/opensips/osipsconsolerc +# these files are just an examples so no need to restrict access to them %config(noreplace) %{_sysconfdir}/opensips/tls/ca.conf %config(noreplace) %{_sysconfdir}/opensips/tls/request.conf %config(noreplace) %{_sysconfdir}/opensips/tls/rootCA/cacert.pem @@ -615,15 +811,24 @@ fi %config(noreplace) %{_sysconfdir}/opensips/tls/user/user-cert_req.pem %config(noreplace) %{_sysconfdir}/opensips/tls/user/user-privkey.pem -%{_libdir}/opensips/opensipsctl/opensipsctl.* +%{_libdir}/opensips/opensipsctl/opensipsctl.base +%{_libdir}/opensips/opensipsctl/opensipsctl.ctlbase +%{_libdir}/opensips/opensipsctl/opensipsctl.dbtext +%{_libdir}/opensips/opensipsctl/opensipsctl.fifo +%{_libdir}/opensips/opensipsctl/opensipsctl.sqlbase +%{_libdir}/opensips/opensipsctl/opensipsctl.unixsock + %{_libdir}/opensips/opensipsctl/opensipsdbctl.base %{_libdir}/opensips/opensipsctl/opensipsdbctl.dbtext %{_libdir}/opensips/opensipsctl/dbtextdb/dbtextdb.py* -%dir %{_datadir}/opensips -%dir %{_datadir}/opensips/dbtext -%dir %{_datadir}/opensips/dbtext/opensips +%dir %{_datadir}/opensips/ +%dir %{_datadir}/opensips/dbtext/ +%dir %{_datadir}/opensips/dbtext/opensips/ +%dir %{_datadir}/opensips/menuconfig_templates/ + %{_datadir}/opensips/dbtext/opensips/* +%{_datadir}/opensips/menuconfig_templates/*.m4 %{_mandir}/man5/opensips.cfg.5* %{_mandir}/man8/opensips.8* @@ -634,7 +839,6 @@ fi %doc docdir/NEWS %doc docdir/README %doc docdir/README-MODULES -%doc docdir/README.tls %doc COPYING %{_libdir}/opensips/modules/acc.so @@ -643,12 +847,16 @@ fi %{_libdir}/opensips/modules/auth_db.so %{_libdir}/opensips/modules/avpops.so %{_libdir}/opensips/modules/benchmark.so +%{_libdir}/opensips/modules/cachedb_local.so +%{_libdir}/opensips/modules/cachedb_sql.so %{_libdir}/opensips/modules/call_control.so %{_libdir}/opensips/modules/closeddial.so %{_libdir}/opensips/modules/cfgutils.so +%{_libdir}/opensips/modules/db_cachedb.so %{_libdir}/opensips/modules/db_flatstore.so %{_libdir}/opensips/modules/db_virtual.so %{_libdir}/opensips/modules/db_text.so +%{_libdir}/opensips/modules/dns_cache.so %{_libdir}/opensips/modules/dialog.so %{_libdir}/opensips/modules/dialplan.so %{_libdir}/opensips/modules/dispatcher.so @@ -663,15 +871,17 @@ fi %{_libdir}/opensips/modules/identity.so %{_libdir}/opensips/modules/imc.so %{_libdir}/opensips/modules/load_balancer.so -%{_libdir}/opensips/modules/localcache.so %{_libdir}/opensips/modules/mangler.so +%{_libdir}/opensips/modules/mathops.so %{_libdir}/opensips/modules/maxfwd.so %{_libdir}/opensips/modules/mediaproxy.so %{_libdir}/opensips/modules/mi_fifo.so %{_libdir}/opensips/modules/mi_datagram.so +%{_libdir}/opensips/modules/mi_http.so %{_libdir}/opensips/modules/msilo.so %{_libdir}/opensips/modules/nathelper.so %{_libdir}/opensips/modules/nat_traversal.so +%{_libdir}/opensips/modules/rtpproxy.so %{_libdir}/opensips/modules/options.so %{_libdir}/opensips/modules/path.so %{_libdir}/opensips/modules/pdt.so @@ -682,6 +892,8 @@ fi %{_libdir}/opensips/modules/registrar.so %{_libdir}/opensips/modules/rr.so %{_libdir}/opensips/modules/signaling.so +%{_libdir}/opensips/modules/sipcapture.so +%{_libdir}/opensips/modules/sipmsgops.so %{_libdir}/opensips/modules/siptrace.so %{_libdir}/opensips/modules/sl.so %{_libdir}/opensips/modules/speeddial.so @@ -695,7 +907,8 @@ fi %{_libdir}/opensips/modules/userblacklist.so %{_libdir}/opensips/modules/uri.so %{_libdir}/opensips/modules/usrloc.so -%{_libdir}/opensips/modules/xlog.so +%{_libdir}/opensips/modules/uac_auth.so +%{_libdir}/opensips/modules/uac_registrant.so %doc docdir/README.acc %doc docdir/README.alias_db @@ -703,89 +916,104 @@ fi %doc docdir/README.auth_db %doc docdir/README.avpops %doc docdir/README.benchmark +%doc docdir/README.cachedb_local +%doc docdir/README.cachedb_sql +%doc docdir/README.call_control %doc docdir/README.cfgutils +%doc docdir/README.closeddial +%doc docdir/README.db_cachedb +%doc docdir/README.db_flatstore %doc docdir/README.db_text +%doc docdir/README.db_virtual %doc docdir/README.dialog %doc docdir/README.dialplan %doc docdir/README.dispatcher %doc docdir/README.diversion +%doc docdir/README.dns_cache %doc docdir/README.domain %doc docdir/README.domainpolicy %doc docdir/README.drouting %doc docdir/README.enum %doc docdir/README.exec -#%doc docdir/README.flatstore %doc docdir/README.gflags %doc docdir/README.group +%doc docdir/README.identity %doc docdir/README.imc +%doc docdir/README.load_balancer %doc docdir/README.mangler +%doc docdir/README.mathops %doc docdir/README.maxfwd %doc docdir/README.mediaproxy -%doc docdir/README.mi_fifo %doc docdir/README.mi_datagram +%doc docdir/README.mi_fifo +%doc docdir/README.mi_http %doc docdir/README.msilo +%doc docdir/README.nat_traversal %doc docdir/README.nathelper %doc docdir/README.options %doc docdir/README.path %doc docdir/README.pdt %doc docdir/README.permissions %doc docdir/README.pike +%doc docdir/README.qos +%doc docdir/README.ratelimit %doc docdir/README.registrar %doc docdir/README.rr +%doc docdir/README.rtpproxy +%doc docdir/README.signaling +%doc docdir/README.sipcapture +%doc docdir/README.sipmsgops %doc docdir/README.siptrace %doc docdir/README.sl %doc docdir/README.speeddial %doc docdir/README.sst %doc docdir/README.statistics -#%doc docdir/README.textops +%doc docdir/README.stun +%doc docdir/README.textops +%doc docdir/README.tls %doc docdir/README.tm %doc docdir/README.uac +%doc docdir/README.uac_auth %doc docdir/README.uac_redirect +%doc docdir/README.uac_registrant %doc docdir/README.uri +%doc docdir/README.userblacklist %doc docdir/README.usrloc -%doc docdir/README.xlog %files aaa_radius -%defattr(-,root,root,-) %{_libdir}/opensips/modules/aaa_radius.so %doc docdir/README.aaa_radius %files acc -%defattr(-,root,root,-) %{_libdir}/opensips/modules/acc.so %doc docdir/README.acc %files auth_aaa -%defattr(-,root,root,-) %{_libdir}/opensips/modules/auth_aaa.so %doc docdir/README.auth_aaa %files auth_diameter -%defattr(-,root,root,-) %{_libdir}/opensips/modules/auth_diameter.so %doc docdir/README.auth_diameter %files b2bua -%defattr(-,root,root,-) %{_libdir}/opensips/modules/b2b_entities.so %{_libdir}/opensips/modules/b2b_logic.so %doc docdir/README.b2b_entities %doc docdir/README.b2b_logic %files carrierroute -%defattr(-,root,root,-) %{_libdir}/opensips/modules/carrierroute.so %doc docdir/README.carrierroute %files cpl-c -%defattr(-,root,root,-) %{_libdir}/opensips/modules/cpl-c.so %doc docdir/README.cpl-c %files db_berkeley -%defattr(-,root,root,-) %{_sbindir}/bdb_recover %{_libdir}/opensips/modules/db_berkeley.so +%{_libdir}/opensips/opensipsctl/opensipsctl.db_berkeley %{_libdir}/opensips/opensipsctl/opensipsdbctl.db_berkeley %dir %{_datadir}/opensips/db_berkeley %dir %{_datadir}/opensips/db_berkeley/opensips @@ -793,55 +1021,99 @@ fi %doc docdir/README.db_berkeley %files db_http -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_http.so %doc docdir/README.db_http +%if %{undefined el5} +%files db_perlvdb +%dir %{perl_vendorlib}/OpenSIPS/VDB +%dir %{perl_vendorlib}/OpenSIPS/VDB/Adapter +%{_libdir}/opensips/modules/db_perlvdb.so +%{perl_vendorlib}/OpenSIPS/VDB.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/AccountingSIPtrace.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Alias.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Auth.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Describe.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Speeddial.pm +%{perl_vendorlib}/OpenSIPS/VDB/Adapter/TableVersions.pm +%{perl_vendorlib}/OpenSIPS/VDB/Column.pm +%{perl_vendorlib}/OpenSIPS/VDB/Pair.pm +%{perl_vendorlib}/OpenSIPS/VDB/ReqCond.pm +%{perl_vendorlib}/OpenSIPS/VDB/Result.pm +%{perl_vendorlib}/OpenSIPS/VDB/VTab.pm +%{perl_vendorlib}/OpenSIPS/VDB/Value.pm +%doc docdir/README.db_perlvdb +%endif + +%files event_datagram +%{_libdir}/opensips/modules/event_datagram.so +%doc docdir/README.event_datagram + +%files event_rabbitmq +%{_libdir}/opensips/modules/event_rabbitmq.so +%doc docdir/README.event_rabbitmq + +%files event_route +%{_libdir}/opensips/modules/event_route.so +%doc docdir/README.event_route + +%files event_xmlrpc +%{_libdir}/opensips/modules/event_xmlrpc.so +%doc docdir/README.event_xmlrpc + %files h350 -%defattr(-,root,root,-) %{_libdir}/opensips/modules/h350.so %doc docdir/README.h350 +%files httpd +%{_libdir}/opensips/modules/httpd.so +%doc docdir/README.httpd + %files jabber -%defattr(-,root,root,-) %{_libdir}/opensips/modules/jabber.so %doc docdir/README.jabber +%files json +%{_libdir}/opensips/modules/json.so +%doc docdir/README.json + %files ldap -%defattr(-,root,root,-) %{_libdir}/opensips/modules/ldap.so %doc docdir/README.ldap %files memcached -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/memcached.so -%doc docdir/README.memcached +%{_libdir}/opensips/modules/cachedb_memcached.so +%doc docdir/README.cachedb_memcached %files mmgeoip -%defattr(-,root,root,-) %{_libdir}/opensips/modules/mmgeoip.so %doc docdir/README.mmgeoip %files mysql -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_mysql.so +%{_libdir}/opensips/opensipsctl/opensipsctl.mysql %{_libdir}/opensips/opensipsctl/opensipsdbctl.mysql %dir %{_datadir}/opensips/mysql %{_datadir}/opensips/mysql/*.sql %doc docdir/README.db_mysql -%if %{defined db_oracle} +%if 0%{?_with_oracle} %files oracle -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/db_oracle.db +%{_sbindir}/opensips_orasel +%{_libdir}/opensips/modules/db_oracle.so +%{_libdir}/opensips/opensipsctl/opensipsctl.oracle %{_libdir}/opensips/opensipsctl/opensipsdbctl.oracle +%{_libdir}/opensips/opensipsctl/opensipsdbfunc.oracle %dir %{_datadir}/opensips/oracle %{_datadir}/opensips/oracle/* %doc docdir/README.db_oracle %endif +%files peering +%{_libdir}/opensips/modules/peering.so +%doc docdir/README.peering + %files perl -%defattr(-,root,root,-) %dir %{perl_vendorlib}/OpenSIPS %dir %{perl_vendorlib}/OpenSIPS/LDAPUtils %dir %{perl_vendorlib}/OpenSIPS/Utils @@ -855,116 +1127,98 @@ fi %{perl_vendorlib}/OpenSIPS/Utils/Debug.pm %doc docdir/README.perl -%files perlvdb -%defattr(-,root,root,-) -%dir %{perl_vendorlib}/OpenSIPS/VDB -%dir %{perl_vendorlib}/OpenSIPS/VDB/Adapter -%{_libdir}/opensips/modules/db_perlvdb.so -%{perl_vendorlib}/OpenSIPS/VDB.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/AccountingSIPtrace.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Alias.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Auth.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Describe.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/Speeddial.pm -%{perl_vendorlib}/OpenSIPS/VDB/Adapter/TableVersions.pm -%{perl_vendorlib}/OpenSIPS/VDB/Column.pm -%{perl_vendorlib}/OpenSIPS/VDB/Pair.pm -%{perl_vendorlib}/OpenSIPS/VDB/ReqCond.pm -%{perl_vendorlib}/OpenSIPS/VDB/Result.pm -%{perl_vendorlib}/OpenSIPS/VDB/VTab.pm -%{perl_vendorlib}/OpenSIPS/VDB/Value.pm -%doc docdir/README.perlvdb - -%files peering -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/peering.so -%doc docdir/README.peering +%files pi_http +%{_libdir}/opensips/modules/pi_http.so +%{_datadir}/opensips/pi_http/* +%doc docdir/README.pi_http %files postgresql -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_postgres.so +%{_libdir}/opensips/opensipsctl/opensipsctl.pgsql %{_libdir}/opensips/opensipsctl/opensipsdbctl.pgsql %dir %{_datadir}/opensips/postgres %{_datadir}/opensips/postgres/*.sql %doc docdir/README.db_postgres %files presence -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence.so %doc docdir/README.presence +%files presence_callinfo +%{_libdir}/opensips/modules/presence_callinfo.so +%doc docdir/README.presence_callinfo + %files presence_dialoginfo -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_dialoginfo.so %doc docdir/README.presence_dialoginfo %files presence_mwi -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_mwi.so %doc docdir/README.presence_mwi %files presence_xcapdiff -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_xcapdiff.so +%doc docdir/README.presence_xcapdiff %files presence_xml -%defattr(-,root,root,-) %{_libdir}/opensips/modules/presence_xml.so %doc docdir/README.presence_xml %files pua -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua.so %doc docdir/README.pua -%files pua_dialoginfo -%defattr(-,root,root,-) -%{_libdir}/opensips/modules/pua_dialoginfo.so -%doc docdir/README.pua_dialoginfo - %files pua_bla -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_bla.so %doc docdir/README.pua_bla +%files pua_dialoginfo +%{_libdir}/opensips/modules/pua_dialoginfo.so +%doc docdir/README.pua_dialoginfo + %files pua_mi -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_mi.so %doc docdir/README.pua_mi %files pua_usrloc -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_usrloc.so %doc docdir/README.pua_usrloc %files pua_xmpp -%defattr(-,root,root,-) %{_libdir}/opensips/modules/pua_xmpp.so %doc docdir/README.pua_xmpp +%files python +%{_libdir}/opensips/modules/python.so + +%if %{undefined el5} +%files redis +%{_libdir}/opensips/modules/cachedb_redis.so +%doc docdir/README.cachedb_redis +%endif + %files regex -%defattr(-,root,root,-) %{_libdir}/opensips/modules/regex.so %doc docdir/README.regex +%files rest_client +%{_libdir}/opensips/modules/rest_client.so +%doc docdir/README.rest_client + %files rls -%defattr(-,root,root,-) %{_libdir}/opensips/modules/rls.so %doc docdir/README.rls %files seas -%defattr(-,root,root,-) %{_libdir}/opensips/modules/seas.so %doc docdir/README.seas %files sms -%defattr(-,root,root,-) %{_libdir}/opensips/modules/sms.so %doc docdir/README.sms %if %{undefined disable_snmpstats} %files snmpstats -%defattr(-,root,root,-) %{_libdir}/opensips/modules/snmpstats.so %doc docdir/README.snmpstats %dir %{_datadir}/snmp @@ -977,35 +1231,189 @@ fi %endif %files tlsops -%defattr(-,root,root,-) %{_libdir}/opensips/modules/tlsops.so %doc docdir/README.tlsops %files unixodbc -%defattr(-,root,root,-) %{_libdir}/opensips/modules/db_unixodbc.so %doc docdir/README.db_unixodbc %files xcap -%defattr(-,root,root,-) %{_libdir}/opensips/modules/xcap.so %doc docdir/README.xcap %files xcap_client -%defattr(-,root,root,-) %{_libdir}/opensips/modules/xcap_client.so %doc docdir/README.xcap_client +%files xmlrpc +%{_libdir}/opensips/modules/mi_xmlrpc.so +%{_libdir}/opensips/modules/mi_xmlrpc_ng.so +%doc docdir/README.mi_xmlrpc +%doc docdir/README.mi_xmlrpc_ng + %files xmpp -%defattr(-,root,root,-) %{_libdir}/opensips/modules/xmpp.so %doc docdir/README.xmpp %changelog -* Wed Nov 04 2009 John Khvatov - 1.6.0-4: +* Tue Jul 30 2013 Nick Altmann - 1.10.1-1 +- Update to 1.10.1 + +* Wed May 22 2013 Nick Altmann - 1.9.1-1 +- Rebuild specification, add new modules and dependencies + +* Tue Jan 22 2013 Peter Lemenkov - 1.8.2-3 +- Revert systemd macros + +* Thu Jan 10 2013 Peter Lemenkov - 1.8.2-2 +- Allow rtpproxy module to accept avps +- Few bugfixes + +* Tue Nov 06 2012 Peter Lemenkov - 1.8.2-1 +- Ver. 1.8.2 (Bugfix release) + +* Sat Sep 22 2012 Remi Collet - 1.8.1-3 +- rebuild against libmemcached.so.11 without SASL + +* Fri Aug 17 2012 Peter Lemenkov - 1.8.1-2 +- Enabled json module +- Enabled xmlrpc module +- Enabled cachedb_memcached module on EL5, EL6 +- Enabled cachedb_redis module on EL6 + +* Wed Aug 15 2012 Peter Lemenkov - 1.8.1-1 +- Ver. 1.8.1 +- Dropped all upstreamed patches + +* Fri Jul 20 2012 Fedora Release Engineering - 1.8.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 09 2012 Petr Pisar - 1.8.0-2 +- Perl 5.16 rebuild + +* Tue Jul 03 2012 Peter Lemenkov - 1.8.0-1 +- update to 1.8.0 + +* Fri Jun 08 2012 Petr Pisar - 1.7.2-8 +- Perl 5.16 rebuild + +* Sat May 12 2012 Peter Lemenkov - 1.7.2-7 +- Change %%define to %%global + +* Sat May 12 2012 Peter Lemenkov - 1.7.2-6 +- Added missing docs + +* Fri May 11 2012 Peter Lemenkov - 1.7.2-5 +- Fixed conditional building with Oracle DB + +* Sat Apr 28 2012 Peter Lemenkov - 1.7.2-4 +- Fixes for systemd unit + +* Sun Apr 22 2012 Remi Collet - 1.7.2-3 +- rebuild against libmemcached.so.10 + +* Thu Apr 19 2012 Peter Lemenkov - 1.7.2-2 +- Fix building on EPEL + +* Thu Apr 19 2012 Peter Lemenkov - 1.7.2-1 +- update to 1.7.2 (bugfix release). +- enable systemd support where possible + +* Fri Apr 13 2012 Jindrich Novy - 1.7.1-6 +- rebuild against new librpm and libdb + +* Sat Mar 03 2012 Remi Collet - 1.7.1-5 +- rebuild against libmemcached.so.9 + +* Fri Feb 10 2012 Petr Pisar - 1.7.1-4 +- Rebuild against PCRE 8.30 + +* Fri Jan 13 2012 Fedora Release Engineering - 1.7.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Dec 01 2011 John Khvatov - 1.7.1-2 +- upstream tarball rebuild + +* Thu Nov 24 2011 John Khvatov - 1.7.1-1 +- update to 1.7.1 (bugfix release). + +* Mon Nov 07 2011 John Khvatov - 1.7.0-1 +- update to 1.7.0 +- dropped upstreamed patches +- added new modules: event_datagram and python +- removed lcr module + +* Sat Sep 17 2011 Remi Collet - 1.6.4-13 +- rebuild against libmemcached.so.8 + +* Mon Aug 22 2011 John Khvatov - 1.6.4-12 +- rebuild against new libnetsnmp + +* Thu Jul 21 2011 Petr Sabata - 1.6.4-11 +- Perl mass rebuild + +* Wed Jul 20 2011 Petr Sabata - 1.6.4-10 +- Perl mass rebuild + +* Mon Jul 11 2011 Peter Lemenkov - 1.6.4-9 +- Updated init-script + +* Mon Jul 11 2011 Peter Lemenkov - 1.6.4-8 +- Upstream re-released traball with several new patches (API compatible) + +* Fri Jun 17 2011 Marcela Mašláňová - 1.6.4-7 +- Perl mass rebuild + +* Wed Mar 23 2011 Dan Horák - 1.6.4-6 +- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient) + +* Tue Feb 08 2011 Fedora Release Engineering - 1.6.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Dec 22 2010 John Khvatov - 1.6.4-1 +- dropped upstreamed patch (opensips-build.patch) +- update to 1.6.4 +- added new module: presence_callinfo + +* Sat Oct 30 2010 John Khvatov - 1.6.3-4 +- rebuild against new libnetsnmp + +* Wed Oct 06 2010 Remi Collet - 1.6.3-3 +- rebuilt against new libmemcached + +* Wed Sep 08 2010 Dan Horák - 1.6.3-2 +- fix a build issue + +* Thu Aug 12 2010 John Khvatov - 1.6.3-1 +- update to 1.6.3 + +* Wed Aug 11 2010 David Malcolm - 1.6.2-5 +- recompiling .py files against Python 2.7 (rhbz#623343) + +* Tue Jun 01 2010 Marcela Maslanova - 1.6.2-4 +- Mass rebuild with perl-5.12.0 + +* Wed May 05 2010 Remi Collet - 1.6.2-3 +- rebuilt against new libmemcached + +* Thu Apr 15 2010 John Khvatov - 1.6.2-2 +- Disabled build of the memcached subpackage for EPEL + +* Thu Apr 15 2010 John Khvatov - 1.6.2-1 +- Updated to 1.6.2 + +* Sun Feb 07 2010 Remi Collet - 1.6.1-2 +- rebuilt against new libmemcached + +* Tue Dec 22 2009 John Khvatov - 1.6.1-1 +- Updated to 1.6.1 +- Dropped upstreamed patches + +* Wed Nov 04 2009 John Khvatov - 1.6.0-4 - Fixed typo: pia_mi to pua_mi in presence_xcapdiff dependencies -* Thu Nov 03 2009 John Khvatov - 1.6.0-3 +* Tue Nov 03 2009 John Khvatov - 1.6.0-3 - Added patch for compatibility with new openssl * Thu Oct 29 2009 John Khvatov - 1.6.0-2 @@ -1141,7 +1549,7 @@ fi * Thu Sep 6 2007 Peter Lemenkov 1.2.2-8 - Added another one missing BR - which (needs by snmpstats module) - Cosmetic: dropped commented out 'Requires' - + * Thu Sep 06 2007 Jan ONDREJ (SAL) 1.2.2-7 - added attr macro for init script - added -p to install arguments to preserve timestamp @@ -1173,3 +1581,4 @@ fi * Tue Jul 24 2007 Peter Lemenkov 1.2.1-1 - Initial spec. + diff --git a/packaging/freebsd/Makefile b/packaging/freebsd/Makefile index bb58c61ee8..16f75ace12 100644 --- a/packaging/freebsd/Makefile +++ b/packaging/freebsd/Makefile @@ -6,7 +6,7 @@ # PORTNAME= opensips -PORTVERSION= 1.9.0 +PORTVERSION= 1.10.1 CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/${PORTVERSION}/src/ DISTNAME= ${PORTNAME}-${PORTVERSION}-tls_src diff --git a/packaging/gentoo/opensips-1.9.0.ebuild b/packaging/gentoo/opensips-1.10.1.ebuild similarity index 100% rename from packaging/gentoo/opensips-1.9.0.ebuild rename to packaging/gentoo/opensips-1.10.1.ebuild diff --git a/packaging/netbsd/Makefile b/packaging/netbsd/Makefile index 5fcb512ed5..228c84ec5e 100644 --- a/packaging/netbsd/Makefile +++ b/packaging/netbsd/Makefile @@ -8,9 +8,9 @@ COMMENT= "OpenSIPS" PORTNAME= opensips -PORTVERSION= 1.9.0-notls +PORTVERSION= 1.10.1-notls CATEGORIES= net -MASTER_SITES= http://opensips.org/pub/opensips/1.9.0/src/ +MASTER_SITES= http://opensips.org/pub/opensips/1.10.1/src/ MAINTAINER= bogdan@opensips.org diff --git a/packaging/openbsd/Makefile b/packaging/openbsd/Makefile index 6a6c6744ea..a02a90a78e 100644 --- a/packaging/openbsd/Makefile +++ b/packaging/openbsd/Makefile @@ -8,7 +8,7 @@ COMMENT= "OpenSIPS" PORTNAME= opensips -PORTVERSION= 1.9.0-notls +PORTVERSION= 1.10.1-notls CATEGORIES= net MASTER_SITES= http://opensips.org/pub/opensips/1.6.0/src/ diff --git a/packaging/rpm/opensips.spec.CentOS b/packaging/rpm/opensips.spec.CentOS index b51f633f5c..6457bbab0d 100644 --- a/packaging/rpm/opensips.spec.CentOS +++ b/packaging/rpm/opensips.spec.CentOS @@ -1,6 +1,6 @@ %define name opensips -%define ver 1.9.1 -%define rel 5 +%define ver 1.10.1 +%define rel 1 %define _sharedir %{_prefix}/share Summary: OpenSIPS, very fast and flexible SIP Server @@ -270,6 +270,17 @@ This module implements a xmlrpc server that handles xmlrpc requests and generate When a xmlrpc message is received a default method is executed. +%package mi_xmlrpc_ng +Summary: opensips mi_xmlrpc_ng implementation. +Group: System Environment/Daemons +Requires: opensips = %ver +BuildRequires: xmlrpc-c-devel + +%description mi_xmlrpc_ng +This module implements a xmlrpc_ng server that handles xmlrpc_ng requests and generates xmlrpc_ng responses. +When a xmlrpc_ng message is received a default method is executed. + + %package db_http Summary: opensips db_http implementation. Group: System Environment/Daemons @@ -337,6 +348,15 @@ The Perl Virtual Database (VDB) provides a virtualization framework for OpenSIPS's database access. It does not handle a particular database engine itself but lets the user relay database requests to arbitrary Perl functions. +%package sngtc +Summary: Sangoma media transcoding interface for the OpenSIPS +Group: System Environment/Daemons +Requires: opensips = %ver + +%description sngtc +The sngtc package implements interface to Sangoma media transcoding. + + %package tlsops Summary: TLS-relating functions for the OpenSIPS Group: System Environment/Daemons @@ -353,7 +373,7 @@ parameters. %setup -n %{name}-%{ver}-tls %build -make all exclude_modules="" ORAVERSION=11.2/client cfg-target=/%{_sysconfdir}/opensips/ +make all exclude_modules="" ORAVERSION=11.2/client cfg-target=%{_sysconfdir}/opensips/ %install @@ -410,6 +430,7 @@ fi %doc %{_docdir}/opensips/README.cfgutils %doc %{_docdir}/opensips/README.closeddial %doc %{_docdir}/opensips/README.db_flatstore +%doc %{_docdir}/opensips/README.db_cachedb %doc %{_docdir}/opensips/README.db_text %doc %{_docdir}/opensips/README.db_virtual %doc %{_docdir}/opensips/README.dialog @@ -430,6 +451,7 @@ fi %doc %{_docdir}/opensips/README.load_balancer %doc %{_docdir}/opensips/README.lua %doc %{_docdir}/opensips/README.mangler +%doc %{_docdir}/opensips/README.mathops %doc %{_docdir}/opensips/README.maxfwd %doc %{_docdir}/opensips/README.mediaproxy %doc %{_docdir}/opensips/README.mi_datagram @@ -449,6 +471,7 @@ fi %doc %{_docdir}/opensips/README.qos %doc %{_docdir}/opensips/README.ratelimit %doc %{_docdir}/opensips/README.registrar +%doc %{_docdir}/opensips/README.rest_client %doc %{_docdir}/opensips/README.rr %doc %{_docdir}/opensips/README.rtpproxy %doc %{_docdir}/opensips/README.seas @@ -494,6 +517,7 @@ fi %{_libdir}/opensips/modules/call_control.so %{_libdir}/opensips/modules/cfgutils.so %{_libdir}/opensips/modules/closeddial.so +%{_libdir}/opensips/modules/db_cachedb.so %{_libdir}/opensips/modules/db_flatstore.so %{_libdir}/opensips/modules/db_text.so %{_libdir}/opensips/modules/db_virtual.so @@ -515,6 +539,7 @@ fi %{_libdir}/opensips/modules/load_balancer.so %{_libdir}/opensips/modules/lua.so %{_libdir}/opensips/modules/mangler.so +%{_libdir}/opensips/modules/mathops.so %{_libdir}/opensips/modules/maxfwd.so %{_libdir}/opensips/modules/mediaproxy.so %{_libdir}/opensips/modules/mi_datagram.so @@ -535,6 +560,7 @@ fi %{_libdir}/opensips/modules/qos.so %{_libdir}/opensips/modules/ratelimit.so %{_libdir}/opensips/modules/registrar.so +%{_libdir}/opensips/modules/rest_client.so %{_libdir}/opensips/modules/rr.so %{_libdir}/opensips/modules/rtpproxy.so %{_libdir}/opensips/modules/seas.so @@ -790,6 +816,13 @@ fi %{_libdir}/opensips/modules/mi_xmlrpc.so +%files mi_xmlrpc_ng +%defattr(-,root,root) +%doc %{_docdir}/opensips/README.mi_xmlrpc_ng + +%{_libdir}/opensips/modules/mi_xmlrpc_ng.so + + %files db_http %defattr(-,root,root) %doc %{_docdir}/opensips/README.db_http @@ -856,6 +889,13 @@ fi %{_libdir}/opensips/perl/OpenSIPS/VDB/VTab.pm %{_libdir}/opensips/perl/OpenSIPS/VDB/Value.pm +%files sngtc +%defattr(-,root,root,-) +%doc %{_docdir}/opensips/README.sngtc + +%{_libdir}/opensips/modules/sngtc.so + + %files tlsops %defattr(-,root,root,-) %doc %{_docdir}/opensips/README.tlsops @@ -863,6 +903,10 @@ fi %{_libdir}/opensips/modules/tlsops.so +%changelog +* Tue Aug 06 2013 Fabrizio Picconi +- Some new rpm optional modules are added: + mi_xmlrpc_ng,sngtc,db_cachedb,mathops,rest_client %changelog * Sun Jul 21 2013 Fabrizio Picconi - Some new rpm optional modules are added: diff --git a/packaging/rpm/opensips.spec.SuSE b/packaging/rpm/opensips.spec.SuSE index a696ed8094..f0a821d586 100644 --- a/packaging/rpm/opensips.spec.SuSE +++ b/packaging/rpm/opensips.spec.SuSE @@ -1,5 +1,5 @@ %define name opensips -%define ver 1.9.0 +%define ver 1.10.1 %define rel 0 %define EXCLUDED_MODULES aaa_radius b2b_entities b2b_logic db_http json memcached jabber cpl-c xmpp rls mi_xmlrpc xcap_client db_mysql db_postgres db_unixodbc db_oracle db_berkeley osp perl snmpstats db_perlvdb peering carrierroute mmgeoip presence presence_xml presence_mwi presence_dialoginfo pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo xcap xcap_client ldap h350 identity regex diff --git a/packaging/solaris/base-pkginfo b/packaging/solaris/base-pkginfo index 118ad79fe4..1d6ffbb8fd 100644 --- a/packaging/solaris/base-pkginfo +++ b/packaging/solaris/base-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-base-dbg" NAME="Programmable SIP Server Base Install - Debugging Symbols" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="bogdan@opensips.org" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/berkeley-pkginfo b/packaging/solaris/berkeley-pkginfo index b9d2ca0de0..293c839d41 100644 --- a/packaging/solaris/berkeley-pkginfo +++ b/packaging/solaris/berkeley-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-berkeley-dbg" NAME="Programmable SIP Server Berkeley Database Support - Debugging Symbols" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/carrierroute-pkginfo b/packaging/solaris/carrierroute-pkginfo index 238715d89f..7f8f9e27c1 100644 --- a/packaging/solaris/carrierroute-pkginfo +++ b/packaging/solaris/carrierroute-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-carrierroute" NAME="Programmable SIP Server carrierroute Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/identity-pkginfo b/packaging/solaris/identity-pkginfo index 29d5c53762..a859e30927 100644 --- a/packaging/solaris/identity-pkginfo +++ b/packaging/solaris/identity-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-identity" NAME="Programmable SIP Server Identity Module" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/ldap-pkginfo b/packaging/solaris/ldap-pkginfo index 4bf5300966..da2505803e 100644 --- a/packaging/solaris/ldap-pkginfo +++ b/packaging/solaris/ldap-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-ldap" NAME="Programmable SIP Server LDAP Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/mmgeoip-pkginfo b/packaging/solaris/mmgeoip-pkginfo index 89d68acabe..f8978b45ab 100644 --- a/packaging/solaris/mmgeoip-pkginfo +++ b/packaging/solaris/mmgeoip-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-geoip" NAME="Programmable SIP Server Address Location Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/mysql-pkginfo b/packaging/solaris/mysql-pkginfo index b7b2fd4752..ce32c05196 100644 --- a/packaging/solaris/mysql-pkginfo +++ b/packaging/solaris/mysql-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-mysql" NAME="Programmable SIP Server MySQL Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/perl-pkginfo b/packaging/solaris/perl-pkginfo index 1bc03424a7..55b7c2017c 100644 --- a/packaging/solaris/perl-pkginfo +++ b/packaging/solaris/perl-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-perl" NAME="Programmable SIP Server PERL Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/pgsql-pkginfo b/packaging/solaris/pgsql-pkginfo index 644b1b68b0..5ce56dd9a9 100644 --- a/packaging/solaris/pgsql-pkginfo +++ b/packaging/solaris/pgsql-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-pgsql" NAME="Programmable SIP Server PostgreSQL Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/regex-pkginfo b/packaging/solaris/regex-pkginfo index 91466faca7..1951235e60 100644 --- a/packaging/solaris/regex-pkginfo +++ b/packaging/solaris/regex-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-regex" NAME="Programmable SIP Server Regex Module" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/snmp-pkginfo b/packaging/solaris/snmp-pkginfo index 4de0cd09ac..ee8a4ac0f6 100644 --- a/packaging/solaris/snmp-pkginfo +++ b/packaging/solaris/snmp-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-snmp" NAME="Programmable SIP Server SNMP Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/tls-pkginfo b/packaging/solaris/tls-pkginfo index 33efd9f059..134dd69ea5 100644 --- a/packaging/solaris/tls-pkginfo +++ b/packaging/solaris/tls-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-base-TLS" NAME="Programmable SIP Server Base Install with TLS" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/packaging/solaris/xmlrpc-pkginfo b/packaging/solaris/xmlrpc-pkginfo index f58c52b2e3..55b1c5653f 100644 --- a/packaging/solaris/xmlrpc-pkginfo +++ b/packaging/solaris/xmlrpc-pkginfo @@ -1,11 +1,11 @@ PKG="OpenSIPS-xmlrpc" NAME="Programmable SIP Server MI XMLRPC Support" -VERSION="1.9.0-notls" +VERSION="1.10.1-notls" ARCH="sparc" CLASSES="none" CATEGORY="utility" VENDOR="OpenSIPS Solutions" -PSTAMP="29thJan13" +PSTAMP="12thMar14" EMAIL="saguti@gmail.com" ISTATES="S s 1 2 3" RSTATES="S s 1 2 3" diff --git a/parser/digest/digest.c b/parser/digest/digest.c index 4483e5b761..2d5702d7ec 100644 --- a/parser/digest/digest.c +++ b/parser/digest/digest.c @@ -115,13 +115,6 @@ dig_err_t check_dig_cred(dig_cred_t* _c) /* Realm must be present */ if (_c->realm.s == 0) res |= E_DIG_REALM; - /* If Username has domain, it must equal to Realm */ - if (_c->username.domain.s && - ((_c->username.domain.len != _c->realm.len) || - (strncmp(_c->username.domain.s, _c->realm.s, - _c->realm.len) != 0))) - res |= E_DIG_DOMAIN; - /* Nonce that was used must be specified */ if (_c->nonce.s == 0) res |= E_DIG_NONCE; diff --git a/parser/parse_content.c b/parser/parse_content.c index 8b1f491c52..a54e0f8a74 100644 --- a/parser/parse_content.c +++ b/parser/parse_content.c @@ -243,6 +243,11 @@ char* parse_content_length( char* buffer, char* end, int* length) number = 0; while (p='0' && *p<='9') { number = number*10 + (*p)-'0'; + if (number<0) { + LM_ERR("number overflow at pos %d in len number [%.*s]\n", + (int)(p-buffer),(int)(end-buffer), buffer); + return 0; + } size ++; p++; } diff --git a/parser/sdp/sdp.c b/parser/sdp/sdp.c index dd4a6d64e3..cbbeb979c1 100644 --- a/parser/sdp/sdp.c +++ b/parser/sdp/sdp.c @@ -752,7 +752,7 @@ int parse_sdp(struct sip_msg* _m) void free_sdp(sdp_info_t** sdp) { __free_sdp(*sdp); - pkg_free(sdp); + pkg_free(*sdp); *sdp = NULL; } diff --git a/pvar.c b/pvar.c index d04ce3cbb8..bff13a99f2 100644 --- a/pvar.c +++ b/pvar.c @@ -736,7 +736,7 @@ static int pv_get_contact_body(struct sip_msg *msg, pv_param_t *param, ct = ct_b->contacts; } } - } while (ct_b); + } while (ct_h); res->rs.s = pv_local_buf; res->rs.len = p - pv_local_buf; @@ -3670,8 +3670,10 @@ int pv_parse_format(str *in, pv_elem_p *el) if(in->len == 0) { *el = pkg_malloc(sizeof(pv_elem_t)); - if(*el == NULL) + if(*el == NULL) { + LM_ERR("not enough pkg memory for PV element (1)\n"); goto error; + } memset(*el, 0, sizeof(pv_elem_t)); (*el)->text = *in; return 0; @@ -3685,8 +3687,10 @@ int pv_parse_format(str *in, pv_elem_p *el) { e0 = e; e = pkg_malloc(sizeof(pv_elem_t)); - if(!e) + if(!e) { + LM_ERR("not enough pkg memory for PV element (2)\n"); goto error; + } memset(e, 0, sizeof(pv_elem_t)); n++; if(*el == NULL) @@ -3705,8 +3709,10 @@ int pv_parse_format(str *in, pv_elem_p *el) s.len = in->s+in->len-p; p0 = pv_parse_spec(&s, &e->spec); - if(p0==NULL) + if(p0==NULL) { + LM_ERR("parsing PV spec failed\n"); goto error; + } if(!is_in_str(p0,in)) break; p = p0; diff --git a/receive.c b/receive.c index e78713c4a6..bc1e53b81a 100644 --- a/receive.c +++ b/receive.c @@ -88,6 +88,7 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info) { struct sip_msg* msg; struct timeval start; + char *tmp; msg=pkg_malloc(sizeof(struct sip_msg)); if (msg==0) { @@ -108,7 +109,8 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info) msg->set_global_port=default_global_port; if (parse_msg(buf,len, msg)!=0){ - LM_ERR("parse_msg failed\n"); + tmp=ip_addr2a(&(rcv_info->src_ip)); + LM_ERR("Unable to parse msg received from [%s:%d]\n", tmp, rcv_info->src_port); /* if a REQUEST msg was detected (first line was succesfully parsed) we should trigger the error route */ if ( msg->first_line.type==SIP_REQUEST && error_rlist.a!=NULL ) diff --git a/route.c b/route.c index d38ee69dab..55669b0aca 100644 --- a/route.c +++ b/route.c @@ -1148,7 +1148,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt>0) ret = 1; - else if(rt==0 && s1->len>s1->len) + else if(rt==0 && s1->len>s2->len) ret = 1; else ret = 0; break; @@ -1158,7 +1158,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt>0) ret = 1; - else if(rt==0 && s1->len>=s1->len) + else if(rt==0 && s1->len>=s2->len) ret = 1; else ret = 0; break; @@ -1168,7 +1168,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt<0) ret = 1; - else if(rt==0 && s1->lenlen) + else if(rt==0 && s1->lenlen) ret = 1; else ret = 0; break; @@ -1178,7 +1178,7 @@ inline static int comp_s2s(int op, str *s1, str *s2) rt = strncasecmp(s1->s,s2->s, n); if (rt<0) ret = 1; - else if(rt==0 && s1->len<=s1->len) + else if(rt==0 && s1->len<=s2->len) ret = 1; else ret = 0; break; @@ -2181,6 +2181,56 @@ void print_rl(void) } } + +int is_script_func_used( char *name, int param_no) +{ + unsigned int i; + + for( i=0; itype==ELEM_T) { + if (e->left.type==ACTION_O) + if (is_mod_func_used((struct action*)e->right.v.data,name,param_no)==1) + return 1; + } else if (e->type==EXP_T) { + if (e->left.v.expr && is_mod_func_in_expr(e->left.v.expr,name,param_no)==1) + return 1; + if (e->right.v.expr && is_mod_func_in_expr(e->right.v.expr,name,param_no)==1) + return 1; + } + return 0; +} + + +int is_mod_func_used(struct action *a, char *name, int param_no) +{ + cmd_export_t *cmd; + while(a) { + if (a->type==MODULE_T) { + /* first param is the name of the function */ + cmd = (cmd_export_t*)a->elem[0].u.data; + LM_DBG("checking %s against %s\n",name,cmd->name); + if (strcasecmp(cmd->name, name)==0 && + (param_no==cmd->param_no || param_no==-1) ) + return 1; + } + + if (a->type==IF_T || a->type==WHILE_T) + if (is_mod_func_in_expr((struct expr*)a->elem[0].u.data,name,param_no)==1) + return 1; + + /* follow all leads from actions than may have sub-blocks of instructions */ + if (a->elem[0].type==ACTIONS_ST) + if (is_mod_func_used((struct action*)a->elem[0].u.data,name,param_no)==1) + return 1; + + if (a->elem[1].type==ACTIONS_ST) + if (is_mod_func_used((struct action*)a->elem[1].u.data,name,param_no)==1) + return 1; + + if (a->elem[2].type==ACTIONS_ST) + if (is_mod_func_used((struct action*)a->elem[2].u.data,name,param_no)==1) + return 1; + + a = a->next; + } + + return 0; +} diff --git a/route_struct.h b/route_struct.h index e392a9c0ef..a1333f2f44 100644 --- a/route_struct.h +++ b/route_struct.h @@ -156,6 +156,7 @@ struct action* append_action(struct action* a, struct action* b); void print_action(struct action* a); void print_expr(struct expr* exp); void print_actions(struct action* a); +int is_mod_func_used(struct action *a, char *name, int param_no); diff --git a/scripts/db_berkeley/opensips/silo b/scripts/db_berkeley/opensips/silo index c164e3d53c..cae879ba29 100644 --- a/scripts/db_berkeley/opensips/silo +++ b/scripts/db_berkeley/opensips/silo @@ -7,4 +7,4 @@ METADATA_READONLY METADATA_LOGFLAGS 0 METADATA_DEFAULTS -NIL|''|''|''|''|0|0|0|'text/plain'|'' +NIL|''|''|''|''|0|0|0|'text/plain'|NIL diff --git a/scripts/dbtext/opensips/dialog b/scripts/dbtext/opensips/dialog index 6ec42e9ed3..569f9d4f34 100644 --- a/scripts/dbtext/opensips/dialog +++ b/scripts/dbtext/opensips/dialog @@ -1 +1 @@ -dlg_id(long,auto) callid(string) from_uri(string) from_tag(string) to_uri(string) to_tag(string) mangled_from_uri(string,null) mangled_to_uri(string,null) caller_cseq(string) callee_cseq(string) caller_ping_cseq(int) callee_ping_cseq(int) caller_route_set(string,null) callee_route_set(string,null) caller_contact(string) callee_contact(string) caller_sock(string) callee_sock(string) state(int) start_time(int) timeout(int) vars(string,null) profiles(string,null) script_flags(int) flags(int) +dlg_id(long) callid(string) from_uri(string) from_tag(string) to_uri(string) to_tag(string) mangled_from_uri(string,null) mangled_to_uri(string,null) caller_cseq(string) callee_cseq(string) caller_ping_cseq(int) callee_ping_cseq(int) caller_route_set(string,null) callee_route_set(string,null) caller_contact(string) callee_contact(string) caller_sock(string) callee_sock(string) state(int) start_time(int) timeout(int) vars(string,null) profiles(string,null) script_flags(int) flags(int) diff --git a/scripts/mysql/msilo-create.sql b/scripts/mysql/msilo-create.sql index 691e5cbdc7..07d80a2094 100644 --- a/scripts/mysql/msilo-create.sql +++ b/scripts/mysql/msilo-create.sql @@ -9,7 +9,7 @@ CREATE TABLE silo ( exp_time INT DEFAULT 0 NOT NULL, snd_time INT DEFAULT 0 NOT NULL, ctype CHAR(32) DEFAULT 'text/plain' NOT NULL, - body BLOB DEFAULT '' NOT NULL + body BLOB NOT NULL ) ENGINE=MyISAM; CREATE INDEX account_idx ON silo (username, domain); diff --git a/scripts/opensipsctl b/scripts/opensipsctl index 1b27013b94..12302f1c68 100755 --- a/scripts/opensipsctl +++ b/scripts/opensipsctl @@ -1402,7 +1402,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmgw) shift @@ -1452,7 +1452,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmcr) shift @@ -1500,7 +1500,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmgrp) shift @@ -1552,7 +1552,7 @@ dr() { exit 1 fi - $CTLCMD ds_reload + $CTLCMD dr_reload ;; rmgrule) shift diff --git a/scripts/oracle/msilo-create.sql b/scripts/oracle/msilo-create.sql index 1ae2b27c10..08e375c7b9 100644 --- a/scripts/oracle/msilo-create.sql +++ b/scripts/oracle/msilo-create.sql @@ -9,7 +9,7 @@ CREATE TABLE silo ( exp_time NUMBER(10) DEFAULT 0 NOT NULL, snd_time NUMBER(10) DEFAULT 0 NOT NULL, ctype VARCHAR2(32) DEFAULT 'text/plain', - body BLOB DEFAULT '' + body BLOB ); CREATE OR REPLACE TRIGGER silo_tr diff --git a/scripts/postgres/msilo-create.sql b/scripts/postgres/msilo-create.sql index f59e64f01a..d6323d0af5 100644 --- a/scripts/postgres/msilo-create.sql +++ b/scripts/postgres/msilo-create.sql @@ -9,7 +9,7 @@ CREATE TABLE silo ( exp_time INTEGER DEFAULT 0 NOT NULL, snd_time INTEGER DEFAULT 0 NOT NULL, ctype VARCHAR(32) DEFAULT 'text/plain' NOT NULL, - body BYTEA DEFAULT '' NOT NULL + body BYTEA NOT NULL ); CREATE INDEX silo_account_idx ON silo (username, domain); diff --git a/socket_info.c b/socket_info.c index 41b106f8ba..e4acd29c98 100644 --- a/socket_info.c +++ b/socket_info.c @@ -867,13 +867,13 @@ int fix_all_socket_lists(void) if ((udp_listen==0) #ifdef USE_TCP - && (tcp_listen==0) + && (tcp_listen==0 || tcp_disable) #ifdef USE_TLS - && (tls_listen==0) + && (tls_listen==0 || tls_disable) #endif #endif #ifdef USE_SCTP - && (sctp_listen==0) + && (sctp_listen==0 || sctp_disable) #endif ){ LM_ERR("no listening sockets\n"); diff --git a/sr_module.c b/sr_module.c index 15bec0598d..9ddedb4797 100644 --- a/sr_module.c +++ b/sr_module.c @@ -425,6 +425,7 @@ int init_child(int rank) case PROC_TIMER: type = "PROC_TIMER"; break; case PROC_MODULE: type = "PROC_MODULE"; break; case PROC_TCP_MAIN: type = "PROC_TCP_MAIN"; break; + case PROC_BIN: type = "PROC_BIN"; break; } if (!type) { diff --git a/sr_module.h b/sr_module.h index 4a7f88634d..5152eeba08 100644 --- a/sr_module.h +++ b/sr_module.h @@ -82,6 +82,7 @@ typedef int (*mod_proc_wrapper)(); #define PROC_TIMER -1 /* Timer attendant process */ #define PROC_MODULE -2 /* Extra process requested by modules */ #define PROC_TCP_MAIN -4 /* TCP main process */ +#define PROC_BIN -8 /* Any binary interface listener */ #define DEFAULT_DLFLAGS 0 /* value that signals to module loader to use default dlopen flags in opensips */ diff --git a/tcp_conn.h b/tcp_conn.h index ca6e999938..b87cd92b61 100644 --- a/tcp_conn.h +++ b/tcp_conn.h @@ -193,6 +193,9 @@ struct tcp_connection{ (r)->parsed=(r)->pos=(r)->start=(r)->buf; \ (r)->error=TCP_REQ_OK;\ (r)->state=H_SKIP_EMPTY; \ + (r)->body=0; \ + (r)->complete=(r)->content_len=(r)->has_content_len=0; \ + (r)->bytes_to_go=0; \ }while(0) diff --git a/tcp_read.c b/tcp_read.c index ad968374dc..6a6ecc833a 100644 --- a/tcp_read.c +++ b/tcp_read.c @@ -439,8 +439,10 @@ void release_tcpconn(struct tcp_connection* c, long state, int unix_sock) c, state, c->fd, c->id); LM_DBG(" extra_data %p\n", c->extra_data); - if (c->con_req) + if (c->con_req) { pkg_free(c->con_req); + c->con_req = NULL; + } /* release req & signal the parent */ if (c->fd!=-1) close(c->fd); @@ -696,8 +698,11 @@ int tcp_read_req(struct tcp_connection* con, int* bytes_read) &local_rcv) <0) LM_ERR("receive_msg failed \n"); - if (req != ¤t_req) + if (!size && req != ¤t_req) { + /* if we no longer need this tcp_req + * we can free it now */ pkg_free(req); + } } *req->parsed=c; @@ -743,11 +748,6 @@ int tcp_read_req(struct tcp_connection* con, int* bytes_read) goto end_req; } - con->con_req->content_len = req->content_len; - con->con_req->bytes_to_go = req->bytes_to_go; - con->con_req->error = req->error; - con->con_req->state = req->state; - if (req->pos != req->buf) { /* we have read some bytes */ memcpy(con->con_req->buf,req->buf,req->pos-req->buf); @@ -766,6 +766,18 @@ int tcp_read_req(struct tcp_connection* con, int* bytes_read) else con->con_req->parsed = con->con_req->buf; + if (req->body != 0) { + con->con_req->body = con->con_req->buf + (req->body-req->buf); + } else + con->con_req->body = 0; + + con->con_req->complete=req->complete; + con->con_req->has_content_len=req->has_content_len; + con->con_req->content_len=req->content_len; + con->con_req->bytes_to_go=req->bytes_to_go; + con->con_req->error = req->error; + con->con_req->state = req->state; + /* zero out the per process req for the future SIP msg */ init_tcp_req(¤t_req); } @@ -935,7 +947,7 @@ void tcp_receive_loop(int unix_sock) */ inline static int handle_io(struct fd_map* fm, int idx,int event_type) { - int ret; + int ret=0; int n; struct tcp_connection* con; int s,rw; diff --git a/test/13.cfg b/test/13.cfg index f6e9345d5d..29093b087f 100644 --- a/test/13.cfg +++ b/test/13.cfg @@ -19,7 +19,7 @@ route{ return; }; if (method == "REGISTER") { - if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) { + if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(extra)")) { sl_send_reply("403", "Not allowed"); } sl_send_reply("200", "OK"); diff --git a/test/14.cfg b/test/14.cfg index d2efec331f..84a76114d3 100644 --- a/test/14.cfg +++ b/test/14.cfg @@ -19,7 +19,7 @@ route{ return; }; if (method == "REGISTER") { - if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(s:30)")) { + if(!cr_route("default", "register", "$rU", "$rU", "call_id", "$avp(extra)")) { sl_send_reply("403", "Not allowed"); } sl_send_reply("200", "OK"); diff --git a/test/2.cfg b/test/2.cfg index f69350e1eb..66609c8cd2 100644 --- a/test/2.cfg +++ b/test/2.cfg @@ -55,8 +55,8 @@ loadmodule "xlog/xlog.so" modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") modparam("mi_datagram", "socket_name", "/tmp/opensips.sock") modparam("dialog", "db_mode", 2) -modparam("tm", "fr_inv_timer_avp", "$avp(i:704)") -modparam("auth", "rpid_avp", "$avp(i:302)") +modparam("tm", "fr_inv_timer_avp", "$avp(fr_inv_timer)") +modparam("auth", "rpid_avp", "$avp(rpid)") modparam("sms", "modems", "Nokia [d=/dev/ttyS1;b=9600;m=new;l=30] ") modparam("sms", "networks", "D1 [m=10] ;d2[ m=20]") modparam("sms", "links", "NOKIA[D1;d2]") diff --git a/test/25.cfg b/test/25.cfg index 56cbc29ff4..15a16fafe0 100644 --- a/test/25.cfg +++ b/test/25.cfg @@ -19,8 +19,8 @@ modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") route { #xlog("user: $rU\n"); - $avp(i:80) = $rU; - $avp(i:81) = $rd; + $avp(req-username) = $rU; + $avp(req-domain) = $rd; if(!lookup ("location")){ sl_send_reply("404", "Not Found"); @@ -32,7 +32,7 @@ route { exit; } - if (!check_user_blacklist("$avp(i:80)", "$avp(i:81)")) { + if (!check_user_blacklist("$avp(req-username)", "$avp(req-domain)")) { xlog("$rU user blacklisted\n"); sl_send_reply("403", "Forbidden"); exit; diff --git a/test/7.cfg b/test/7.cfg index 5dd7acda0c..2b34e3a87d 100644 --- a/test/7.cfg +++ b/test/7.cfg @@ -162,7 +162,7 @@ modparam("tm", "via1_matching", 1) modparam("tm", "unix_tx_timeout", 2) modparam("tm", "restart_fr_on_each_reply", 1) modparam("tm", "pass_provisional_replies", 0) -modparam("tm", "fr_inv_timer_avp", "$avp(s:callee_fr_inv_timer)") +modparam("tm", "fr_inv_timer_avp", "$avp(callee_fr_inv_timer)") loadmodule "xlog/xlog.so" modparam("xlog", "buf_size", 4096) @@ -187,7 +187,7 @@ modparam("nathelper", "rtpproxy_disable_tout", 60) modparam("nathelper", "rtpproxy_tout", 1) modparam("nathelper", "rtpproxy_retr", 5) modparam("nathelper", "sipping_method", "OPTIONS") -modparam("nathelper", "received_avp", "$avp(i:801)") +modparam("nathelper", "received_avp", "$avp(received)") loadmodule "textops/textops.so" @@ -209,7 +209,7 @@ modparam("registrar", "retry_after", 0) modparam("registrar", "method_filtering", 0) modparam("registrar", "path_mode", 2) modparam("registrar", "path_use_received", 0) -modparam("registrar", "received_avp", "$avp(i:801)") +modparam("registrar", "received_avp", "$avp(received)") loadmodule "sl/sl.so" modparam("sl", "enable_stats", 1) @@ -221,7 +221,7 @@ modparam("db_mysql", "auto_reconnect", 1) loadmodule "auth/auth.so" modparam("auth", "nonce_expire", 300) modparam("auth", "rpid_suffix", ";party=calling;id-type=subscriber;screen=yes") -modparam("auth", "rpid_avp", "$avp(s:rpid)") +modparam("auth", "rpid_avp", "$avp(rpid)") loadmodule "auth_db/auth_db.so" modparam("auth_db", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") @@ -231,7 +231,7 @@ modparam("auth_db", "password_column", "password") modparam("auth_db", "password_column_2", "ha1b") modparam("auth_db", "calculate_ha1", 1) modparam("auth_db", "use_domain", 0) -modparam("auth_db", "load_credentials", "$avp(s:caller_uuid)=uuid") +modparam("auth_db", "load_credentials", "$avp(caller_uuid)=uuid") loadmodule "uri_db/uri_db.so" modparam("uri_db", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") @@ -266,7 +266,7 @@ modparam("permissions", "source_col", "src_ip") modparam("permissions", "proto_col", "proto") modparam("permissions", "from_col", "from_pattern") modparam("permissions", "tag_col", "tag") -modparam("permissions", "peer_tag_avp", "$avp(s:peer_uuid)") +modparam("permissions", "peer_tag_avp", "$avp(peer_uuid)") loadmodule "lcr/lcr.so" modparam("lcr", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") @@ -282,14 +282,14 @@ modparam("lcr", "strip_column", "strip") modparam("lcr", "prefix_column", "prefix") modparam("lcr", "from_uri_column", "from_uri") modparam("lcr", "priority_column", "priority") -modparam("lcr", "gw_uri_avp", "$avp(i:1400)") -modparam("lcr", "ruri_user_avp", "$avp(i:1402)") -modparam("lcr", "contact_avp", "$avp(i:1401)") -modparam("lcr", "fr_inv_timer_avp", "$avp(s:fr_inv_timer_avp)") +modparam("lcr", "gw_uri_avp", "$avp(gw_uri)") +modparam("lcr", "ruri_user_avp", "$avp(ruri_user)") +modparam("lcr", "contact_avp", "$avp(contact)") +modparam("lcr", "fr_inv_timer_avp", "$avp(fr_inv_timer_avp)") modparam("lcr", "fr_inv_timer", 90) modparam("lcr", "fr_inv_timer_next", 30) -modparam("lcr", "rpid_avp", "$avp(s:rpid)") -modparam("lcr", "flags_avp", "$avp(i:712)") +modparam("lcr", "rpid_avp", "$avp(rpid)") +modparam("lcr", "flags_avp", "$avp(flags)") loadmodule "uac_redirect/uac_redirect.so" modparam("uac_redirect", "default_filter", "accept") @@ -329,7 +329,7 @@ modparam("acc", "acc_from_tag_column", "from_tag") modparam("acc", "detect_direction", 1) modparam("acc", "acc_sip_code_column", "sip_code") modparam("acc", "acc_sip_reason_column", "sip_reason") -modparam("acc", "multi_leg_info", "src_leg=$avp(i:901);dst_leg=$avp(i:902)") +modparam("acc", "multi_leg_info", "src_leg=$avp(src_leg);dst_leg=$avp(dst_leg)") ######################################################################## # Request route 'main' @@ -415,8 +415,8 @@ route[0] route[1] { xlog("L_INFO", "Clear caller preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_delete("$avp(s:caller_cli)/g"); - avp_delete("$avp(s:clir)/g"); + avp_delete("$avp(caller_cli)/g"); + avp_delete("$avp(clir)/g"); } @@ -426,9 +426,9 @@ route[1] route[2] { xlog("L_INFO", "Clear callee preferences - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_delete("$avp(s:callee_fr_inv_timer)/g"); - avp_delete("$avp(s:cfu)/g"); - avp_delete("$avp(s:cfc)/g"); + avp_delete("$avp(callee_fr_inv_timer)/g"); + avp_delete("$avp(cfu)/g"); + avp_delete("$avp(cfc)/g"); } @@ -438,11 +438,11 @@ route[2] route[3] { route(1); - xlog("L_INFO", "Load caller preferences for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Load caller preferences for uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # load caller avps - avp_db_load("$avp(s:caller_uuid)", "*"); - avp_copy("$avp(s:cli)", "$avp(s:caller_cli)/d"); - if(is_avp_set("$avp(s:clir)/n") && avp_check("$avp(s:clir)", "eq/i:1")) + avp_db_load("$avp(caller_uuid)", "*"); + avp_copy("$avp(cli)", "$avp(caller_cli)/d"); + if(is_avp_set("$avp(clir)/n") && avp_check("$avp(clir)", "eq/i:1")) { # mark for anonymization setflag(28); @@ -455,27 +455,27 @@ route[3] ######################################################################## route[4] { - xlog("L_INFO", "Load callee preferences for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Load callee preferences for uuid '$avp(callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # load callee avps - avp_db_load("$avp(s:callee_uuid)", "*"); - if(is_avp_set("$avp(s:cfu)/s")) + avp_db_load("$avp(callee_uuid)", "*"); + if(is_avp_set("$avp(cfu)/s")) { - xlog("L_INFO", "Call-forward-unconditional to '$avp(s:cfu)' found - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Call-forward-unconditional to '$avp(cfu)' found - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(8); - avp_delete("$avp(s:caller_uuid)/g"); - avp_copy("$avp(s:callee_uuid)", "$avp(s:caller_uuid)/d"); - avp_pushto("$ru", "$avp(s:cfu)"); + avp_delete("$avp(caller_uuid)/g"); + avp_copy("$avp(callee_uuid)", "$avp(caller_uuid)/d"); + avp_pushto("$ru", "$avp(cfu)"); route(3); route(14); exit; } - if(is_avp_set("$avp(s:ringtimeout)/n")) + if(is_avp_set("$avp(ringtimeout)/n")) { - xlog("L_INFO", "Setting ring timeout to $avp(s:ringtimeout) secs - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_copy("$avp(s:ringtimeout)", "$avp(s:callee_fr_inv_timer)/d"); + xlog("L_INFO", "Setting ring timeout to $avp(ringtimeout) secs - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + avp_copy("$avp(ringtimeout)", "$avp(callee_fr_inv_timer)/d"); } } @@ -485,8 +485,8 @@ route[4] ######################################################################## route[5] { - xlog("L_INFO", "Setting acc source-leg for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_printf("$avp(i:901)", "$avp(s:caller_uuid)|$avp(s:acc_caller_user)|$avp(s:acc_caller_domain)|$avp(s:acc_state)"); + xlog("L_INFO", "Setting acc source-leg for uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + avp_printf("$avp(src_leg)", "$avp(caller_uuid)|$avp(acc_caller_user)|$avp(acc_caller_domain)|$avp(acc_state)"); } @@ -495,8 +495,8 @@ route[5] ######################################################################## route[6] { - xlog("L_INFO", "Setting acc destination-leg for uuid '$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - avp_printf("$avp(i:902)", "$avp(s:callee_uuid)|$avp(s:acc_callee_user)|$avp(s:acc_callee_domain)"); + xlog("L_INFO", "Setting acc destination-leg for uuid '$avp(callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + avp_printf("$avp(dst_leg)", "$avp(callee_uuid)|$avp(acc_callee_user)|$avp(acc_callee_domain)"); } @@ -505,7 +505,7 @@ route[6] ######################################################################## route[7] { - xlog("L_INFO", "Accounting failed request for uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Accounting failed request for uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(5); route(6); resetflag(24); @@ -518,17 +518,17 @@ route[7] ######################################################################## route[8] { - $avp(s:acc_callee_user) = $rU; - $avp(s:acc_callee_domain) = $rd; + $avp(acc_callee_user) = $rU; + $avp(acc_callee_domain) = $rd; route(5); route(6); - avp_delete("$avp(s:acc_caller_user)"); - avp_delete("$avp(s:acc_caller_domain)"); - avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)"); - avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)"); - avp_delete("$avp(s:acc_state)/g"); - $avp(s:acc_state) = "cfu"; + avp_delete("$avp(acc_caller_user)"); + avp_delete("$avp(acc_caller_domain)"); + avp_copy("$avp(acc_callee_user)", "$avp(acc_caller_user)"); + avp_copy("$avp(acc_callee_domain)", "$avp(acc_caller_domain)"); + avp_delete("$avp(acc_state)/g"); + $avp(acc_state) = "cfu"; } @@ -616,13 +616,13 @@ route[12] { remove_hf("Remote-Party-ID"); } - if(is_avp_set("$avp(s:caller_cli)/s")) + if(is_avp_set("$avp(caller_cli)/s")) { if(!isflagset(28)) { - xlog("L_INFO", "Set caller CLI '$avp(s:caller_cli)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - append_hf("P-Asserted-Identity: <$avp(s:caller_cli)>\r\n"); + xlog("L_INFO", "Set caller CLI '$avp(caller_cli)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + append_hf("P-Asserted-Identity: <$avp(caller_cli)>\r\n"); } } @@ -648,8 +648,8 @@ route[12] t_on_failure("2"); if(!isflagset(26)) { - $avp(s:acc_callee_user) = $rU; - $avp(s:acc_callee_domain) = $rd; + $avp(acc_callee_user) = $rU; + $avp(acc_callee_domain) = $rd; route(5); route(6); @@ -682,7 +682,7 @@ route[13] sl_send_reply("100", "Trying"); if(from_gw()) { - $avp(s:caller_uuid) = "0"; + $avp(caller_uuid) = "0"; xlog("L_INFO", "Call from PSTN' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); setflag(23); @@ -691,18 +691,18 @@ route[13] { if(allow_trusted()) { - if(is_avp_set("$avp(s:peer_uuid)/s")) + if(is_avp_set("$avp(peer_uuid)/s")) { # use tag-column from trusted-table as uuid for this caller - avp_copy("$avp(s:peer_uuid)", "$avp(s:caller_uuid)/d"); + avp_copy("$avp(peer_uuid)", "$avp(caller_uuid)/d"); } else { # if no uuid is set, use "0" as default uuid - $avp(s:caller_uuid) = "0"; + $avp(caller_uuid) = "0"; } - xlog("L_INFO", "Call from trusted peer with uuid '$avp(s:caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Call from trusted peer with uuid '$avp(caller_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); if(!is_domain_local("$rd")) { @@ -730,9 +730,9 @@ route[13] } } } - $avp(s:acc_caller_user) = $fU; - $avp(s:acc_caller_domain) = $fd; - $avp(s:acc_state) = "call"; + $avp(acc_caller_user) = $fU; + $avp(acc_caller_domain) = $fd; + $avp(acc_state) = "call"; route(3); if(nat_uac_test("19")) @@ -759,21 +759,21 @@ route[14] if(!is_domain_local("$rd")) { setflag(20); - $avp(s:callee_uuid) = "0"; + $avp(callee_uuid) = "0"; route(16); } - avp_delete("$avp(s:callee_uuid)"); - avp_db_query("select uuid from subscriber where username = '$rU'", "$avp(s:callee_uuid)"); - if(is_avp_set("$avp(s:callee_uuid)/s")) + avp_delete("$avp(callee_uuid)"); + avp_db_query("select uuid from subscriber where username = '$rU'", "$avp(callee_uuid)"); + if(is_avp_set("$avp(callee_uuid)/s")) { - xlog("L_INFO", "Callee is local, uuid='$avp(s:callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Callee is local, uuid='$avp(callee_uuid)' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(15); } else { - $avp(s:callee_uuid) = "0"; + $avp(callee_uuid) = "0"; xlog("L_INFO", "Callee is not local - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); route(16); @@ -792,8 +792,8 @@ route[15] { xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); - $avp(s:acc_callee_user) = $rU; - $avp(s:acc_callee_domain) = $rd; + $avp(acc_callee_user) = $rU; + $avp(acc_callee_domain) = $rd; route(7); sl_send_reply("404", "User Offline"); @@ -879,8 +879,8 @@ route[17] # For international calls, either "00" or + is prefixed, like # +49123456780 or 0049123456789. # - avp_delete("$avp(s:orig_callee_user)/g"); - $avp(s:orig_callee_user) = $rU; + avp_delete("$avp(orig_callee_user)/g"); + $avp(orig_callee_user) = $rU; if(uri =~ "^sip:(\+[1-9])?[0-9]+@") { # looks like a PSTN number @@ -900,18 +900,18 @@ route[17] { # unknown format, maybe NDC wasn't added before? - xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Not normalized callee '$avp(orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); return(-1); } # else we have "+" + CC + NDC + SN - xlog("L_INFO", "Normalized callee '$avp(s:orig_callee_user)' to E.164 format '$rU' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Normalized callee '$avp(orig_callee_user)' to E.164 format '$rU' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); return(1); } else { - xlog("L_INFO", "Not normalized callee '$avp(s:orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); + xlog("L_INFO", "Not normalized callee '$avp(orig_callee_user)' to E.164 format - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); return(-1); } @@ -940,7 +940,7 @@ route[18] xlog("L_INFO", "ENUM query failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n"); # ENUM query failed, revert $rU - avp_pushto("$ru/username", "$avp(s:orig_callee_user)"); + avp_pushto("$ru/username", "$avp(orig_callee_user)"); } } @@ -1060,12 +1060,12 @@ failure_route[2] } if(t_check_status("301|302")) { - avp_delete("$avp(s:acc_caller_user)/g"); - avp_delete("$avp(s:acc_caller_domain)/g"); - avp_delete("$avp(s:acc_state)/g"); - avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)"); - avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)"); - $avp(s:acc_state) = "cfc"; + avp_delete("$avp(acc_caller_user)/g"); + avp_delete("$avp(acc_caller_domain)/g"); + avp_delete("$avp(acc_state)/g"); + avp_copy("$avp(acc_callee_user)", "$avp(acc_caller_user)"); + avp_copy("$avp(acc_callee_domain)", "$avp(acc_caller_domain)"); + $avp(acc_state) = "cfc"; setflag(29); if(!get_redirects("1:1")) { @@ -1078,10 +1078,10 @@ failure_route[2] exit; } # get last URI from destination-set and set it as R-URI - avp_delete("$avp(s:tmp)/g"); - $avp(s:tmp) = $ds; - avp_subst("$avp(s:tmp)", "/.*(sip:.+@[^:;>]+).*$/\1/"); - avp_pushto("$ru", "$avp(s:tmp)"); + avp_delete("$avp(tmp)/g"); + $avp(tmp) = $ds; + avp_subst("$avp(tmp)", "/.*(sip:.+@[^:;>]+).*$/\1/"); + avp_pushto("$ru", "$avp(tmp)"); setflag(29); t_on_branch("1"); @@ -1089,15 +1089,15 @@ failure_route[2] route(14); exit; } - if($avp(s:cfc) != NULL) + if($avp(cfc) != NULL) { - avp_delete("$avp(s:acc_caller_user)/g"); - avp_delete("$avp(s:acc_caller_domain)/g"); - avp_delete("$avp(s:acc_state)/g"); - avp_copy("$avp(s:acc_callee_user)", "$avp(s:acc_caller_user)"); - avp_copy("$avp(s:acc_callee_domain)", "$avp(s:acc_caller_domain)"); - $avp(s:acc_state) = "cfc"; - avp_pushto("$ru", "$avp(s:cfc)"); + avp_delete("$avp(acc_caller_user)/g"); + avp_delete("$avp(acc_caller_domain)/g"); + avp_delete("$avp(acc_state)/g"); + avp_copy("$avp(acc_callee_user)", "$avp(acc_caller_user)"); + avp_copy("$avp(acc_callee_domain)", "$avp(acc_caller_domain)"); + $avp(acc_state) = "cfc"; + avp_pushto("$ru", "$avp(cfc)"); setflag(29); t_on_branch("1"); diff --git a/tls/README b/tls/README index 2c24a66d5b..2cec8a3f60 100644 --- a/tls/README +++ b/tls/README @@ -779,7 +779,7 @@ route{ ... # calls to other SIP domains # set the proper SSL context (certificate) for local hosted domains - avp_write("$fd","$avp(i:400)"); + avp_write("$fd","$avp(fd)"); t_relay(); # uses NAPTR and SRV lookups exit; ... diff --git a/tls/doc/tls_user.sgml b/tls/doc/tls_user.sgml index f9b8db4142..3b35a0e0e8 100644 --- a/tls/doc/tls_user.sgml +++ b/tls/doc/tls_user.sgml @@ -887,7 +887,7 @@ route{ ... # calls to other SIP domains # set the proper SSL context (certificate) for local hosted domains - avp_write("$fd","$avp(i:400)"); + avp_write("$fd","$avp(fd)"); t_relay(); # uses NAPTR and SRV lookups exit; ... diff --git a/version.h b/version.h index 52c21d10bf..65ee637201 100644 --- a/version.h +++ b/version.h @@ -28,7 +28,7 @@ #define OPENSIPS_FULL_VERSION NAME " " VERSION " (" ARCH "/" OS ")" -#ifdef STATS +#ifdef STATISTICS #define STATS_STR "STATS: On" #else #define STATS_STR "STATS: Off"