Imported Upstream version 4.1.6

rfuchs/rtpstat-fix upstream/4.1.6
Victor Seva 12 years ago
parent acc54fb770
commit eb59d0198f

@ -1,3 +1,427 @@
===================== 2014-09-18 Version 4.1.6 Released =====================
===================== Changes Since Version 4.1.5 ===========================
commit 895be72fff0ebbb8041737c567db2e7a72b1493e
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Sep 18 15:29:32 2014 +0200
Makefile.defs: version set to 4.1.6
commit aceb784c2b5705bb1f9c89f9df6bdf1891856946
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Sep 18 15:27:26 2014 +0200
pkg/rpm: version set to 4.1.5 in rpm specs
commit 32fd8a7b52ec13c2cd7059d7389ff663edb40d84
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Sep 18 15:25:26 2014 +0200
pkg/deb: version set to 4.1.6 in debian specs
commit c59199c69f6fe492bdb9888b623da85cf086bd4b
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Fri Jul 25 23:16:31 2014 +0200
sms: domain is not allocated in pkg by the module
- skip freeing in mod destroy
(cherry picked from commit fc383b13c32d4f89fbb8a7de14a07cbb26f38693)
commit e47f3cbb168a6cf73de4ba5a7ea6f797ebb4a176
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Wed Jul 30 15:58:27 2014 +0200
dialog: if ACK for 200ok is not coming in 60sec, dialog lifetime is shortened for 10 more sec
- should handle the situation when caller cancels the call but the
callee answered before getting the cancel
- reported by Alex Balashov
(cherry picked from commit ca3da467f59dbaed2d20aa45314ac12a362e2deb)
commit 15a8dbb8898f6430591500d6302b4ec0afc636a3
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Wed Sep 17 21:23:10 2014 +0200
core: revert rpc printf name cherry picked for fixing result
commit 555537769f5ecbf8dacc3de7529da05bfbdd3d04
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Sep 16 23:38:35 2014 +0200
core: safety check for outbound buffer
- pointer can end up being NULL if replacement fails to be built (e.g.,
via topoh)
(cherry picked from commit c2b0be97a3ef8e4e1bff34a5c73328a63979aa61)
commit b58b5fd3c8c2f9cef6362f7f069bad7f814475ca
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Sep 16 23:33:20 2014 +0200
core: hanlde replacement buffer free for WS/WSS frame sending
- affected when using topoh for ws/wss traffic
(cherry picked from commit ec8fe1e7ea904a51ca933d0b15408ca464002cbe)
commit c13b5a0bfe80bea3cf76a16675f9261334ab4998
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Sep 16 19:05:57 2014 +0200
dialog: check if the transaction is created for BYE closing the dialog
- if not, release the dialog, because there will be no tm callbacks
called later to release it. In this way avoid zombie dialog.
- reported by Ovidiu Sas, FS#424
(cherry picked from commit 02e43f87b2fa3be61bc4c63a9f8359457e3e0484)
commit e37c57c0cd430d0e0ce158af63fa929036695041
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Sep 16 18:13:02 2014 +0200
utils/kamctl: removed unused default values
- test if DEFAULT_Q is set inside the function using it, because it has
single place usage
(cherry picked from commit 1735feed8e287e92c3d81cf6a4d873460f6ee878)
commit 95aa4a4265fef62f347bbd6c32aafcfe34d87954
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Fri Sep 12 20:41:55 2014 +0200
usrloc: safety check for debug message printing path value from rpc add command
- reported and patch by Thomas Arimont, FS#467
(cherry picked from commit b1ba03f1fe41522b62aa727966c4dec3062cbbb9)
commit 118c901bd1879a46d9e392093994bc544cf511c1
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Sep 11 22:36:56 2014 +0200
dispatcher: free dset root structure at reload
- reported by Heenan, Timothy Steven
(cherry picked from commit 7fb8c88c1d4aeb50d1e637697132ab0994dcdb28)
commit 0d64a8f9838cb682600685bb23709f1652c4cc5a
Author: Alekzander Spiridonov <sipidronov@gmail.com>
Date: Thu Sep 4 07:09:02 2014 -0700
msg_parser: fix To parameter with null value parsing
(cherry picked from commit 14183ffa5e1bab1659d1df87a77057d50c376029)
commit 9c1126fddba58e6a63409ee3cf210fb24b1e7922
Author: Luis Azedo <luis@2600hz.com>
Date: Wed Sep 10 15:23:45 2014 +0100
proposed change for dbtext query results.
this behaviour was observed by interacting with module presence.
presentity clean runs from timer every 6 secs.
if the first run returns a large set of rows, it iterates all rows doing
some notifications and deleting the presentity.
if it takes more then 6 secs to complete, the next run will override the
results internal structure pointer maintained in the connection level.
the proposed patch, maintains the query result internal structure within
the result, using the ptr field for that.
(cherry picked from commit dae74e974a028082a3250805da83223220123c10)
commit f66d5efb20e5acec87c8b9d38a9a6c5faacc4a18
Author: Hugh Waite <hugh.waite@acision.com>
Date: Mon Sep 8 17:46:55 2014 +0100
parser: Fix parsing of Retry-After header
- Allow no space between duration and optional comment
(cherry picked from commit accfbe0abb0d811e249b687cb6047c9234a6d884)
commit 53c60551f1316d846f0cbafc04f8d8772156f7b0
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Mon Sep 8 14:14:17 2014 +0200
presence: take in consideration send_fast_notify when sending empty NOTIFY
- patch by Luis Azedo <luis.azedo@factorlusitano.com>
(cherry picked from commit 5bffcf8bdc83628aea4f5e3cda06b20ce88f659f)
commit 8925975c4e82693fbf262ed45ac179e494fb0ca3
Author: Alex Hermann <alex@speakup.nl>
Date: Fri Aug 22 13:55:42 2014 +0200
dialog: Correctly restore dialog lifetime from DB
Restore the lifetime to the configured value instead of the offset from the
time the reload from the DB took place.
(cherry picked from commit 3d5f8af6efb5a33e46427a1a9b273e445a3064c7)
commit af985c5fe70dcaa6a92c5e67fff81807dbef27bc
Author: Alex Hermann <alex@speakup.nl>
Date: Mon Jul 7 16:38:29 2014 +0200
dialog: Set the dialog context on transaction failure
Before, the dialog context would be derived from the callid and tags. This
could select the wrong dialog in case of spirals. This patch sets the correct
dialog context by storing the it in the transaction and restoring it on a
failure. Now the correct dialog variables are available in failure_route.
(cherry picked from commit 811bb515c09e7270d1d7f8a28d280e184874e487)
commit b12a01e553699786953ec601197669314bf414c7
Author: Alex Hermann <alex@speakup.nl>
Date: Mon Jul 7 16:38:29 2014 +0200
dialog: Set the dialog context on incoming replies
Before, the dialog context would be derived from the callid and tags. This
could select the wrong dialog in case of spirals. This patch sets the correct
dialog context by storing the it in the transaction and restoring it on an
incoming response. Now the correct dialog variables are available in
onreply_route.
(cherry picked from commit 25a3297915fbcc0a267d444d245526de978a5d62)
commit 63e9a59290316e7603fb7e527cb6f6bb75653e16
Author: Ovidiu Sas <osas@voipembedded.com>
Date: Tue Sep 2 14:25:42 2014 -0400
xhttp_pi: proper sizeof for memset
(cherry picked from commit 613d188f92401c60549ea0337ea0dcf3c68067d7)
commit 45567abeb463fb69ce54dd0ed337d28275e04a12
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Sep 2 10:29:22 2014 +0200
msilo: proper walk through sent list for cleanup
- reported by Bhupendra Singh
(cherry picked from commit 5fd8a1bdaae82decdb606901fe7bf3e6e9149803)
commit 6c92649113c95538b6940596fb14f1f90f34bd1b
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue Sep 2 09:50:57 2014 +0200
Makefile.defs: don't set gcc flag -maltivec if not advertised for powerpc
- reported at FS#444,
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=729635
- following a patch by Roland Stigge <stigge@antcom.de> on debian bug
tracker
(cherry picked from commit 6fe4e56937563a413cfd83794e0fe71a20caf3d5)
commit 3f528195fdb08c68881e584bb64dd2474a3ea01f
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Mon Sep 1 23:45:13 2014 +0200
core: return OK as string for a successful dns.delete rpc command
- closes FS#260
(cherry picked from commit b77613398fe7a69d4ac52add3630c94373cbe3e8)
commit 870535c346f70a20c1e3f2b2d0736ea00bc29a5a
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Mon Sep 1 23:36:25 2014 +0200
tm: rebuild the local request if uri was changed in event route
- rebuild was done only on changes over headers and body, with an
eventual new r-uri being used in that case
- no should work also when only r-uri is changed
- closes FS#158
(cherry picked from commit dbd8ea9b1fa216e59d4c36e2eb4b671202824259)
commit b3215ff4e69b31cd24ed2226003529113a765413
Author: Kristian Frederik Høgh <kfh@uni-tel.dk>
Date: Mon Sep 1 22:03:20 2014 +0200
tm: rebuild local Via when force socket is changed in event_route[tm:local-request]
- new forced socket is also set for sending out
(cherry picked from commit e404d123610b63ddd1c75d39667b373c40071eab)
commit e41ddd2878e1281f7ff7e4c12d115acea1ff7e8a
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Mon Aug 25 16:56:16 2014 +0200
core: update content for -D option in man page
(cherry picked from commit ee9ea2f543975769ca544dcf3b75b97698e3b53e)
commit 8a53fa7a680c573c6d08bdc166793bbaf7c6e2f4
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Mon Aug 25 16:55:27 2014 +0200
core: main - proper info for -D command line option
(cherry picked from commit 2b33768745130b91e984b679f9eed01a6267d8cc)
commit ad5972f97df4a13a1044dc13e9570c1dd216d30f
Author: Luis Azedo <luis.azedo@factorlusitano.com>
Date: Fri Aug 22 16:05:15 2014 +0200
json: fixed parameter number for free fixup function
(cherry picked from commit a1b6093aaee9e96f00475752273c9c925ba390d3)
commit e65b32a7fef536638babe848d8b796fc26929bf7
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Fri Aug 22 15:53:47 2014 +0200
pua_dialoginfo: proper jump to end of the structure
- void has no standard size
- descovered on a report by Charles Chance
(cherry picked from commit 4108c7a125a3e50d1d670bc4c842b29cc32ec438)
commit e4c7b4349cb04d657488794e68d46bcd172e0fd6
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Fri Aug 15 16:01:38 2014 +0200
textopsx: msg_apply_changes() exits config execution if result is not parsing well
- sip_msg_t structure is can be invalid
- similar behavior with the case when the message is broken from the
network, it doesn't get to config file
- reported by Marco B.
(cherry picked from commit 55960106bbaa908057c3f619034b146fda7df48b)
commit 1913bead1dbc8a6ccd1424cd5b0d50430ca87cbd
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Aug 14 17:49:18 2014 +0200
dialog: when adding a new dialog, lock the slot until the structure is linked
- search for dialog based on sip attributes and if no result found, then
lock the hash table slot until the new structure is built and linked
in the table
- should avoid simulataneous creation for same dialog if there is a
not-handled retransmission or parallel forking upstream, resulting in
many processing managing duplicated requests
(cherry picked from commit 6fb686de57f783b3c29e5b4e11ad1509882616bb)
commit be02c48d9335dc71a023244d20ef669f4e986e9e
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Aug 14 14:59:09 2014 +0200
dialog: release of dialog for not-forwarded initial request done by creator
- avoid releasing new dialog in case of upstream paralel forking
or retransmission by other processes than the other which created the
dialog
- it could result in destroying the dialog in initial state if the
request was not forwarded yet, likely to happen because creator
process runs more callbacks
(cherry picked from commit c125cf6f36aedb75b4f1e0b32dbe5bdd0a48b8b5)
commit 939ab9bd2d6c09054bfa21860635c26a4d106fbb
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Aug 14 14:46:21 2014 +0200
dialog: simplified dlg referencing on creation and spiral detection
(cherry picked from commit fcf5f5b3115c0c40f4df9eb066489bb3e590c3b1)
commit b19a94889eed0dde7131ac5328192962504ed928
Author: Marcus Hunger <hunger@sipgate.de>
Date: Tue Aug 12 16:09:28 2014 +0200
rtpproxy: swap tags for lookup command (l) to fix one way audio on reinvite
- affected cases when the lookup was used explicitely
(cherry picked from commit 21e54da18f9bc6f87f913a897c9183074de4c937)
commit 77662cf6075dce9a94d4ae4f840cb5c52ac26491
Author: Jorj Bauer <jorj@isc.upenn.edu>
Date: Fri Aug 8 09:26:21 2014 -0400
modules/sca: fix 180 replies in sca_call_info_invite_reply_18x_handler()
- Per Broadworks Release 13.0v1 documentation, 180s should produce
"appearance-state=progressing" just like 183s do; Polycom OS 3.3.4
doesn't care, but 4.x swaps leg information when it hears
"appearance-state=alerting"
- report and patch from Joao Vitor Arruda
(cherry picked from commit 82e67c07eebe9f7277156a6a6d87ffd5e04c892d)
commit a0d8ea1c69e01b90d57a2352f94a0aca691a245a
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Mon Sep 1 18:29:20 2014 +0200
app_lua: search for for lua 5.1 compilation flags
- lua 5.2 embedded api is not compatible with 5.1
- an upgrade to c code in app_lua is required, till then, lua-5.1 has to
be installed (can co-exist with lua 5.2)
(cherry picked from commit 04da8d891cdf1314e24cf025b64ed1cc70ce7b5e)
commit 2fd085d21fb1a026d31d98541a9e33c568245771
Author: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Tue Aug 19 17:21:57 2014 +0200
debugger: fix reset_msgid
Don't change the msg->id when that message has been processed already
(cherry picked from commit 6b2f7d0b9d405d8ffd2310f788254453d6748f0b)
commit 1d44d71e1786182df3f81f7abf206e13faae9d26
Author: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu Aug 14 18:24:31 2014 +0200
parser/rr: free_rr() is expecting rr_t** parameter
- give the parameter as &r, following the commit
b40d92962b680ac29dd38ffe3c8f1aa1e39d3a97
(cherry picked from commit 34ba948cdabf7139c8563e531f18c4a486b31a00)
commit 8ce72b602046e39c862c7db7eb885ca4b3ac960c
Author: Hugh Waite <hugh.waite@acision.com>
Date: Tue Aug 12 19:56:45 2014 +0100
core/parser: Free rr correctly in error cases
- Fix potential memory leak if parameters are parsed into rr structure
(cherry picked from commit b40d92962b680ac29dd38ffe3c8f1aa1e39d3a97)
commit 6c967cebd213d1820cd1af428db5449b1af9aec1
Author: Hugh Waite <hugh.waite@acision.com>
Date: Tue Aug 12 19:52:27 2014 +0100
outbound: Fix memory leak
- Free parameters parsed when checking for ob markers
(cherry picked from commit 392689597376eb6f047c12504bcce367f5940260)
===================== 2014-08-06 Version 4.1.5 Released =====================
===================== Changes Since Version 4.1.4 ===========================

@ -164,7 +164,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
# version number
VERSION = 4
PATCHLEVEL = 1
SUBLEVEL = 5
SUBLEVEL = 6
EXTRAVERSION =
# memory manager switcher
@ -1502,19 +1502,27 @@ ifeq ($(ARCH), ppc)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
CFLAGS= $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
CFLAGS=
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
$(call set_if_empty,CPU,powerpc)
CFLAGS+=-ftree-vectorize \
-fno-strict-overflow \
-mtune=$(CPU) -maltivec
ifeq ($(NOALTIVEC),)
CFLAGS += $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
CFLAGS += -ftree-vectorize
CFLAGS += -maltivec
CFLAGS += -fno-strict-overflow
CFLAGS += -mtune=$(CPU)
endif
else
#if gcc 4.0+
ifeq ($(CC_SHORTVER), 4.x)
$(call set_if_empty,CPU,powerpc)
CFLAGS+=-ftree-vectorize \
-mtune=$(CPU) -maltivec
ifeq ($(NOALTIVEC),)
CFLAGS += $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
CFLAGS += -ftree-vectorize
CFLAGS += -maltivec
CFLAGS += -mtune=$(CPU)
endif
else
#if gcc 3.4+
ifeq ($(CC_SHORTVER), 3.4)

@ -2,6 +2,6 @@
* DO NOT EDIT IT
*/
#define REPO_VER "2b3d4b"
#define REPO_HASH "2b3d4b"
#define REPO_VER "010d57"
#define REPO_HASH "010d57"
#define REPO_STATE ""

@ -3969,6 +3969,7 @@ void dns_cache_delete_all(rpc_t* rpc, void* ctx)
return;
}
dns_cache_flush(0);
rpc->printf(ctx, "OK");
}
/* deletes all the entries from the cache,
@ -3980,6 +3981,7 @@ void dns_cache_delete_all_force(rpc_t* rpc, void* ctx)
return;
}
dns_cache_flush(1);
rpc->printf(ctx, "OK");
}
/* clones an entry and extends its memory area to hold a new rr.

@ -143,6 +143,11 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
outb.len = len;
sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
if(outb.s==NULL) {
LM_ERR("failed to update outgoing buffer\n");
return -1;
}
#ifdef USE_TCP
if (unlikely((dst->proto == PROTO_WS
#ifdef USE_TLS
@ -181,7 +186,7 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
wsev.id = con->id;
ret = sr_event_exec(SREV_TCP_WS_FRAME_OUT, (void *) &wsev);
tcpconn_put(con);
return ret;
goto done;
}
#endif
@ -275,9 +280,11 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
LOG(L_CRIT, "BUG: msg_send: unknown proto %d\n", dst->proto);
goto error;
}
ret = 0;
done:
if(outb.s != buf)
pkg_free(outb.s);
return 0;
return ret;
error:
if(outb.s != buf)
pkg_free(outb.s);

@ -227,8 +227,10 @@ Options:\n\
(to use both use `-rR`)\n\
-K Turn on \"via:\" host checking when forwarding replies\n\
-d Debugging mode (multiple -d increase the level)\n\
-D no 1..do not fork (almost) anyway, 2..do not daemonize creator\n\
3..daemonize (default)\n\
-D Control how daemonize is done:\n\
-D..do not fork (almost) anyway;\n\
-DD..do not daemonize creator;\n\
-DDD..daemonize (default)\n\
-E Log to stderr\n\
-e Log messages printed in terminal colors (requires -E)\n"
#ifdef USE_TCP

@ -8,12 +8,12 @@ auto_gen=
NAME=app_lua.so
ifeq ($(CROSS_COMPILE),)
BUILDER = $(shell which lua-config)
BUILDER = $(shell which lua-config)
endif
ifeq ($(BUILDER),)
ifeq ($(CROSS_COMPILE),)
BUILDER = $(shell which pkg-config)
BUILDER = $(shell which pkg-config)
endif
ifeq ($(BUILDER),)
LUA51 = $(shell ls $(LOCALBASE)/lib/liblua* | grep liblua5.1)
@ -28,14 +28,19 @@ ifeq ($(BUILDER),)
endif
else
LUAVER=XX
LUALIBS = $(shell pkg-config --silence-errors --libs lua)
LUALIBS = $(shell pkg-config --silence-errors --libs lua-5.1)
ifeq ($(LUALIBS),)
LUALIBS = $(shell pkg-config --silence-errors --libs lua5.1)
ifneq ($(LUALIBS),)
ifeq ($(LUALIBS),)
LUALIBS = $(shell pkg-config --silence-errors --libs lua)
ifneq ($(LUALIBS),)
LUAVER=5X
endif
else
LUAVER=51
endif
else
LUAVER=5X
LUAVER=51X
endif
ifeq ($(LUAVER),XX)
LUA51 = $(shell ls /usr/lib/liblua* | grep liblua5.1)
@ -51,8 +56,13 @@ ifeq ($(BUILDER),)
DEFS+= $(shell pkg-config --cflags lua5.1 | sed -e "s/\\\\/'/" -e "s/\\\\\"/\"'/")
LIBS = $(shell pkg-config --libs lua5.1)
else
DEFS+= $(shell pkg-config --cflags lua)
LIBS = $(shell pkg-config --libs lua)
ifeq ($(LUAVER),51X)
DEFS+= $(shell pkg-config --cflags lua-5.1)
LIBS = $(shell pkg-config --libs lua-5.1)
else
DEFS+= $(shell pkg-config --cflags lua)
LIBS = $(shell pkg-config --libs lua)
endif
endif
endif
endif

@ -44,16 +44,16 @@ int dbt_use_table(db1_con_t* _h, const str* _t)
/*
* Get and convert columns from a result
*/
static int dbt_get_columns(db1_con_t* _h, db1_res_t* _r)
static int dbt_get_columns(db1_res_t* _r, dbt_result_p _dres)
{
int col;
if (!_h || !_r) {
if (!_r || !_dres) {
LM_ERR("invalid parameter\n");
return -1;
}
RES_COL_N(_r) = DBT_CON_RESULT(_h)->nrcols;
RES_COL_N(_r) = _dres->nrcols;
if (!RES_COL_N(_r)) {
LM_ERR("no columns\n");
return -2;
@ -78,10 +78,10 @@ static int dbt_get_columns(db1_con_t* _h, db1_res_t* _r)
LM_DBG("allocate %d bytes for RES_NAMES[%d] at %p",
(int)sizeof(str), col,
RES_NAMES(_r)[col]);
RES_NAMES(_r)[col]->s = DBT_CON_RESULT(_h)->colv[col].name.s;
RES_NAMES(_r)[col]->len = DBT_CON_RESULT(_h)->colv[col].name.len;
RES_NAMES(_r)[col]->s = _dres->colv[col].name.s;
RES_NAMES(_r)[col]->len = _dres->colv[col].name.len;
switch(DBT_CON_RESULT(_h)->colv[col].type)
switch(_dres->colv[col].type)
{
case DB1_STR:
case DB1_STRING:
@ -89,12 +89,12 @@ static int dbt_get_columns(db1_con_t* _h, db1_res_t* _r)
case DB1_INT:
case DB1_DATETIME:
case DB1_DOUBLE:
RES_TYPES(_r)[col] = DBT_CON_RESULT(_h)->colv[col].type;
RES_TYPES(_r)[col] = _dres->colv[col].type;
break;
default:
LM_WARN("unhandled data type column (%.*s) type id (%d), "
"use STR as default\n", RES_NAMES(_r)[col]->len,
RES_NAMES(_r)[col]->s, DBT_CON_RESULT(_h)->colv[col].type);
RES_NAMES(_r)[col]->s, _dres->colv[col].type);
RES_TYPES(_r)[col] = DB1_STR;
break;
}
@ -105,10 +105,10 @@ static int dbt_get_columns(db1_con_t* _h, db1_res_t* _r)
/*
* Convert a row from result into db API representation
*/
static int dbt_convert_row(db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
static int dbt_convert_row(db1_res_t* _res, db_row_t* _r, dbt_row_p _r1)
{
int i;
if (!_h || !_r || !_res) {
if (!_r || !_res || !_r1) {
LM_ERR("invalid parameter value\n");
return -1;
}
@ -119,12 +119,12 @@ static int dbt_convert_row(db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
}
for(i = 0; i < RES_COL_N(_res); i++) {
(ROW_VALUES(_r)[i]).nul = DBT_CON_ROW(_h)->fields[i].nul;
(ROW_VALUES(_r)[i]).nul = _r1->fields[i].nul;
switch(RES_TYPES(_res)[i])
{
case DB1_INT:
VAL_INT(&(ROW_VALUES(_r)[i])) =
DBT_CON_ROW(_h)->fields[i].val.int_val;
_r1->fields[i].val.int_val;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_INT;
break;
@ -134,46 +134,46 @@ static int dbt_convert_row(db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
case DB1_DOUBLE:
VAL_DOUBLE(&(ROW_VALUES(_r)[i])) =
DBT_CON_ROW(_h)->fields[i].val.double_val;
_r1->fields[i].val.double_val;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_DOUBLE;
break;
case DB1_STRING:
VAL_STR(&(ROW_VALUES(_r)[i])).s =
DBT_CON_ROW(_h)->fields[i].val.str_val.s;
_r1->fields[i].val.str_val.s;
VAL_STR(&(ROW_VALUES(_r)[i])).len =
DBT_CON_ROW(_h)->fields[i].val.str_val.len;
_r1->fields[i].val.str_val.len;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_STRING;
VAL_FREE(&(ROW_VALUES(_r)[i])) = 0;
break;
case DB1_STR:
VAL_STR(&(ROW_VALUES(_r)[i])).s =
DBT_CON_ROW(_h)->fields[i].val.str_val.s;
_r1->fields[i].val.str_val.s;
VAL_STR(&(ROW_VALUES(_r)[i])).len =
DBT_CON_ROW(_h)->fields[i].val.str_val.len;
_r1->fields[i].val.str_val.len;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_STR;
VAL_FREE(&(ROW_VALUES(_r)[i])) = 0;
break;
case DB1_DATETIME:
VAL_INT(&(ROW_VALUES(_r)[i])) =
DBT_CON_ROW(_h)->fields[i].val.int_val;
_r1->fields[i].val.int_val;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_DATETIME;
break;
case DB1_BLOB:
VAL_STR(&(ROW_VALUES(_r)[i])).s =
DBT_CON_ROW(_h)->fields[i].val.str_val.s;
_r1->fields[i].val.str_val.s;
VAL_STR(&(ROW_VALUES(_r)[i])).len =
DBT_CON_ROW(_h)->fields[i].val.str_val.len;
_r1->fields[i].val.str_val.len;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_BLOB;
VAL_FREE(&(ROW_VALUES(_r)[i])) = 0;
break;
case DB1_BITMAP:
VAL_INT(&(ROW_VALUES(_r)[i])) =
DBT_CON_ROW(_h)->fields[i].val.bitmap_val;
_r1->fields[i].val.bitmap_val;
VAL_TYPE(&(ROW_VALUES(_r)[i])) = DB1_INT;
break;
}
@ -185,15 +185,15 @@ static int dbt_convert_row(db1_con_t* _h, db1_res_t* _res, db_row_t* _r)
/*
* Convert rows from internal to db API representation
*/
static int dbt_convert_rows(db1_con_t* _h, db1_res_t* _r)
static int dbt_convert_rows(db1_res_t* _r, dbt_result_p _dres)
{
int col;
int row;
dbt_row_p _rp = NULL;
if (!_h || !_r) {
if (!_r || !_dres) {
LM_ERR("invalid parameter\n");
return -1;
}
RES_ROW_N(_r) = DBT_CON_RESULT(_h)->nrrows;
RES_ROW_N(_r) = _dres->nrrows;
if (!RES_ROW_N(_r)) {
return 0;
}
@ -201,23 +201,16 @@ static int dbt_convert_rows(db1_con_t* _h, db1_res_t* _r)
LM_ERR("could not allocate rows");
return -2;
}
col = 0;
_rp = DBT_CON_RESULT(_h)->rows;
row = 0;
_rp = _dres->rows;
while(_rp) {
DBT_CON_ROW(_h) = _rp;
if (!DBT_CON_ROW(_h)) {
LM_ERR("failed to get current row\n");
RES_ROW_N(_r) = col;
db_free_rows(_r);
return -3;
}
if (dbt_convert_row(_h, _r, &(RES_ROWS(_r)[col])) < 0) {
LM_ERR("failed to convert row #%d\n", col);
RES_ROW_N(_r) = col;
if (dbt_convert_row(_r, &(RES_ROWS(_r)[row]), _rp) < 0) {
LM_ERR("failed to convert row #%d\n", row);
RES_ROW_N(_r) = row;
db_free_rows(_r);
return -4;
}
col++;
row++;
_rp = _rp->next;
}
return 0;
@ -227,18 +220,18 @@ static int dbt_convert_rows(db1_con_t* _h, db1_res_t* _r)
/*
* Fill the structure with data from database
*/
static int dbt_convert_result(db1_con_t* _h, db1_res_t* _r)
static int dbt_convert_result(db1_res_t* _r, dbt_result_p _dres)
{
if (!_h || !_r) {
if (!_r || !_dres) {
LM_ERR("invalid parameter\n");
return -1;
}
if (dbt_get_columns(_h, _r) < 0) {
if (dbt_get_columns(_r, _dres) < 0) {
LM_ERR("failed to get column names\n");
return -2;
}
if (dbt_convert_rows(_h, _r) < 0) {
if (dbt_convert_rows(_r, _dres) < 0) {
LM_ERR("failed to convert rows\n");
db_free_columns(_r);
return -3;
@ -249,14 +242,14 @@ static int dbt_convert_result(db1_con_t* _h, db1_res_t* _r)
/*
* Retrieve result set
*/
int dbt_get_result(db1_con_t* _h, db1_res_t** _r)
int dbt_get_result(db1_res_t** _r, dbt_result_p _dres)
{
if (!_h || !_r) {
if ( !_r) {
LM_ERR("invalid parameter value\n");
return -1;
}
if (!DBT_CON_RESULT(_h))
if (!_dres)
{
LM_ERR("failed to get result\n");
*_r = 0;
@ -270,12 +263,13 @@ int dbt_get_result(db1_con_t* _h, db1_res_t** _r)
return -2;
}
if (dbt_convert_result(_h, *_r) < 0)
if (dbt_convert_result(*_r, _dres) < 0)
{
LM_ERR("failed to convert result\n");
pkg_free(*_r);
return -4;
}
(*_r)->ptr = _dres;
return 0;
}

@ -36,10 +36,11 @@
#include "../../lib/srdb1/db_con.h"
#include "../../lib/srdb1/db_row.h"
#include "dbt_res.h"
/*
* Retrieve result set
*/
int dbt_get_result(db1_con_t* _h, db1_res_t** _r);
int dbt_get_result(db1_res_t** _r, dbt_result_p _dres);
int dbt_use_table(db1_con_t* _h, const str* _t);

@ -119,9 +119,6 @@ void dbt_close(db1_con_t* _h)
return;
}
if (DBT_CON_RESULT(_h))
dbt_result_free(DBT_CON_RESULT(_h));
pkg_free(_h);
return;
}
@ -138,19 +135,18 @@ int dbt_free_result(db1_con_t* _h, db1_res_t* _r)
return -1;
}
if(db_free_result(_r) < 0)
if(dbt_result_free((dbt_result_p)_r->ptr) < 0)
{
LM_ERR("unable to free result structure\n");
return -1;
LM_ERR("unable to free internal structure\n");
}
if(dbt_result_free(DBT_CON_RESULT(_h)) < 0)
if(db_free_result(_r) < 0)
{
LM_ERR("unable to free internal structure\n");
LM_ERR("unable to free result structure\n");
return -1;
}
DBT_CON_RESULT(_h) = NULL;
return 0;
}
@ -173,6 +169,7 @@ int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
dbt_table_p _tbc = NULL;
dbt_row_p _drp = NULL;
dbt_result_p _dres = NULL;
int result = 0;
int *lkey=NULL, *lres=NULL;
@ -273,8 +270,6 @@ int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
/* dbt_result_print(_dres); */
DBT_CON_RESULT(_h) = _dres;
if(lkey)
pkg_free(lkey);
if(lres)
@ -286,7 +281,11 @@ int dbt_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
if(_o_l)
pkg_free(_o_l);
return dbt_get_result(_h, _r);
result = dbt_get_result(_r, _dres);
if(result != 0)
dbt_result_free(_dres);
return result;
error:
/* unlock database */
@ -302,6 +301,8 @@ error_nounlock:
pkg_free(_o_op);
if(_o_l)
pkg_free(_o_l);
if(_dres)
dbt_result_free(_dres);
LM_ERR("failed to query the table!\n");
return -1;

@ -119,7 +119,9 @@ int dbt_result_free(dbt_result_p _dres)
for(i=0; i<_dres->nrcols; i++)
{
if((_dres->colv[i].type==DB1_STR
|| _dres->colv[i].type==DB1_STRING)
|| _dres->colv[i].type==DB1_STRING
|| _dres->colv[i].type==DB1_BLOB
)
&& _rp0->fields[i].val.str_val.s)
pkg_free(_rp0->fields[i].val.str_val.s);
}

@ -44,18 +44,12 @@ typedef struct _dbt_result
dbt_row_p rows;
} dbt_result_t, *dbt_result_p;
//typedef db1_res_t dbt_result_t, *dbt_result_p;
typedef struct _dbt_con
{
dbt_cache_p con;
dbt_result_p res;
dbt_row_p row;
} dbt_con_t, *dbt_con_p;
#define DBT_CON_CONNECTION(db_con) (((dbt_con_p)((db_con)->tail))->con)
#define DBT_CON_RESULT(db_con) (((dbt_con_p)((db_con)->tail))->res)
#define DBT_CON_ROW(db_con) (((dbt_con_p)((db_con)->tail))->row)
dbt_result_p dbt_result_new(dbt_table_p, int*, int);
int dbt_result_free(dbt_result_p);

@ -268,18 +268,18 @@ int dbg_msgid_filter(struct sip_msg *msg, unsigned int flags, void *bar)
}
msgid_base = _dbg_pid_list[indx].msgid_base;
lock_release(_dbg_pid_list[indx].lock);
msgid_new = msg->id - msgid_base;
LM_DBG("msg->id:%d msgid_base:%d -> %d\n", msg->id, msgid_base, msgid_new);
if(msgid_new>0)
if(msg->id > msgid_base)
{
msgid_new = msg->id - msgid_base;
LM_DBG("msg->id:%d msgid_base:%d -> %d\n",
msg->id, msgid_base, msgid_new);
msg->id = msgid_new;
return 1;
}
else
{
LM_WARN("msgid_new<=0??\n");
return -1;
LM_DBG("msg->id:%d already processed\n", msg->id);
}
return 1;
}
/**

@ -360,7 +360,7 @@ static int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows)
}
/*link the dialog*/
link_dlg(dlg, 0);
link_dlg(dlg, 0, 0);
dlg->h_id = VAL_INT(values+1);
next_id = d_table->entries[dlg->h_entry].next_id;
@ -383,11 +383,13 @@ static int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows)
dlg->tl.timeout = (unsigned int)(VAL_INT(values+9));
LM_DBG("db dialog timeout is %u (%u/%u)\n", dlg->tl.timeout,
get_ticks(), (unsigned int)time(0));
if (dlg->tl.timeout<=(unsigned int)time(0))
if (dlg->tl.timeout<=(unsigned int)time(0)) {
dlg->tl.timeout = 0;
else
dlg->lifetime = 0;
} else {
dlg->lifetime = dlg->tl.timeout - dlg->start_ts;
dlg->tl.timeout -= (unsigned int)time(0);
dlg->lifetime = dlg->tl.timeout;
}
GET_STR_VALUE(cseq1, values, 10 , 1, 1);
GET_STR_VALUE(cseq2, values, 11 , 1, 1);

@ -58,6 +58,7 @@
#include "../../lib/kcore/statistics.h"
#include "../../action.h"
#include "../../script_cb.h"
#include "../../pt.h"
#include "../../lib/kcore/faked_msg.h"
#include "../../parser/parse_from.h"
#include "../../parser/parse_cseq.h"
@ -451,6 +452,13 @@ static void dlg_onreply(struct cell* t, int type, struct tmcb_params *param)
return;
unref = 0;
if (type & (TMCB_RESPONSE_IN|TMCB_ON_FAILURE)) {
/* Set the dialog context so it is available in onreply_route and failure_route*/
set_current_dialog(req, dlg);
dlg_set_ctx_iuid(dlg);
goto done;
}
if (type==TMCB_RESPONSE_FWDED) {
/* The state does not change, but the msg is mutable in this callback*/
run_dlg_callbacks(DLGCB_RESPONSE_FWDED, dlg, req, rpl, DLG_DIR_UPSTREAM, 0);
@ -704,6 +712,11 @@ void dlg_onreq(struct cell* t, int type, struct tmcb_params *param)
sip_msg_t *req = param->req;
dlg_cell_t *dlg = NULL;
if(req->first_line.u.request.method_value == METHOD_BYE) {
_dlg_ctx.t = 1;
return;
}
if(req->first_line.u.request.method_value != METHOD_INVITE)
return;
@ -774,6 +787,7 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
str ttag;
str req_uri;
unsigned int dir;
int mlock;
dlg = dlg_get_ctx_dialog();
if(dlg != NULL) {
@ -798,18 +812,20 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
}
trim(&req_uri);
if (detect_spirals)
{
if (spiral_detected == 1)
return 0;
dir = DLG_DIR_NONE;
dir = DLG_DIR_NONE;
mlock = 1;
/* search dialog by SIP attributes
* - if not found, hash table slot is left locked, to avoid races
* to add 'same' dialog on parallel forking or not-handled-yet
* retransmissions. Release slot after linking new dialog */
dlg = search_dlg(&callid, &ftag, &ttag, &dir);
if(dlg) {
mlock = 0;
if (detect_spirals) {
if (spiral_detected == 1)
return 0;
dlg = get_dlg(&callid, &ftag, &ttag, &dir);
if (dlg)
{
if ( dlg->state != DLG_STATE_DELETED )
{
if ( dlg->state != DLG_STATE_DELETED ) {
LM_DBG("Callid '%.*s' found, must be a spiraled request\n",
callid.len, callid.s);
spiral_detected = 1;
@ -817,9 +833,12 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
if (run_initial_cbs)
run_dlg_callbacks( DLGCB_SPIRALED, dlg, req, NULL,
DLG_DIR_DOWNSTREAM, 0);
/* get_dlg() has incremented the ref count by 1
* - it's ok, dlg will be unref at the end of function */
goto finish;
/* set ctx dlg id shortcuts */
_dlg_ctx.iuid.h_entry = dlg->h_entry;
_dlg_ctx.iuid.h_id = dlg->h_id;
/* search_dlg() has incremented the ref count by 1 */
dlg_release(dlg);
return 0;
}
dlg_release(dlg);
}
@ -832,16 +851,16 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
&ftag/*from_tag*/,
&req_uri /*r-uri*/ );
if (dlg==0)
{
if (dlg==0) {
if(likely(mlock==1)) dlg_hash_release(&callid);
LM_ERR("failed to create new dialog\n");
return -1;
}
/* save caller's tag, cseq, contact and record route*/
if (populate_leg_info(dlg, req, t, DLG_CALLER_LEG,
&(get_from(req)->tag_value)) !=0)
{
&(get_from(req)->tag_value)) !=0) {
if(likely(mlock==1)) dlg_hash_release(&callid);
LM_ERR("could not add further info to the dialog\n");
shm_free(dlg);
return -1;
@ -850,7 +869,9 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
/* Populate initial varlist: */
dlg->vars = get_local_varlist_pointer(req, 1);
link_dlg(dlg, 0);
/* if search_dlg() returned NULL, slot was kept locked */
link_dlg(dlg, 0, mlock);
if(likely(mlock==1)) dlg_hash_release(&callid);
dlg->lifetime = get_dlg_timeout(req);
s.s = _dlg_ctx.to_route_name;
@ -871,16 +892,12 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
goto error;
}
/* new dlg - reference it once more for current dialog iuid shortcut */
dlg_ref(dlg, 1);
if_update_stat( dlg_enable_stats, processed_dlgs, 1);
finish:
_dlg_ctx.cpid = my_pid();
_dlg_ctx.iuid.h_entry = dlg->h_entry;
_dlg_ctx.iuid.h_id = dlg->h_id;
set_current_dialog(req, dlg);
dlg_release(dlg);
return 0;
@ -914,7 +931,7 @@ int dlg_set_tm_callbacks(tm_cell_t *t, sip_msg_t *req, dlg_cell_t *dlg,
goto error;
}
if ( d_tmb.register_tmcb( req, t,
TMCB_RESPONSE_READY|TMCB_RESPONSE_FWDED,
TMCB_RESPONSE_IN|TMCB_RESPONSE_READY|TMCB_RESPONSE_FWDED|TMCB_ON_FAILURE,
dlg_onreply, (void*)iuid, dlg_iuid_sfree)<0 ) {
LM_ERR("failed to register TMCB\n");
goto error;
@ -1180,6 +1197,20 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
_dlg_ctx.iuid.h_entry = dlg->h_entry;
_dlg_ctx.iuid.h_id = dlg->h_id;
if (req->first_line.u.request.method_value != METHOD_ACK) {
iuid = dlg_get_iuid_shm_clone(dlg);
if(iuid!=NULL)
{
/* register callback for the replies of this request */
if ( d_tmb.register_tmcb( req, 0, TMCB_RESPONSE_IN|TMCB_ON_FAILURE,
dlg_onreply, (void*)iuid, dlg_iuid_sfree)<0 ) {
LM_ERR("failed to register TMCB (3)\n");
shm_free(iuid);
}
iuid = NULL;
}
}
/* run state machine */
switch ( req->first_line.u.request.method_value ) {
case METHOD_PRACK:
@ -1247,6 +1278,9 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
dlg_unref(dlg, unref);
_dlg_ctx.cpid = my_pid();
_dlg_ctx.expect_t = 1;
if_update_stat( dlg_enable_stats, active_dlgs, -1);
goto done;
}

@ -249,6 +249,13 @@ int dlg_clean_run(ticks_t ti)
unlink_unsafe_dlg(&d_table->entries[i], tdlg);
destroy_dlg(tdlg);
}
if(tdlg->state==DLG_STATE_CONFIRMED_NA && tdlg->start_ts<tm-60) {
if(update_dlg_timer(&dlg->tl, 10)<0) {
LM_ERR("failed to update dialog lifetime in long non-ack state\n");
}
dlg->lifetime = 10;
dlg->dflags |= DLG_FLAG_CHANGED;
}
}
lock_set_release(d_table->locks, d_table->entries[i].lock_idx);
}
@ -684,10 +691,12 @@ dlg_cell_t* dlg_get_by_iuid(dlg_iuid_t *diuid)
* \param ftag from tag
* \param ttag to tag
* \param dir direction
* \param mode let hash table slot locked if dialog is not found
* \return dialog structure on success, NULL on failure
*/
static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
str *callid, str *ftag, str *ttag, unsigned int *dir)
str *callid, str *ftag, str *ttag,
unsigned int *dir, int mode)
{
struct dlg_cell *dlg;
struct dlg_entry *d_entry;
@ -707,7 +716,7 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
}
}
dlg_unlock( d_table, d_entry);
if(likely(mode==0)) dlg_unlock( d_table, d_entry);
LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s);
return 0;
}
@ -736,7 +745,7 @@ struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir)
unsigned int he;
he = core_hash(callid, 0, d_table->size);
dlg = internal_get_dlg(he, callid, ftag, ttag, dir);
dlg = internal_get_dlg(he, callid, ftag, ttag, dir, 0);
if (dlg == 0) {
LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s);
@ -746,18 +755,69 @@ struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir)
}
/*!
* \brief Search dialog that corresponds to CallId, From Tag and To Tag
*
* Get dialog that correspond to CallId, From Tag and To Tag.
* See RFC 3261, paragraph 4. Overview of Operation:
* "The combination of the To tag, From tag, and Call-ID completely
* defines a peer-to-peer SIP relationship between [two UAs] and is
* referred to as a dialog."
* Note that the caller is responsible for decrementing (or reusing)
* the reference counter by one again if a dialog has been found.
* If the dialog is not found, the hash slot is left locked, to allow
* linking the structure of a new dialog.
* \param callid callid
* \param ftag from tag
* \param ttag to tag
* \param dir direction
* \return dialog structure on success, NULL on failure (and slot locked)
*/
dlg_cell_t* search_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir)
{
struct dlg_cell *dlg;
unsigned int he;
he = core_hash(callid, 0, d_table->size);
dlg = internal_get_dlg(he, callid, ftag, ttag, dir, 1);
if (dlg == 0) {
LM_DBG("dialog with callid='%.*s' not found\n", callid->len, callid->s);
return 0;
}
return dlg;
}
/*!
* \brief Release hash table slot by call-id
* \param callid call-id value
*/
void dlg_hash_release(str *callid)
{
unsigned int he;
struct dlg_entry *d_entry;
he = core_hash(callid, 0, d_table->size);
d_entry = &(d_table->entries[he]);
dlg_unlock(d_table, d_entry);
}
/*!
* \brief Link a dialog structure
* \param dlg dialog
* \param n extra increments for the reference counter
* \param mode link in safe mode (0 - lock slot; 1 - don't)
*/
void link_dlg(struct dlg_cell *dlg, int n)
void link_dlg(struct dlg_cell *dlg, int n, int mode)
{
struct dlg_entry *d_entry;
d_entry = &(d_table->entries[dlg->h_entry]);
dlg_lock( d_table, d_entry);
if(unlikely(mode==0)) dlg_lock( d_table, d_entry);
/* keep id 0 for special cases */
dlg->h_id = 1 + d_entry->next_id++;
@ -773,7 +833,7 @@ void link_dlg(struct dlg_cell *dlg, int n)
ref_dlg_unsafe(dlg, 1+n);
dlg_unlock( d_table, d_entry);
if(unlikely(mode==0)) dlg_unlock( d_table, d_entry);
return;
}

@ -316,12 +316,41 @@ dlg_cell_t* dlg_get_by_iuid(dlg_iuid_t *diuid);
dlg_cell_t* get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir);
/*!
* \brief Search dialog that corresponds to CallId, From Tag and To Tag
*
* Get dialog that correspond to CallId, From Tag and To Tag.
* See RFC 3261, paragraph 4. Overview of Operation:
* "The combination of the To tag, From tag, and Call-ID completely
* defines a peer-to-peer SIP relationship between [two UAs] and is
* referred to as a dialog."
* Note that the caller is responsible for decrementing (or reusing)
* the reference counter by one again if a dialog has been found.
* If the dialog is not found, the hash slot is left locked, to allow
* linking the structure of a new dialog.
* \param callid callid
* \param ftag from tag
* \param ttag to tag
* \param dir direction
* \return dialog structure on success, NULL on failure (and slot locked)
*/
dlg_cell_t* search_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir);
/*!
* \brief Release hash table slot by call-id
* \param callid call-id value
*/
void dlg_hash_release(str *callid);
/*!
* \brief Link a dialog structure
* \param dlg dialog
* \param n extra increments for the reference counter
* \param mode link in safe mode (0 - lock slot; 1 - don't)
*/
void link_dlg(dlg_cell_t *dlg, int n);
void link_dlg(struct dlg_cell *dlg, int n, int mode);
/*!

@ -45,10 +45,22 @@ int dlg_cfg_cb(sip_msg_t *msg, unsigned int flags, void *cbp)
if(flags&POST_SCRIPT_CB) {
dlg = dlg_get_ctx_dialog();
if(dlg!=NULL) {
if(_dlg_ctx.t==0 && dlg->state==DLG_STATE_UNCONFIRMED) {
LM_DBG("new dialog with no trasaction after config execution\n");
dlg_release(dlg);
if(_dlg_ctx.t==0 && (dlg->state==DLG_STATE_UNCONFIRMED
|| _dlg_ctx.expect_t==1)) {
if(_dlg_ctx.cpid!=0 && _dlg_ctx.cpid==my_pid()) {
/* release to destroy dialog if created by this process
* and request was not forwarded */
if(dlg->state==DLG_STATE_UNCONFIRMED) {
LM_DBG("new dialog with no trasaction after config"
" execution\n");
} else {
LM_DBG("dialog with no expected trasaction after"
" config execution\n");
}
dlg_release(dlg);
}
}
/* get ctx dlg increased ref count - release now */
dlg_release(dlg);
}
}

@ -39,9 +39,11 @@ typedef struct _dlg_ctx {
int timeout;
dlg_cell_t *dlg1;
dlg_iuid_t iuid;
int cpid;
int set;
unsigned int dir;
int t;
int t; /* set to 1 if tm req in callback executed */
int expect_t; /* set to 1 if expects that t is set after config */
} dlg_ctx_t;
/* A dialog-variable */

@ -844,12 +844,14 @@ int ds_destroy_list(void)
void destroy_list(int list_id)
{
ds_set_t *sp = NULL;
ds_set_t *sp1 = NULL;
ds_dest_t *dest = NULL;
sp = ds_lists[list_id];
while(sp)
{
sp1 = sp->next;
for(dest = sp->dlist; dest!= NULL; dest=dest->next)
{
if(dest->uri.s!=NULL)
@ -860,7 +862,8 @@ void destroy_list(int list_id)
}
if (sp->dlist != NULL)
shm_free(sp->dlist);
sp = sp->next;
shm_free(sp);
sp = sp1;
}
ds_lists[list_id] = NULL;

@ -88,7 +88,7 @@ static int fixup_get_field_free(void** param, int param_no)
}
if (param_no == 3) {
return fixup_free_pvar_null(param, 3);
return fixup_free_pvar_null(param, 1);
}
LM_ERR("invalid parameter number <%d>\n", param_no);

@ -251,7 +251,8 @@ errorx:
*/
int msg_list_check(msg_list ml)
{
msg_list_el p0;
msg_list_el p0;
msg_list_el p1;
if(!ml)
goto errorx;
@ -265,6 +266,7 @@ int msg_list_check(msg_list ml)
p0 = ml->lsent;
while(p0)
{
p1 = p0->next;
if(p0->flag & MS_MSG_DONE || p0->flag & MS_MSG_ERRO)
{
LM_DBG("mid:%d got reply\n", p0->msgid);
@ -287,7 +289,7 @@ int msg_list_check(msg_list ml)
ml->ldone = p0;
ml->nrdone++;
}
p0 = p0->next;
p0 = p1;
}
lock_release(&ml->sem_done);

@ -385,6 +385,8 @@ static int use_outbound_non_reg(struct sip_msg *msg)
LM_ERR("parsing Route-URI parameters\n");
return 0;
}
/* Not interested in param body - just the hooks */
free_params(params);
if (hooks.uri.ob)
{
@ -450,6 +452,9 @@ static int use_outbound_non_reg(struct sip_msg *msg)
LM_ERR("parsing Contact-URI parameters\n");
return 0;
}
/* Not interested in param body - just the hooks */
free_params(params);
if (hooks.contact.ob)
{
LM_DBG("found ;ob parameter on Contact-URI - outbound"

@ -682,7 +682,7 @@ int update_subscription(struct sip_msg* msg, subs_t* subs, int to_tag_gen,
}
else
{
if(notify(subs, NULL, NULL, 0)< 0)
if(send_fast_notify && (notify(subs, NULL, NULL, 0)< 0))
{
LM_ERR("Could not send notify\n");
goto error;

@ -347,7 +347,7 @@ struct str_list* get_str_list(unsigned short avp_flags, int_str avp_name) {
memset( list_current, 0, len);
list_current->s.s = (char*)( (void*) list_current + sizeof(struct str_list));
list_current->s.s = (char*)list_current + sizeof(struct str_list);
list_current->s.len = avp_value.s.len;
memcpy(list_current->s.s,avp_value.s.s,avp_value.s.len);

@ -2452,6 +2452,11 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc
if (to_tag.len == 0) {
FORCE_RTP_PROXY_RET (-1);
}
if (msg->first_line.type == SIP_REQUEST) {
tmp = from_tag;
from_tag = to_tag;
to_tag = tmp;
}
create = 0;
} else if ((msg->first_line.type == SIP_REPLY && offer != 0)
|| (msg->first_line.type == SIP_REQUEST && offer == 0)) {

@ -1072,9 +1072,6 @@ sca_call_info_invite_reply_18x_handler( sip_msg_t *msg,
switch ( msg->REPLY_STATUS ) {
case 180:
state = SCA_APPEARANCE_STATE_ALERTING;
break;
case 183:
state = SCA_APPEARANCE_STATE_PROGRESSING;
break;

@ -672,9 +672,6 @@ static int sms_init(void)
static int sms_exit(void)
{
if ((!domain_str) && (domain.s))
pkg_free(domain.s);
if (queued_msgs)
shm_free(queued_msgs);

@ -223,8 +223,11 @@ static int msg_apply_changes_f(sip_msg_t *msg, char *str1, char *str2)
/* reparse the message */
LM_DBG("SIP message content updated - reparsing\n");
if (parse_msg(msg->buf, msg->len, msg)!=0){
LM_ERR("parsing new sip message failed\n");
return -1;
LM_ERR("parsing new sip message failed [[%.*s]]\n",
msg->len, msg->buf);
/* exit config execution - sip_msg_t structure is no longer
* valid/safe for config */
return 0;
}
return 1;

@ -83,6 +83,7 @@
#include "../../cfg_core.h" /* cfg_get(core, core_cfg, use_dns_failover) */
#endif
#ifdef WITH_EVENT_LOCAL_REQUEST
#include "../../data_lump.h"
#include "../../receive.h"
#include "../../route.h"
#include "../../action.h"
@ -406,18 +407,56 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
lreq.dst_uri.len=0;
}
if (unlikely(lreq.add_rm || lreq.body_lumps)) {
LM_DBG("apply new updates to sip msg\n");
if(lreq.force_send_socket != uac_r->dialog->send_sock) {
LM_DBG("Send socket updated to: %.*s",
lreq.force_send_socket->address_str.len,
lreq.force_send_socket->address_str.s);
/* rebuild local Via - remove previous value
* and add the one for the new send socket */
if (!del_lump(&lreq, lreq.h_via1->name.s - lreq.buf,
lreq.h_via1->len, 0)) {
LM_ERR("Failed to remove previous local Via\n");
/* attempt a normal update to give it a chance */
goto normal_update;
}
/* reuse same branch value from previous local Via */
memcpy(lreq.add_to_branch_s, lreq.via1->branch->value.s,
lreq.via1->branch->value.len);
lreq.add_to_branch_len = lreq.via1->branch->value.len;
/* update also info about new destination and send sock */
uac_r->dialog->send_sock=lreq.force_send_socket;
request->dst.send_sock = lreq.force_send_socket;
request->dst.proto = lreq.force_send_socket->proto;
LM_DBG("apply new updates with Via to sip msg\n");
buf1 = build_req_buf_from_sip_req(&lreq,
(unsigned int*)&buf_len1,
&dst, BUILD_NO_LOCAL_VIA|BUILD_NO_VIA1_UPDATE|
BUILD_IN_SHM);
(unsigned int*)&buf_len1, &dst, BUILD_IN_SHM);
if (likely(buf1)){
shm_free(buf);
buf = buf1;
buf_len = buf_len1;
/* a possible change of the method is not handled! */
}
} else {
normal_update:
if (unlikely(lreq.add_rm || lreq.body_lumps
|| lreq.new_uri.s)) {
LM_DBG("apply new updates without Via to sip msg\n");
buf1 = build_req_buf_from_sip_req(&lreq,
(unsigned int*)&buf_len1,
&dst, BUILD_NO_LOCAL_VIA|BUILD_NO_VIA1_UPDATE|
BUILD_IN_SHM);
if (likely(buf1)){
shm_free(buf);
buf = buf1;
buf_len = buf_len1;
/* a possible change of the method is not handled! */
}
}
}
lreq.buf=0; /* covers the obsolete DYN_BUF */
free_sip_msg(&lreq);

@ -552,7 +552,7 @@ static void ul_rpc_add(rpc_t* rpc, void* ctx)
}
LM_DBG("ret: %d table:%.*s aor:%.*s contact:%.*s expires:%d dtemp:%f path:%.*s flags:%d bflags:%d methods:%d\n",
ret, table.len, table.s, aor.len, aor.s, contact.len, contact.s,
(int) ci.expires, dtemp, ci.path->len, ci.path->s, ci.flags, ci.cflags, (int) ci.methods);
(int) ci.expires, dtemp, (ci.path)?ci.path->len:0, (ci.path && ci.path->s)?ci.path->s:"", ci.flags, ci.cflags, (int) ci.methods);
if ( ret != 9) {
rpc->fault(ctx, 500, "Not enough parameters or wrong format");
return;

@ -885,7 +885,7 @@ int ph_getColVals(ph_mod_t *module, ph_cmd_t *cmd,
if(vals==NULL||ids==NULL) {LM_ERR("oom\n"); return -1;}
col_vals = vals; col_ids = ids;
vals = &col_vals[size]; ids = &col_ids[size];
memset(vals, 0, sizeof(str*)); memset(ids, 0, sizeof(str*));
memset(vals, 0, sizeof(str)); memset(ids, 0, sizeof(str));
/* Retrieve the node attribute */
attr.s = ph_xmlNodeGetAttrContentByName(node,
XHTTP_PI_XML_ID_ATTR);

@ -2110,7 +2110,7 @@ char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
case HDR_TO_T:
if (new_tag && new_tag->len) {
to_tag=get_to(msg)->tag_value;
if (to_tag.len )
if ( to_tag.len || to_tag.s )
len+=new_tag->len-to_tag.len;
else
len+=new_tag->len+TOTAG_TOKEN_LEN/*";tag="*/;

@ -546,7 +546,12 @@ endofheader:
break;
case S_PARA_VALUE:
/* parameter with null value, e.g. foo= */
param->value.s=tmp;
if ( status==F_CRLF )
param->value.s=tmp-2;
else if ( status==F_CR || status==F_LF )
param->value.s=tmp-1;
else
param->value.s=tmp;
param->value.len=0;
add_param(param, to_b, newparam);
saved_status=E_PARA_VALUE;

@ -59,6 +59,7 @@ char* parse_retry_after(char* const buf, const char* const end, unsigned* const
case ';':
case '\r':
case '\n':
case '(':
goto found;
default:
/* invalid char */

@ -138,7 +138,7 @@ static inline int do_parse_rr_body(char *buf, int len, rr_t **head)
}
error:
if (r) pkg_free(r);
if (r) free_rr(&r);
free_rr(head); /* Free any contacts created so far */
return -1;

@ -1,5 +1,5 @@
%define name kamailio
%define ver 4.1.5
%define ver 4.1.6
%define rel 0%{dist}

@ -1,3 +1,9 @@
kamailio (4.1.6) unstable; urgency=low
* update to 4.1.6 from upstream
-- Daniel-Constantin Mierla <miconda@gmail.com> Thu, 18 Sep 2014 14:10:20 +0100
kamailio (4.1.5) unstable; urgency=low
* update to 4.1.5 from upstream

@ -1,3 +1,9 @@
kamailio (4.1.6) unstable; urgency=low
* update to 4.1.6 from upstream
-- Daniel-Constantin Mierla <miconda@gmail.com> Thu, 18 Sep 2014 14:10:20 +0100
kamailio (4.1.5) unstable; urgency=low
* update to 4.1.5 from upstream

@ -1,3 +1,9 @@
kamailio (4.1.6) unstable; urgency=low
* update to 4.1.6 from upstream
-- Daniel-Constantin Mierla <miconda@gmail.com> Thu, 18 Sep 2014 14:10:20 +0100
kamailio (4.1.5) unstable; urgency=low
* update to 4.1.5 from upstream

@ -1,3 +1,9 @@
kamailio (4.1.6) unstable; urgency=low
* update to 4.1.6 from upstream
-- Daniel-Constantin Mierla <miconda@gmail.com> Thu, 18 Sep 2014 14:10:20 +0100
kamailio (4.1.5) unstable; urgency=low
* update to 4.1.5 from upstream

@ -1,3 +1,9 @@
kamailio (4.1.6) unstable; urgency=low
* update to 4.1.6 from upstream
-- Daniel-Constantin Mierla <miconda@gmail.com> Thu, 18 Sep 2014 14:10:20 +0100
kamailio (4.1.5) unstable; urgency=low
* update to 4.1.5 from upstream

@ -1,3 +1,9 @@
kamailio (4.1.6) unstable; urgency=low
* update to 4.1.6 from upstream
-- Daniel-Constantin Mierla <miconda@gmail.com> Thu, 18 Sep 2014 14:10:20 +0100
kamailio (4.1.5) unstable; urgency=low
* update to 4.1.5 from upstream

@ -1,5 +1,5 @@
%define name kamailio
%define ver 4.1.5
%define ver 4.1.6
%define rel 0%{dist}

@ -1,5 +1,5 @@
%define name kamailio
%define ver 4.1.5
%define ver 4.1.6
%define rel 0
%define EXCLUDED_MODULES mysql jabber cpl-c avp_radius auth_radius group_radius uri_radius pa postgres osp tlsops unixodbc

@ -1,5 +1,5 @@
%define name kamailio
%define ver 4.1.5
%define ver 4.1.6
%define rel 0
%define _sharedir %{_prefix}/share

@ -1,5 +1,5 @@
%define name kamailio
%define ver 4.1.5
%define ver 4.1.6
%define rel 0
%define EXCLUDED_MODULES mysql jabber cpl-c auth_radius misc_radius peering postgress pa unixodbc osp tlsops

@ -75,7 +75,16 @@ Turns on debugging, multiple
increase the debug level.
.TP
.BI \-D
Runs sip-router in the foreground (it doesn't fork into daemon mode).
Control how daemonize is done:
.br
.B -D
- do not fork (almost) anyway (run in foreground, doesn't fork into daemon mode);
.br
.B -DD
- do not daemonize creator (main process is not daemonized);
.br
.B -DDD
- daemonize (default)
.TP
.BI \-E
Sends all the log messages to stderr.

@ -2446,6 +2446,10 @@ usrloc() {
exit 1
fi
if [ -z "$DEFAULT_Q" ] ; then
DEFAULT_Q = "1.0"
fi
$CTLCMD ul_add "$USRLOC_TABLE" "$OSERUSER@$OSERDOMAIN" "$2" \
"$UL_EXPIRES" "$DEFAULT_Q" "$UL_PATH" "$UL_FLAGS" "$BR_FLAGS" "$ALL_METHODS"
exit $?

@ -56,11 +56,7 @@
# FIXME
# FOREVER="2030-05-28 21:32:15"
# DEFAULT_ALIASES_EXPIRES=$FOREVER
# DEFAULT_Q="1.0"
# DEFAULT_CALLID="Default-Call-ID"
# DEFAULT_CSEQ="13"
# DEFAULT_LOCATION_EXPIRES=$FOREVER
# Program to calculate a message-digest fingerprint

@ -54,12 +54,6 @@ DBUID_TABLES=${UID_TABLES:-uid_credentials uid_domain uid_domain_attrs
# FIXME
FOREVER=${FOREVER:-2030-05-28 21:32:15}
DEFAULT_ALIASES_EXPIRES=${DEFAULT_ALIASES_EXPIRES:-${FOREVER}}
DEFAULT_Q=${DEFAULT_Q:-1.0}
DEFAULT_CALLID=${DEFAULT_CALLID:-Default-Call-ID}
DEFAULT_CSEQ=${DEFAULT_CSEQ:-13}
DEFAULT_LOCATION_EXPIRES=${DEFAULT_LOCATION_EXPIRES:-${FOREVER}}
# default location for config files
DEFAULT_CFG_DIR=/usr/local/etc/kamailio

Loading…
Cancel
Save