0

我非常缺乏在 Postgres 中使用 json 的经验,这使得获取我需要的数据变得非常困难。使用下面的查询,我可以看到这callflow给了我通话每个部分的时间。我可以得到比 0 更大的times地方吗?理想情况下,我只需要在每行之间和每行hangup_time之间以秒为单位的时间。created_timehangup_time

select
    xml_cdr_uuid,
    json->'callflow'
from fusionpbx.public.v_xml_cdr
where start_stamp > now() - '1 day'::interval;

这给了我每行这样的时间数组。

[
    {
        "times":
        {
            "hangup_time": "1588604603083829",
            "bridged_time": "1588604592603811",
            "created_time": "1588604575783849",
            "answered_time": "1588604575803817",
            "progress_time": "1588604575803817",
            "transfer_time": "0",
            "last_hold_time": "0",
            "resurrect_time": "0",
            "hold_accum_time": "0",
            "progress_media_time": "0",
            "profile_created_time": "1588604582343873"
        },
        "extension": {...},
        "@attributes": {...},
        "caller_profile": {...},
    },
    {
        "times":
        {
            "hangup_time": "0",
            "bridged_time": "0",
            "created_time": "1588604575783849",
            "answered_time": "1588604575803817",
            "progress_time": "1588604575803817",
            "transfer_time": "1588604582343873",
            "last_hold_time": "0",
            "resurrect_time": "0",
            "hold_accum_time": "0",
            "progress_media_time": "0",
            "profile_created_time": "1588604575783849"
        },
        "extension": {...},
        "@attributes": {...},
        "caller_profile": {...},
    },
    {
        "times":
        {
            "hangup_time": "0",
            "bridged_time": "0",
            "created_time": "1588604575783849",
            "answered_time": "0",
            "progress_time": "0",
            "transfer_time": "1588604575783849",
            "last_hold_time": "0",
            "resurrect_time": "0",
            "hold_accum_time": "0",
            "progress_media_time": "0",
            "profile_created_time": "1588604575783849"
        },
        "extension": {...},
        "@attributes": {...},
        "caller_profile": {...},
    }
]
4

0 回答 0