Freeswitch - 解析通话详细记录信息
我有 Freeswitch 服务器以 JSON 格式将 CDR 信息(仅一条腿)发送到 PHP 脚本,我需要在每种可能的情况下解析分机号和电话号码:
- 从 PSTN 到:用户、组、呼叫中心应用程序的来电(已应答、未应答)
- 用户向 PSTN 发出的呼叫(已应答、未应答)
每个场景必须在 JSON 中使用不同的变量 - 取决于是否桥接、是否传入(destination_number)、是否传出(caller_id_number) 等。
我使用 bridge_uuid 来检测呼叫是否已桥接,但仍然收到桥接 uuid 缺失且 last_app 为桥接的呼叫(状态为 ORIGINATOR_CANCEL)。
我整理了 7 个场景,但仍然有电话,电话号码由于某种原因出现在分机中,反之亦然。
有没有简单的方法可以从 CDR 获取这些信息?
场景1:
- 出站
- bridge_uuid = 存在
- 分机= callflow.0.caller_profile.caller_id_number
- number = callflow.0.caller_profile.destination_number
场景2:
- 出站
- bridge_uuid = 不存在
- 分机= callflow .0.caller_profile.destination_number
- 数字 = callflow.0.caller_profile.caller_id_number
场景3:
- 出站
- bridge_uuid = 不存在
- last_app = 网桥
- 分机= callflow.0.caller_profile.caller_id_number
- number = callflow.0.caller_profile.destination_number
场景4:
- 入站
- bridge_uuid = 存在
- cc_agent_bridged = 存在
- 扩展名 = callflow.0.caller_profile.originatee.originatee_caller_profiles.0.destination_number
- number = callflow.0.caller_profile.caller_id_number
场景 5:
- 入站
- bridge_uuid = 存在
- cc_agent_bridged = 不存在
- 扩展名 = callflow.0.caller_profile.caller_id_number
- number = callflow.0.caller_profile.destination_number
场景6:
- 入站
- bridge_uuid =不存在
- 扩展= NULL
- number = callflow.0.caller_profile.caller_id_number
场景7:
- 入站
- bridge_uuid =存在
- cc_agent_bridged =不存在
- 扩展=???
- 数量 = ???
JSON CDR
'core-uuid' => 'bf6eef3c-16b7-4f61-8cc2-1cd73460268e',
'switchname' => 'freeswitch',
'channel_data' =>
array (
'state' => 'CS_REPORTING',
'direction' => 'outbound',
'state_number' => '11',
'flags' => '0=1;2=1;22=1;40=1;42=1;45=1;116=1;117=1',
'caps' => '1=1;2=1;3=1;4=1;5=1;6=1;8=1;9=1;10=1',
),
'callStats' =>
array (
),
'variables' =>
array (
'direction' => 'outbound',
'is_outbound' => 'true',
'uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'call_uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'session_id' => '4755',
'sip_profile_name' => 'homeoffice',
'video_media_flow' => 'disabled',
'text_media_flow' => 'disabled',
'channel_name' => 'sofia/homeoffice/4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_destination_url' => 'sip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1%3Bfs_nat%3Dyes%3Bfs_path%3Dsip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'origination_caller_id_name' => 'Name%20Surname',
'origination_caller_id_number' => '1829XXXXXXX',
'EXT_ID' => '163748',
'USER_ID' => '793',
'ID_TYPE' => 'application',
'callgroup' => 'local',
'dialed_user' => '4012',
'dialed_domain' => 'pbx.domain.com',
'sip_invite_domain' => 'pbx.domain.com',
'presence_id' => '4012%40pbx.domain.com',
'originate_early_media' => 'true',
'rtp_use_codec_string' => 'OPUS,G729,PCMU,PCMA,GSM',
'local_media_ip' => 'XXX.XXX.XXX.XXX',
'local_media_port' => '17432',
'advertised_media_ip' => 'XXX.XXX.XXX.XXX',
'audio_media_flow' => 'sendrecv',
'rtp_local_sdp_str' => 'v%3D0%0D%0Ao%3DFreeSWITCH%201646156158%201646156159%20IN%20IP4%20XXX.XXX.XXX.XXX%0D%0As%3DFreeSWITCH%0D%0Ac%3DIN%20IP4%20XXX.XXX.XXX.XXX%0D%0At%3D0%200%0D%0Am%3Daudio%2017432%20RTP/AVP%20102%2018%200%208%203%20103%20101%0D%0Aa%3Drtpmap%3A102%20opus/48000/2%0D%0Aa%3Dfmtp%3A102%20useinbandf
ec%3D1%3B%20maxaveragebitrate%3D30000%3B%20maxplaybackrate%3D48000%3B%20ptime%3D20%3B%20minptime%3D10%3B%20maxptime%3D40%0D%0Aa%3Drtpmap%3A18%20G729/8000%0D%0Aa%3Dfmtp%3A18%20annexb%3Dno%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A8%20PCMA/8000%0D%0Aa%3Drtpmap%3A3%20GSM/8000%0D%0Aa%3Drtpmap%3A103%20telephone-e
vent/48000%0D%0Aa%3Dfmtp%3A103%200-15%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dptime%3A20%0D%0Aa%3Dsendrecv%0D%0A',
'sip_outgoing_contact_uri' => '%3Csip%3Amod_sofia%40XXX.XXX.XXX.XXX%3A5090%3E',
'sip_req_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'sip_nat_detected' => 'true',
'sofia_profile_name' => 'office',
'recovery_profile_name' => 'office',
'sofia_profile_url' => 'sip%3Amod_sofia%40XXX.XXX.XXX.XXX%3A5090',
'sip_local_network_addr' => 'XXX.XXX.XXX.XXX',
'sip_reply_host' => 'XXX.XXX.XXX.XXX',
'sip_reply_port' => '56955',
'sip_network_ip' => 'XXX.XXX.XXX.XXX',
'sip_network_port' => '56955',
'sip_user_agent' => 'Z%205.5.9%20v2.10.17.3',
'sip_allow' => 'INVITE,%20ACK,%20CANCEL,%20BYE,%20NOTIFY,%20REFER,%20MESSAGE,%20OPTIONS,%20INFO,%20SUBSCRIBE',
'sip_recover_contact' => '%3Csip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3E',
'sip_full_via' => 'SIP/2.0/UDP%20XXX.XXX.XXX.XXX%3A5090%3Brport%3D5090%3Bbranch%3Dz9hG4bKS6tvm613tKgpg',
'sip_recover_via' => 'SIP/2.0/UDP%20XXX.XXX.XXX.XXX%3A5090%3Brport%3D5090%3Bbranch%3Dz9hG4bKS6tvm613tKgpg',
'sip_from_display' => 'Name%20Surname',
'sip_full_from' => '%22Name%20Surname%22%20%3Csip%3A1829XXXXXXX%40pbx.domain.com%3E%3Btag%3DDc8U2HQFrDQ4D',
'sip_full_to' => '%3Csip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1%3E%3Btag%3De4ab0722',
'sip_from_user' => '1829XXXXXXX',
'sip_from_uri' => '1829XXXXXXX%40pbx.domain.com',
'sip_from_host' => 'pbx.domain.com',
'sip_to_params' => 'transport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'sip_to_user' => '4012',
'sip_to_port' => '56955',
'sip_to_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_to_host' => 'XXX.XXX.XXX.XXX',
'sip_contact_params' => 'transport%3DUDP',
'sip_contact_user' => '4012',
'sip_contact_port' => '56955',
'sip_contact_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_contact_host' => 'XXX.XXX.XXX.XXX',
'sip_to_tag' => 'e4ab0722',
'sip_from_tag' => 'Dc8U2HQFrDQ4D',
'sip_cseq' => '48533003',
'sip_call_id' => '7ba03d12-1451-123b-ff84-ac1f6b94e36c',
'hangup_cause' => 'NO_ANSWER',
'hangup_cause_q850' => '19',
'digits_dialed' => 'none',
'start_stamp' => '2022-03-01%2018%3A26%3A30',
'profile_start_stamp' => '2022-03-01%2018%3A26%3A30',
'progress_stamp' => '2022-03-01%2018%3A26%3A30',
'end_stamp' => '2022-03-01%2018%3A27%3A30',
'start_epoch' => '1646173590',
'start_uepoch' => '1646173590060292',
'profile_start_epoch' => '1646173590',
'profile_start_uepoch' => '1646173590060292',
'answer_epoch' => '0',
'answer_uepoch' => '0',
'bridge_epoch' => '0',
'bridge_uepoch' => '0',
'last_hold_epoch' => '0',
'last_hold_uepoch' => '0',
'hold_accum_seconds' => '0',
'hold_accum_usec' => '0',
'hold_accum_ms' => '0',
'resurrect_epoch' => '0',
'resurrect_uepoch' => '0',
'progress_epoch' => '1646173590',
'progress_uepoch' => '1646173590620111',
'progress_media_epoch' => '0',
'progress_media_uepoch' => '0',
'end_epoch' => '1646173650',
'end_uepoch' => '1646173650000174',
'caller_id' => '%22Name%20Surname%22%20%3C1829XXXXXXX%3E',
'duration' => '60',
'billsec' => '0',
'progresssec' => '0',
'answersec' => '0',
'waitsec' => '0',
'progress_mediasec' => '0',
'flow_billsec' => '0',
'mduration' => '59940',
'billmsec' => '0',
'progressmsec' => '560',
'answermsec' => '0',
'waitmsec' => '0',
'progress_mediamsec' => '0',
'flow_billmsec' => '0',
'uduration' => '59939882',
'billusec' => '0',
'progressusec' => '559819',
'answerusec' => '0',
'waitusec' => '0',
'progress_mediausec' => '0',
'flow_billusec' => '0',
'sip_hangup_disposition' => 'send_cancel',
'sip_invite_failure_status' => '487',
'sip_invite_failure_phrase' => 'CANCEL',
),
'callflow' =>
array (
0 =>
array (
'profile_index' => '1',
'caller_profile' =>
array (
'username' => '',
'dialplan' => '',
'caller_id_name' => 'Name Surname',
'ani' => '1829XXXXXXX',
'aniii' => '',
'caller_id_number' => '1829XXXXXXX',
'network_addr' => 'XXX.XXX.XXX.XXX',
'rdnis' => '',
'destination_number' => '4012',
'uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'source' => 'src/switch_ivr_originate.c',
'context' => 'default',
'chan_name' => 'sofia/office/[email protected]:56955',
),
'times' =>
array (
'created_time' => '1646173590060292',
'profile_created_time' => '1646173590060292',
'progress_time' => '1646173590620111',
'progress_media_time' => '0',
'answered_time' => '0',
'bridged_time' => '0',
'last_hold_time' => '0',
'hold_accum_time' => '0',
'hangup_time' => '1646173650000174',
'resurrect_time' => '0',
'transfer_time' => '0',
),
),
),
)
PHP 脚本
$data = json_decode($data_above, true);
$bridged = isset($data['variables']['bridge_uuid']);
$callcenter = isset($data['variables']['cc_agent_bridged']);
$direction = $data['variables']['direction'];
$extension = $data['callflow'][0]['caller_profile'];
$extension = match($direction)
{
'inbound'=>match($bridged)
{
true => match($callcenter)
{
true => $extension['originatee']['originatee_caller_profiles'][0]['destination_number'],
false => 'caller_id_number'
},
false => ''
},
'outbound'=>match($bridged)
{
true => 'caller_id_number',
false => $data['variables']['last_app'] == 'bridge' ? 'caller_id_number' : 'destination_number'
}
};
I have Freeswitch server sending CDR information (A leg only) in JSON to PHP script and I need to parse extension and phone number in every scenario possible:
- Incoming call from PSTN to: user, group, callcenter app (answered, un-answered)
- Outgoing call to PSTN from user (answered, un-answered)
Each scenario have to use different variable in the JSON - depends if was bridged or not, if it's incoming (destination_number), if it's outgoing (caller_id_number), etc.
I was using bridge_uuid to detect if the call was bridged, but still got calls where bridge_uuid is missing and last_app is bridge (with status ORIGINATOR_CANCEL).
I put together 7 scenarios, but still there are calls, where phone number appear in extension for some reason and vice-versa.
Is there any simple way to get this information from CDR?
SCENARIO 1:
- outbound
- bridge_uuid = exists
- extension = callflow.0.caller_profile.caller_id_number
- number = callflow.0.caller_profile.destination_number
SCENARIO 2:
- outbound
- bridge_uuid = not exists
- extension = callflow.0.caller_profile.destination_number
- number = callflow.0.caller_profile.caller_id_number
SCENARIO 3:
- outbound
- bridge_uuid = not exists
- last_app = bridge
- extension = callflow.0.caller_profile.caller_id_number
- number = callflow.0.caller_profile.destination_number
SCENARIO 4:
- inbound
- bridge_uuid = exists
- cc_agent_bridged = exists
- extension = callflow.0.caller_profile.originatee.originatee_caller_profiles.0.destination_number
- number = callflow.0.caller_profile.caller_id_number
SCENARIO 5:
- inbound
- bridge_uuid = exists
- cc_agent_bridged = not exists
- extension = callflow.0.caller_profile.caller_id_number
- number = callflow.0.caller_profile.destination_number
SCENARIO 6:
- inbound
- bridge_uuid = not exists
- extension = NULL
- number = callflow.0.caller_profile.caller_id_number
SCENARIO 7:
- inbound
- bridge_uuid = exists
- cc_agent_bridged = not exists
- extension = ???
- number = ???
JSON CDR
'core-uuid' => 'bf6eef3c-16b7-4f61-8cc2-1cd73460268e',
'switchname' => 'freeswitch',
'channel_data' =>
array (
'state' => 'CS_REPORTING',
'direction' => 'outbound',
'state_number' => '11',
'flags' => '0=1;2=1;22=1;40=1;42=1;45=1;116=1;117=1',
'caps' => '1=1;2=1;3=1;4=1;5=1;6=1;8=1;9=1;10=1',
),
'callStats' =>
array (
),
'variables' =>
array (
'direction' => 'outbound',
'is_outbound' => 'true',
'uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'call_uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'session_id' => '4755',
'sip_profile_name' => 'homeoffice',
'video_media_flow' => 'disabled',
'text_media_flow' => 'disabled',
'channel_name' => 'sofia/homeoffice/4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_destination_url' => 'sip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1%3Bfs_nat%3Dyes%3Bfs_path%3Dsip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'origination_caller_id_name' => 'Name%20Surname',
'origination_caller_id_number' => '1829XXXXXXX',
'EXT_ID' => '163748',
'USER_ID' => '793',
'ID_TYPE' => 'application',
'callgroup' => 'local',
'dialed_user' => '4012',
'dialed_domain' => 'pbx.domain.com',
'sip_invite_domain' => 'pbx.domain.com',
'presence_id' => '4012%40pbx.domain.com',
'originate_early_media' => 'true',
'rtp_use_codec_string' => 'OPUS,G729,PCMU,PCMA,GSM',
'local_media_ip' => 'XXX.XXX.XXX.XXX',
'local_media_port' => '17432',
'advertised_media_ip' => 'XXX.XXX.XXX.XXX',
'audio_media_flow' => 'sendrecv',
'rtp_local_sdp_str' => 'v%3D0%0D%0Ao%3DFreeSWITCH%201646156158%201646156159%20IN%20IP4%20XXX.XXX.XXX.XXX%0D%0As%3DFreeSWITCH%0D%0Ac%3DIN%20IP4%20XXX.XXX.XXX.XXX%0D%0At%3D0%200%0D%0Am%3Daudio%2017432%20RTP/AVP%20102%2018%200%208%203%20103%20101%0D%0Aa%3Drtpmap%3A102%20opus/48000/2%0D%0Aa%3Dfmtp%3A102%20useinbandf
ec%3D1%3B%20maxaveragebitrate%3D30000%3B%20maxplaybackrate%3D48000%3B%20ptime%3D20%3B%20minptime%3D10%3B%20maxptime%3D40%0D%0Aa%3Drtpmap%3A18%20G729/8000%0D%0Aa%3Dfmtp%3A18%20annexb%3Dno%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A8%20PCMA/8000%0D%0Aa%3Drtpmap%3A3%20GSM/8000%0D%0Aa%3Drtpmap%3A103%20telephone-e
vent/48000%0D%0Aa%3Dfmtp%3A103%200-15%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dptime%3A20%0D%0Aa%3Dsendrecv%0D%0A',
'sip_outgoing_contact_uri' => '%3Csip%3Amod_sofia%40XXX.XXX.XXX.XXX%3A5090%3E',
'sip_req_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'sip_nat_detected' => 'true',
'sofia_profile_name' => 'office',
'recovery_profile_name' => 'office',
'sofia_profile_url' => 'sip%3Amod_sofia%40XXX.XXX.XXX.XXX%3A5090',
'sip_local_network_addr' => 'XXX.XXX.XXX.XXX',
'sip_reply_host' => 'XXX.XXX.XXX.XXX',
'sip_reply_port' => '56955',
'sip_network_ip' => 'XXX.XXX.XXX.XXX',
'sip_network_port' => '56955',
'sip_user_agent' => 'Z%205.5.9%20v2.10.17.3',
'sip_allow' => 'INVITE,%20ACK,%20CANCEL,%20BYE,%20NOTIFY,%20REFER,%20MESSAGE,%20OPTIONS,%20INFO,%20SUBSCRIBE',
'sip_recover_contact' => '%3Csip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3E',
'sip_full_via' => 'SIP/2.0/UDP%20XXX.XXX.XXX.XXX%3A5090%3Brport%3D5090%3Bbranch%3Dz9hG4bKS6tvm613tKgpg',
'sip_recover_via' => 'SIP/2.0/UDP%20XXX.XXX.XXX.XXX%3A5090%3Brport%3D5090%3Bbranch%3Dz9hG4bKS6tvm613tKgpg',
'sip_from_display' => 'Name%20Surname',
'sip_full_from' => '%22Name%20Surname%22%20%3Csip%3A1829XXXXXXX%40pbx.domain.com%3E%3Btag%3DDc8U2HQFrDQ4D',
'sip_full_to' => '%3Csip%3A4012%40XXX.XXX.XXX.XXX%3A56955%3Btransport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1%3E%3Btag%3De4ab0722',
'sip_from_user' => '1829XXXXXXX',
'sip_from_uri' => '1829XXXXXXX%40pbx.domain.com',
'sip_from_host' => 'pbx.domain.com',
'sip_to_params' => 'transport%3DUDP%3Brinstance%3D845ce1bf3f9efbf1',
'sip_to_user' => '4012',
'sip_to_port' => '56955',
'sip_to_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_to_host' => 'XXX.XXX.XXX.XXX',
'sip_contact_params' => 'transport%3DUDP',
'sip_contact_user' => '4012',
'sip_contact_port' => '56955',
'sip_contact_uri' => '4012%40XXX.XXX.XXX.XXX%3A56955',
'sip_contact_host' => 'XXX.XXX.XXX.XXX',
'sip_to_tag' => 'e4ab0722',
'sip_from_tag' => 'Dc8U2HQFrDQ4D',
'sip_cseq' => '48533003',
'sip_call_id' => '7ba03d12-1451-123b-ff84-ac1f6b94e36c',
'hangup_cause' => 'NO_ANSWER',
'hangup_cause_q850' => '19',
'digits_dialed' => 'none',
'start_stamp' => '2022-03-01%2018%3A26%3A30',
'profile_start_stamp' => '2022-03-01%2018%3A26%3A30',
'progress_stamp' => '2022-03-01%2018%3A26%3A30',
'end_stamp' => '2022-03-01%2018%3A27%3A30',
'start_epoch' => '1646173590',
'start_uepoch' => '1646173590060292',
'profile_start_epoch' => '1646173590',
'profile_start_uepoch' => '1646173590060292',
'answer_epoch' => '0',
'answer_uepoch' => '0',
'bridge_epoch' => '0',
'bridge_uepoch' => '0',
'last_hold_epoch' => '0',
'last_hold_uepoch' => '0',
'hold_accum_seconds' => '0',
'hold_accum_usec' => '0',
'hold_accum_ms' => '0',
'resurrect_epoch' => '0',
'resurrect_uepoch' => '0',
'progress_epoch' => '1646173590',
'progress_uepoch' => '1646173590620111',
'progress_media_epoch' => '0',
'progress_media_uepoch' => '0',
'end_epoch' => '1646173650',
'end_uepoch' => '1646173650000174',
'caller_id' => '%22Name%20Surname%22%20%3C1829XXXXXXX%3E',
'duration' => '60',
'billsec' => '0',
'progresssec' => '0',
'answersec' => '0',
'waitsec' => '0',
'progress_mediasec' => '0',
'flow_billsec' => '0',
'mduration' => '59940',
'billmsec' => '0',
'progressmsec' => '560',
'answermsec' => '0',
'waitmsec' => '0',
'progress_mediamsec' => '0',
'flow_billmsec' => '0',
'uduration' => '59939882',
'billusec' => '0',
'progressusec' => '559819',
'answerusec' => '0',
'waitusec' => '0',
'progress_mediausec' => '0',
'flow_billusec' => '0',
'sip_hangup_disposition' => 'send_cancel',
'sip_invite_failure_status' => '487',
'sip_invite_failure_phrase' => 'CANCEL',
),
'callflow' =>
array (
0 =>
array (
'profile_index' => '1',
'caller_profile' =>
array (
'username' => '',
'dialplan' => '',
'caller_id_name' => 'Name Surname',
'ani' => '1829XXXXXXX',
'aniii' => '',
'caller_id_number' => '1829XXXXXXX',
'network_addr' => 'XXX.XXX.XXX.XXX',
'rdnis' => '',
'destination_number' => '4012',
'uuid' => 'c9aa9f5f-7afd-46af-8cca-2af25b758aec',
'source' => 'src/switch_ivr_originate.c',
'context' => 'default',
'chan_name' => 'sofia/office/[email protected]:56955',
),
'times' =>
array (
'created_time' => '1646173590060292',
'profile_created_time' => '1646173590060292',
'progress_time' => '1646173590620111',
'progress_media_time' => '0',
'answered_time' => '0',
'bridged_time' => '0',
'last_hold_time' => '0',
'hold_accum_time' => '0',
'hangup_time' => '1646173650000174',
'resurrect_time' => '0',
'transfer_time' => '0',
),
),
),
)
PHP SCRIPT
$data = json_decode($data_above, true);
$bridged = isset($data['variables']['bridge_uuid']);
$callcenter = isset($data['variables']['cc_agent_bridged']);
$direction = $data['variables']['direction'];
$extension = $data['callflow'][0]['caller_profile'];
$extension = match($direction)
{
'inbound'=>match($bridged)
{
true => match($callcenter)
{
true => $extension['originatee']['originatee_caller_profiles'][0]['destination_number'],
false => 'caller_id_number'
},
false => ''
},
'outbound'=>match($bridged)
{
true => 'caller_id_number',
false => $data['variables']['last_app'] == 'bridge' ? 'caller_id_number' : 'destination_number'
}
};
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论