sip-router
11 years agoMerge commit 'origin/ser_core_cvs'
Andrei Pelinescu-Onciul [Thu, 7 May 2009 12:55:01 +0000 (14:55 +0200)]
Merge commit 'origin/ser_core_cvs'

* commit 'origin/ser_core_cvs':
  core: log L_CRIT fix
  sctp: internal macro/hooks for sctp events
  sctp: internal macro-hooks for stats

Conflicts:
dprint.c
dprint.h

11 years agocore: log L_CRIT fix
Andrei Pelinescu-Onciul [Thu, 7 May 2009 11:50:41 +0000 (11:50 +0000)]
core: log L_CRIT fix

- don't add a "BUG" prefix to L_CRIT log messages (there are many
  L_CRIT messages that are not bugs, e.g. parse errors).
- added a new level L_BUG, special for BUG use (automatically adds
  a "BUG" prefix).

11 years agocore: PUBLISH and REFER recognized by first line parser
Daniel-Constantin Mierla [Wed, 6 May 2009 18:53:56 +0000 (20:53 +0200)]
core: PUBLISH and REFER recognized by first line parser

- still duplicity of getting the method - parse_metod() and macro by
  parsing first line

11 years agopresence: fixed bug in taking the parsed event structure
Daniel-Constantin Mierla [Wed, 6 May 2009 18:52:32 +0000 (20:52 +0200)]
presence: fixed bug in taking the parsed event structure

11 years agotest: port all registrar based tests (mysql, postgres, unixodbc) to sr
Henning Westerholt [Wed, 6 May 2009 16:55:33 +0000 (18:55 +0200)]
test: port all registrar based tests (mysql, postgres, unixodbc) to sr

11 years agotest: small fix in module check, return success when found in the first dir
Henning Westerholt [Wed, 6 May 2009 16:52:36 +0000 (18:52 +0200)]
test: small fix in module check, return success when found in the first dir

11 years agotest: small fixes for test 2, port test 1 and 4
Henning Westerholt [Wed, 6 May 2009 16:35:38 +0000 (18:35 +0200)]
test: small fixes for test 2, port test 1 and 4

11 years agocore script parsing: minor fix: " at the end of file
Andrei Pelinescu-Onciul [Wed, 6 May 2009 16:32:46 +0000 (18:32 +0200)]
core script parsing: minor fix: " at the end of file

Having a closing quote at the end of file generated a parse error.

Reported-by: Henning Westerholt <henning.westerholt@1und1.de>
11 years agotest: port test 2 to sr, comment non-working modules out
Henning Westerholt [Wed, 6 May 2009 16:26:49 +0000 (18:26 +0200)]
test: port test 2 to sr, comment non-working modules out

11 years agodispatcher(k): add 'struct tmb' to fix module loading after change 441ab3c9f2ca
Henning Westerholt [Wed, 6 May 2009 16:16:28 +0000 (18:16 +0200)]
dispatcher(k): add 'struct tmb' to fix module loading after change 441ab3c9f2ca

11 years agodoc: config migration
Andrei Pelinescu-Onciul [Wed, 6 May 2009 15:57:25 +0000 (17:57 +0200)]
doc: config migration

Added a config migration guide for ser 2.1 to sip-router.
The kamailio part is empty for now.

11 years agocfg: example configs migrated to sip-router
Andrei Pelinescu-Onciul [Wed, 6 May 2009 15:50:53 +0000 (17:50 +0200)]
cfg: example  configs migrated to sip-router

Ported ser example configs to sip-router:
- updated module path (now using loadpath)
- changed mysql module name to db_mysql
- replaced max_len in msg:len comparisons with 4096
- updated avp and selects non-empty checks:
  if($v)  -> if ($v!="")
  if(!$v) -> if (strempty($v)) or if ($v=="")

11 years agomake: fix the module path in installed cfg
Andrei Pelinescu-Onciul [Wed, 6 May 2009 15:48:05 +0000 (17:48 +0200)]
make: fix the module path in installed cfg

- fix: the module path is updated in the installed cfg and man
  pages (broken when the multiple modules were added).

11 years agocore script parsing: various small fixes
Andrei Pelinescu-Onciul [Wed, 6 May 2009 14:45:04 +0000 (16:45 +0200)]
core script parsing: various small fixes

- fix: allow "default" in a config var id (e.g. session_timer.default).
  It stopped working after default became a keyword (switch()).
- fix: allow negative number in selects (e.g. @eval.pop[-1])
- fix: allow negative number in function parameters
- fix setavpflag, resetavpflag, isavpflag and "simple" avp names

11 years agotest: adaption of kamailio specific scripts to sr, more generalization
Henning Westerholt [Wed, 6 May 2009 15:12:17 +0000 (17:12 +0200)]
test: adaption of kamailio specific scripts to sr, more generalization

11 years agoport from k r5751, fscanf can fail, fix warning related to recent glibc versions
Henning Westerholt [Wed, 6 May 2009 13:04:34 +0000 (15:04 +0200)]
port from k r5751, fscanf can fail, fix warning related to recent glibc versions

11 years agorefine 15e2e89e5d1e7f9dc6265c270153088596159ee5, remove instead comment out
Henning Westerholt [Wed, 6 May 2009 12:31:33 +0000 (14:31 +0200)]
refine 15e2e89e5d1e7f9dc6265c270153088596159ee5, remove instead comment out

11 years agocore: Consolidate append_str macro usage
Jan Janak [Wed, 6 May 2009 12:47:14 +0000 (14:47 +0200)]
core: Consolidate append_str macro usage

The definition of append_str macro was scattered across the source tree,
there were multiple definition of the macro, some of them with different
parameters.

This patch brings the definition of append_str macro into ut.h header
file and removes all other definitions from core and modules.

We chose the version with three parameters where the pointer and the
length of the source string are passed separately to the macro. This is
more flexible than passing both of them within one parameter as str
structure.

All references to append_mem_block have been removed because the same
operation can now be achieved with append_str. In addition to that we
updated parameters passed to append_str where needed, converting one
str parameter to <pointer,len> pair of parameters.

Some modules had yet another version of append_str defined, there we
renamed the macro to some other name to make sure that the local
definition does not conflict with the definition on ut.h

11 years agopresence_xml: disable bla support
Daniel-Constantin Mierla [Wed, 6 May 2009 12:09:47 +0000 (14:09 +0200)]
presence_xml: disable bla support

- needs review with latest spec updates
- potential issues with merging need to be reviewed as well

11 years agoMerge unit tests from kamailio trunk.
Jan Janak [Wed, 6 May 2009 10:08:08 +0000 (12:08 +0200)]
Merge unit tests from kamailio trunk.

* trunk: (126 commits)
  - extend test with one non-digit URI (bug #2694633)
  - fix isql function, remove column delimiter
  - add missing check for kamailio binary on start
  - fix NULL behaviour for db_unixodbc in module
  - add functionality for runtime message forwarding, this is useful
  - remove a few modules that need (now) external libraries
  - change functionality in cr_route, cr_prime_route to not store information
  - improve tests a bit for flags and mask matching
  - fix test description
  - move encode_contact, decode_contact and decode_contact_header function
  - add a new test for carrierroute, non-numerical matching mode
  - fix tests after removal of the uri module and the moving of the $shv vars
  - fix tests, add pv loadmodule..
  - remove options module from test after removal in the tree
  - add missing module and compile checks on start
  - add new utils module to test
  - finish renaming, fix module name in test
  - add new module 'utils', to hold various SIP message related functionality
  - extend registrar test for db_mysql and db_postgres: test also for contact
  - finish refactoring of carrierroute module
  ...

11 years agoSerial forking functions.
Jan Janak [Wed, 6 May 2009 09:17:17 +0000 (11:17 +0200)]
Serial forking functions.

This patch adds two new functions to tm module, t_load_contacts and
t_next_contacts which can be used to implement serial forking.

There are also two new parameters, fr_inv_timer_next and contacts_avp.
Parameter fr_inv_timer_next is similar to fr_inv_timer, the value
of this parameter is used for subsequent branches during serial forking.

The value of contacts_avp is the identifier of the AVP which contains
the list of contacts to be used for serial forking.

The serial forking functions originate from Kamailio where they were
implemented by Juha Heinanen.

11 years agoSplitting fix_sock_str into socket2str and fix_sock_str
Jan Janak [Wed, 6 May 2009 09:10:48 +0000 (11:10 +0200)]
Splitting fix_sock_str into socket2str and fix_sock_str

This patch splits fix_sock_str into two function, socket2str and
fix_sock_str. The function socket2str is exported and can be used
to print the socket into a pre-allocated memory buffer. Function
fix_sock_str allocates the memory buffer and calls socket2str
internally.

The primary consumer of this change is the serial forking code in
tm module.

This patch also defines a new macro called MAX_SOCKET_STR which
evaluates to the maximum size of textual representation of any
socket.

11 years agocore: better config parsing error messages
Andrei Pelinescu-Onciul [Tue, 5 May 2009 19:04:02 +0000 (21:04 +0200)]
core: better config parsing error messages

- on expression parsing error try to keep the number of parsing
  error messages low
- better if parse error reporting

11 years agocore: type casts support in the script
Andrei Pelinescu-Onciul [Tue, 5 May 2009 17:43:18 +0000 (19:43 +0200)]
core: type casts support in the script

Support for casts added: (int) and (str).
E.g.: (int)$v ; (str)$v+"test".

11 years agoscript parsing: if (non-int) not any longer an error
Andrei Pelinescu-Onciul [Tue, 5 May 2009 17:19:54 +0000 (19:19 +0200)]
script parsing: if (non-int) not any longer an error

An if expression that does not evaluate to int is not any longer
considered a parse error. It will generate a warning, but sr will
start.
This allows backward compatible if (@select) or if($avp).

11 years agocore expr eval: string == fix
Andrei Pelinescu-Onciul [Tue, 5 May 2009 17:17:12 +0000 (19:17 +0200)]
core expr eval: string == fix

- fixed typo which made == the same as != for strings
- minor optimizations debugging messages fixes

11 years agocore expr: optimizations fixes for $v op 0|1 -> $v
Andrei Pelinescu-Onciul [Tue, 5 May 2009 14:15:01 +0000 (16:15 +0200)]
core expr:  optimizations fixes for $v op 0|1 -> $v

- fix missing cast for the  $v <op> c -> $v optimizations
  (e.g. $v - 0 -> $v, 1 * $v -> $v): instead of replacing
  $v <op> c with $v use (type_of(<op>)) $v.  $v without the cast
  to the type produced by the operator is used now only when
  type_of($v)==type_of(<op>).
  E.g.: 1 * $v -> (int)$v
        1 * ($v/$w) -> $v/$w  ($v/$w produces always an int, so no
                               need for the cast)
  Bug example:  1*"2"+3 was optimized to "2"+3 == "23" instead of
  (int)"2"+3 == 5.

- better debugging messages

11 years agocore expr. eval: support for int & str casts
Andrei Pelinescu-Onciul [Tue, 5 May 2009 11:51:40 +0000 (13:51 +0200)]
core expr. eval: support for int & str casts

- new internal operators for force-casting to int or str
- fix int conversion failure for v1 str_concat v2

11 years agocore expr. eval: fix fixup/optimization bug
Andrei Pelinescu-Onciul [Mon, 4 May 2009 20:23:59 +0000 (22:23 +0200)]
core expr. eval: fix fixup/optimization bug

In some cases some ref'ed rvals were replaced in-place, messing up
the refcnt.

11 years agocore expr. eval: added bug catcher
Andrei Pelinescu-Onciul [Mon, 4 May 2009 20:02:49 +0000 (22:02 +0200)]
core expr. eval: added bug catcher

Added code for catching an easy to overlook bug (replacing in-line
a referenced rval during optimizing).

11 years agocore script engine: if switched to rval_expr
Andrei Pelinescu-Onciul [Mon, 4 May 2009 19:58:40 +0000 (21:58 +0200)]
core script engine: if switched to rval_expr

- switched if to use directly rval_expr
- warn on startup if "if" expression is constant
- fail to start if "if" expression evaluates to non-int

11 years agocore expr. eval: support for =~
Andrei Pelinescu-Onciul [Mon, 4 May 2009 19:09:23 +0000 (21:09 +0200)]
core expr. eval: support for =~

The match regular expression operator (=~) is now supported in
rval_exprs.

11 years agoMerge commit 'origin/andrei/type_conversion'
Andrei Pelinescu-Onciul [Mon, 4 May 2009 21:38:12 +0000 (23:38 +0200)]
Merge commit 'origin/andrei/type_conversion'

* commit 'origin/andrei/type_conversion':
  script parsing: fix bug in expression error checking
  core expr eval: various fixes
  news: update (new operators, expr. eval behaviour a.s.o.)
  core: new script operators: eq, ne, ieq, ine
  core expr eval: fix assoc., commut and 0 adding for +, ==
  core expr eval: minor ==/!= optimization
  core expr eval: internal == & != int and str only versions
  core expr eval: special handling for undef cmp expr
  core eval expr: cache undefined results too
  core expr eval:  str automatic conversion to int
  core expr eval: undef conversion to int and str
  core expr eval: defined @select

11 years agoa bunch of small refactorings in the dialog module
Henning Westerholt [Sun, 3 May 2009 21:25:05 +0000 (23:25 +0200)]
a bunch of small refactorings in the dialog module

- move populate_leg_info declaration to the proper header file
 - unify mostly identical dlg_seq_up_onreply, dlg_seq_down_onreply functions
 - make unref_new_dialog static, this is not used outside the implementation file
 - compact variable declarations in dlg_onroute and a few other functions
 - the get_dlg_tl_payload macro is only used once, integrate it into the code

11 years agoadd complete doxygen documentation for dlg_handlers.{c,h} in dialog module
Henning Westerholt [Sun, 3 May 2009 20:54:24 +0000 (22:54 +0200)]
add complete doxygen documentation for dlg_handlers.{c,h} in dialog module

11 years agosmall refactoring to decrease exported symbols signature
Henning Westerholt [Sun, 3 May 2009 18:07:53 +0000 (20:07 +0200)]
small refactoring to decrease exported symbols signature

- move unlink_unsafe_dlg function to header file, make them static
- move unref_dlg_unsafe, ref_dlg_unsafe macros to implementation file

11 years agocomplete doxygen documentation for dlg_hash header and implementation
Henning Westerholt [Sun, 3 May 2009 18:02:10 +0000 (20:02 +0200)]
complete doxygen documentation for dlg_hash header and implementation

11 years agospelling fix in documentation
Henning Westerholt [Sun, 3 May 2009 17:23:22 +0000 (19:23 +0200)]
spelling fix in documentation

11 years agoadd more doxygen documentation for dialog module
Henning Westerholt [Thu, 30 Apr 2009 21:09:50 +0000 (23:09 +0200)]
add more doxygen documentation for dialog module

11 years agodon't include and link with database API, this is not needed
Henning Westerholt [Thu, 30 Apr 2009 18:32:26 +0000 (20:32 +0200)]
don't include and link with database API, this is not needed

11 years agospelling fixes in documentation
Henning Westerholt [Thu, 30 Apr 2009 17:58:20 +0000 (19:58 +0200)]
spelling fixes in documentation

11 years agogenerate README for the cfg_rpc module
Henning Westerholt [Thu, 30 Apr 2009 16:58:11 +0000 (18:58 +0200)]
generate README for the cfg_rpc module

11 years agogenerate README for blst module
Henning Westerholt [Thu, 30 Apr 2009 16:55:41 +0000 (18:55 +0200)]
generate README for blst module

11 years agogenerate README for bdb module
Henning Westerholt [Thu, 30 Apr 2009 16:54:26 +0000 (18:54 +0200)]
generate README for bdb module

11 years agogenerate and add README for auth_identity module
Henning Westerholt [Thu, 30 Apr 2009 16:37:04 +0000 (18:37 +0200)]
generate and add README for auth_identity module

11 years agosmall spelling fix in docs and comment
Henning Westerholt [Thu, 30 Apr 2009 16:20:23 +0000 (18:20 +0200)]
small spelling fix in docs and comment

11 years agodocumentation fix, acc_syslog contains no parameter 'secret'
Henning Westerholt [Thu, 30 Apr 2009 16:16:10 +0000 (18:16 +0200)]
documentation fix, acc_syslog contains no parameter 'secret'

11 years agocore expr eval: fix script functions failure check
Andrei Pelinescu-Onciul [Mon, 4 May 2009 08:41:07 +0000 (10:41 +0200)]
core expr eval: fix script functions failure check

script/module functions integer/boolean evaluation did not respect
the module return convention (>0 success, <0 failure).

Reported-by: Daniel-Constantin Mierla <miconda@gmail.com>
11 years agotmx: doc updated
Daniel-Constantin Mierla [Sun, 3 May 2009 13:39:05 +0000 (15:39 +0200)]
tmx: doc updated

11 years agotmx: added t_cancel_branches()
Daniel-Constantin Mierla [Sun, 3 May 2009 13:19:25 +0000 (15:19 +0200)]
tmx: added t_cancel_branches()

11 years agotm: which cancel exported via TM API
Daniel-Constantin Mierla [Sun, 3 May 2009 13:18:21 +0000 (15:18 +0200)]
tm: which cancel exported via TM API

11 years agopv: doc updated
Daniel-Constantin Mierla [Sun, 3 May 2009 12:47:21 +0000 (14:47 +0200)]
pv: doc updated

11 years agopv: avp_aliases parameter
Daniel-Constantin Mierla [Sun, 3 May 2009 11:42:56 +0000 (13:42 +0200)]
pv: avp_aliases parameter

- avp_aliases parameter from K core
- pv module is the only one exporting $avp(...) PV, so without it this
  parameter makes no sense

11 years agocore: auto_aliases to control rev DNS aliases
Daniel-Constantin Mierla [Sun, 3 May 2009 11:04:49 +0000 (13:04 +0200)]
core: auto_aliases to control rev DNS aliases

- parameter takes boolean value
- if set, rev dns results are added to aliases list
- default is set

11 years agopresence_xml: link to kmi lib
Daniel-Constantin Mierla [Fri, 1 May 2009 21:23:51 +0000 (23:23 +0200)]
presence_xml: link to kmi lib

11 years agotmx: new module to collect K TM extensions
Daniel-Constantin Mierla [Fri, 1 May 2009 13:14:37 +0000 (15:14 +0200)]
tmx: new module to collect K TM extensions

- includes:
- pseudo-variables
- MI commands
- statistics (only register them now, no update)

11 years agotm: unref_cell(t) added to tm api
Daniel-Constantin Mierla [Fri, 1 May 2009 12:58:49 +0000 (14:58 +0200)]
tm: unref_cell(t) added to tm api

- wrapper to UNREF(T) define
- used by K extensions (tmx module)

11 years agoregistrar: declare usrloc_api_t variable
Daniel-Constantin Mierla [Fri, 1 May 2009 12:52:58 +0000 (14:52 +0200)]
registrar: declare usrloc_api_t variable

11 years agotm: define tm_ctx_get() to NULL if no WITH_TM_CTX
Daniel-Constantin Mierla [Fri, 1 May 2009 12:01:26 +0000 (14:01 +0200)]
tm: define tm_ctx_get() to NULL if no WITH_TM_CTX

11 years agotm: free dst_uri.s in fake_req if failure
Daniel-Constantin Mierla [Fri, 1 May 2009 11:55:06 +0000 (13:55 +0200)]
tm: free dst_uri.s in fake_req if failure

- free fake_req->dst_uri.s if no more pkg for fake_req->new_uri.s

11 years agotm: added tm_ctx to collect K extension requirements
Daniel-Constantin Mierla [Fri, 1 May 2009 11:40:33 +0000 (13:40 +0200)]
tm: added tm_ctx to collect K extension requirements

- it holds now branch index value used by $T_branch_index
- added function in TM API to access tm_ctx

11 years agotm: exported more functions via TM API
Daniel-Constantin Mierla [Fri, 1 May 2009 10:35:01 +0000 (12:35 +0200)]
tm: exported more functions via TM API

- t_lookup_callid, generate_callid, generate_fromtag, t_lookup_request,
  t_check are now available via API

11 years agosctp: internal macro/hooks for sctp events
Andrei Pelinescu-Onciul [Thu, 30 Apr 2009 16:39:10 +0000 (16:39 +0000)]
sctp: internal macro/hooks for sctp events

Added macros for sctp events (for now empty, or defined to simple
 example DBG()):

SCTP_EV_ASSOC_CHANGE
SCTP_EV_PEER_ADDR_CHANGE
SCTP_EV_REMOTE_ERROR
SCTP_EV_SEND_FAILED
SCTP_EV_SHUTDOWN_EVENT
SCTP_EV_SENDER_DRY_EVENT

11 years agosctp: internal macro-hooks for stats
Andrei Pelinescu-Onciul [Thu, 30 Apr 2009 16:38:54 +0000 (16:38 +0000)]
sctp: internal macro-hooks for stats

Added macros for sctp statistics.  (for now empty, keeping
more statistics will only involve redefining them):

SCTP_STATS_ESTABLISHED() - new association is opened successfully
SCTP_STATS_CONNECT_FAILED() - attempt to open new assoc. failed
SCTP_STATS_LOCAL_REJECT() - local reject of a "connect" attempt
                            (unused for now)
SCTP_STATS_REMOTE_SHUTDOWN()
SCTP_STATS_COMM_LOST() - error on open association
SCTP_STATS_SENDQ_FULL() - send failed due to full buffers (kernel)
SCTP_STATS_SEND_FAILED() - send failed for some other reason
SCTP_STATS_SEND_FORCE_RETRY() - send failed and retried
                                (sctp_send_retries!=0)

11 years agofix lib/binrpc compilation (include path, s/modules/modules_s/)
Henning Westerholt [Thu, 30 Apr 2009 09:15:05 +0000 (11:15 +0200)]
fix lib/binrpc compilation (include path, s/modules/modules_s/)

11 years agosms(s): sms_report_type & tmb declared in multiple places
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:35:39 +0000 (17:35 +0200)]
sms(s): sms_report_type & tmb declared in multiple places

11 years agorr(s): missing extern for avp_flag_dialog
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:34:57 +0000 (17:34 +0200)]
rr(s): missing extern for avp_flag_dialog

11 years agomangler(s): missing extern
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:34:20 +0000 (17:34 +0200)]
mangler(s): missing extern

11 years agosms(k): sms_report_type & tmb declared in multiple places
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:33:19 +0000 (17:33 +0200)]
sms(k): sms_report_type & tmb declared in multiple places

11 years agoregistrar(k): missing extern for ul
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:31:57 +0000 (17:31 +0200)]
registrar(k): missing extern for ul

11 years agopua_usrloc(k): missing extern for pua_send_publish & pua_send_subscribe
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:31:15 +0000 (17:31 +0200)]
pua_usrloc(k): missing extern for pua_send_publish & pua_send_subscribe

11 years agopua_dialoginfo(k): missing extern for pua_send_publish
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:30:32 +0000 (17:30 +0200)]
pua_dialoginfo(k): missing extern for pua_send_publish

11 years agodispatcher(k): missing extern for tmb
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:29:48 +0000 (17:29 +0200)]
dispatcher(k): missing extern for tmb

11 years agoauth_diameter(k): missing extern for sockfd & use_domain
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:27:58 +0000 (17:27 +0200)]
auth_diameter(k): missing extern for sockfd & use_domain

11 years agotm: missing extern for rpc_cancel_doc[]
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:25:56 +0000 (17:25 +0200)]
tm: missing extern for rpc_cancel_doc[]

11 years agotm: _tm_table should be extern
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 15:24:08 +0000 (17:24 +0200)]
tm:  _tm_table should be extern

- _tm_table was declared in h_table.h without "extern", causing a
  _tm_table symbol to be created in each module including
  h_table.h.

Reported-by: Daniel-Constantin Mierla <miconda@gmail.com>
11 years agoRURI manipulating functions have been fixed to preserve
Miklos Tirpak [Wed, 29 Apr 2009 13:55:13 +0000 (15:55 +0200)]
RURI manipulating functions have been fixed to preserve
tel: URI parameters

- parameters of a tel: URI embedded in a sip URI had been lost
when SET_USER_T action was called for instance.
("sip:123;param=val@foo.com;user=phone"
became
"sip:456@foo.com;user=phone"
after rewriting the user name.)
- sip_params variable is added to sip_uri structure to
store the original sip: URI parameters.

11 years agoscript parsing: fix bug in expression error checking
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 12:02:16 +0000 (14:02 +0200)]
script parsing: fix bug in expression error checking

- fixed core dump when attempting to continuing script checking
  after an expression parse error.

11 years agocore expr eval: various fixes
Andrei Pelinescu-Onciul [Wed, 29 Apr 2009 11:55:01 +0000 (13:55 +0200)]
core expr eval: various fixes

- fix pvars type evaluated to STRING almost always (when they had
  PV_VAL_STR).
- fix undefined not properly propagated for avps (typo) which caused
  some comparsion to behave in unexpected way (e.g.
  $undef_avp != $undef_avp was true).
- fix <undef>+something (used to produce an error, now is
  equivalent to "" + something).

11 years agotm: handling of branch flags
Daniel-Constantin Mierla [Tue, 28 Apr 2009 18:40:26 +0000 (20:40 +0200)]
tm: handling of branch flags

- save/restore branch upon execution of tm specific routes

11 years agocore: wrapper to return branch iterator position
Daniel-Constantin Mierla [Tue, 28 Apr 2009 18:38:09 +0000 (20:38 +0200)]
core: wrapper to return branch iterator position

11 years agonews: update (new operators, expr. eval behaviour a.s.o.)
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 17:54:03 +0000 (19:54 +0200)]
news: update (new operators, expr. eval behaviour a.s.o.)

11 years agocore: new script operators: eq, ne, ieq, ine
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 17:48:11 +0000 (19:48 +0200)]
core: new script operators: eq, ne, ieq, ine

Added operators for: - string == and string != : eq, ne
                     - integer == and integer!= : ieq, ine
They are almost equivalent to == or !=, but they force the
conversion of their operands (eq to string and ieq to int),
allowing among other things better type checking on startup
and more optimizations.
Non equiv. examples: 0 == "" (true) is not equivalent to 0 eq ""
(false: it evaluates to "0" eq ""). "a" ieq "b" (true: (int)"a" is
0 and (int)"b" is 0) is not equivalent to "a" == "b" (false).

Note: the names are not final, they are mostly for testing.
Future releases might replace ==/!= with ieq/ine and use eq/ne for
strings.

11 years agokex: documentation for km_append_branch()
Daniel-Constantin Mierla [Tue, 28 Apr 2009 17:34:29 +0000 (19:34 +0200)]
kex: documentation for km_append_branch()

11 years agokex: added km_append_branch
Daniel-Constantin Mierla [Tue, 28 Apr 2009 17:23:23 +0000 (19:23 +0200)]
kex: added km_append_branch

- K compatible append_branch() function

11 years agoregistrar: update for getblagsval
Daniel-Constantin Mierla [Tue, 28 Apr 2009 17:22:41 +0000 (19:22 +0200)]
registrar: update for getblagsval

11 years agopv: update for getbflagsval
Daniel-Constantin Mierla [Tue, 28 Apr 2009 17:22:23 +0000 (19:22 +0200)]
pv: update for getbflagsval

11 years agocore: renamed getbflsgs to getblagsval
Daniel-Constantin Mierla [Tue, 28 Apr 2009 17:21:04 +0000 (19:21 +0200)]
core: renamed getbflsgs to getblagsval

- match the template of counterpart setblagsval
- swapped the parameters

11 years agocore expr eval: fix assoc., commut and 0 adding for +, ==
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 16:34:03 +0000 (18:34 +0200)]
core expr eval: fix assoc., commut and 0 adding for +, ==

- fix associativity for the generic plus: because of the non-fixed
  argument types (can work with strings integers or both in the
  same type), RVE_PLUS_OP is associative _only_ if the operand
  types match.
  Non-assoc. example: "a" + 1 + "2"  (can be "a12" or "a3").
  Instead of adding extra checks for the same type, rely on the
  optimizer having already replaced RVE_PLUS_OP with RVE_IPLUS_OP
  or RVE_CONCAT_OP => RVE_PLUS_OP will be used only when the
  operands types are mixed or cannot be determined (e.g. AVP), or
  when script optimizations are turned off (-O0).
- fix commutativity for the generic plus. Similar to the above.
  Non-commut. example: 1 + "2" == 3, but  "2" + 1 == "21".
- fix commutativity for the generic == and !=.
  Non. commut. example:  0 == "" , but  "" != 0.
  Similar fix as above, relying on the optimizer and the type specific
  operators: RVE_IEQ_OP, RVE_IDIFF_OP, RVE_STREQ_OP and
  RVE_STRDIFF_OP.
- fix $v + 0 / 0 + $v -> $v optimizations. Because of the generic
  plus and recent changes that allow int + str, even if the result
  is an int (left side operant is integer), 0 + $v can be
  different from $v. E.g.: 0+"1" == 1, which is different from
  "1".

11 years agocore expr eval: minor ==/!= optimization
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 15:49:54 +0000 (17:49 +0200)]
core expr eval: minor ==/!= optimization

- replace the generic RVE_EQ_OP/RVE_DIFF_OP with the type specific
  version (RVE_IEQ_OP/RVE_STREQ_OP...), if the type is known.

11 years agocore expr eval: internal == & != int and str only versions
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 15:39:35 +0000 (17:39 +0200)]
core expr eval: internal == & != int and str only versions

- added RVE_IEQ_OP and RVE_IDIFF_OP - internal integer only
  (force argument conversion to int)  operators
- added RVE_STREQ and RVE_STRDIFF_OP - internal string only
  (force argument conversion to str) operators

11 years agokex: script and branch flags operations
Daniel-Constantin Mierla [Tue, 28 Apr 2009 14:35:28 +0000 (16:35 +0200)]
kex: script and branch flags operations

- K script and branch flags operations included in kex module
- the parameters must be now enclosed in quotes
- the parameters can be now integer value or Pseudo-Variable with
  integer value
- the optional 'branch' parameter for branch flags parameters is now the
  second, for a more logical parameter mapping with the version without
  this parameter

11 years agokex: doxumentation for script and branch flags operations
Daniel-Constantin Mierla [Tue, 28 Apr 2009 14:34:21 +0000 (16:34 +0200)]
kex: doxumentation for script and branch flags operations

11 years agocore expr eval: special handling for undef cmp expr
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 14:07:23 +0000 (16:07 +0200)]
core expr eval: special handling for undef cmp expr

undef == expression is evaluated in the following way:
 - default:
           (type_of(expression))(undef) == expression.
   If the expression is undef too, the whole comparison it's
   evaluated to true (internally it's evaluated to
   (str) undef == (str) undef =>    "" == "" => true).
   E.g.:  undef == 0   -> (int)undef == 0   -> 0 == 0  -> true
          undef == "a" -> (str)undef == "a" -> ""=="a" -> false
          undef == undef -> true
 - if UNDEF_EQ_UNDEF_TRUE is defined, the == comparison is always
   false except for undef == undef which is true.
   E.g.:  undef == 0 -> false ; undef == "" false
 - if UNDEF_EQ_ALWAY_FALSE is defined, the result is always false

!= is always the reverse of ==.

Note: this covers only the case when undef is on the _left_ side
 (the case in which we do not know what to convert undef to). If
 the undef is on the right side, it will work like for any other
 comparison: expr == undef => expr == (type_of(expr)) undef.

11 years agocore eval expr: cache undefined results too
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 13:08:35 +0000 (15:08 +0200)]
core eval expr: cache undefined results too

- internally cache undefined results of avp and pvar evaluations
 (using RV_NONE for the val_type), between calls.
- fix wrong cache check for defined(pvar) (not used yet)

11 years agopv: fix of tobody.params transformation
Daniel-Constantin Mierla [Tue, 28 Apr 2009 12:54:58 +0000 (14:54 +0200)]
pv: fix of tobody.params transformation

- reported by Alex Hermann

11 years agocore expr eval: str automatic conversion to int
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 10:00:04 +0000 (12:00 +0200)]
core expr eval:  str automatic conversion to int

(int)"" = 0
(int)"<number>" = <number>  (e.g. (int)"123" = 123)
(int)"<non-numeric>" = 0    (e.g. (int)"abc" = 0)

11 years agocore expr eval: undef conversion to int and str
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 08:50:56 +0000 (10:50 +0200)]
core expr eval: undef conversion to int and str

(int)(undef)=0
(str)(undef)=""

11 years agocore expr eval: defined @select
Andrei Pelinescu-Onciul [Tue, 28 Apr 2009 07:50:07 +0000 (09:50 +0200)]
core expr eval: defined @select

- a select can now be undefined (defined @select when run_select
 returns >0 or error => true)
- RV_CACHE_SELECT introduced

11 years agouse pcre-config when available, based on patch #2781237 from Jinke Jiang
Henning Westerholt [Mon, 27 Apr 2009 15:42:32 +0000 (17:42 +0200)]
use pcre-config when available, based on patch #2781237 from Jinke Jiang