I think you need to read about sipcapture module<br>Also you can manage to install homer server which is very important in any sip enviroment<br><br>Regards<br><br><div class="quote" style="line-height: 1.5"><br><br>-------- Original Message --------<br>Subject: [SR-Users] ways to track all messages of a dialog<br>From: Fabian Borot <fborot@hotmail.com><br>To: sr-users@lists.kamailio.org<br>CC: <br><br><br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need to track all messages (SIP Requests, SIP Responses) for some SIP dialogs. Let's say I need to log something specific on each state for calls initiated from a certain IP (initial request, temporary replies, rejection with a negative response, call was accepted with 200, termination with BYE, termination with CANCEL  etc. ).<br>I am thinking on using flags but I am not sure after reading the tutorial  on flags (http://www.kamailio.org/dokuwiki/doku.php/tutorials:openser-flag-operations) if that is going to work properly. The doc says: "They provide a very easy and fast way of keeping states during processing a request or during a transaction". I am afraid that the ACK if the call is accepted and the BYE won't be tracked properly because they are not part of the initial transaction. Also the doc does not mention if the flag is preserved among branches spawned during the processing of the call.<br><br>The idea is for example: <br><br>request_route {<br>   if (is_method("INVITE")){<br>           if ($si == "192.168.168.100"){        #condition that would set the flag, INVITE came from "my_IP"<br>                        #flag/mark dialog<br>                     setflag(1);<br>                   #log call from "my_IP" was received<br>         }<br>             route("INCOMING);<br>        }<br>     If(loose_route() ){<br>           if (is_method("ACK")){<br>                      if(isflagset(1)){<br>                             #log ACK related to "my_IP" was received<br>                    }<br>             }<br>             if (is_method("CANCEL")){<br>                   if(isflagset(1)){<br>                             #log CANCEL related to "my_IP" was received<br>                 }<br>             }<br>             if (is_method("BYE")){<br>                      if(isflagset(1)){<br>                             #log BYE related to "my_IP" was received<br>                    }<br>             }<br>     }<br>}<br><br>Then :<br><br>route["INCOMING"] {<br>       # do some processing<br>  # do some processing<br>  <br>      t_onreply("INCOMING");<br>      t_on_failure("INCOMING");     <br>      t_relay();<br>}<br><br>onreply_route[INCOMING] {<br>    #do some processing<br>   if(isflagset(1)){<br>             #log a reply related to "my_IP" was received<br>        }<br>}<br><br>failure_route[INCOMING] {<br>     #do some processing<br>   if(isflagset(1)){<br>             #log a negative reply related to "my_IP" was received<br>       }<br>}<br><br><br>Will the flags work on this case ?<br><br>My 2nd approach is to use a htable and use the call_id for my calls as the key. The on each route section (reply, failure_reply, ACK processing etc.) find the $ci on the htable and if it is there do the appropriate action. But I need to delete the key:value once the call ends or leave it autoexpire with a expire value bigger than the max_call_duration_time that we have in our system.<br><br><br><br><br>_______________________________________________<br>Kamailio (SER) - Users Mailing List<br>sr-users@lists.kamailio.org<br>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users<br></blockquote></div>