THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Nils Ohlmeier (nils)
Attached to Project - sip-router
Summary - Proto names are causing parser errors
Task Type - Bug Report
Category - Core
Status - Assigned
Assigned To - Andrei Pelinescu-Onciul
Operating System - All
Severity - Medium
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - When the configuration file contains a statement like this:
if (proto==TCP) {
this is causing a parser errors at the startup of SER like this:
0(26225) : <core> [cfg.y:3163]: parse error in config file /home/lando/sip-router/etc/sip-router-basic.cfg, line 76, column 13-15: syntax error
0(26225) : <core> [cfg.y:3163]: parse error in config file /home/lando/sip-router/etc/sip-router-basic.cfg, line 76, column 13-15: number expected
0(26225) : <core> [cfg.y:3166]: parse error in config file /home/lando/sip-router/etc/sip-router-basic.cfg, line 76, column 16: bad expression
0(26225) : <core> [cfg.y:3166]: parse error in config file /home/lando/sip-router/etc/sip-router-basic.cfg, line 76, column 16: invalid route statement
Currently only statements like this are working:
if (proto==2) {
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=15
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A user has added themself to the list of users assigned to this task.
FS#15 - Proto names are causing parser errors
User who did this - Nils Ohlmeier (nils)
http://sip-router.org/tracker/index.php?do=details&task_id=15
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Hi, in failure route I call next_gw(), it success and the request is
sent to a second gateway (inspecting with ngrep I see that the sent
request has the gw IP as RURI).
But if I print (xlog) $ru it still shows the previously selected gw
(the first one).
This is, the behaviour is correct but $ru is not updated in the script process.
I show an example which hopefully would show the issue (xlogs).
Basically the script invokes ROUTE_GW which uses LCR to select the
first gw, sets FAILURE_ROUTE_GW and calls ROUTE_DEFAULT (in which
t_relay is done). FAILURE_ROUTE block also sets FAILURE_ROUTE block,
uses LCR to select a new gw and calls to ROUTE_DEFAULT:
INVITE sip:1234@sip.mydomain.org - From: ibc - from
222.230.253.254:48254 (Twinkle/1.4.2)
[ROUTE GW] LCR: Selected gw ($rd): 222.230.249.81
[ROUTE DEFAULT] $ru = sip:1234@222.230.249.81:0 <---- Seems to be OK
500 "Internal Error" from 222.230.249.81:5060 (GW1)
[FAILURE ROUTE GW] CRITICAL: LCR: 500 replied by gw 222.230.249.81 -->
Doing failover...
[FAILURE ROUTE GW] Selected gw ($rd): 222.230.249.81 <----- WRONG !!!
[ROUTE DEFAULT] $ru = sip:1234@222.230.249.81:0 <----- WRONG !!!
503 "Service Unavailable" from 99.121.79.216:5060 (GW2) <----- But
the used gw is the expected.
[FAILURE ROUTE GW] CRITICAL: LCR: 503 replied by gw 99.121.79.216 -->
Doing failover...
[FAILURE ROUTE GW] CRITICAL: LCR: No gateways available --> 503
Kamailio 1.5 rev 5925.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>
I just realized today that I have the siprouter.org domain (for
pre-historic reasons that I don't even remember). It didn't even have
proper DNS, but I have set that up and pointed www. to the same ip as
www (but the server does not recognize the siprouter.org domain). Or
maybe I should use CNAME?
Who is the keeper of DNS for sip-router.org? Let's sync up so at least
siprouter.org redirects correctly the most important addresses.
g-)
Module: sip-router
Branch: master
Commit: b2ba3a96b33e4bac14a9de6b615665af9f598c78
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b2ba3a9…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Sep 18 23:56:08 2009 +0200
xmlrpc doc: use set_reply_close()
Updated doc & examples to use set_reply_close() and
set_reply_no_connect() in the XMLRPC route instead of return -1.
(this allows using rpc async commands with the broken python
xmlrpclib).
---
modules_s/xmlrpc/README | 19 ++++++++++++++++---
modules_s/xmlrpc/doc/functions.xml | 6 ++++++
modules_s/xmlrpc/doc/xmlrpc.xml | 14 +++++++++++---
3 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/modules_s/xmlrpc/README b/modules_s/xmlrpc/README
index b497e66..d1abb54 100644
--- a/modules_s/xmlrpc/README
+++ b/modules_s/xmlrpc/README
@@ -456,14 +456,21 @@ Content-Length: 276
xmlrpclib with a Transport class that works.
For the second solution (force closing tcp connections after answering)
- the XMLRPC route should end with a return -1, exit -1 or drop -1.
+ the XMLRPC route should have a set_reply_close() command before
+ dispatch_rpc(). set_reply_no_connect() is also recommended (avoid
+ trying to open tcp connection to xmlrpc clients that closed it).
+ Alternatively ending the XMLRPC route with return -1, exit -1 or drop
+ -1 can also be used, but note that this will not work for async rpcs
+ (it will close the connection immeidately and not on the async
+ response).
Example 1.
route[XMLRPC]{
- dispatch_rpc();
# close connection only for xmlrpclib user agents
if search("^User-Agent:.*xmlrpclib"))
- return -1 ;
+ set_reply_close();
+ set_reply_no_connect(); # optional
+ dispatch_rpc();
}
1.4. Client Examples
@@ -543,6 +550,9 @@ modparam("xmlrpc", "autoconversion", 1)
modparam("xmlrpc", "route", "XMLRPC");
#...
route[XMLRPC]{
+ if search("^User-Agent:.*xmlrpclib"))
+ set_reply_close();
+ set_reply_no_connect(); # optional
dispatch_rpc();
}
@@ -566,5 +576,8 @@ route[XMLRPC]{
xmlrpc_reply("400", "Unauthorized");
return;
}
+ if search("^User-Agent:.*xmlrpclib"))
+ set_reply_close();
+ set_reply_no_connect(); # optional
dispatch_rpc();
}
diff --git a/modules_s/xmlrpc/doc/functions.xml b/modules_s/xmlrpc/doc/functions.xml
index bc3820f..adacbac 100644
--- a/modules_s/xmlrpc/doc/functions.xml
+++ b/modules_s/xmlrpc/doc/functions.xml
@@ -43,6 +43,9 @@
modparam("xmlrpc", "route", "XMLRPC");
#...
route[XMLRPC]{
+ if search("^User-Agent:.*xmlrpclib"))
+ set_reply_close();
+ set_reply_no_connect(); # optional
dispatch_rpc();
}
</programlisting>
@@ -74,6 +77,9 @@ route[XMLRPC]{
xmlrpc_reply("400", "Unauthorized");
return;
}
+ if search("^User-Agent:.*xmlrpclib"))
+ set_reply_close();
+ set_reply_no_connect(); # optional
dispatch_rpc();
}
</programlisting>
diff --git a/modules_s/xmlrpc/doc/xmlrpc.xml b/modules_s/xmlrpc/doc/xmlrpc.xml
index c893e97..2cdf422 100644
--- a/modules_s/xmlrpc/doc/xmlrpc.xml
+++ b/modules_s/xmlrpc/doc/xmlrpc.xml
@@ -677,15 +677,23 @@ Content-Length: 276
</para>
<para>
For the second solution (force closing tcp connections after answering)
- the XMLRPC route should end with a return -1, exit -1 or drop -1.
+ the XMLRPC route should have a <function>set_reply_close()</function>
+ command before <function>dispatch_rpc()</function>.
+ <function>set_reply_no_connect()</function> is also recommended
+ (avoid trying to open tcp connection to xmlrpc clients that closed it).
+ Alternatively ending the XMLRPC route with return -1, exit -1 or
+ drop -1 can also be used, but note that this will not work for
+ async rpcs (it will close the connection immeidately and not on the
+ async response).
<example>
<programlisting>
<![CDATA[
route[XMLRPC]{
- dispatch_rpc();
# close connection only for xmlrpclib user agents
if search("^User-Agent:.*xmlrpclib"))
- return -1 ;
+ set_reply_close();
+ set_reply_no_connect(); # optional
+ dispatch_rpc();
}
]]>
</programlisting>
Module: sip-router
Branch: master
Commit: b8d528b657bd52fce0b342e01380001b4ffa15fe
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b8d528b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Sep 18 20:52:37 2009 +0200
tcp: fix fd leak on async error or quick connect
In some error cases (from which the most likely to appear in
real-life would be maximum global send queue size exceeded),
the fd for a new created connection (in tcp_send()) was not closed
when the connection was destroyed.
Same thing happened in the case of a "quick" connect (connect & send
finish immediately, this happens in general only on localhost) for
a connection marked as close-after-send (via the new msg
send_flags).
---
tcp_main.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tcp_main.c b/tcp_main.c
index a72e3cc..d2f7b59 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -2270,6 +2270,9 @@ conn_wait_close:
* connection (tcpconn_chld_put(c))) or when tcp_main receives a
* CONN_ERROR it*/
c->state=S_CONN_BAD;
+ /* we are here only if we opened a new fd (and not reused a cached or
+ a reader one) => if the connect was successful close the fd */
+ if (fd>=0) close(fd);
TCPCONN_LOCK;
if (c->flags & F_CONN_HASHED){
/* if some other parallel tcp_send did send CONN_ERROR to
Module: sip-router
Branch: master
Commit: cc256eba86a81f61ead4e00c39d81858b5e5e56c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cc256eb…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Sep 18 21:03:26 2009 +0200
tm: send_flags can be used in branch & reply routes
Forwarding send flags can now be used in branch routes (and they
will affect only the current branch) and in reply routes (if the
reply will be forwarded, either as provisional or final reply, the
send_flags will affect it, but they will not affect other
replies).
---
modules/tm/t_fwd.c | 30 +++++++++++++++++++++++++++++-
modules/tm/t_reply.c | 5 ++++-
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index 0590c10..2ef3025 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -144,6 +144,23 @@ unsigned int get_on_branch(void)
}
+/** create a branch "buffer".
+ * Creates the buffer used in the branch rb and runs the on_branch route.
+ * @param t - transaction
+ * @param i_req - corresponding sip_msg, must be non-null, flags might be
+ * be modified (on_branch route)
+ * @param branch - branch no
+ * @param uri
+ * @param path - path vector (list of route like destination in text form,
+ * e.g.: "<sip:1.2.3.4;lr>, <sip:5.6.7.8;lr>")
+ * @param len - resul parameter, it will be filled with the created buffer
+ * lenght.
+ * @param dst - value/result parameter. It will be used to generate the
+ * message. All the values except the send_flags are read-only.
+ * send_flags it's updated.
+ * @return pointer to shm alloc'ed buffer on success (*len and dst->send_flags
+ * are filled/modified), 0 on failure
+ */
static char *print_uac_request( struct cell *t, struct sip_msg *i_req,
int branch, str *uri, str* path, unsigned int *len, struct dest_info* dst)
{
@@ -156,6 +173,8 @@ static char *print_uac_request( struct cell *t, struct sip_msg *i_req,
str path_bak;
int path_backed_up;
int backup_route_type;
+ snd_flags_t fwd_snd_flags_bak;
+ snd_flags_t rpl_snd_flags_bak;
shbuf=0;
msg_uri_bak.s=0; /* kill warnings */
@@ -208,11 +227,20 @@ static char *print_uac_request( struct cell *t, struct sip_msg *i_req,
set_route_type(BRANCH_ROUTE);
tm_ctx_set_branch_index(branch+1);
if (exec_pre_script_cb(i_req, BRANCH_CB_TYPE)>0) {
+ /* backup ireq msg send flags */
+ fwd_snd_flags_bak=i_req->fwd_send_flags;;
+ rpl_snd_flags_bak=i_req->rpl_send_flags;
+ i_req->fwd_send_flags=dst->send_flags /* intial value */;
if (run_top_route(branch_rt.rlist[branch_route], i_req, 0) < 0) {
LOG(L_ERR, "Error in run_top_route\n");
}
+ /* update dst send_flags */
+ dst->send_flags=i_req->fwd_send_flags;
+ /* restore ireq_msg flags */
+ i_req->fwd_send_flags=fwd_snd_flags_bak;
+ i_req->rpl_send_flags=rpl_snd_flags_bak;
exec_post_script_cb(i_req, BRANCH_CB_TYPE);
- }
+ }
tm_ctx_set_branch_index(0);
set_route_type(backup_route_type);
}
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index 981efd2..fa99650 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -1607,6 +1607,9 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch,
if (branch!=relay) {
free_via_clen_lump(&relayed_msg->add_rm);
}
+ /* update send_flags with possible additions from the
+ reply route */
+ uas_rb->dst.send_flags|=relayed_msg->rpl_send_flags;
}
}
update_reply_stats( relayed_code );
@@ -1978,7 +1981,7 @@ int reply_received( struct sip_msg *p_msg )
backup_domain_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to );
setbflagsval(0, uac->branch_flags);
/* Pre- and post-script callbacks have already
- * been execueted by the core. (Miklos)
+ * been executed by the core. (Miklos)
*/
if (run_top_route(onreply_rt.rlist[t->on_reply], p_msg, 0)<0)
LOG(L_ERR, "ERROR: on_reply processing failed\n");
Module: sip-router
Branch: master
Commit: 0fa4b2d5a4d9700eed970d36ed1bb803c1f07d21
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0fa4b2d…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Sep 18 13:36:33 2009 +0200
Merge commit 'origin/andrei/path'
* commit 'origin/andrei/path':
core: add path route headers after local via
core: path support when forwarding
tm: path support
xlog(s): updated to the new next_branch()
registrar(s): updated to the new append_branch()
permissions(s): updated to the new next_branch()
osp(s): updated to the new append_branch()
exec(s): use ser_append_branch() instead of append_branch()
cpl-c(s): updated to the new append_branch()
tm: updated to the new append_branch() & next_branch()
enum: s/km_append_brach/append_branch/
avpops: updated to the new append_branch()
core: append_branch & next_branch api changes
Conflicts:
modules/tm/sip_msg.c
modules/tm/t_fwd.c
---