Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-23 Thread Daniel-Constantin Mierla

Hello,

can you add a debug message to acc module, compile, reinstall and test 
again? Send again the debug messages with parameter debug=4


I am attaching the patch for master branch, should be easy to apply to 
3.1 as well.


Cheers,
Daniel

On 9/13/11 11:33 AM, Daniel-Constantin Mierla wrote:

Hello,

On 9/13/11 11:21 AM, Ozren Lapcevic wrote:

Hi,

On Tue, Sep 13, 2011 at 8:46 AM, Daniel-Constantin Mierla 
mailto:mico...@gmail.com>> wrote:


Hello,

just to be sure, you used flag 2 for missed calls, right? I can
see it set in onreply_route.



Yes, I've used #!define FLT_ACCMISSED 2 and setflag(FLT_ACCMISSED) 
for missed calls. I checked the flag in onreply_route and failure 
route and they are properly set.


That means the flags are ok now, the issue seems to be in other
place. You don't set any of the accounting flags in request route
block, isn't it? I mean, the first accounting flag (like
accounting answered calls or missed calls) is set in failure
route. If so, the acc does not register itself for a tm callback
that is used for handling accounting events.



Actually, I do set other accounting flags in following routes:

#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3

#MAIN ROUTE

if (is_method("INVITE")) setflag(FLT_ACC);

route[WITHINDLG] {
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {

setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if 
the transaction fails

}
 .

route[LOCATION] {
# only for people who don't have multiple contacts (no serial 
forking, not used in reported scenario)


if ( is_method("INVITE") && !(isflagset(FLT_USRPREF))) 
setflag(FLT_ACCMISSED);

}

#called only for serial forked calls
failure_route[FAIL_FORK] {
   .
   # if second branch set flag
setflag(FLT_ACCMISSED);
t_flush_flags();
  
  # if 3rd branch (voicemail) reset flag
resetflag(FLT_ACCMISSED);
t_flush_flags();
  
}


Now that you've mentioned it, I've removed all other setflag() 
functions and kept only the ones in FAIL_FORK failure route. There is 
still no logging of the second branch.


Try to set acc flag for writing to syslog in route {...}, you can
reset it in failure route or onreply_route. Of course, this as an
workaround for now, I will look for a proper solution in case
this is the problem.



I'm not sure I can implement needed logic this way. I don't want to 
account 1st branch. If I set FLT_ACCMISSED flag in route {...} and 
reset it in on_reply and failure route, it will be too late, the 
missed call will already be accounted. Or, I'm missing something?


It meant setting FLT_ACC (not FLT_ACCMISSED) in main route and reset 
it on onreply_route in case you didn't want to account successful 
transactions at all. But I see you actually set the acc flag in route 
block ... probably I have to dig further in the logs for more details. 
So far it looked like an issue if no acc module flags were set in 
request route block.


--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

diff --git a/modules_k/acc/acc_logic.c b/modules_k/acc/acc_logic.c
index d6e6d53..6cac79d 100644
--- a/modules_k/acc/acc_logic.c
+++ b/modules_k/acc/acc_logic.c
@@ -493,6 +493,8 @@ int acc_api_exec(struct sip_msg *rq, acc_engine_t *eng,
 
 static void tmcb_func( struct cell* t, int type, struct tmcb_params *ps )
 {
+   LM_DBG("acc callback called for t(%p) event type %d, reply code %d\n",
+   t, type, ps->code);
if (type&TMCB_RESPONSE_OUT) {
acc_onreply( t, ps->req, ps->rpl, ps->code);
} else if (type&TMCB_E2EACK_IN) {
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-24 Thread Daniel-Constantin Mierla

Hello,

just to refresh in case you mentioned already, do you set acc missed 
call flag in request route block?


I found another issue that if this flag is no set in request route, the 
callback to tm that is used for accounting missed calls is not 
registered. Can you try with 3.2.0 (git master branch at this moment) 
and set the acc_prepare_flag parameter, plus the flag itself for invites?


Thanks,
Daniel

On 9/23/11 4:23 PM, Ozren Lapcevic wrote:

Hi Daniel,

sure, debug log is in attach.

Cheers
Ozren


On Fri, Sep 23, 2011 at 1:41 PM, Daniel-Constantin Mierla 
mailto:mico...@gmail.com>> wrote:


Hello,

can you add a debug message to acc module, compile, reinstall and
test again? Send again the debug messages with parameter debug=4

I am attaching the patch for master branch, should be easy to
apply to 3.1 as well.

Cheers,
Daniel



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-26 Thread Ozren Lapcevic
On Sat, Sep 24, 2011 at 9:11 AM, Daniel-Constantin Mierla  wrote:

>  Hello,
>
> just to refresh in case you mentioned already, do you set acc missed call
> flag in request route block?
>


No. I'm setting setflag(FLT_ACCMISSED) in failure route for serially forked
calls.

(Also, I'm setting setflag(FLT_ACC); in main route for INVITES. I'm setting
setflag(FLT_ACC) and setflag(FLT_ACCFAILED) in WITHINDLG route for loose
routed BYEs.)

Previously, before starting this thread, and before any of your patches,
I've tried setting FLT_ACCMISSED in LOCATION route and in RELAY route, but
didn't help with properly accounting only the 2nd branch.


I found another issue that if this flag is no set in request route, the
> callback to tm that is used for accounting missed calls is not registered.
> Can you try with 3.2.0 (git master branch at this moment) and set the
> acc_prepare_flag parameter, plus the flag itself for invites?
>


I've installed new Kamailio with instructions from:
http://www.kamailio.org/dokuwiki/doku.php/install:kamailio-devel-from-git.
However, default kamailio config file and kamctl file both show 3.1 version.
How can I check whether I have 3.2 version installed?

acc_prepare_flag should be set in main route, e.g. in the same place as
FLT_ACC for INVITES?

Cheers
Ozren



> Thanks,
> Daniel
>
>
> On 9/23/11 4:23 PM, Ozren Lapcevic wrote:
>
> Hi Daniel,
>
> sure, debug log is in attach.
>
> Cheers
> Ozren
>
>
> On Fri, Sep 23, 2011 at 1:41 PM, Daniel-Constantin Mierla <
> mico...@gmail.com> wrote:
>
>>  Hello,
>>
>> can you add a debug message to acc module, compile, reinstall and test
>> again? Send again the debug messages with parameter debug=4
>>
>> I am attaching the patch for master branch, should be easy to apply to 3.1
>> as well.
>>
>> Cheers,
>>  Daniel
>>
>>
>
> ___
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing 
> listsr-us...@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierla -- http://www.asipto.com
>
> Kamailio Advanced Training, Oct 10-13, Berlin: 
> http://asipto.com/u/kathttp://linkedin.com/in/miconda -- 
> http://twitter.com/miconda
>
>
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-26 Thread Daniel-Constantin Mierla

Hello,

On 9/26/11 11:44 AM, Ozren Lapcevic wrote:


On Sat, Sep 24, 2011 at 9:11 AM, Daniel-Constantin Mierla 
mailto:mico...@gmail.com>> wrote:


Hello,

just to refresh in case you mentioned already, do you set acc
missed call flag in request route block?



No. I'm setting setflag(FLT_ACCMISSED) in failure route for serially 
forked calls.
ok, so that caused not to register to TM for a callback on failure 
events when the transaction for respective INVITE was created.


(Also, I'm setting setflag(FLT_ACC); in main route for INVITES. I'm 
setting setflag(FLT_ACC) and setflag(FLT_ACCFAILED) in WITHINDLG route 
for loose routed BYEs.)

This is different that what we looked after.


Previously, before starting this thread, and before any of your 
patches, I've tried setting FLT_ACCMISSED in LOCATION route and in 
RELAY route, but didn't help with properly accounting only the 2nd 
branch.


Because it caused the first branch also to be recorded to missed calls.



I found another issue that if this flag is no set in request
route, the callback to tm that is used for accounting missed calls
is not registered. Can you try with 3.2.0 (git master branch at
this moment) and set the acc_prepare_flag parameter, plus the flag
itself for invites?



I've installed new Kamailio with instructions from: 
http://www.kamailio.org/dokuwiki/doku.php/install:kamailio-devel-from-git. 
However, default kamailio config file and kamctl file both show 3.1 
version. How can I check whether I have 3.2 version installed?

Do:

/usr/local/sbin/kamailio -V

The config file kamailio.cfg is not overwritten if already exists, to 
prevent mistakenly loss (no backup).





acc_prepare_flag should be set in main route, e.g. in the same place 
as FLT_ACC for INVITES?

Yes, it has to be set in request route {...} block.

Cheers,
Daniel

--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-26 Thread Ozren Lapcevic
Hi,

sorry if I haven't been clear in the last mail(s). I'll try to recap.

I have a call with 3 branches that are serially forked. branch 1 and 2 can
be PSTN number or SIP URI. branch 3 is voicemail. I do not want to account
1st branch if call is missed, only the 2nd one.

Here are the snippets from the configuration file that I'm using since I've
started this thread. I've bolded parts where acc related flags are set.

route { 
route(WITHINDLG);   

if ( is_method("INVITE") ) { ...
*setflag(FLT_ACC);   # [1]*
#check for user defined forking priorities and timers
route(FORK);
}
route(LOCATION);
route(RELAY);
}

#check for user defined forking priorities and timers
route[FORK]{  ...
# user has multiple contacts, do serial forking
setflag(FLT_USRPREF);  
# overwrite request URI with highest priority contact
if ($avp(prio1) =~ "^sip:00") $ru = $avp(prio1) + "@host";
else $ru = $avp(prio1);  
}

route[RELAY] {
if (is_method("INVITE")) {
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");

#if users have priorities set, use FAIL_FORK failure route
if ( isflagset(FLT_USRPREF) ) t_on_failure("FAIL_FORK");
}
if (!t_relay()) sl_reply_error();
exit;
}

# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {
*setflag(FLT_ACC);* *# [2]*
*setflag(FLT_ACCFAILED);* *# [3]*
}
route(RELAY);
}  } }

# USER location service
route[LOCATION] {
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);* *# [4] - not used in serial
forking scenario
*}
}

# Failure route for forked calls
failure_route[FAIL_FORK] { ...
# handle 2nd branch
if ( ($avp(prio) == 2) && ( isflagset(FLT_USRPREF) )) {
t_on_failure("FAIL_FORK");

if ($avp(prio2) =~ "^sip:00") $ru = $avp(prio2) +
"@host"; # tel number
else {
$ru = $avp(prio2); # sip uri
route(LOCATION);
}
*setflag(FLT_ACCMISSED); # [5]*
}
# 3rd branch is voicemail
else {
$ru = $(avp(uuid));
rewritehostport("host:port");
append_hf("P-App-Name: voicemail\r\n");
append_hf("P-App-Param:
Email-Address=$avp(email)\r\n");
}
route(RELAY);

if (t_is_canceled()) {
exit;
}
}

With code above I'm testing following scenarios, where o...@abc.hr calls
p...@abc.hr. Due to p...@abc.hr settings and priorities set, 1st branch is
PSTN number, 2nd branch is sip:p...@abc.hr and 3rd branch is voicemail:
1. pero doesn't answer 1st branch and 2nd branch, voicemail activates. There
are no logs in missed_calls. I want to have a single log in missed_calls for
this case.
2. pero doesn't answer 1st branch, declines call at 2nd branch (486 Busy),
voicemail activates. There are no logs in missed_calls. I want to have a
single log in missed_calls for this case.
3. pero doesn't answer 1st branch, 2nd branch rings, oz cancels call,
voicemail doesn't activate. There is a single log in missed_calls (487).
This is ok, as expected.
4. 1st branch rings, oz cancels call. There is a single log in missed_calls
(487). This is also ok.
Logs in acc table exist and are good for all 4 cases - all of them are
related to established call to voicemail server.

Previously, I've tested several variations of config file above:

Variation 1: remove [1], [2] and [3]. (look for bolded lines above). In this
variation, only [5] is related to acc flags and is set in failure route.
When testing 4 scenarios above, there are no logs in acc and acc

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-26 Thread Daniel-Constantin Mierla

Hello,

the mail is quite long and has lot of inner references that makes it not 
that easy to follow, better focus only on what is wrong.


I see lot of OKs, but I don't get it if you tried with v3.2.0. If still 
does not work, send the debug messages.


You can always use acc_db_request(...) just to record a missed call 
whenever you want, but the other way with flags should work as well, 
after latest enhancement, maybe it needs some tuning if not there yet. 
Previously there was no callback to tm registered for failure event if 
the missed call flag was not set in main route block.


Cheers,
Daniel

On 9/26/11 3:17 PM, Ozren Lapcevic wrote:

Hi,

sorry if I haven't been clear in the last mail(s). I'll try to recap.

I have a call with 3 branches that are serially forked. branch 1 and 2 
can be PSTN number or SIP URI. branch 3 is voicemail. I do not want to 
account 1st branch if call is missed, only the 2nd one.


Here are the snippets from the configuration file that I'm using since 
I've started this thread. I've bolded parts where acc related flags 
are set.


route { 
route(WITHINDLG);   

if ( is_method("INVITE") ) { ...
*setflag(FLT_ACC);   # [1]*
#check for user defined forking priorities and timers
route(FORK);
}
route(LOCATION);
route(RELAY);
}

#check for user defined forking priorities and timers
route[FORK]{  ...
# user has multiple contacts, do serial forking
setflag(FLT_USRPREF);  
# overwrite request URI with highest priority contact
if ($avp(prio1) =~ "^sip:00") $ru = $avp(prio1) + "@host";
else $ru = $avp(prio1);  
}

route[RELAY] {
if (is_method("INVITE")) {
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");

#if users have priorities set, use FAIL_FORK failure route
if ( isflagset(FLT_USRPREF) ) t_on_failure("FAIL_FORK");
}
if (!t_relay()) sl_reply_error();
exit;
}

# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {
*setflag(FLT_ACC);* *# [2]*
*setflag(FLT_ACCFAILED);* *# [3]*
}
route(RELAY);
}  } }

# USER location service
route[LOCATION] {
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);* *# [4] - not used in serial forking scenario
*}
}

# Failure route for forked calls
failure_route[FAIL_FORK] { ...
# handle 2nd branch
if ( ($avp(prio) == 2) && ( isflagset(FLT_USRPREF) )) {
t_on_failure("FAIL_FORK");

if ($avp(prio2) =~ "^sip:00") $ru = 
$avp(prio2) + "@host"; # tel number

else {
$ru = $avp(prio2); # sip uri
route(LOCATION);
}
*setflag(FLT_ACCMISSED); # [5]*
}
# 3rd branch is voicemail
else {
$ru = $(avp(uuid));
rewritehostport("host:port");
append_hf("P-App-Name: voicemail\r\n");
append_hf("P-App-Param: 
Email-Address=$avp(email)\r\n");

}
route(RELAY);

if (t_is_canceled()) {
exit;
}
}

With code above I'm testing following scenarios, where o...@abc.hr 
 calls p...@abc.hr . Due to 
p...@abc.hr  settings and priorities set, 1st 
branch is PSTN number, 2nd branch is sip:p...@abc.hr 
 and 3rd branch is voicemail:
1. pero doesn't answer 1st branch and 2nd branch, voicemail activates. 
There are no logs in missed_calls. I want to have a single log in 
missed_calls for this case.
2. pero doesn't answer 1st branch, declines call at 2nd branch (486 
Busy), voicemail activates. There are no logs in missed_calls. I want 
to have a single log in missed_calls for this case.
3. pero doesn't answer

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-27 Thread Ozren Lapcevic
Just tested with v3.2 and acc_prepare_flag and accounting works fine now!

Thanks,
Ozren


On Tue, Sep 27, 2011 at 8:21 AM, Daniel-Constantin Mierla  wrote:

>  Hello,
>
> the mail is quite long and has lot of inner references that makes it not
> that easy to follow, better focus only on what is wrong.
>
> I see lot of OKs, but I don't get it if you tried with v3.2.0. If still
> does not work, send the debug messages.
>
> You can always use acc_db_request(...) just to record a missed call
> whenever you want, but the other way with flags should work as well, after
> latest enhancement, maybe it needs some tuning if not there yet. Previously
> there was no callback to tm registered for failure event if the missed call
> flag was not set in main route block.
>
> Cheers,
> Daniel
>
>
> On 9/26/11 3:17 PM, Ozren Lapcevic wrote:
>
> Hi,
>
> sorry if I haven't been clear in the last mail(s). I'll try to recap.
>
> I have a call with 3 branches that are serially forked. branch 1 and 2 can
> be PSTN number or SIP URI. branch 3 is voicemail. I do not want to account
> 1st branch if call is missed, only the 2nd one.
>
> Here are the snippets from the configuration file that I'm using since I've
> started this thread. I've bolded parts where acc related flags are set.
>
> route { 
> route(WITHINDLG);   
>
> if ( is_method("INVITE") ) { ...
> *setflag(FLT_ACC);   # [1]*
> #check for user defined forking priorities and timers
> route(FORK);
> }
> route(LOCATION);
> route(RELAY);
> }
>
> #check for user defined forking priorities and timers
> route[FORK]{  ...
> # user has multiple contacts, do serial forking
> setflag(FLT_USRPREF);  
> # overwrite request URI with highest priority contact
> if ($avp(prio1) =~ "^sip:00") $ru = $avp(prio1) + "@host";
> else $ru = $avp(prio1);  
> }
>
> route[RELAY] {
> if (is_method("INVITE")) {
> t_on_reply("REPLY_ONE");
> t_on_failure("FAIL_ONE");
>
> #if users have priorities set, use FAIL_FORK failure route
> if ( isflagset(FLT_USRPREF) ) t_on_failure("FAIL_FORK");
> }
> if (!t_relay()) sl_reply_error();
> exit;
> }
>
> # Handle requests within SIP dialogs
> route[WITHINDLG] {
> if (has_totag()) {
> if (loose_route()) {
> if (is_method("BYE")) {
> *setflag(FLT_ACC);* *# [2]*
> *setflag(FLT_ACCFAILED);* *# [3]*
> }
> route(RELAY);
> }  } }
>
> # USER location service
> route[LOCATION] {
> 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);* *# [4] - not used in serial
> forking scenario
> *}
> }
>
> # Failure route for forked calls
> failure_route[FAIL_FORK] { ...
> # handle 2nd branch
> if ( ($avp(prio) == 2) && ( isflagset(FLT_USRPREF) )) {
> t_on_failure("FAIL_FORK");
>
> if ($avp(prio2) =~ "^sip:00") $ru = $avp(prio2) +
> "@host"; # tel number
> else {
> $ru = $avp(prio2); # sip uri
> route(LOCATION);
> }
> *setflag(FLT_ACCMISSED); # [5]*
> }
> # 3rd branch is voicemail
> else {
> $ru = $(avp(uuid));
> rewritehostport("host:port");
> append_hf("P-App-Name: voicemail\r\n");
> append_hf("P-App-Param:
> Email-Address=$avp(email)\r\n");
> }
> route(RELAY);
>
> if (t_is_canceled()) {
> exit;
> }
> }
>
> With code above I'm testing following scenarios, where o...@abc.hr calls
> p...@abc.hr. Due to p...@abc.hr settings and priorities set, 1st branch is
> PSTN number, 2nd branch is sip:p...@abc.hr and

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-27 Thread Daniel-Constantin Mierla

Hello,

On 9/27/11 12:32 PM, Ozren Lapcevic wrote:

Just tested with v3.2 and acc_prepare_flag and accounting works fine now!

great, thanks for reporting back.

Not sure if this should be backported to 3.1 branch, thinking of how it 
was so far designed the acc -- I am actually not that much convinced for 
backporting since more or less similar functionality can be done using 
acc_db_request(...) in failure_route and version 3.2 is on the corner, 
but also this backport would introduce a new parameter to acc module ... 
I will give more thought until the next minor release to 3.1 branch.


Cheers,
Daniel


Thanks,
Ozren


On Tue, Sep 27, 2011 at 8:21 AM, Daniel-Constantin Mierla 
mailto:mico...@gmail.com>> wrote:


Hello,

the mail is quite long and has lot of inner references that makes
it not that easy to follow, better focus only on what is wrong.

I see lot of OKs, but I don't get it if you tried with v3.2.0. If
still does not work, send the debug messages.

You can always use acc_db_request(...) just to record a missed
call whenever you want, but the other way with flags should work
as well, after latest enhancement, maybe it needs some tuning if
not there yet. Previously there was no callback to tm registered
for failure event if the missed call flag was not set in main
route block.

Cheers,
Daniel


On 9/26/11 3:17 PM, Ozren Lapcevic wrote:

Hi,

sorry if I haven't been clear in the last mail(s). I'll try to
recap.

I have a call with 3 branches that are serially forked. branch 1
and 2 can be PSTN number or SIP URI. branch 3 is voicemail. I do
not want to account 1st branch if call is missed, only the 2nd one.

Here are the snippets from the configuration file that I'm using
since I've started this thread. I've bolded parts where acc
related flags are set.

route { 
route(WITHINDLG);   

if ( is_method("INVITE") ) { ...
*setflag(FLT_ACC);   # [1]*
#check for user defined forking priorities and timers
route(FORK);
}
route(LOCATION);
route(RELAY);
}

#check for user defined forking priorities and timers
route[FORK]{  ...
# user has multiple contacts, do serial forking
setflag(FLT_USRPREF);  
# overwrite request URI with highest priority contact
if ($avp(prio1) =~ "^sip:00") $ru = $avp(prio1) +
"@host";
else $ru = $avp(prio1);  
}

route[RELAY] {
if (is_method("INVITE")) {
t_on_reply("REPLY_ONE");
t_on_failure("FAIL_ONE");

#if users have priorities set, use FAIL_FORK
failure route
if ( isflagset(FLT_USRPREF) )
t_on_failure("FAIL_FORK");
}
if (!t_relay()) sl_reply_error();
exit;
}

# Handle requests within SIP dialogs
route[WITHINDLG] {
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {
*setflag(FLT_ACC);* *# [2]*
*setflag(FLT_ACCFAILED);* *# [3]*
}
route(RELAY);
}  } }

# USER location service
route[LOCATION] {
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);* *# [4] - not used in serial forking
scenario
*}
}

# Failure route for forked calls
failure_route[FAIL_FORK] { ...
# handle 2nd branch
if ( ($avp(prio) == 2) && (
isflagset(FLT_USRPREF) )) {
t_on_failure("FAIL_FORK");

if ($avp(prio2) =~ "^sip:00") $ru =
$avp(prio2) + "@host"; # tel number
else {
$ru = $avp(prio2); # sip uri
route(LOCATION);
}
*setflag(FLT_ACCMISSED); # [5]*
}
  

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-06 Thread Daniel-Constantin Mierla

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:


http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05

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: o...@abc.hr  and 
p...@abc.hr . p...@abc.hr  
also has set telephone number as alternative number if he is not 
reachable at sip:p...@abc.hr . Moreover, 
p...@abc.hr  has voicemail turned on. When 
o...@abc.hr  calls p...@abc.hr , 
first p...@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. o...@abc.hr  calls p...@abc.hr 
, there are no answers and call is forked to 
voicemail.
2. o...@abc.hr  calls p...@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.

Cheers
Ozren


# - acc params -
/* what special events should be accounted ? */
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 0)
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
modparam("acc", 
"log_extra","src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")

/* enhanced DB accounting */
#!ifdef WITH_ACCDB
modparam("acc", "db_flag", FLT_ACC)
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
modparam("acc", "db_url", DBURL)
modparam("acc", "db_extra", 
"src_user=$fU;src_domain=$fd;dst_user=$tU;dst_domain=$td;src_ip=$si")

#!endif

...


# 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

# h

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-07 Thread Ozren Lapcevic
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?

Cheers
Ozren


On Tue, Sep 6, 2011 at 2:18 PM, Daniel-Constantin Mierla
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:
>
>
> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05
>
> 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: o...@abc.hr and p...@abc.hr. p...@abc.hr also
> has set telephone number as alternative number if he is not reachable at
> sip:p...@abc.hr. Moreover, p...@abc.hr has voicemail turned on. When
> o...@abc.hr calls p...@abc.hr, first p...@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. o...@abc.hr calls p...@abc.hr, there are no answers and call is forked to
> voicemail.
> 2. o...@abc.hr calls p...@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.
>
> Cheers
> Ozren
>
>
> # - acc params -
> /* what special events should be accounted ? */
> modparam("acc", "early_media", 0)
> modparam("acc", "report_ack", 1)
> modparam("acc", "report_cancels", 0)
> modparam("acc", "detect_direction", 0)
> /* account triggers (flags) */
> modparam("acc", "log_flag", FLT_ACC)
> modparam("acc", "log_missed_flag", FLT_ACCMISSED)
> modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
> modparam("acc",
> "log_extra","src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
> /* enhanced DB accounting */
> #!ifdef WITH_ACCDB
> modparam("acc", "db_flag", FLT_ACC)
> modparam("acc", "db_missed_flag", FLT_ACCMISSED)
> modparam("acc", "db_url", DBURL)
> modparam("acc", "db_extra",
> "src_user=$fU;src_domain=$fd;dst_user=$tU;dst_domain=$td;src_ip=$si")
> #!endif
>
> ...
>
>
> # 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
> route

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-08 Thread Ozren Lapcevic
Hi,

I've previously installed kamailio from git branch 3.1. Now, I've manged to
git cherry-pick your patch, but got "fatal: Could not find
83620cb7cd14ee3b509eef72d99337567f53967f" when tried to get t_flush_flags().
I've double-checked commit and found it here:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commit;h=83620cb7cd14ee3b509eef72d99337567f53967f.
I don't know why I can't cherry-pick it.

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
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:
>
> git pull origin
> git cherry-pick -x  83620cb7cd14ee3b509eef72d99337567f53967f
> git cherry-pick -x  c589ca35b2aa3097a3c9e2a5a050514337300c05
>
> then recompile/install. First cherry-pick brings the t_flush_flags, the
> second auto-update of the flags after branch/failure route.
>
> If you installed from packages, then you would need to repackage yourself
> after patching. The patches are available at commit url, for example:
>
>
>
> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05
>
> 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 <
> mico...@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:
>>
>>
>> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05
>>
>> 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: o...@abc.hr and p...@abc.hr. pero@abc.hralso 
>> has set telephone number as alternative number if he is not reachable
>> at sip:p...@abc.hr. Moreover, p...@abc.hr has voicemail turned on. When
>> o...@abc.hr calls p...@abc.hr, first p...@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. o...@abc.hr calls p...@abc.hr, there are no answers and call is forked
>> to voicemail.
>> 2. o...@abc.hr calls p...@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'

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-12 Thread Ozren Lapcevic
Hi,

now I'm using t_flush_flags() after setting the accounting flag in
falure_route and latest updates (I have a new 3.1 clone without depth
parameter and I've made sure your changes are in sources), but it doesn't
solve the case, accounting behavior is still exactly the same as described
in the first mail.

If it is of any help, previously I've tested the same scenario where I was
setting the accounting flag in RELAY and LOCATION routes which were called
from failure route.

Cheers
Ozren

On Mon, Sep 12, 2011 at 9:19 AM, Daniel-Constantin Mierla  wrote:

>  Hello,
>
> over the weekend I backported the implementation of t_flush_flags() as well
> as auto-update of transaction flags after branch/failure route. Just pull
> the latest branch 3.1 and you are ready to compile/install.
>
> Let us know if it solves the case.
>
> Cheers,
> Daniel
>
>
> On 9/9/11 2:40 PM, Daniel-Constantin Mierla wrote:
>
> Hello,
>
> when you pulled the GIT branch 3.1, did you use --depth 1, like next?
>
>   git clone --depth 1 git://git.sip-router.org/sip-router kamailio
>
> 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.
>
> Cheers,
> Daniel
>
>
> On 9/7/11 2:20 PM, Ozren Lapcevic wrote:
>
> Hi,
>
> I've previously installed kamailio from git branch 3.1. Now, I've manged to
> git cherry-pick your patch, but got "fatal: Could not find
> 83620cb7cd14ee3b509eef72d99337567f53967f" when tried to get t_flush_flags().
> I've double-checked commit and found it here:
> http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commit;h=83620cb7cd14ee3b509eef72d99337567f53967f.
> I don't know why I can't cherry-pick it.
>
> 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 <
> mico...@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:
>>
>> git pull origin
>> git cherry-pick -x  83620cb7cd14ee3b509eef72d99337567f53967f
>> git cherry-pick -x  c589ca35b2aa3097a3c9e2a5a050514337300c05
>>
>> then recompile/install. First cherry-pick brings the t_flush_flags, the
>> second auto-update of the flags after branch/failure route.
>>
>> If you installed from packages, then you would need to repackage yourself
>> after patching. The patches are available at commit url, for example:
>>
>>
>>
>> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05
>>
>>  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 <
>> mico...@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:
>>>
>>>
>>> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05
>>>
>>> Actually, reporting if all goes fine with this patch, will help in
>>> backporting it to 3.1 branch.
>>>
>>> Thanks,
>>> Daniel
>>>
>>
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-12 Thread Daniel-Constantin Mierla

Hello,

On 9/12/11 12:04 PM, Ozren Lapcevic wrote:

Hi,

now I'm using t_flush_flags() after setting the accounting flag in 
falure_route and latest updates (I have a new 3.1 clone without depth 
parameter and I've made sure your changes are in sources), but it 
doesn't solve the case, accounting behavior is still exactly the same 
as described in the first mail.


If it is of any help, previously I've tested the same scenario where I 
was setting the accounting flag in RELAY and LOCATION routes which 
were called from failure route.


can you send the debug messages for such a call (use debug=4 in your 
config)? Also, set a tm onreply_route[x] for such invite where to print 
with xlog the value of the flags ($mF).


Cheers,
Daniel



Cheers
Ozren

On Mon, Sep 12, 2011 at 9:19 AM, Daniel-Constantin Mierla 
mailto:mico...@gmail.com>> wrote:


Hello,

over the weekend I backported the implementation of
t_flush_flags() as well as auto-update of transaction flags after
branch/failure route. Just pull the latest branch 3.1 and you are
ready to compile/install.

Let us know if it solves the case.

Cheers,
Daniel


On 9/9/11 2:40 PM, Daniel-Constantin Mierla wrote:

Hello,

when you pulled the GIT branch 3.1, did you use --depth 1, like next?

  git clone --depth 1 git://git.sip-router.org/sip-router
 kamailio

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.

Cheers,
Daniel


On 9/7/11 2:20 PM, Ozren Lapcevic wrote:

Hi,

I've previously installed kamailio from git branch 3.1. Now,
I've manged to git cherry-pick your patch, but got "fatal: Could
not find 83620cb7cd14ee3b509eef72d99337567f53967f" when tried to
get t_flush_flags(). I've double-checked commit and found it
here:

http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commit;h=83620cb7cd14ee3b509eef72d99337567f53967f.
I don't know why I can't cherry-pick it.

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
mailto:mico...@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:

git pull origin
git cherry-pick -x  83620cb7cd14ee3b509eef72d99337567f53967f
git cherry-pick -x  c589ca35b2aa3097a3c9e2a5a050514337300c05

then recompile/install. First cherry-pick brings the
t_flush_flags, the second auto-update of the flags after
branch/failure route.

If you installed from packages, then you would need to
repackage yourself after patching. The patches are available
at commit url, for example:



http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05

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
mailto:mico...@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:


http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c589ca35b2aa3097a3c9e2a5a050514337300c05

Actually, reporting if all goes fine with this patch,
will help in backporting it to 3.1 branch.

Thanks,
Daniel





___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://l

Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-12 Thread Daniel-Constantin Mierla

Hello,

just to be sure, you used flag 2 for missed calls, right? I can see it 
set in onreply_route.


That means the flags are ok now, the issue seems to be in other place. 
You don't set any of the accounting flags in request route block, isn't 
it? I mean, the first accounting flag (like accounting answered calls or 
missed calls) is set in failure route. If so, the acc does not register 
itself for a tm callback that is used for handling accounting events.


Try to set acc flag for writing to syslog in route {...}, you can reset 
it in failure route or onreply_route. Of course, this as an workaround 
for now, I will look for a proper solution in case this is the problem.


Cheers,
Daniel

On 9/12/11 3:29 PM, Ozren Lapcevic wrote:


I have attached log file. I have single onreply_route[REPLY_ONE] used 
for all replies. Grep "REPLY_ONE, FLAGS" to find where the flags are 
printed. Grep "FAIL FORK" for logs from failure route.


Let me know if you need anything else.

Cheers
Ozren


--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-13 Thread Ozren Lapcevic
Hi,

On Tue, Sep 13, 2011 at 8:46 AM, Daniel-Constantin Mierla  wrote:

> Hello,
>
> just to be sure, you used flag 2 for missed calls, right? I can see it set
> in onreply_route.
>


Yes, I've used #!define FLT_ACCMISSED 2 and setflag(FLT_ACCMISSED) for
missed calls. I checked the flag in onreply_route and failure route and they
are properly set.



> That means the flags are ok now, the issue seems to be in other place. You
> don't set any of the accounting flags in request route block, isn't it? I
> mean, the first accounting flag (like accounting answered calls or missed
> calls) is set in failure route. If so, the acc does not register itself for
> a tm callback that is used for handling accounting events.
>


Actually, I do set other accounting flags in following routes:

#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3

#MAIN ROUTE

if (is_method("INVITE")) setflag(FLT_ACC);

route[WITHINDLG] {
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {

setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if the
transaction fails
}
 .

route[LOCATION] {
# only for people who don't have multiple contacts (no serial
forking, not used in reported scenario)

if ( is_method("INVITE") && !(isflagset(FLT_USRPREF)))
setflag(FLT_ACCMISSED);
}

#called only for serial forked calls
failure_route[FAIL_FORK] {
   .
   # if second branch set flag
setflag(FLT_ACCMISSED);
t_flush_flags();
  
  # if 3rd branch (voicemail) reset flag
resetflag(FLT_ACCMISSED);
t_flush_flags();
  
}


Now that you've mentioned it, I've removed all other setflag() functions and
kept only the ones in FAIL_FORK failure route. There is still no logging of
the second branch.



> Try to set acc flag for writing to syslog in route {...}, you can reset it
> in failure route or onreply_route. Of course, this as an workaround for now,
> I will look for a proper solution in case this is the problem.
>


I'm not sure I can implement needed logic this way. I don't want to account
1st branch. If I set FLT_ACCMISSED flag in route {...} and reset it in
on_reply and failure route, it will be too late, the missed call will
already be accounted. Or, I'm missing something?

Cheers
Ozren


On 9/12/11 3:29 PM, Ozren Lapcevic wrote:
>
>>
>> I have attached log file. I have single onreply_route[REPLY_ONE] used for
>> all replies. Grep "REPLY_ONE, FLAGS" to find where the flags are printed.
>> Grep "FAIL FORK" for logs from failure route.
>>
>> Let me know if you need anything else.
>>
>> Cheers
>> Ozren
>>
>
> --
> Daniel-Constantin Mierla -- http://www.asipto.com
> Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>
>
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Accounting only the 2nd branch of missed serial forked call

2011-09-13 Thread Daniel-Constantin Mierla

Hello,

On 9/13/11 11:21 AM, Ozren Lapcevic wrote:

Hi,

On Tue, Sep 13, 2011 at 8:46 AM, Daniel-Constantin Mierla 
mailto:mico...@gmail.com>> wrote:


Hello,

just to be sure, you used flag 2 for missed calls, right? I can
see it set in onreply_route.



Yes, I've used #!define FLT_ACCMISSED 2 and setflag(FLT_ACCMISSED) for 
missed calls. I checked the flag in onreply_route and failure route 
and they are properly set.


That means the flags are ok now, the issue seems to be in other
place. You don't set any of the accounting flags in request route
block, isn't it? I mean, the first accounting flag (like
accounting answered calls or missed calls) is set in failure
route. If so, the acc does not register itself for a tm callback
that is used for handling accounting events.



Actually, I do set other accounting flags in following routes:

#!define FLT_ACC 1
#!define FLT_ACCMISSED 2
#!define FLT_ACCFAILED 3

#MAIN ROUTE

if (is_method("INVITE")) setflag(FLT_ACC);

route[WITHINDLG] {
if (has_totag()) {
if (loose_route()) {
if (is_method("BYE")) {

setflag(FLT_ACC); # do accounting ...
setflag(FLT_ACCFAILED); # ... even if 
the transaction fails

}
 .

route[LOCATION] {
# only for people who don't have multiple contacts (no serial 
forking, not used in reported scenario)


if ( is_method("INVITE") && !(isflagset(FLT_USRPREF))) 
setflag(FLT_ACCMISSED);

}

#called only for serial forked calls
failure_route[FAIL_FORK] {
   .
   # if second branch set flag
setflag(FLT_ACCMISSED);
t_flush_flags();
  
  # if 3rd branch (voicemail) reset flag
resetflag(FLT_ACCMISSED);
t_flush_flags();
  
}


Now that you've mentioned it, I've removed all other setflag() 
functions and kept only the ones in FAIL_FORK failure route. There is 
still no logging of the second branch.


Try to set acc flag for writing to syslog in route {...}, you can
reset it in failure route or onreply_route. Of course, this as an
workaround for now, I will look for a proper solution in case this
is the problem.



I'm not sure I can implement needed logic this way. I don't want to 
account 1st branch. If I set FLT_ACCMISSED flag in route {...} and 
reset it in on_reply and failure route, it will be too late, the 
missed call will already be accounted. Or, I'm missing something?


It meant setting FLT_ACC (not FLT_ACCMISSED) in main route and reset it 
on onreply_route in case you didn't want to account successful 
transactions at all. But I see you actually set the acc flag in route 
block ... probably I have to dig further in the logs for more details. 
So far it looked like an issue if no acc module flags were set in 
request route block.


Cheers,
Daniel

--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users