Hi,
I am trying to use t_suspend()/t_continue() multiple times on the same
transaction. Calling t_suspend() more than once works, but the second
time I call t_continue() the transaction is killed and a 500 response is
sent. It is the "if (branch == t->nr_of_outgoings)" check from the code
fragment below (from t_suspend.c:t_continue()) that results in the
transaction being killed - you can see the debug/error line I added to
determine this in the fragment.
Is using t_suspend()/t_continue() multiple times something that should
work?
Thanks,
Peter
if (t->uas.status < 200) {
/* No final reply has been sent yet.
* Check whether or not there is any pending branch.
*/
for ( branch = 0;
branch < t->nr_of_outgoings;
branch++
) {
if ((t->uac[branch].request.buffer != NULL)
&& (t->uac[branch].last_received < 200)
)
break;
}
if (branch == t->nr_of_outgoings) {
/* There is not any open branch so there is
* no chance that a final response will be
received. */
ret = 0;
LM_ERR("branch == t->nr_of_outgoings\n");
goto kill_trans;
}
}
--
Peter Dunkley
Technical Director
Crocodile RCS Ltd
Hi, the new RFC 6665 mandates that the subscription dialog is made
*after* the first NOTIFY from the UAS (rather than after the 200 to
the initial SUBSCRIBE). This means that the UAC MUST take the route
set from the *first* received NOTIFY (instead of taking it from the
200 to the initial SUBSCRIBE).
Therefore a proxy compliant with RFC 6665 MUST always add RR to
in-dialog NOTIFY requests and thus, I propose that the default SR
script file implements it.
Regards.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>
Module: sip-router
Branch: master
Commit: 0f702f6e236eb0cbb238bf83a0c4ae94d7b3cad8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0f702f6…
Author: Anca Vamanu <anca.vamanu(a)1and1.ro>
Committer: Anca Vamanu <anca.vamanu(a)1and1.ro>
Date: Thu Jul 19 17:49:13 2012 +0300
modules_k/uac: uac_replace_from/to AUTO mode with dialog module
Added a implementation for uac_replace_from/to() that uses the dialog
module for AUTO mode. In this mode the URIs are stored as dialog
variables.
The change in tm module fixes a bug: if uac_replace_to() was called, the
URI was not changed accordingly in Cancel.
---
modules/tm/t_cancel.c | 5 +-
modules_k/dialog/dialog.c | 2 +
modules_k/dialog/dlg_load.h | 6 +
modules_k/uac/README | 111 +++++++++++-----
modules_k/uac/doc/uac_admin.xml | 68 +++++++++-
modules_k/uac/replace.c | 292 ++++++++++++++++++++++++++++++---------
modules_k/uac/uac.c | 17 ++-
7 files changed, 393 insertions(+), 108 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=0f7…
According to the 3.3 docs, this function in the ™ module is no longer needed. Is this correct?
If so, should someone remove it?
Hmm. All mentions of ™ gets automatically converted to a trademark sign in my mailer. I mean the T M Module :-)
/O
--------
1.4.6. delete_timer (integer)
Time after which a to-be-deleted transaction currently ref-ed by a process will be tried to be deleted again (in milliseconds).
Note: this parameter is obsolete for ser 2.1 (in 2.1 the transaction is deleted the moment it's not referenced anymore).
Default value is 200 milliseconds.
Example 6. Set delete_timer parameter
...
modparam("tm", "delete_timer", 100)
...
Hi All,
I'm observing a core intermittently at "qm_status (qm=0x786cd000) at
mem/q_malloc.c:763" for kamailio version 3.1.0
looking at the backtrace this is occurring while doing a tcp buffer
overrun. Please have a look and let me know if anyone observed this issue
or how can we debug it.
Please find the backtrace and kamailio version
osbprod-V2R0:~ # /usr/sbin/kamailio -V
version: kamailio 3.1.0 (i386/linux) 21a375
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS,
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
DBG_QM_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535, PKG_SIZE 15MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 21a375
compiled on 12:38:44 Apr 26 2012 with gcc 4.5.0
#0 qm_status (qm=0x786cd000) at mem/q_malloc.c:763
#1 0x0819c0f3 in qm_debug_frag (qm=0x786cd000, f=<value optimized out>) at
mem/q_malloc.c:167
#2 0x0819c352 in qm_free (qm=0x786cd000, p=0x7a6cb6ac, file=0x821cce2
"<core>: tcp_main.c", func=0x822285f "wbufq_run", line=880) at
mem/q_malloc.c:457
#3 0x0815f686 in wbufq_run (tcpconn=0x7a1a7548, ev=4, fd_i=-1) at
tcp_main.c:880
#4 handle_tcpconn_ev (tcpconn=0x7a1a7548, ev=4, fd_i=-1) at tcp_main.c:4141
#5 0x08169bf2 in io_wait_loop_epoll () at io_wait.h:1092
#6 tcp_main_loop () at tcp_main.c:4606
#7 0x080b0404 in main_loop () at main.c:1655
#8 0x080b1f84 in main (argc=9, argv=0xbfb4c9f4) at main.c:2446
(gdb) l
758 LOG_(DEFAULT_FACILITY, memlog, "qm_status: ",
759 "dumping free list stats :\n");
760 for(h=0,i=0;h<QM_HASH_SIZE;h++){
761 unused=0;
762 for (f=qm->free_hash[h].head.u.nxt_free,j=0;
763 f!=&(qm->free_hash[h].head);
f=f->u.nxt_free, i++, j++){
764 if (!FRAG_WAS_USED(f)){
765 unused++;
766 #ifdef DBG_QM_MALLOC
767 LOG_(DEFAULT_FACILITY,
memlog, "qm_status: ",
Hello,
I have a few questions about the websocket module which I have successfully
installed but I wasn't able to make calls through it:
1. After setting up the proxy ip:port in the call.htm file (of sipml5) to *
127.0.0.1:5060* the client started to work but kamailio script refused to
establish my connection because the following condition was not satisfied:
*if ($Rp != MY_WS_PORT && $Rp != MY_WSS_PORT) {*
* xlog("L_WARN", "HTTP request received on $Rp\n");*
* xhttp_reply("403", "Forbidden", "", "");*
* exit;*
*}*
*MY_WS_PORT* and *MY_WSS_PORT *are set to 80 and 443 respectively, as the
default config example of websocket module says so.
Then, I decided to change the ip:port to *127.0.0.1:80*, always in the
call.htm file and afterwards the condition was satisfied but sipml5 dies
with
SIP stack start: proxy='127.0.0.1:80', realm='<sip:127.0.0.1>',
impi='2000', impu='<sip:2000@127.0.0.1>'
tsk_utils.js:97<http://127.0.0.1/sipml5/src/tinySAK/src/tsk_utils.js?svn=5>
Connecting to 'ws://127.0.0.1:80'
tsk_utils.js:97<http://127.0.0.1/sipml5/src/tinySAK/src/tsk_utils.js?svn=5>
Stack starting
tsk_utils.js:97<http://127.0.0.1/sipml5/src/tinySAK/src/tsk_utils.js?svn=5>
Unexpected response code: 200 :1 <http://127.0.0.1/>
__tsip_transport_ws_onerror
tsk_utils.js:97<http://127.0.0.1/sipml5/src/tinySAK/src/tsk_utils.js?svn=5>
__tsip_transport_ws_onclose
tsk_utils.js:97<http://127.0.0.1/sipml5/src/tinySAK/src/tsk_utils.js?svn=5>
Failed to connet to the server
Finally, I ended up commenting the condition block and restored the
original values of ip:port to *127.0.0.1:5060* .
Having done that, I tried again and another error was thrown but this time,
in the next condition block: * if ($hdr(Host) == $null ||
!is_myself($hdr(Host))) *
<script>: WebSocket
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <script>: Host:
127.0.0.1:5060
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <script>:
Origin: http://127.0.0.1
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==9 && [
127.0.0.1:5060] == [127.0.0.1]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==9 && [
127.0.0.1:5060] == [127.0.0.2]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==13 && [
127.0.0.1:5060] == [192.168.10.95]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==13 && [
127.0.0.1:5060] == [192.168.10.55]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==9 && [
127.0.0.1:5060] == [127.0.0.1]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==9 && [
127.0.0.1:5060] == [127.0.0.2]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==13 && [
127.0.0.1:5060] == [192.168.10.95]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[socket_info.c:589]: grep_sock_info - checking if host==us: 14==13 && [
127.0.0.1:5060] == [192.168.10.55]
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: DEBUG: <core>
[forward.c:462]: *check_self: host != me*
Aug 8 11:30:53 carlosrdcnx-laptop kamailio[16238]: WARNING: <script>: Bad
host 127.0.0.1:5060
I commented the block too and only then sipml5 was able to register itself.
What am I doing wrong here?
2. I registered a legacy softphone (twinkle) to attempt to initiate a call
in both ways, but the was something wrong with the signaling, probably some
frame decoding garbage in the buffer of the SIP message. Perhaps these
bytes are part of the frame control header but since I haven't read the RFC
(yet) I am mentioning it anyway.
tcp_send: buf=*#012�~#003�*INVITE sip:2000@df7jal23ls0d.invalid;transport=ws
SIP/2.0#015#012Record-Route:
<sip:127.0.0.1;transport=ws;r2=on;lr=on>#015#012Record-Route:
<sip:127.0.0.1;r2=on;lr=on>#015#012Via: SIP/2.0/WS
127.0.0.1;branch=z9hG4bK90a8.b1a7035e13ed19880dd12a1f4c86adbb.0#015#012Via:
SIP/2.0/UDP 127.0.0.1:5062;rport=5062;branch=z9hG4bKimixlbyp#015#012Max-Forwards:
69#015#012To: <sip:2000@127.0.0.1>#015#012From: "1000"
<sip:1000@127.0.0.1>;tag=lrtfz#015#012Call-ID:
gxsqobolphfchfq(a)carlosrdcnx-laptop.site#015#012CSeq: 654
INVITE#015#012Contact: <sip:1000@127.0.0.1:5062>#015#012Content-Type:
application/sdp#015#012Allow:
INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE#015#012Supported:
replaces,norefersub,100rel#015#012User-Agent:
Twinkle/1.4.2#015#012Content-Length:
302#015#012#015#012v=0#015#012o=twinkle 391470222 1383232165 IN IP4
127.0.0.1#015#012s=-#015#012c=IN IP4 127.0.0.1#015#012t=0 0#015#012m=audio
8008 RTP/AVP 98 97 8 0 3 101#015#012a=rtpmap:98
speex/16000#015#012a=rtpmap:97 speex/8000#015#012a=rtpmap:8
PCMA/8000#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:3
GSM/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101
0-15#015#012a=ptime:20#015#012
3. Does Twinkle support the minimum media requirements for testing? If not,
what (Linux) softphone is suitable for this purpose?
Thanks and sorry for the long email.
Carlos.
Well, not the simpl5.org site itself, since it uses its own
Websocket-SIP gateway to make calls. I downloaded their code and
changed the gateway address from "sipml5.org" to "192.168.0.148" which
is the VM where I'm testing. Also, Apache is using ports 8000 and 4443
since Kamailio uses 80 and 443.
But when I try to make a call, filling 192.168.0.48 as the realm, I
get "Disconnected: Failed to connet to the server" from the call.htm
page. I monitored packets with Wireshark and I see no traffic that
would make sense between the machine with the browser and the one with
Kamailio. I suspect I have to make more changes in the sipml5.org
Javascript, am I correct?
Kamailio itself (Dev version) is up and running and normal SIP from
normal UAs works. Here's the config I'm using. It's the example in the
websocket module directory, just changed to use my db and the default
TLS cert that was installed:
----------------------------------------------------------------------
#!KAMAILIO
#
# Simple/sample kamailio.cfg for running a proxy/registrar with TLS and
# WebSockets support.
#!substdef "!DBURL!mysql://ser:heslo@localhost/ser!g"
#!substdef "!MY_IP_ADDR!192.168.0.148!g"
#!substdef "!MY_WS_PORT!80!g"
#!substdef "!MY_WSS_PORT!443!g"
#!substdef "!MY_WS_ADDR!tcp:MY_IP_ADDR:MY_WS_PORT!g"
#!substdef "!MY_WSS_ADDR!tls:MY_IP_ADDR:MY_WSS_PORT!g"
##!define LOCAL_TEST_RUN
#!define WITH_TLS
#!define WITH_WEBSOCKETS
####### Global Parameters #########
fork=yes
children=4
#alias="example.com"
#!ifdef WITH_TLS
enable_tls=1
#!endif
listen=MY_IP_ADDR
#!ifdef WITH_WEBSOCKETS
listen=MY_WS_ADDR
#!ifdef WITH_TLS
listen=MY_WSS_ADDR
#!endif
#!endif
tcp_connection_lifetime=3604
tcp_accept_no_cl=yes
tcp_rd_buf_size=16384
syn_branch=0
debug=2
# set paths to location of modules (to sources or installation folders)
#!ifdef WITH_SRCPATH
mpath="modules_k:modules"
#!else
mpath="/usr/local/kamailio/lib/kamailio/modules_k/:/usr/local/kamailio/lib/kamailio/modules/"
#!endif
loadmodule "db_mysql.so"
loadmodule "tm.so"
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "siputils.so"
loadmodule "xlog.so"
loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "kex.so"
loadmodule "mi_rpc.so"
#!ifdef WITH_TLS
loadmodule "tls.so"
#!endif
#!ifdef WITH_WEBSOCKETS
loadmodule "xhttp.so"
loadmodule "websocket.so"
loadmodule "nathelper.so"
#!endif
# ----------------- setting module-specific parameters ---------------
# ----- tm params -----
# auto-discard branches from previous serial forking leg
modparam("tm", "failure_reply_mode", 3)
# default retransmission timeout: 30sec
modparam("tm", "fr_timer", 30000)
# default invite retransmission timeout after 1xx: 120sec
modparam("tm", "fr_inv_timer", 120000)
# ----- rr params -----
# add value to ;lr param to cope with most of the UAs
modparam("rr", "enable_full_lr", 1)
# do not append from tag to the RR (no need for this script)
modparam("rr", "append_fromtag", 0)
# ----- registrar params -----
modparam("registrar", "method_filtering", 1)
modparam("registrar", "max_expires", 3600)
modparam("registrar", "gruu_enabled", 0)
# ----- usrloc params -----
modparam("usrloc", "db_url", "DBURL")
modparam("usrloc", "db_mode", 0)
# ----- auth_db params -----
modparam("auth_db", "db_url", "DBURL")
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", "")
#!ifdef WITH_TLS
# ----- tls params -----
modparam("tls", "config", "/usr/local/kamailio/etc/kamailio/tls.cfg")
#!endif
#!ifdef WITH_WEBSOCKETS
# ----- nathelper params -----
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
# Note: leaving NAT pings turned off here as nathelper is _only_ being used for
# WebSocket connections. NAT pings are not needed as WebSockets have
# their own keep-alives.
#!endif
####### Routing Logic ########
# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
request_route {
# per request initial checks
route(REQINIT);
#!ifdef WITH_WEBSOCKETS
if (nat_uac_test(64)) {
# Do NAT traversal stuff for requests from a WebSocket
# connection - even if it is not behind a NAT!
# This won't be needed in the future if Kamailio and the
# WebSocket client support Outbound and Path.
force_rport();
if (is_method("REGISTER"))
fix_nated_register();
else {
if (!add_contact_alias()) {
xlog("L_ERR", "Error aliasing contact <$ct>\n");
sl_send_reply("400", "Bad Request");
exit;
}
}
}
#!endif
# handle requests within SIP dialogs
route(WITHINDLG);
### only initial requests (no To tag)
# CANCEL processing
if (is_method("CANCEL")) {
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
# authentication
route(AUTH);
# record routing for dialog forming requests (in case they are routed)
# - remove preloaded route headers
remove_hf("Route");
if (is_method("INVITE"))
record_route();
# handle registrations
route(REGISTRAR);
if ($rU==$null) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# user location service
route(LOCATION);
route(RELAY);
}
route[RELAY] {
if (!t_relay()) {
sl_reply_error();
}
exit;
}
# Per SIP request initial checks
route[REQINIT] {
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if(!sanity_check("1511", "7")) {
xlog("Malformed SIP message from $si:$sp\n");
exit;
}
}
# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
#!ifdef WITH_WEBSOCKETS
if ($du == "") {
if (!handle_ruri_alias()) {
xlog("L_ERR", "Bad alias <$ru>\n");
sl_send_reply("400", "Bad Request");
exit;
}
}
#!endif
route(RELAY);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# no loose-route, but stateful ACK;
# must be an ACK after a 487
# or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction...
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
}
# Handle SIP registrations
route[REGISTRAR] {
if (is_method("REGISTER")) {
if (!save("location"))
sl_reply_error();
exit;
}
}
# USER location service
route[LOCATION] {
if (!lookup("location")) {
$var(rc) = $rc;
t_newtran();
switch ($var(rc)) {
case -1:
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
}
}
# Authentication route
route[AUTH] {
if (is_method("REGISTER") || from_uri==myself) {
# authenticate requests
if (!auth_check("$fd", "subscriber", "1")) {
auth_challenge("$fd", "0");
exit;
}
# user authenticated - remove auth header
if(!is_method("REGISTER"))
consume_credentials();
}
# if caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (from_uri!=myself && uri!=myself) {
sl_send_reply("403","Not relaying");
exit;
}
}
#!ifdef WITH_WEBSOCKETS
onreply_route {
if (nat_uac_test(64)) {
# Do NAT traversal stuff for replies to a WebSocket connection
# - even if it is not behind a NAT!
# This won't be needed in the future if Kamailio and the
# WebSocket client support Outbound and Path.
add_contact_alias();
}
}
event_route[xhttp:request] {
set_reply_close();
set_reply_no_connect();
if ($Rp != MY_WS_PORT && $Rp != MY_WSS_PORT) {
xlog("L_WARN", "HTTP request received on $Rp\n");
xhttp_reply("403", "Forbidden", "", "");
exit;
}
xlog("L_DBG", "HTTP Request Received\n");
if ($hdr(Upgrade)=~"websocket"
&& $hdr(Connection)=~"Upgrade"
&& $rm=~"GET") {
xlog("L_DBG", "WebSocket\n");
xlog("L_DBG", " Host: $hdr(Host)\n");
xlog("L_DBG", " Origin: $hdr(Origin)\n");
if ($hdr(Host) == $null || !is_myself($hdr(Host))) {
xlog("L_WARN", "Bad host $hdr(Host)\n");
xhttp_reply("403", "Forbidden", "", "");
exit;
}
# Optional... validate Origin
# Optional... perform HTTP authentication
# ws_handle_handshake() exits (no further configuration file
# processing of the request) when complete.
if (ws_handle_handshake())
{
# Optional... cache some information abou the
# successful connection
exit;
}
}
xhttp_reply("404", "Not found", "", "");
}
event_route[websocket:closed] {
xlog("L_INFO", "WebSocket connection from $si:$sp has closed\n");
}
#!endif
----------------------------------------------------------------------
--
Juan Carlos Castro y Castro
Instant Solutions - Telefonia Gerando Resultado
http://www.instant.com.br
Principais capitais: 4063-6100
Demais regiões: (11)4063-6100
Hello,
within w_get_sdp function in modules/sdpops/sdpops_mod.c
} else {
avp_val.s.s = pkg_malloc(sdp->raw_sdp.len);
avp_val.s.len = sdp->raw_sdp.len;
if (avp_val.s.s == NULL)
I do not find anywhere where avp_val.s.s variable is freed.
So I attach two possible patches to solve that in two different ways.
Kind regards,
Vicente.