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: 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: 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: 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
---
Module: sip-router
Branch: master
Commit: 643491da0b3cb9a87d278c08ed5e0879511ddfc1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=643491d…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Sep 18 12:57:42 2009 +0200
Merge commit 'origin/andrei/send_flags'
* commit 'origin/andrei/send_flags':
NEWS: update
core: new close after send and reuse only script functions
tcp: send_flags support
sl: use the msg reply send_flags
tm: support for send_flags
core: send flags support
---
I've tried tagging the current code version, before doing some merges,
but by mistake I've pushed more tags back to the repository.
They look like old ser tags which somehow did not make it in the intial
import. There's no harm done, just some extra tags.
The commit messages that appear as being on a tag, where already on the
repo, they get extra reported probably because of a minor problem with the
script generating the emails.
Andrei