The you just got the snapshot at that time without the history of
the commit and probably you did the git clone after I did the
commit, a new git pull taking newer commit. So try cloning again the
latest branch 3.1, without --depth 1 parameter.
Your patch alone, without t_flush_flags(), doesn't change anything
in my scenario, there is still no logging of 2nd branch.
Cheers
Ozren
On Wed, Sep 7, 2011 at 1:05 PM,
Daniel-Constantin Mierla <miconda@gmail.com>
wrote:
Hello,
On 9/7/11 11:25 AM, Ozren Lapcevic wrote:
Hi Daniel,
thanks for the quick fix and reply.
What is the easiest way to try this new patch? I'm
running kamailio 3.1.4 and there is no t_flush_flags()
in tmx module in that version. I suppose I need to
install Kamailio Devel from git (http://www.kamailio.org/dokuwiki/doku.php/install:kamailio-devel-from-git)
to get t_flush flags() and your patch or is there a
workaround to apply them to my 3.1.4 branch?
did you install 3.1.4 from tarball/packages or is it from
git branch 3.1? If later, then you can do:
There you find at top of the page a link named 'patch' that
you can use with git tools to apply or extract the
diff-patch part and apply with patch.
Cheers,
Daniel
Cheers
Ozren
On Tue, Sep 6, 2011 at 2:18
PM, Daniel-Constantin Mierla <miconda@gmail.com>
wrote:
Hello,
can you use t_flush_flags() after setting the
accounting flag in falure_route? Automatic
update was missing so far, reported by Alex
Hermann as well. I just did a patch, so if you
want to try it, see the commit:
Actually, reporting if all goes fine with this
patch, will help in backporting it to 3.1
branch.
Thanks,
Daniel
On 9/5/11 2:41 PM, Ozren Lapcevic wrote:
Hi,
I'm having some problems accounting missed
serial forked calls to mysql database.
I have following setup. Each user can have
up to two contacts: telephone number
(routed to asterisk) and SIP URI. Users
can specify which contact has higher
priority - which one should ring first.
There is also SEMS voicemail which is
forked as 3rd serial call leg if there is
no answer at first two contacts.
For example, I have two users: oz@abc.hr
and pero@abc.hr. pero@abc.hr also has
set telephone number as alternative number
if he is not reachable at sip:pero@abc.hr.
Moreover, pero@abc.hr has
voicemail turned on. When oz@abc.hr
calls pero@abc.hr, first pero@abc.hr's SIP
client rings, then if there is no answer
and after the timeout telephone number
rings and finally, if there is no answer
at telephone and after the timeout INVITE
is forked to SEMS.
There are two interesting scenarios
accounting-wise which can happened:
1. oz@abc.hr
calls pero@abc.hr, there
are no answers and call is forked to
voicemail.
2. oz@abc.hr
calls pero@abc.hr, there
is no answer at SIP client, but pero
answers call at telephone.
When scenario 1 happens, I want to have
only one log (row) in missed_calls table.
When scenario 2 happens, I don't want to
have a log in missed_calls table.
To accomplish this, I want to log only
the 2nd branch of the forked call.
However, there is either a bug in acc
module or I'm doing something wrong, and
I can't get Kamailio to log only the 2nd
branch. I think that I am setting
the FLT_ACCMISSED flag correctly - after
the 2nd branch is handled and prior to
calling the RELAY route. Logs show that
FLT_ACCMISSED flag is set prior to calling
t_relay(), and there are no errors in
debug log. I am using $ru = "something" to
rewrite URI prior to forking request.
I can easily set up logging of every call
(two missed calls for serially forked call
to two locations) by setting FLT_ACCMISSED
flag for each INVITE. I can set up logging
of every call's 1st branch, by reseting
FLT_ACCMISSED flag when handling 2nd
branch of the call. Interestingly, logging
of only the 2nd branch of the serial
forked call works when there is no forking
to voicemail!
Any ideas how to solve this problem?
Bellow are important parts of my config
file. I'm running kamailio 3.1.4.
# Main SIP request routing logic
# - processing of any incoming SIP request
starts with this route
route {
# per request initial checks
route(REQINIT);
if (src_ip != ****) {
# NAT detection
route(NAT);
}
# 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|SUBSCRIBE"))
record_route();
# account only INVITEs
if (is_method("INVITE"))
{
setflag(FLT_ACC); # do
accounting
}
# dispatch requests to foreign
domains
route(SIPOUT);
### requests for my local domains
# handle presence related requests
route(PRESENCE);
# handle registrations
route(REGISTRAR);
if ($rU==$null)
{
# request with no Username
in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# dispatch destinations to PSTN
route(PSTN);
if ( is_method("INVITE") ) {
route(DBALIASES);
#check for user defined
forking priorities and timers
route(FORK);
}
# user location service
route(LOCATION);
route(RELAY);
}
#check for user defined forking priorities
and timers
route[FORK]{
sql_query("con", "select * from
usr_pref_custom where uuid='$tu'",
"pref");
#if users have priorities
set, use FAIL_FORK failure route
if (
isflagset(FLT_USRPREF) ) {
t_on_failure("FAIL_FORK");
}
}
if (isflagset(FLT_ACCMISSED))
xlog("L_INFO","RELAY, $rm $ru, ACCMISSED
FLAG IS SET");
else xlog("L_INFO","RELAY, $rm
$ru, ACCMISSED FLAG IS NOT SET");
if (!t_relay()) {
sl_reply_error();
}
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()) {
xlog("L_INFO","WITHINDLG, loose_route()");
if
(is_method("BYE")) {
xlog("L_INFO","WITHINDLG, BYE, DO
ACCOUNTING");
setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the
transaction fails
}
route(RELAY);
} else {
if
(is_method("SUBSCRIBE") && uri ==
myself) {
#
in-dialog subscribe requests
route(PRESENCE);
exit;
}
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;
}
}
# USER location service
route[LOCATION] {
#skip if $ru is telephone number
if ($ru =~ "^sip:00") {
xlog("L_INFO","SKIP
lookup...");
}
else {
if (!lookup("location")) {
switch ($rc) {
case -1:
case -3:
t_newtran();
t_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Method Not
Allowed");
exit;
}
}
}
# when routing via usrloc, log the
missed calls also, but only if user
doesn't have prios set
if ( is_method("INVITE")
&& !(isflagset(FLT_USRPREF))) {
setflag(FLT_ACCMISSED);
}
}
# Failure route for forked calls
failure_route[FAIL_FORK] {
#!ifdef WITH_NAT
if (is_method("INVITE") &&
(isbflagset(FLB_NATB) ||
isflagset(FLT_NATS))) {
unforce_rtp_proxy();
}
#!endif
if ($avp(prio) >= 1) {
$avp(prio) = $avp(prio) +
1;