I am using Kamailio versions 5.5.7 and 5.8.0  as a stateful proxy (with tm module) and I want to have metrics for all
the SIP messages received and sent. I am using the statistics module for counting messages.
I have in configuration file the following routes to capture events and count them: onsend_route, onreply_route and event ( corex:reply-out, tn:local_response, sl:local-response, tm:local-request, sl:filtered-ack and network:msg)
I have found the following problems that I need some hints how to solve them:

1) When a response is received to a request, I can count the response received in the reply_route
but I don't find a way that works to count the reply being forwarded to the other side. onsend_route works fine
for requests being forwarded. Is there any event_route or any trick that can be used to count the reply being
forwarded similar to the onsend_route for requests?

2) When Kamailio receives a CANCEL it generates and sends automatically the 200 OK for the CANCEL
and a 487 for the INVITE which started that dialog which is being cancelled, but I don't find a way that works to count those two responses Kamailio generates.

3) After having cancelled a dialog on one direction due to receipt of a CANCEL, kamailio generates local requests on the other direction,
 a CANCEL and an ACK also when it receives a 487 for the INVITE being cancelled.
I don't find the way to count those.  onsend_route does not work for locally generated CANCEL and ACK requests and the event_route[tm:local-request] only works for
requests created outside of the tm module but not those created by the tm module itself (the CANCEL
and the ACKs) since the tm module is not using its own function t_uac_prepare to create those requests
(that function is the one that calls the event_route).  Is there any statistic generated by the tm
module or elsewhere or any other trick so I can count those requests?

4) When Kamailio generates retransmissions how can I count those? onsend_route, onreply_route and event ( corex:reply-out, tn:local_response, sl:local-response) doesn't work for retransmissions. Are there statistics generated somewhere in the tm module for retransmissions? Is there any other way to count those.



El contenido de este mensaje puede contener información confidencial sometida a secreto profesional. Si usted ha recibido este correo por error, no está permitida su distribución. Por favor elimine cualquier copia, archivo adjunto e infórmenos por esta vía.
Los datos personales contenidos en este correo y que han sido facilitados por usted o provienen de fuentes de acceso público serán utilizados por Future Space, S.A., para gestionar nuestra relación contractual o pre-contractual, resolver su solicitud y mantenerle informado sobre los productos o servicios solicitados o similares.
Se conservarán mientras exista un interés mutuo para ello, no se oponga al tratamiento o solicite su supresión. Los datos no serán comunicados a terceros, salvo obligación legal. Puede ejercitar sus derechos de acceso, rectificación, supresión, limitación del tratamiento, portabilidad de los datos y oposición mediante escrito dirigido a Future Space, S.A. Avenida de Tenerife 2, Edificio 2, Planta 1ª, 28703 San Sebastián de los Reyes, Madrid o mediante correo electrónico a dpo@futurespace.com. Si consideras que se han infringido tus derechos puedes presentar una reclamación ante la www.agpd.es.

The contents of this electronic mail may be confidential or privileged. If you have received this message by mistake, please do not send it to anyone. We ask you to delete any existing copies, attached files and to notify us accordingly.
The personal data provided or obtained from publicly accessible resources will be processed by Future Space, S.A. in order to manage our contractual or pre-contractual relationship, solve your request and keep you informed about activities or products requested by you or similar. Personal data will be stored while a mutual interest exist or either erasure or objection to process them is requested. Data will not be disclosed to third parties unless there is a legal obligation to do so. You have the rights to access, rectify, erasure, restriction of processing, data portability and oppose any processing of your personal data held by Future Space, S.A. To make effective use of your rights, please contact us at
Future Space, S.A. Avenida de Tenerife 2, Edificio 2, Planta 1ª, 28703 San Sebastián de los Reyes, Madrid or by email at dpo@futurespace.com. If you consider processing of your personal data infringes data protection regulations you can file a claim with www.agpd.es