Module: sip-router
Branch: 3.1
Commit: 9dbf735878acc87bab1a0740476f1d106f89412f
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9dbf735…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Jul 27 19:34:35 2011 +0200
core: allow forcing send socket for replies
- patch by Marcus Hunger, closes FS#142
(cherry picked from commit bf48d46366eb50ebcaf0972d2524b65d3accdffa)
---
forward.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/forward.c b/forward.c
index 175f54b..aa71780 100644
--- a/forward.c
+++ b/forward.c
@@ -124,6 +124,8 @@ static int sock_inet = -1;
static int sock_inet6 = -1;
#endif /* USE_IPV6 */
+static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg);
+
struct socket_info* get_out_socket(union sockaddr_union* to, int proto)
{
int* temp_sock;
@@ -829,6 +831,9 @@ int forward_reply(struct sip_msg* msg)
}
#endif
+
+ apply_force_send_socket(&dst, msg);
+
if (msg_send(&dst, new_buf, new_len)<0)
{
STATS_RPL_FWD_DROP();
@@ -850,3 +855,10 @@ error:
if (new_buf) pkg_free(new_buf);
return -1;
}
+
+static void apply_force_send_socket(struct dest_info* dst, struct sip_msg* msg)
+{
+ if (msg->force_send_socket != 0) {
+ dst->send_sock = get_send_socket(msg, &dst->to, dst->proto);
+ }
+}