Hi Sergey,

 

You probably looked already at the already existing json logging support in Kamailio, recently there was also common event expression syntax added: https://www.kamailio.org/wiki/cookbooks/devel/core#log_engine_cli_parameter

Maybe you can add some post-processing to format it in a way you would like to ingress it.

 

Regarding your requirements, the first two categories look more like accounting requests, have you looked into facility the accounting module for transactions and/or dialogs?

 

The last category is probably highly specific to the particular Kamailio configuration file. Maybe its easier to just use some script language json operations together with http_client or the like?

 

Of course, a module can be added if there is demand, for the transactions and dialogs one need to use the internal callbacks.

 

Cheers,

 

Henning

 

 

From: Sergey Safarov <s.safarov@gmail.com>
Sent: Sonntag, 9. Juli 2023 20:42
To: Kamailio (SER) - Devel Mailing List <sr-dev@lists.kamailio.org>
Subject: [sr-dev] Re: tracing, zipkin

 

Zipkin schema for JSON body can be found at

https://zipkin.io/zipkin-api/#/default/post_spans

Required to select "Model -> Span".

 

On Sun, Jul 9, 2023 at 8:59 PM Sergey Safarov <s.safarov@gmail.com> wrote:

When used different application servers like:

1) kamailio;

2) freeswitch;

3) crm

 

Required correlate logs and events between all daemons.

For such purposes can be used tracing (OpenTelementry, Zipkin).

 

An example for Envoy tracking can look like

POST /api/v2/spans HTTP/1.1

host: zipkin

content-type: application/json

x-envoy-internal: true

x-forwarded-for: 217.12.247.98

x-envoy-expected-rq-timeout-ms: 5000

transfer-encoding: chunked

 

2ad

[{"tags":{"upstream_cluster":"dynamic_forward_proxy_cluster","component":"proxy","response_flags":"DC","peer.address":"127.0.0.1","http.method":"CONNECT","http.protocol":"HTTP/1.1","downstream_cluster":"-","user_agent":"curl/7.85.0","request_size":"842","guid:x-request-id":"0456e862-4cf7-9ee2-b280-e6f59965a70d","upstream_cluster.name":"dynamic_forward_proxy_cluster","http.status_code":"200","response_size":"3750"},"name":"ifconfig.net:443","annotations":[{"timestamp":1688924085239932,"value":"ss"}],"kind":"SERVER","localEndpoint":{"port":0,"ipv4":"217.12.247.98"},"timestamp":1688924084352715,"shared":true,"traceId":"67480febdcdd48dc","duration":886997,"id":"67480febdcdd48dc"}]

0

 

HTTP/1.1 202 Accepted

content-length: 0

server: Armeria/1.17.2

date: Sun, 9 Jul 2023 17:34:47 GMT

 

 

where json body looks like

[
  {
    "tags": {
      "upstream_cluster": "dynamic_forward_proxy_cluster",
      "component": "proxy",
      "response_flags": "DC",
      "peer.address": "127.0.0.1",
      "http.method": "CONNECT",
      "http.protocol": "HTTP/1.1",
      "downstream_cluster": "-",
      "user_agent": "curl/7.85.0",
      "request_size": "842",
      "guid:x-request-id": "0456e862-4cf7-9ee2-b280-e6f59965a70d",
      "upstream_cluster.name": "dynamic_forward_proxy_cluster",
      "http.status_code": "200",
      "response_size": "3750"
    },
    "name": "ifconfig.net:443",
    "annotations": [
      {
        "timestamp": 1688924085239932,
        "value": "ss"
      }
    ],
    "kind": "SERVER",
    "localEndpoint": {
      "port": 0,
      "ipv4": "217.12.247.98"
    },
    "timestamp": 1688924084352715,
    "shared": true,
    "traceId": "67480febdcdd48dc",
    "duration": 886997,
    "id": "67480febdcdd48dc"
  }
]

 

I looking to create a task for the team developer to develop a module like "tracing_zipkin". This module should allow trace transactions and dialogs

  1. request and response timing;
  2. dialog start-stop events;
  3. business logic like call hold/unhold, media added//removed (video, text, message, audio), request multipart content raw or filtered.

 

I will appreciate it if you share your thoughts about how JSON POST should look.

 

Sergey Safarov