<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Thanks you!<br>
    </p>
    <div class="moz-cite-prefix">10.04.2019 10:28, Jan-Hendrik Dörner
      пишет:<br>
    </div>
    <blockquote type="cite"
      cite="mid:E097777E-F483-42AD-9599-26F5555F9BFE@doerner.net">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hello,
      <div class=""><br class="">
      </div>
      <div class="">i was working on a similar problem. I followed the
        acc-dialog -> (r)syslog approach.</div>
      <div class="">In rsyslog I piped the message to a script, which
        appends the message as a xml-record to a file in
        "/var/log/kamailio-call.log“.</div>
      <div class="">(This script might be useful for you to adapt to
        your needs.)</div>
      <div class="">
        <div style="margin: 0px; font-stretch: normal; font-size: 10px;
          line-height: normal; font-family: Monaco;" class=""><span
            style="font-variant-ligatures: no-common-ligatures" class=""><br
              class="">
          </span></div>
        <div style="margin: 0px; font-stretch: normal; font-size: 10px;
          line-height: normal; font-family: Monaco;" class=""><span
            style="font-variant-ligatures: no-common-ligatures" class="">module(load="omprog“)</span></div>
        <div style="margin: 0px; font-stretch: normal; font-size: 10px;
          line-height: normal; font-family: Monaco;" class=""><span
            style="font-variant-ligatures: no-common-ligatures" class="">local6.*
            action(type="omprog" binary="/etc/rsyslog-cdr-script.sh")</span></div>
      </div>
      <div class=""><br class="">
        <div>and my script looks like</div>
        <div><br class="">
        </div>
        <div>
          <div style="margin: 0px; font-stretch: normal; font-size:
            10px; line-height: normal; font-family: Monaco;" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">#! /bin/ash</span></div>
          <div style="margin: 0px; font-stretch: normal; font-size:
            10px; line-height: normal; font-family: Monaco;" class="">Log=/var/log/kamailio-call.log</div>
          <div style="margin: 0px; font-stretch: normal; font-size:
            10px; line-height: normal; font-family: Monaco;" class="">read
            fromstdin;</div>
          <div style="margin: 0px; font-stretch: normal; font-size:
            10px; line-height: normal; font-family: Monaco;" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">while read fromstdin; do</span></div>
          <div style="margin: 0px; font-stretch: normal; font-size:
            10px; line-height: normal; font-family: Monaco;" class=""> 
             echo $fromstdin | sed -e "s/^[^;]* \(.*=\)/\1/" -e
            "s/\(time=[0-9]*\)\.[0-9]*/\1/g" -e
            "s/\([^=;]*\)=\([^;]*\(;[^ ][^=]*=[^;]*\)*\); /
            <\1>\2<\/\1>; /g" -e "s/ \([^=;]*\)=\([^;]*\(;[^
            ][^=]*=[^;]*\)*\)$/ <\1>\2<\/\1>/" | awk 'BEGIN
            {FS=";"; printf "<call>"} { i = 1; while(i <
            NF){if(index($i,"time>")>0) { time_value = $i;
            gsub("<[^>]*>","",time_value); sub(">[^<]*",
            strftime(">%Y-%m-%dT%H:%M:%S", time_value), $i); } printf
            $i;  i = i+1;} } END {print "</call>"}' >> $Log</div>
          <div style="margin: 0px; font-stretch: normal; font-size:
            10px; line-height: normal; font-family: Monaco;" class=""><span
              style="font-variant-ligatures: no-common-ligatures"
              class="">done</span></div>
          <div class=""><span style="font-variant-ligatures:
              no-common-ligatures" class=""><br class="">
            </span></div>
        </div>
        <div>Here a little explanation that might be helpful to
          understand the commands:</div>
        <div>The sed-command </div>
        <div>*) removes the front syslog-stuff</div>
        <div>*) trunks all the post dot digit from any entry that names
          ends with „time" and </div>
        <div>*) converts it to xml-syntax (one extra for the last entry)</div>
        <div><br class="">
        </div>
        <div>The awk command converts the (trunked) timestamps into a
          "human-readable“ format and adds the enclosing „call“ syntax.</div>
        <div>(If you exactly know what your syslog entry syntax is, you
          might simplify the script statements a lot … )</div>
        <div><br class="">
        </div>
        <div>I hope this helps a little.</div>
        <div><br class="">
        </div>
        <div>Regards</div>
        <div>Jan-Hendrik</div>
        <div><br class="">
        </div>
        <div><br class="">
          <blockquote type="cite" class="">
            <div class="">Am 07.04.2019 um 12:42 schrieb Henning
              Westerholt <<a href="mailto:hw@skalatan.de" class=""
                moz-do-not-send="true">hw@skalatan.de</a>>:</div>
            <br class="Apple-interchange-newline">
            <div class="">
              <div class="">Hello,<br class="">
                <br class="">
                some starting points:<br class="">
                <br class="">
                - use dlg_manage() or set a dialog flag in the cfg to
                start dialog tracking<br class="">
                <br class="">
                - setup the dialog event routes (section 11 in README)
                and put your <br class="">
                logging logic there<br class="">
                <br class="">
                Best regards,<br class="">
                <br class="">
                Henning<br class="">
                <br class="">
                Am 06.04.19 um 11:29 schrieb Yu Boot:<br class="">
                <blockquote type="cite" class="">How to make something
                  on dialog event? Just can't figure it out after <br
                    class="">
                  reading module docs :(<br class="">
                  <br class="">
                  <br class="">
                  06.04.2019 2:09, David Villasmil пишет:<br class="">
                  <blockquote type="cite" class="">You can always export
                    the cdr table periodically.<br class="">
                    Take a look at siremis. And when the trigger fires
                    every 5 minutes to <br class="">
                    create the cdrs, just export them.<br class="">
                    <br class="">
                    <br class="">
                    Also, as it’s been said, you can use the dialog and
                    when the call <br class="">
                    ends gather all the info and just print it out. You
                    can direct it to <br class="">
                    rsyslog to save it anywhere you want.<br class="">
                    <br class="">
                  </blockquote>
                  <br class="">
                  _______________________________________________<br
                    class="">
                  Kamailio (SER) - Users Mailing List<br class="">
                  <a href="mailto:sr-users@lists.kamailio.org" class=""
                    moz-do-not-send="true">sr-users@lists.kamailio.org</a><br
                    class="">
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br class="">
                </blockquote>
                <br class="">
                -- <br class="">
                Henning Westerholt - <a
                  href="https://skalatan.de/blog/" class=""
                  moz-do-not-send="true">https://skalatan.de/blog/</a><br
                  class="">
                Kamailio services - <a
                  href="https://skalatan.de/services" class=""
                  moz-do-not-send="true">https://skalatan.de/services</a><br
                  class="">
                <br class="">
                _______________________________________________<br
                  class="">
                Kamailio (SER) - Users Mailing List<br class="">
                <a href="mailto:sr-users@lists.kamailio.org" class=""
                  moz-do-not-send="true">sr-users@lists.kamailio.org</a><br
                  class="">
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br class="">
              </div>
            </div>
          </blockquote>
        </div>
        <br class="">
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
  </body>
</html>