sip-router
8 years agoMerge branch 'master' into treimann/acc-cdr
Timo Reimann [Mon, 15 Aug 2011 12:58:20 +0000 (14:58 +0200)]
Merge branch 'master' into treimann/acc-cdr

* master: (76 commits)
  core: new core event for received datagrams
  Added documentation to the DMQ module
  htable: docs updated with db_expires parameter
  htable: control load/save of expires value from db via parameter
  srdb1: updated the definition of siptrace table to include time_us column
  modules_k/siptrace: Add time to x-headers
  modules_k/siptrace: Add column time_us
  modules_k/siptrace: Add "x-headers" feature
  modules_k/siptrace: Add trace_to_database configuration parameter
  modules_k/siptrace: separately store to db and/or send duplicate
  pua_xmpp: fixes to SIP-XMPP presence status translations
  Expose terminate_dlg through C API
  Expose terminate_dlg through C API
  Added terminate_dlg description
  Expose terminate_dlg through C API
  modules_k/dialog: Fix a bug that would cause a segfault when caller bind address information could not be retrieved from database and "dlg_list" was fifo-issued.
  modules_k/dialog: Improve dialog timer list handling.
  modules/tm, modules_k/pua: Fix for concurrency issue in PUA module
  tm: keep internal retr. intervals in ms
  lib/srdb1/schema: forgot to increase version number of pua table
  ...

Conflicts:
modules_k/dialog/dialog.c
modules_k/dialog/dlg_load.h

8 years agocore: new core event for received datagrams
Daniel-Constantin Mierla [Sun, 14 Aug 2011 20:59:53 +0000 (22:59 +0200)]
core: new core event for received datagrams

- event type defined as SREV_NET_DGRAM_IN
- allow modules to get a callback when a udp datagram is received
- offers the possibility to handle different content sent via datagram,
  such as HEP from Homer project, without invading the core with new
  code

8 years agoMerge branch 'mariusbucur/dmq'
Marius Bucur [Sun, 14 Aug 2011 02:20:16 +0000 (19:20 -0700)]
Merge branch 'mariusbucur/dmq'

8 years agoAdded documentation to the DMQ module
unknown [Sun, 14 Aug 2011 02:02:31 +0000 (19:02 -0700)]
Added documentation to the DMQ module

8 years agohtable: docs updated with db_expires parameter
Daniel-Constantin Mierla [Sat, 13 Aug 2011 22:18:40 +0000 (00:18 +0200)]
htable: docs updated with db_expires parameter

8 years agohtable: control load/save of expires value from db via parameter
Daniel-Constantin Mierla [Sat, 13 Aug 2011 22:04:25 +0000 (00:04 +0200)]
htable: control load/save of expires value from db via parameter

- db_expires - a new paramter to control if the expires of the items in
  the hash table should be loaded/saved to database
- default is 0 - do not load/save expires value - backward
  compatibility, since there might be hash tables loaded form database
  but without expires
- if the hash table definition does not have an auto-expires, even
  if db_expires=1, the expires column is not selected since it is not
  needed

8 years agosrdb1: updated the definition of siptrace table to include time_us column
Daniel-Constantin Mierla [Sat, 13 Aug 2011 21:37:10 +0000 (23:37 +0200)]
srdb1: updated the definition of siptrace table to include time_us column

- regenerated scripts to create the database schema based on latest xml
  schema definition

8 years agomodules_k/siptrace: Add time to x-headers
Tristan Bruns [Fri, 5 Aug 2011 07:30:53 +0000 (09:30 +0200)]
modules_k/siptrace: Add time to x-headers

Signed-off-by: Tristan Bruns <bruns@decoit.de>
Signed-off-by: Daniel-Constantin Mierla <miconda@gmail.com>
8 years agomodules_k/siptrace: Add column time_us
Tristan Bruns [Fri, 5 Aug 2011 07:26:54 +0000 (09:26 +0200)]
modules_k/siptrace: Add column time_us

Signed-off-by: Tristan Bruns <bruns@decoit.de>
Signed-off-by: Daniel-Constantin Mierla <miconda@gmail.com>
8 years agomodules_k/siptrace: Add "x-headers" feature
Tristan Bruns [Fri, 5 Aug 2011 07:24:14 +0000 (09:24 +0200)]
modules_k/siptrace: Add "x-headers" feature

The "x-headers" feature stores the fromip, toip, method and direction
in the message body (using X-* headers). This allows to transmit them
using duplicate_uri from one kamailio to an other.

Signed-off-by: Tristan Bruns <bruns@decoit.de>
Signed-off-by: Daniel-Constantin Mierla <miconda@gmail.com>
8 years agomodules_k/siptrace: Add trace_to_database configuration parameter
Tristan Bruns [Wed, 3 Aug 2011 10:29:24 +0000 (12:29 +0200)]
modules_k/siptrace: Add trace_to_database configuration parameter

Adding configuration parameter to disable writing to the database.
We can use this to only duplicate the SIP messages without storing them
in our database.

Signed-off-by: Tristan Bruns <bruns@decoit.de>
Signed-off-by: Daniel-Constantin Mierla <miconda@gmail.com>
8 years agomodules_k/siptrace: separately store to db and/or send duplicate
Tristan Bruns [Wed, 3 Aug 2011 10:28:45 +0000 (12:28 +0200)]
modules_k/siptrace: separately store to db and/or send duplicate

Signed-off-by: Tristan Bruns <bruns@decoit.de>
Signed-off-by: Daniel-Constantin Mierla <miconda@gmail.com>
8 years agopua_xmpp: fixes to SIP-XMPP presence status translations
Daniel-Constantin Mierla [Fri, 12 Aug 2011 20:51:20 +0000 (22:51 +0200)]
pua_xmpp: fixes to SIP-XMPP presence status translations

* patch by Laura Testi to fix:
- the online/offline status is ok in both direction (SIP<-->XMPP)
- other status (away/busy) is not ok from XMPP to SIP
- busy status is not ok from SIP to XMPP
- each time XMPP contact change the status, triger a new SUBSCRIBE in  xmpp
  gateway which generate multiple same subscriptions with different callid
  in both active_watchers and pua tables. This also makes multiple NOTIFY
  generation from the main Presence Server to GW when the SIP contact change
  it's status

8 years agoMerge branch 'pd/pua_fix'
pd [Fri, 12 Aug 2011 16:28:16 +0000 (17:28 +0100)]
Merge branch 'pd/pua_fix'

* pd/pua_fix:
  modules/tm, modules_k/pua: Fix for concurrency issue in PUA module

8 years agoExpose terminate_dlg through C API
Jason Penton [Fri, 12 Aug 2011 15:36:33 +0000 (17:36 +0200)]
Expose terminate_dlg through C API

8 years agoExpose terminate_dlg through C API
Jason Penton [Fri, 12 Aug 2011 15:34:03 +0000 (17:34 +0200)]
Expose terminate_dlg through C API

8 years agoAdded terminate_dlg description
Jason Penton [Fri, 12 Aug 2011 15:28:18 +0000 (17:28 +0200)]
Added terminate_dlg description

8 years agoExpose terminate_dlg through C API
Jason Penton [Fri, 12 Aug 2011 15:07:17 +0000 (17:07 +0200)]
Expose terminate_dlg through C API

8 years agomodules_k/dialog: Fix a bug that would cause a segfault when
Timo Reimann [Fri, 12 Aug 2011 12:08:02 +0000 (14:08 +0200)]
modules_k/dialog: Fix a bug that would cause a segfault when
caller bind address information could not be retrieved from
database and "dlg_list" was fifo-issued.

- Check nulliness of dlg->bind_addr[DLG_CALLER_LEG] before
  printing.
  (May be NULL when server doesn't feel responsible for a bound
  address loaded from dialog database.)
- Move check-and-print code for both directions (caller and
  callee) next to each other.

8 years agomodules_k/dialog: Improve dialog timer list handling.
Timo Reimann [Thu, 11 Aug 2011 15:19:20 +0000 (17:19 +0200)]
modules_k/dialog: Improve dialog timer list handling.

- Avoid updating a dialog timer item if it is not yet linked into
  the timer list.
  (Avoids reference counting bugs due to race conditions where the
  timer list has not been initialized yet prior to any update
  attempts.)
- In case of bogus dialog during timer insertion, postpone release
  of dialog timer lock until error log message has been emitted.

8 years agomodules/tm, modules_k/pua: Fix for concurrency issue in PUA module
pd [Thu, 11 Aug 2011 16:28:19 +0000 (17:28 +0100)]
modules/tm, modules_k/pua: Fix for concurrency issue in PUA module

- It is quite possible for the mandatory NOTIFY request sent by a
  presence server on establishment of a SUBSCRIBE dialog to
  over-take (either on the wire or within Kamailio) the 2xx response
  to the SUBSCRIBE.  When this happens Kamailio outputs an error
  message and does not update the rls_presentity table.

- The change to the tm module is to make t_request_outside take the
  same arguments (and exhibit mostly the same behaviour) as t_request.
  This is safe to do as a search of the code-base has shown that
  t_request_outside was not actually used anywhere.  The difference
  between t_request and t_request_outside is that t_request frees the
  dialog structure it creates, whereas t_request_outside leaves the
  dialog structure so that the caller can use it to find things like
  the Call-ID and local tag generated for the request.

  The hash table implementation in pua has been modified to enable
  temporary dialogs to be found (new function
  get_temporary_dialog()).  A temporary dialog contains the minimal
  information that was available when the SUBSCRIBE request was sent.
  Temporary dialogs are replaced with proper ones when a 2xx response
  is received.  The delete_htable() function has been updated so that
  it can delete both full and temporary dialogs.

  pua.c has been modified to fix a bug in db_update() - n_query_cols
  was being incorrectly decremented in a certain case within a double
  loop.  db_update() has also been changed to cope with needing to
  insert temporary (and therefore not fully filled in) dialogs into
  the database.

  send_subscribe.c has been modified to create temporary dialogs
  whenever an initial SUBSCRIBE is sent.  The SUBSCRIBE callback
  function searches for and removes any temporary dialogs relating
  to the transaction before it returns.  In normal (non error
  handling behaviour) temporary dialogs are not removed until after
  a full dialog has been created and added to the hash table.

8 years agotm: keep internal retr. intervals in ms
Andrei Pelinescu-Onciul [Thu, 11 Aug 2011 14:58:12 +0000 (16:58 +0200)]
tm: keep internal retr. intervals in ms

When using ticks to keep the retransmission intervals, any
rounding error (when converting from ms to ticks) is increased
with each doubling of the retransmission interval. In the standard
configuration this means that the last retransmission before t2
kicks in, has an error up to 4 times bigger then the initial one
(the rounding error is max. 1 tick/62.5ms for the initial interval
 => up to 250 ms for the last retransmission before t2).

By keeping the retransmission intervals in ms instead of ticks,
this problem is avoided, and the timing error is always < 1 tick
(62.5 ms) + system timer error (< 10 ms usually).

8 years agolib/srdb1/schema: forgot to increase version number of pua table
Juha Heinanen [Wed, 10 Aug 2011 14:53:19 +0000 (17:53 +0300)]
lib/srdb1/schema: forgot to increase version number of pua table

8 years agolib/srdb1/schema: fixed typo in htable schema
Juha Heinanen [Wed, 10 Aug 2011 14:25:09 +0000 (17:25 +0300)]
lib/srdb1/schema: fixed typo in htable schema

8 years agolib/srdb1/schema: fixed size of pua table call_id field
Juha Heinanen [Wed, 10 Aug 2011 13:08:04 +0000 (16:08 +0300)]
lib/srdb1/schema: fixed size of pua table call_id field

8 years agolib/srdb1/schema/rls_presentity.xml: content_type of rls_presentity table
Juha Heinanen [Wed, 10 Aug 2011 12:46:47 +0000 (15:46 +0300)]
lib/srdb1/schema/rls_presentity.xml: content_type of rls_presentity table

- Increased size of content_type field of rls_presentity table from 64
  to 255, because 64 is too short for many actual content types.
- Increased table version.

8 years agocore: added helper functions to return header by name
Daniel-Constantin Mierla [Tue, 9 Aug 2011 20:51:40 +0000 (22:51 +0200)]
core: added helper functions to return header by name

- for special cases when there is no defined type for the header

8 years agomodules_k/textops: Added new exported function append_time_to_request()
pd [Tue, 9 Aug 2011 13:47:19 +0000 (14:47 +0100)]
modules_k/textops: Added new exported function append_time_to_request()

- This function is similar to the existing append_time(), but the existing
  function adds the Date header to replies generated by Kamailio.  This
  function modifies the request.

  In my scenario I want all MESSAGE requests to contain Date headers.  The
  MSILO module inserts Date headers into MESSAGEs that have been stored,
  but not all clients insert Date headers.  This function enables me
  to ensure all MESSAGE requests contain the Date header that I require.

  This is not exactly correct as the Date header should reflect the time
  when the request is first sent - but the current time on the Kamailio
  server is better than nothing and good enough for my needs.

- Usage example:

  if (is_method("MESSAGE") && !is_present_hf("Date"))
      append_time_to_request();

8 years agocore: allow negative parameter to remove_branches
Alex Hermann [Fri, 5 Aug 2011 13:32:14 +0000 (15:32 +0200)]
core: allow negative parameter to remove_branches

8 years agomodules_k/xcap_server: rolling back the addition of the xuiddomain pseudo-variable
pd [Tue, 9 Aug 2011 10:50:48 +0000 (11:50 +0100)]
modules_k/xcap_server: rolling back the addition of the xuiddomain pseudo-variable

- As Juha has pointed out this change was unnecessary.  The domain can
  be extracted from xuid using $(xcapuri(u=>xuid){uri.host})

8 years agomodules_k/auth_radius: added optional uri_user param to radius_www_authorize()
Juha Heinanen [Tue, 9 Aug 2011 05:36:39 +0000 (08:36 +0300)]
modules_k/auth_radius: added optional uri_user param to radius_www_authorize()
- Useful for http authorization.

8 years agodb_postgres: remove db_int2pg_varbit function, commented out since 2008
Henning Westerholt [Mon, 8 Aug 2011 20:43:23 +0000 (22:43 +0200)]
db_postgres: remove db_int2pg_varbit function, commented out since 2008

8 years agodb_postgres: fix doxygen errors, small extensions and cleanups in comments
Henning Westerholt [Mon, 8 Aug 2011 20:42:19 +0000 (22:42 +0200)]
db_postgres: fix doxygen errors, small extensions and cleanups in comments

8 years agopresence(k): fix doxygen errors, small extensions and cleanups in comments
Henning Westerholt [Mon, 8 Aug 2011 20:18:28 +0000 (22:18 +0200)]
presence(k): fix doxygen errors, small extensions and cleanups in comments

8 years agomodules_k/pv: fix 64bit bug.
Alex Hermann [Mon, 8 Aug 2011 14:11:01 +0000 (16:11 +0200)]
modules_k/pv: fix 64bit bug.

time_t is a long int on 64bit systems. Do not cast a int* to time_t*.

8 years agomodules_k/xcap_server: Added new pseudo variable $xcapuri(name=>xuiddomain)
pd [Mon, 8 Aug 2011 11:24:46 +0000 (12:24 +0100)]
modules_k/xcap_server: Added new pseudo variable $xcapuri(name=>xuiddomain)

- $xcapuri(name=>xuiddomain) contains the domain part from $xcapuri(name=>xuid)
  The xuiddomain can be used with www_authorize() and www_challenge() if you
  want the realm to be based on the user's domain instead of something
  hard-coded (like "xcap").

  This is particularly useful if you need multi-domain support, don't want
  plain-text passwords in the subscriber table, and also don't want to have to
  create two entries for each subscriber (one with the SIP domain as the realm
  and one with "xcap" as the realm).

8 years agomodules/tm: fix t_load_contacts for failure_route. Ignore ruri if it has already...
Alex Hermann [Mon, 1 Aug 2011 14:09:38 +0000 (16:09 +0200)]
modules/tm: fix t_load_contacts for failure_route. Ignore ruri if it has already been used.

Commit e973bbe5e7310861f77b17ce0afaf1cca35fe48a removed the logic for handling
failure_route. The result was that when t_load_contacts is called from
failure_route, the current request-uri is added as branch _again_.

This commit restores the original functionality by ignoring the request uri
if it is marked as consumed.

8 years agomodules/tm: add faked_reply_prio parameter to be able to punish faked replies
Alex Hermann [Fri, 5 Aug 2011 15:30:57 +0000 (17:30 +0200)]
modules/tm: add faked_reply_prio parameter to be able to punish faked replies

Thi should fix FS#54.

8 years agocore: add functions remove_branch(int) and clear_branches()
Alex Hermann [Fri, 5 Aug 2011 12:49:16 +0000 (14:49 +0200)]
core: add functions remove_branch(int) and clear_branches()

remove_branch(int) - removes the specified branch from the destination set.
If the parameter is absent, the last branch is removed.

clear_branches() - empties the destination set.

8 years agomodules_k/htable: Only save/load not yet expired entries to/from database.
Alex Hermann [Thu, 28 Jul 2011 14:39:17 +0000 (16:39 +0200)]
modules_k/htable: Only save/load not yet expired entries to/from database.

8 years agomodules_k/htable: save/load htable entry's expires value to/from database.
Alex Hermann [Thu, 28 Jul 2011 13:58:43 +0000 (15:58 +0200)]
modules_k/htable: save/load htable entry's expires value to/from database.

8 years agomodules_k/htable: Correctly save the value type in the database.
Alex Hermann [Thu, 28 Jul 2011 10:42:50 +0000 (12:42 +0200)]
modules_k/htable: Correctly save the value type in the database.

Instead of always saving '0' (string), write a '1' (int) if value is integer.

8 years agomodules/tm: reverted previous commit on t_load_contacts()
Juha Heinanen [Mon, 8 Aug 2011 08:22:23 +0000 (11:22 +0300)]
modules/tm:  reverted previous commit on t_load_contacts()
(cherry picked from commit cc4bcb18b064f7d66b16db2b452c0e36f14aecc3)

8 years agomodules/tm: t_load_contacts() now ignores ruri if it has already been used
Juha Heinanen [Mon, 8 Aug 2011 07:55:24 +0000 (10:55 +0300)]
modules/tm: t_load_contacts() now ignores ruri if it has already been used
- Thanks to Alex Hermann for the patch.

9 years agomodules_k/rls: Added support for XPath within rl-services documents
pd [Fri, 5 Aug 2011 16:20:36 +0000 (17:20 +0100)]
modules_k/rls: Added support for XPath within rl-services documents

- RLS was recently updated to support rl-services index documents that
  "point" to resource-lists.  However, that support only extended to
  indexes that pointed to entire resource-list documents.

  This change enables support for resource lists that "point" to
  specific nodes within a document.

  For example, the following rl-services document would now be supported:

    <?xml version="1.0" encoding="UTF-8"?>
    <rls-services xmlns="urn:ietf:params:xml:ns:rls-services">
      <service uri="sip:alice_all@pd-laptop-linux.croc.internal">
        <resource-list>http://server.example.net:5060/xcap-root/resource-lists/users/sip:alice@example.net/generallist.xml/~~/resource-lists/list%5b@name=%22oma_buddylist%22%5d</resource-list>
        <packages>
            <package>presence</package>
        </packages>
      </service>
    </rls-services>

9 years agoasync: fixed the condition to detect last action in route block
Daniel-Constantin Mierla [Thu, 4 Aug 2011 10:04:59 +0000 (12:04 +0200)]
async: fixed the condition to detect last action in route block

- reported by Inaki Baz Castillo

9 years agotls: safety check for current cipher
Daniel-Constantin Mierla [Thu, 4 Aug 2011 09:41:32 +0000 (11:41 +0200)]
tls: safety check for current cipher

- SSL_get_current_cipher(...) may return NULL, in case of the cipher was
  not set yet for the connection
- caused crash when RPC command tls.list was used in such moment
- cipher description is set to 'unknown' for such case
- reported by Francesco Castellano

9 years agodebian: fix in init script (somewhere it was still using $MEMORY rather than the...
Iñaki Baz Castillo [Thu, 4 Aug 2011 09:40:43 +0000 (11:40 +0200)]
debian: fix in init script (somewhere it was still using $MEMORY rather than the new $SHM_MEMORY).

9 years agodebian: /etc/default/kamailio now includes SHM_MEMORY and PKG_MEMORY variables (rathe...
Iñaki Baz Castillo [Thu, 4 Aug 2011 08:33:36 +0000 (10:33 +0200)]
debian: /etc/default/kamailio now includes SHM_MEMORY and PKG_MEMORY variables (rather than just MEMORY).
The init script takes those values for -m (shared memory) and -M (private memory) command options.
check_kamailio_config() function within the init script also uses "-M $PKG_MEMORY" (so very long
configuration files can be parsed by increasing PKG_MEMORY).

9 years agolcr: fixed README for from_gw() arguments.
Iñaki Baz Castillo [Wed, 3 Aug 2011 22:23:05 +0000 (00:23 +0200)]
lcr: fixed README for from_gw() arguments.

9 years agolcr: Fixed doc in from_gw() arguments.
Iñaki Baz Castillo [Wed, 3 Aug 2011 22:21:35 +0000 (00:21 +0200)]
lcr: Fixed doc in from_gw() arguments.

9 years agotm: don't set dst_uri to next hop for branch_route
Daniel-Constantin Mierla [Wed, 3 Aug 2011 21:03:54 +0000 (23:03 +0200)]
tm: don't set dst_uri to next hop for branch_route

- added flag to skip setting dst_uri to next hop for branch_route if the
  dst_uri was not set before
- there is already a  select and a pseudo-variable to access next hop value,
  in case it is needed in branch route
- reported by Alex Hermann

9 years agodebian: If RUN=no in /etc/default/kamailio then return 0 isntead of LSB compliant...
Iñaki Baz Castillo [Wed, 3 Aug 2011 16:29:55 +0000 (18:29 +0200)]
debian: If RUN=no in /etc/default/kamailio then return 0 isntead of LSB compliant error codes (if not, dpkg returns error in the instalation as kamailio init script is called automatically to start when installed).

9 years agoMakefile: Add async module
Jon Bonilla [Wed, 3 Aug 2011 20:12:14 +0000 (22:12 +0200)]
Makefile: Add async module

9 years agotm: allow nested backup of avp lists when sending local requests
Daniel-Constantin Mierla [Wed, 3 Aug 2011 17:34:09 +0000 (19:34 +0200)]
tm: allow nested backup of avp lists when sending local requests

- added ability to use a local variable instead static var to
  backup/restore avps lists for local generated transactions

9 years agopdbt: off-by-one error fixed in carrier.c, better output for pdbt command-line interf...
Henning Westerholt [Wed, 3 Aug 2011 15:48:44 +0000 (17:48 +0200)]
pdbt: off-by-one error fixed in carrier.c, better output for pdbt command-line interface (parseable)

9 years agomodules_k/acc: Implement CDR-based logging.
Timo Reimann [Wed, 3 Aug 2011 11:17:24 +0000 (13:17 +0200)]
modules_k/acc: Implement CDR-based logging.

Full credits to Sven Knoblich, sven.knoblich@1und1.de .

9 years agomodules_k/dialog: Allow configuration of when initial dialog
Timo Reimann [Tue, 2 Aug 2011 18:14:52 +0000 (20:14 +0200)]
modules_k/dialog: Allow configuration of when initial dialog
callbacks are executed (either in-script or post-script).

- Implement functionality.
- Add documentation.

9 years agomodules_k/dialog: Add documentation for DLGCB_TERMINATED_CONFIRMED
Timo Reimann [Tue, 2 Aug 2011 17:52:02 +0000 (19:52 +0200)]
modules_k/dialog: Add documentation for DLGCB_TERMINATED_CONFIRMED
callback.

9 years agoAdjust several modules to modified dialog callback signature
Timo Reimann [Tue, 2 Aug 2011 17:39:13 +0000 (19:39 +0200)]
Adjust several modules to modified dialog callback signature
(request and response messages given instead of just request; see
commit 5d4473297 for rationale).

Full credits to Sven Knoblich, sven.knoblich@1und1.de .

9 years agomodules_k/dialog: Add multiple features.
Timo Reimann [Tue, 2 Aug 2011 16:29:05 +0000 (18:29 +0200)]
modules_k/dialog: Add multiple features.

- Set and get dialog variables programmatically (needed in certain
  cases where PV access does not suffice).
- Change dialog callback signature to pass both request and
  response message instead of just the request. This is to enable
  access to at least one type of message when the other is not
  available; e.g., DLGCB_FAILED callbacks due to a local timeout
  (408) do not provide requests but responses only.
  Also, adapt callback usages accordingly at multiple spots.
- Provide additional callback DLGCB_TERMINATED_CONFIRMED that is
  executed whenever the response to a BYE request is sent.
- Move unreference_dialog() to a more suitable location.
- Provide functions to add and remove a dialog from a transaction
  (required for referencing at certain occassions).
- Move spiral detection functionality into dlg_new_dialog() to
  faciliate spiral detection when dlg_manage() is used.
- Add a dialog's reference count to list of printable statistics.

Credits to Sven Knoblich, sven.knoblich@1und1.de .

9 years agomodules_k/rls: Fixed a couple of merge errors that crept in during the splitting...
pd [Tue, 2 Aug 2011 13:22:16 +0000 (14:22 +0100)]
modules_k/rls: Fixed a couple of merge errors that crept in during the splitting RLS NOTIFY development

- Problem found by Paul Pankhurst and fixed by Andrew Miller

9 years agodebian: minor fix (not important at all) in init scripts.
Iñaki Baz Castillo [Tue, 2 Aug 2011 13:13:33 +0000 (15:13 +0200)]
debian: minor fix (not important at all) in init scripts.

9 years agocore: remove ifdef'ed code left over from a commit one year ago
Henning Westerholt [Mon, 1 Aug 2011 22:32:02 +0000 (00:32 +0200)]
core: remove ifdef'ed code left over from a commit one year ago

9 years agocore: many extensions and fixes at doxygen docs for module infrastructure
Henning Westerholt [Mon, 1 Aug 2011 22:29:42 +0000 (00:29 +0200)]
core: many extensions and fixes at doxygen docs for module infrastructure

9 years agomodules_k/rls, modules_k/presence: Support for splitting large RLS NOTIFY requests...
pd [Mon, 1 Aug 2011 12:47:52 +0000 (13:47 +0100)]
modules_k/rls, modules_k/presence: Support for splitting large RLS NOTIFY requests into multiple NOTIFY requests

- Many SIP devices (including proxies and SBCs) are not able to handle
  vary large SIP requests.  Requests over 64k in size when using TCP
  are a common problem.

  It is easily possible with large (and even not so large) resource
  lists for RLS to generate NOTIFY requests that are too big for some
  SIP devices to handle.

  This enhancement gives RLS the ability to split these large NOTIFY
  requests into multiple smaller requests (that still comply with the)
  RFC.

  The default behaviour is the old (send a single big NOTIFY request)
  behaviour.

- Feature added by Andrew Miller at Crocodile RCS

9 years agokamctl: added missing tables for dbtext and db_berkeley
Daniel-Constantin Mierla [Mon, 1 Aug 2011 12:49:16 +0000 (14:49 +0200)]
kamctl: added missing tables for dbtext and db_berkeley

9 years agotm: backup/restore lists of avps for usage t_uac
Daniel-Constantin Mierla [Mon, 1 Aug 2011 12:36:39 +0000 (14:36 +0200)]
tm: backup/restore lists of avps for usage t_uac

- when sending a self-generated request while processing other sip
  message, backup the list of avps and restore afterwards
- reported by Sebastian Damm
- added helper function to backup/restore the lists of avps from msg
  context to static var and use transaction lists

9 years agokamctl: updates after changes in .gitignore
Daniel-Constantin Mierla [Mon, 1 Aug 2011 12:35:53 +0000 (14:35 +0200)]
kamctl: updates after changes in .gitignore

9 years ago.gitingnore: set root path for binary names
Daniel-Constantin Mierla [Mon, 1 Aug 2011 12:33:15 +0000 (14:33 +0200)]
.gitingnore: set root path for binary names

- some directories containing the binary name (e.g., kamailio like in
  utils/kamctl/dbtext/kamailio/...) in path were ignored. Updated
  .gitignore to use /kamailio and /ser which according to manual should
  match on the root folder of GIT tree

9 years agoipops: Added function is_ip_rfc1918(ip) for detecting private IPv4 according to RFC...
Iñaki Baz Castillo [Mon, 1 Aug 2011 10:21:44 +0000 (12:21 +0200)]
ipops: Added function is_ip_rfc1918(ip) for detecting private IPv4 according to RFC 1918.

9 years agolib/srdb1/schema: removed index that included missing columns
Juha Heinanen [Sun, 31 Jul 2011 16:04:43 +0000 (19:04 +0300)]
lib/srdb1/schema: removed index that included missing columns

9 years agocore: removing SQL buffer size stuff from doc/cfg_list/docbook/cfg_core.xml
pd [Fri, 29 Jul 2011 11:19:10 +0000 (12:19 +0100)]
core: removing SQL buffer size stuff from doc/cfg_list/docbook/cfg_core.xml

9 years agomodule_k/xcap_server: Added support HTTP 1.1 pre-conditions (If-Match: and If-None...
pd [Fri, 29 Jul 2011 10:56:14 +0000 (11:56 +0100)]
module_k/xcap_server: Added support HTTP 1.1 pre-conditions (If-Match: and If-None-Match:)

- Also fixed the ETag: header send by xcap_server as it should be a
  quoted-string (RFC 2616 section 3.11 and 14.19).
- If-Match (RFC 2616 section 14.24) and If-None-Match (RFC 2616
  section 14.26) are supported for the DELETE, GET, and PUT HTTP
  requests.

  This feature is useful as it enables clients to cache large XML
  documents (user-profiles/avatars/resource-lists) and only have to
  download them when they have actually changed (using If-None-Match:)

  If-Match: can help with the race conditions present when you have
  multiple simultaneous logins by helping to prevent clients from
  overwriting changes made by other clients.

9 years agoMerge branch 'master' into pd
pd [Fri, 29 Jul 2011 10:44:56 +0000 (11:44 +0100)]
Merge branch 'master' into pd

* master:
  core: fix all reported doxygen errors in PV and value evaluation code
  tls: restrict visibility of 4 only internal used functions to the module
  tls: two small code cleanups
  tls: fix all doxygen errors, extend existing documentation in touched files

9 years agocore: fix all reported doxygen errors in PV and value evaluation code
Henning Westerholt [Thu, 28 Jul 2011 21:58:00 +0000 (23:58 +0200)]
core: fix all reported doxygen errors in PV and value evaluation code

9 years agotls: restrict visibility of 4 only internal used functions to the module
Henning Westerholt [Thu, 28 Jul 2011 20:29:30 +0000 (22:29 +0200)]
tls: restrict visibility of 4 only internal used functions to the module

9 years agotls: two small code cleanups
Henning Westerholt [Thu, 28 Jul 2011 20:26:24 +0000 (22:26 +0200)]
tls: two small code cleanups

9 years agotls: fix all doxygen errors, extend existing documentation in touched files
Henning Westerholt [Thu, 28 Jul 2011 20:24:11 +0000 (22:24 +0200)]
tls: fix all doxygen errors, extend existing documentation in touched files

9 years agomodules_k/xcap_server: Improved rls_update_subs() example in README
pd [Thu, 28 Jul 2011 14:38:04 +0000 (15:38 +0100)]
modules_k/xcap_server: Improved rls_update_subs() example in README

9 years agomodules_k/rls: Added a new exported function: rls_update_subs()
pd [Thu, 28 Jul 2011 11:41:07 +0000 (12:41 +0100)]
modules_k/rls: Added a new exported function: rls_update_subs()

- This new function can be called from the Kamailio configuration file
  to force the RLS module to refresh its back-end subscriptions.

  This is particularly useful when the resource list has changed (for
  example, a new contact has been added) as it will create a new back-
  end subscriptions when required.

  This means that when you add a new contact in a client the uses RLS
  the added contact can be immediately subscribed to and will get an
  authorisation request.
- Sample usage:

  case "PUT":
    xcaps_put("$var(uri)", "$var(doc_uri)", "$rb");
    if($xcapuri(u=>auid)=~"pres-rules") {
      pres_update_watchers("$var(uri)", "presence");
      pres_refresh_watchers("$var(uri)", "presence", 1);
    } else if ($xcapuri(u=>auid)=~"resource-lists"
               || $xcapuri(u=>auid)=~"rls-services") {
      rls_update_subs("$var(uri)", "presence");
    }
    exit;
  break;

9 years agomodule_k/rls: Added support for resource-list indices.
pd [Thu, 28 Jul 2011 11:35:03 +0000 (12:35 +0100)]
module_k/rls: Added support for resource-list indices.

- That is, support for resource lists that contain references to
  other resource lists.
- This is needed for OMA/RCS compliance.
- Implementation only works with integrated XCAP.

9 years agoMerge branch 'master' into pd
pd [Thu, 28 Jul 2011 11:22:27 +0000 (12:22 +0100)]
Merge branch 'master' into pd

* master:
  textops(k): internal API bind function exported via module interface
  modules_k/xcap_server: increased maximum size of XCAP URI to 255
  doxygen documentation fixes
  core: allow forcing send socket for replies
  alias_db(k): rephrase documentation a bit to make it hopefully better understandable

9 years agotextops(k): internal API bind function exported via module interface
Daniel-Constantin Mierla [Thu, 28 Jul 2011 11:18:11 +0000 (13:18 +0200)]
textops(k): internal API bind function exported via module interface

- internal API was defined but no function to bind it was available in
  the module interface, reported by Timo Klecker
- rename of functions and typedef'ed struct to match the patterns of
  exporting modules internal API

9 years agomodules_k/xcap_server: increased maximum size of XCAP URI to 255
pd [Thu, 28 Jul 2011 11:15:25 +0000 (12:15 +0100)]
modules_k/xcap_server: increased maximum size of XCAP URI to 255

- The current length (127) is insufficient for some XCAP requests
  I have seen - particularly those for avatars (preseImage).

9 years agodoxygen documentation fixes
Henning Westerholt [Wed, 27 Jul 2011 22:22:09 +0000 (00:22 +0200)]
doxygen documentation fixes

9 years agocore: allow forcing send socket for replies
Daniel-Constantin Mierla [Wed, 27 Jul 2011 17:34:35 +0000 (19:34 +0200)]
core: allow forcing send socket for replies

- patch by Marcus Hunger, closes FS#142

9 years agoalias_db(k): rephrase documentation a bit to make it hopefully better understandable
Henning Westerholt [Wed, 27 Jul 2011 15:29:14 +0000 (17:29 +0200)]
alias_db(k): rephrase documentation a bit to make it hopefully better understandable

9 years agosrdb1, modules_k/presence_xml, modules_k/xcap_server: Updated xcap table version...
pd [Wed, 27 Jul 2011 13:44:39 +0000 (14:44 +0100)]
srdb1, modules_k/presence_xml, modules_k/xcap_server: Updated xcap table version from 3 to 4

- Also fixed a merge issue where I copied the PostgreSQL version of
  presence-create.sql over the MySQL one.

9 years agosrdb1: Fixed merge error made in commit 8623eeb1c2762d299cd88e0b7bc8d8fdb8fa2a72
pd [Wed, 27 Jul 2011 12:49:50 +0000 (13:49 +0100)]
srdb1: Fixed merge error made in commit 8623eeb1c2762d299cd88e0b7bc8d8fdb8fa2a72

- When copying utils/kamctl/mysql/siptrace-create.sql from my local SVN I accidently
  copied across utils/kamctl/postgres/siptrace-create.sql.

9 years agosrdb1: Added support for logging of messages > 64k in sip_trace with MySQL
pd [Wed, 27 Jul 2011 11:18:05 +0000 (12:18 +0100)]
srdb1: Added support for logging of messages > 64k in sip_trace with MySQL

- Some SIP requests - especially full-state NOTIFYs for large resource
  losts - can easily exceed 64k.
- This change makes MySQL use the mediumtext type for message contents.
- Feature added by Andrew Miller at Crocodile RCS

9 years agosrdb1, modules_k/xcap_server: Added support for XML documents larger than 64k in...
pd [Wed, 27 Jul 2011 11:13:25 +0000 (12:13 +0100)]
srdb1, modules_k/xcap_server: Added support for XML documents larger than 64k in MySQL

- It is easily possible for some XML documents (particularly resource lists
  used as a Network Address Book) to exceed 64k in size.
- Feature added by Andrew Miller at Crocodile RCS

9 years agocore, srdb1, modules/db_*, modules_k/db_*: Added support for configuring SQL buffer...
pd [Wed, 27 Jul 2011 10:50:20 +0000 (11:50 +0100)]
core, srdb1, modules/db_*, modules_k/db_*: Added support for configuring SQL buffer size and mediumblob/mediumtext in MySQL

- Currently the SQL buffer size is hard-coded to 64k.  This isn't
  enough in some cases.  For example, it is easily possible for
  resource lists (which can be Network Address Books) to be larger
  than 64k.
- The default buffer size is still 64k, but this can be overriden
  with the new "sql_buffer_size" configuration option.
- Support added for mediumblob/mediumtext in MySQL as the blob/text
  types that are currently supported are limited to 64k.
- Feature added by Andrew Miller at Crocodile RCS

9 years agocore: support for receiving requests > 64kb on TCP
pd [Mon, 25 Jul 2011 09:53:10 +0000 (10:53 +0100)]
core: support for receiving requests > 64kb on TCP

- Issue found and fixed by Andrew Miller at Crocodile RCS

9 years agomodules/tm: Added support for requests > 32 kb over TCP
pd [Mon, 25 Jul 2011 09:50:38 +0000 (10:50 +0100)]
modules/tm: Added support for requests > 32 kb over TCP

- Issue found and fixed by Andrew Miller at Crocodile RCS

9 years agomodules_k/pv: Add s.sql transformation to turn PV into suitable SQL value.
Alex Hermann [Thu, 21 Jul 2011 13:24:09 +0000 (15:24 +0200)]
modules_k/pv: Add s.sql transformation to turn PV into suitable SQL value.

This transformation outputs valid SQL values for various PV values:
 - <null> values are output as NULL
 - integers are output as integers
 - everything else is output as quoted and escaped string

Example:
$var(null) = $null;
$avp(null) = $null;
$avp(str) = "String with \ illegal \\characters";
$avp(nr) = 12345;
$avp(strnr) = "12345";

xlog("$$rm = $rm = $(rm{s.sql})");
xlog("$$var(null) = $var(null) = $(var(null){s.sql})");
xlog("$$avp(null) = $avp(null) = $(avp(null){s.sql})");
xlog("$$avp(str) = $avp(str) = $(avp(str){s.sql})");
xlog("$$avp(nr) = $avp(nr) = $(avp(nr){s.sql})");
xlog("$$avp(strnr) = $avp(strnr) = $(avp(strnr){s.sql})");

Output:
$rm = ACK = 'ACK'
$var(null) = 0 = 0
$avp(null) = <null> = NULL
$avp(str) = String with \ illegal \characters = 'String with \\ illegal \\characters'
$avp(nr) = 12345 = 12345
$avp(strnr) = 12345 = '12345'

9 years agomodules_k/nathelper: Add is_rfc1918(ip_addr) function to test ip_addr for rfc1918addr...
Alex Hermann [Tue, 19 Jul 2011 13:24:11 +0000 (15:24 +0200)]
modules_k/nathelper: Add is_rfc1918(ip_addr) function to test ip_addr for rfc1918addresses.

9 years agomodules_k/uac: Add reg_request_to function
Alex Hermann [Fri, 10 Jun 2011 11:00:20 +0000 (13:00 +0200)]
modules_k/uac: Add reg_request_to function

This function will lookup a local user from the registration table and
prepares mesasage variables so the request can be sent to the remote
user, providing authentiction via uac_auth().

9 years agomodules_k/uac: fix reg_ht_get_byuser when domain is not used.
Alex Hermann [Fri, 3 Jun 2011 14:12:19 +0000 (16:12 +0200)]
modules_k/uac: fix reg_ht_get_byuser when domain is not used.

9 years agocore: Add fixup_pvar_uint helper function
Alex Hermann [Fri, 10 Jun 2011 10:56:11 +0000 (12:56 +0200)]
core: Add fixup_pvar_uint helper function