[SR-Users] pua_subscribe and force_send_socket trouble
Mikko Lehto
mslehto at iki.fi
Fri Jan 9 18:43:54 CET 2015
Hi
I am having strange behavior on local port assignment when
proxying out locally generated request. Kamailio is 4.2.1 from git.
I use MI pua_subscribe to create subscription to be handled by
external presence server.
In event_route[tm:local-request] I set $du to point back to proxy itself.
When request hits initial request_route, I add some headers, change
request URI and prepare failure_route for later uac_auth() processing.
So far so good and TLS packets are flying to correct destination.
Here is the trouble:
when I observe outgoing TLS traffic with tcpdump, I can see that local
source port is not following what I set with force_send_socket(). I tried to
place force_send_socket() in request_route, branch_route, and
tm:local-request, but it is always some random high port (>30000), never
the intended one. I am trying to set it to same as my TLS listening socket.
Is my usage somehow incorrect?
What should I try next to make Kamailio use constant source port?
Relevant config snippet below (IP address and domain part is obscured).
---
mhomed=1
listen=udp:A.B.C.D:5041
listen=tls:A.B.C.D:5041
request_route {
route(REQINIT);
if ( blahblah... ) {
$ru = "sip:" + $rU + "@domain.part.invalid;transport=tls";
$avp(uac_auth) = 0;
route(PR_HDRS);
route(PR_TRIGGERS);
force_send_socket(A.B.C.D:5041);
t_newtran();
route(RELAY);
}
}
route[PR_HDRS] {
remove_hf("User-Agent");
insert_hf("User-Agent: pua_subscribe\r\n","Call-ID");
}
route[PR_TRIGGERS] {
t_on_branch("PR_BRANCH");
t_on_failure("PR_FAILURE");
}
branch_route[PR_BRANCH] {
force_send_socket(A.B.C.D:5041);
}
failure_route[PR_FAILURE] {
if ( $avp(uac_auth) == 0 && ($T_reply_code == 401 or $T_reply_code == 407) ) {
uac_auth();
$avp(uac_auth) = 1;
route(PR_TRIGGERS);
route(RELAY);
}
}
event_route [tm:local-request] {
force_send_socket(A.B.C.D:5041);
$du = "sip:A.B.C.D:5041";
}
route[RELAY] { is from default config }
---
I found these recent commits, bugs and threads somehow relating
to force_send_socket and tm:local-request:
http://sip-router.org/tracker/index.php?do=details&task_id=462
http://lists.sip-router.org/pipermail/sr-users/2014-August/084459.html
dbd8ea9b1fa216e59d4c36e2eb4b671202824259
http://lists.sip-router.org/pipermail/sr-dev/2014-September/024984.html
e404d123610b63ddd1c75d39667b373c40071eab
http://lists.sip-router.org/pipermail/sr-dev/2014-September/024977.html
--
Mikko Lehto
More information about the sr-users
mailing list