esl 的 CHANNEL_PARK事件uuid不一致的问题

这是一个esl的park事件

Event-Name: CHANNEL_PARK
Core-UUID: 85250adc-c5a2-42b2-afc0-00f261fc1546
FreeSWITCH-Hostname: localhost.localdomain
FreeSWITCH-Switchname: localhost.localdomain
FreeSWITCH-IPv4: 192.168.2.215
FreeSWITCH-IPv6: %3A%3A1
Event-Date-Local: 2019-07-12%2012%3A59%3A46
Event-Date-GMT: Fri,%2012%20Jul%202019%2004%3A59%3A46%20GMT
Event-Date-Timestamp: 1562907586285160
Event-Calling-File: switch_ivr.c
Event-Calling-Function: switch_ivr_park
Event-Calling-Line-Number: 950
Event-Sequence: 22750
Channel-State: CS_PARK
Channel-Call-State: ACTIVE
Channel-State-Number: 6
Channel-Name: sofia/internal/1031%40192.168.2.83%3A6781
Unique-ID: 03a1a9de-e736-4ad7-963e-455e913bc2ba
Call-Direction: outbound
Presence-Call-Direction: outbound
Channel-HIT-Dialplan: false
Channel-Presence-ID: 1031%40192.168.2.215
Channel-Call-UUID: 6c69067b-08c7-476e-a0af-06fb4f0482a4
Answer-State: answered
Channel-Read-Codec-Name: PCMA
Channel-Read-Codec-Rate: 8000
Channel-Read-Codec-Bit-Rate: 64000
Channel-Write-Codec-Name: PCMA
Channel-Write-Codec-Rate: 8000
Channel-Write-Codec-Bit-Rate: 64000
Caller-Direction: outbound
Caller-Logical-Direction: outbound
Caller-Caller-ID-Name: 1000
Caller-Caller-ID-Number: 1000
Caller-Orig-Caller-ID-Name: 1000
Caller-Orig-Caller-ID-Number: 1000
Caller-Callee-ID-Name: 1000
Caller-Callee-ID-Number: 1000
Caller-Network-Addr: 192.168.2.83
Caller-ANI: 1000
Caller-Destination-Number: 1031
Caller-Unique-ID: 03a1a9de-e736-4ad7-963e-455e913bc2ba
Caller-Source: src/switch_ivr_originate.c
Caller-Transfer-Source: 1562907583%3Af2f7fed2-ffcd-42ca-8188-e8c9107006a1%3Auuid_br%3A6c69067b-08c7-476e-a0af-06fb4f0482a4
Caller-Context: default
Caller-Channel-Name: sofia/internal/1031%40192.168.2.83%3A6781
Caller-Profile-Index: 20
Caller-Profile-Created-Time: 1562907583445159
Caller-Channel-Created-Time: 1562906514525111
Caller-Channel-Answered-Time: 1562906528205198
Caller-Channel-Progress-Time: 1562906514525111
Caller-Channel-Progress-Media-Time: 0
Caller-Channel-Hangup-Time: 0
Caller-Channel-Transfer-Time: 0
Caller-Channel-Resurrect-Time: 0
Caller-Channel-Bridged-Time: 1562907583525267
Caller-Channel-Last-Hold: 0
Caller-Channel-Hold-Accum: 0
Caller-Screen-Bit: true
Caller-Privacy-Hide-Name: false
Caller-Privacy-Hide-Number: false
Other-Type: originator
Other-Leg-Direction: inbound
Other-Leg-Logical-Direction: inbound
Other-Leg-Username: 1000
Other-Leg-Dialplan: XML
Other-Leg-Caller-ID-Name: 1000
Other-Leg-Caller-ID-Number: 1000
Other-Leg-Orig-Caller-ID-Name: 1000
Other-Leg-Orig-Caller-ID-Number: 1000
Other-Leg-Callee-ID-Name: 1000
Other-Leg-Callee-ID-Number: 1000
Other-Leg-Network-Addr: 192.168.2.214
Other-Leg-ANI: 1000
Other-Leg-Destination-Number: 1031
Other-Leg-Unique-ID: 6c69067b-08c7-476e-a0af-06fb4f0482a4
Other-Leg-Source: mod_sofia
Other-Leg-Context: default
Other-Leg-Channel-Name: sofia/internal/1000%40192.168.2.215
Other-Leg-Profile-Created-Time: 0
Other-Leg-Channel-Created-Time: 0
Other-Leg-Channel-Answered-Time: 0
Other-Leg-Channel-Progress-Time: 0
Other-Leg-Channel-Progress-Media-Time: 0
Other-Leg-Channel-Hangup-Time: 0
Other-Leg-Channel-Transfer-Time: 0
Other-Leg-Channel-Resurrect-Time: 0
Other-Leg-Channel-Bridged-Time: 0
Other-Leg-Channel-Last-Hold: 0
Other-Leg-Channel-Hold-Accum: 0
Other-Leg-Screen-Bit: true
Other-Leg-Privacy-Hide-Name: false
Other-Leg-Privacy-Hide-Number: false
variable_direction: outbound
variable_is_outbound: true
variable_uuid: 03a1a9de-e736-4ad7-963e-455e913bc2ba
variable_session_id: 176
variable_sip_profile_name: internal
variable_video_media_flow: sendrecv
variable_audio_media_flow: sendrecv
variable_channel_name: sofia/internal/1031%40192.168.2.83%3A6781
variable_sip_destination_url: sip%3A1031%40192.168.2.83%3A6781
variable_dialed_user: 1031
variable_dialed_domain: 192.168.2.215
variable_sip_invite_domain: 192.168.2.215
variable_presence_id: 1031%40192.168.2.215
variable_local_video_ip: 192.168.2.215
variable_local_video_port: 17538
variable_rtp_local_sdp_str: v%3D0%0D%0Ao%3DFreeSWITCH%201562887872%201562887873%20IN%20IP4%20192.168.2.215%0D%0As%3DFreeSWITCH%0D%0Ac%3DIN%20IP4%20192.168.2.215%0D%0At%3D0%200%0D%0Am%3Daudio%2018642%20RTP/AVP%2018%20102%20103%209%200%208%203%20101%20105%0D%0Aa%3Drtpmap%3A18%20G729/8000%0D%0Aa%3Dfmtp%3A18%20annexb%3Dno%0D%0Aa%3Drtpmap%3A102%20iLBC/8000%0D%0Aa%3Dfmtp%3A102%20mode%3D30%0D%0Aa%3Drtpmap%3A103%20opus/48000/2%0D%0Aa%3Dfmtp%3A103%20useinbandfec%3D1%3B%20maxaveragebitrate%3D30000%3B%20maxplaybackrate%3D48000%3B%20ptime%3D20%3B%20minptime%3D10%3B%20maxptime%3D40%0D%0Aa%3Drtpmap%3A9%20G722/8000%0D%0Aa%3Drtpmap%3A0%20PCMU/8000%0D%0Aa%3Drtpmap%3A8%20PCMA/8000%0D%0Aa%3Drtpmap%3A3%20GSM/8000%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-16%0D%0Aa%3Drtpmap%3A105%20telephone-event/48000%0D%0Aa%3Dfmtp%3A105%200-16%0D%0Aa%3Dptime%3A20%0D%0Aa%3Dsendrecv%0D%0Am%3Dvideo%2017538%20RTP/AVP%20104%0D%0Ab%3DAS%3A1024%0D%0Aa%3Drtpmap%3A104%20VP8/90000%0D%0Aa%3Drtcp-fb%3A104%20ccm%20fir%0D%0Aa%3Drtcp-fb%3A104%20ccm%20tmmbr%0D%0Aa%3Drtcp-fb%3A104%20nack%0D%0Aa%3Drtcp-fb%3A104%20nack%20pli%0D%0A
variable_sip_outgoing_contact_uri: %3Csip%3Amod_sofia%40192.168.2.215%3A2060%3E
variable_sip_req_uri: 1031%40192.168.2.83%3A6781
variable_sofia_profile_name: internal
variable_recovery_profile_name: internal
variable_sip_local_network_addr: 192.168.2.215
variable_sip_reply_host: 192.168.2.83
variable_sip_reply_port: 6781
variable_sip_network_ip: 192.168.2.83
variable_sip_network_port: 6781
variable_ep_codec_string: CORE_PCM_MODULE.PCMA%408000h%4020i%4064000b
variable_sip_allow: INVITE,%20ACK,%20CANCEL,%20OPTIONS,%20BYE,%20REFER,%20NOTIFY,%20MESSAGE,%20SUBSCRIBE,%20INFO
variable_sip_recover_contact: %3Csip%3A1031%40192.168.2.83%3A6781%3E
variable_sip_full_via: SIP/2.0/UDP%20192.168.2.215%3A2060%3Brport%3D2060%3Bbranch%3Dz9hG4bKgcX7m4KeSSKvH%3Breceived%3D192.168.2.215
variable_sip_recover_via: SIP/2.0/UDP%20192.168.2.215%3A2060%3Brport%3D2060%3Bbranch%3Dz9hG4bKgcX7m4KeSSKvH%3Breceived%3D192.168.2.215
variable_sip_from_display: 1000
variable_sip_full_from: %221000%22%20%3Csip%3A1000%40192.168.2.215%3E%3Btag%3DN07ety2UX8DUH
variable_sip_full_to: %3Csip%3A1031%40192.168.2.83%3A6781%3E%3Btag%3Dbf2d5d0a
variable_sip_from_user: 1000
variable_sip_from_uri: 1000%40192.168.2.215
variable_sip_from_host: 192.168.2.215
variable_sip_to_user: 1031
variable_sip_to_port: 6781
variable_sip_to_uri: 1031%40192.168.2.83%3A6781
variable_sip_to_host: 192.168.2.83
variable_sip_contact_user: 1031
variable_sip_contact_port: 6781
variable_sip_contact_uri: 1031%40192.168.2.83%3A6781
variable_sip_contact_host: 192.168.2.83
variable_sip_to_tag: bf2d5d0a
variable_sip_from_tag: N07ety2UX8DUH
variable_sip_cseq: 7022846
variable_sip_call_id: c11ae998-2140-1238-289f-000c29528a7b
variable_switch_r_sdp: v%3D0%0D%0Ao%3D-%207587729044%207587729049%20IN%20IP4%20192.168.2.83%0D%0As%3DeyeBeam%0D%0Ac%3DIN%20IP4%20192.168.2.83%0D%0At%3D0%200%0D%0Am%3Daudio%206902%20RTP/AVP%208%20101%0D%0Aa%3Drtpmap%3A101%20telephone-event/8000%0D%0Aa%3Dfmtp%3A101%200-15%0D%0Aa%3Dalt%3A1%201%20%3A%20DE7F7604%2092694EDD%20192.168.2.83%206902%0D%0A
variable_rtp_use_codec_string: G729,iLBC,OPUS,G722,PCMU,PCMA,VP8,GSM
variable_rtp_audio_recv_pt: 8
variable_rtp_use_codec_name: PCMA
variable_rtp_use_codec_rate: 8000
variable_rtp_use_codec_ptime: 20
variable_rtp_use_codec_channels: 1
variable_rtp_last_audio_codec_string: PCMA%408000h%4020i%401c
variable_read_codec: PCMA
variable_original_read_codec: PCMA
variable_read_rate: 8000
variable_original_read_rate: 8000
variable_write_codec: PCMA
variable_write_rate: 8000
variable_dtmf_type: rfc2833
variable_local_media_ip: 192.168.2.215
variable_local_media_port: 18642
variable_advertised_media_ip: 192.168.2.215
variable_rtp_use_timer_name: soft
variable_rtp_use_pt: 8
variable_rtp_use_ssrc: 3116562093
variable_rtp_2833_send_payload: 101
variable_rtp_2833_recv_payload: 101
variable_remote_media_ip: 192.168.2.83
variable_remote_media_port: 6902
variable_endpoint_disposition: ANSWER
variable_record_stereo: true
variable_default_gateway: example.com
variable_default_areacode: 918
variable_transfer_fallback_extension: operator
variable_toll_allow: domestic,international,local
variable_accountcode: 1031
variable_user_context: default
variable_effective_caller_id_name: Extension%201031
variable_effective_caller_id_number: 1031
variable_outbound_caller_id_name: FreeSWITCH
variable_outbound_caller_id_number: 0000000000
variable_callgroup: techsupport
variable_origination_uuid: 03a1a9de-e736-4ad7-963e-455e913bc2ba
variable_origination_caller_id_name: 1000
variable_origination_caller_id_number: 1000
variable_originate_early_media: true
variable_pre_transfer_caller_id_name: 1000
variable_pre_transfer_caller_id_number: 1000
variable_current_application: park
variable_transfer_history: ARRAY%3A%3A1562906653%3A492ab704-3c04-45c0-8a9b-7a15113600a9%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562906980%3A481b1f59-2578-4f36-8c80-cdaa25fe1080%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562907002%3Ad1865e45-9088-49d1-879e-f1ca9d2cc037%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562907037%3A4b31feb1-b065-4acb-844d-40843c168ae7%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562907061%3Ac43f829f-29d3-41d3-bd44-77e21b7b9792%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562907087%3A923d8499-02e1-4f38-9f75-03dbbad710fb%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562907104%3Ac856e403-e986-488b-b40e-1e8a95a55ffb%3Auuid_br%3A6629ebf7-f70b-4ab6-80f4-dc4473d62fe9%7C%3A1562907293%3A5349247d-486a-4455-970e-99a0cf30a19a%3Auuid_br%3Aed71995d-2fd5-4f17-a554-6dc15e2eeaad%7C%3A1562907299%3Ae8b3d087-8e2f-4d91-bbdc-ed8f98b8f478%3Auuid_br%3Aed71995d-2fd5-4f17-a554-6dc15e2eeaad%7C%3A1562907332%3Aeadf54a6-e541-46cd-a020-23c27474a279%3Auuid_br%3Ae441d19a-d9d7-4cb5-849a-1af5ce3c3ccf%7C%3A1562907339%3Aac8f792f-7865-4d4e-bd55-205afa8febf0%3Auuid_br%3Ae441d19a-d9d7-4cb5-849a-1af5ce3c3ccf%7C%3A1562907341%3A29aa67b1-15bb-4250-9393-63b271db7e48%3Auuid_br%3Ae441d19a-d9d7-4cb5-849a-1af5ce3c3ccf%7C%3A1562907437%3A9233db34-a3b8-4204-86f8-07e1206d4694%3Auuid_br%3Ae441d19a-d9d7-4cb5-849a-1af5ce3c3ccf%7C%3A1562907487%3A90f93dab-ce79-4a6e-8aac-08e8c4747f74%3Auuid_br%3A95afcfb0-73ce-487c-8b20-929975d0ac40%7C%3A1562907500%3Ad12f5022-811c-43a5-8474-7b1951522c78%3Auuid_br%3A95afcfb0-73ce-487c-8b20-929975d0ac40%7C%3A1562907503%3A977f0b46-8e9b-400e-a1db-f3e8913e85a1%3Auuid_br%3A95afcfb0-73ce-487c-8b20-929975d0ac40%7C%3A1562907505%3Ac5006ae9-48f3-4bab-8e4c-c1375d396c6b%3Auuid_br%3A95afcfb0-73ce-487c-8b20-929975d0ac40%7C%3A1562907570%3A705d3055-be78-484d-acb4-8cf239ab9c5a%3Auuid_br%3A6c69067b-08c7-476e-a0af-06fb4f0482a4%7C%3A1562907583%3Af2f7fed2-ffcd-42ca-8188-e8c9107006a1%3Auuid_br%3A6c69067b-08c7-476e-a0af-06fb4f0482a4
variable_last_bridge_hangup_cause: NORMAL_CLEARING
variable_original_destination_number: 1031
variable_original_caller_id_name: 1000
variable_original_caller_id_number: 1000
variable_transfer_source: 1562907583%3Af2f7fed2-ffcd-42ca-8188-e8c9107006a1%3Auuid_br%3A6c69067b-08c7-476e-a0af-06fb4f0482a4
variable_call_uuid: 6c69067b-08c7-476e-a0af-06fb4f0482a4
variable_last_bridge_to: 6c69067b-08c7-476e-a0af-06fb4f0482a4
variable_bridge_channel: sofia/internal/1000%40192.168.2.215
variable_bridge_uuid: 6c69067b-08c7-476e-a0af-06fb4f0482a4
variable_signal_bond: 6c69067b-08c7-476e-a0af-06fb4f0482a4
variable_last_sent_callee_id_name: 1000
variable_last_sent_callee_id_number: 1000

之前的时候我以为里面的Unique-ID 、Caller-Unique-ID 、 variable_uuid 、Channel-Call-UUID、variable_call_uuid 都是一样的。
后来发现特么的不一定啊。
注意:是不一定。
大部分的时候是一样的,只是偶尔出现的。大概10次有两次吧。因为我测试,监听了所有的事件,可能就导致了freeswitch内部没有及时刷新。

总结一下:
正确的应该取:
Unique-ID 、Caller-Unique-ID 、 variable_uuid
不要取:Channel-Call-UUID 、variable_call_uuid。

猜测原因: 里面数据刷新的不及时。或者再进一步猜测,里面也维持着一个map数组指针,里面的数据没有及时更新。

在FreeSWITCH的ESL(Event Socket Library)中,esl_event结构体是一个非常重要的数据结构,用于表示从FreeSWITCH接收到的事件。该结构体的成员组成如下: ``` typedef struct esl_event { char *event_name; // 事件名称 char *event_subclass; // 事件子类别 char *event_header; // 事件头 char *event_body; // 事件内容 char *event_plain_body; // 事件的裸数据 int event_type; // 事件类型 int event_id; // 事件ID char *event_uuid; // 事件UUID char *event_channel_uuid; // 事件所属通道的UUID char *event_app; // 事件所属应用名 char *event_app_data; // 事件所属应用的数据 char *event_flags; // 事件标志 char *event_priority; // 事件优先级 char *event_call_direction; // 呼叫方向 char *event_context; // 事件所属上下文 char *event_extension; // 事件所属扩展 char *event_caller_id_name; // 主叫方名称 char *event_caller_id_number; // 主叫方号码 char *event_destination_number; // 目的地号码 char *event_network_addr; // 事件来源网络地址 char *event_rdnis; // 事件RDNIS char *event_destination_name; // 目的地名称 char *event_app_response; // 应用响应 char *event_job_uuid; // 任务UUID char *event_job_command; // 任务命令 char *event_job_data; // 任务数据 char *event_job_priority; // 任务优先级 } esl_event_t; ``` 各成员的意义如下: - event_name: 事件名称,例如CHANNEL_CREATE、CHANNEL_DESTROY、DTMF等。 - event_subclass: 事件子类别,用于进一步区分事件类型。 - event_header: 事件头部分,包括事件类型、事件子类别等信息。 - event_body: 事件内容,包括事件所属通道、事件发生时间、事件相关参数等信息。 - event_plain_body: 事件的裸数据,即原始的事件内容。 - event_type: 事件类型,用于区分不同类型的事件。 - event_id: 事件ID,用于标识一个事件。 - event_uuid: 事件UUID,用于标识一个事件在FreeSWITCH中的唯一性。 - event_channel_uuid: 事件所属通道的UUID,用于标识事件所属的通道。 - event_app: 事件所属应用名,表示事件发生时所在的应用。 - event_app_data: 事件所属应用的数据,表示事件发生时应用的相关数据。 - event_flags: 事件标志,标识事件的一些特殊属性。 - event_priority: 事件优先级,用于标识事件的优先级。 - event_call_direction: 呼叫方向,表示事件所属呼叫的方向。 - event_context: 事件所属上下文,表示事件所在的上下文。 - event_extension: 事件所属扩展,表示事件所在的扩展。 - event_caller_id_name: 主叫方名称,表示事件所属呼叫的主叫方名称。 - event_caller_id_number: 主叫方号码,表示事件所属呼叫的主叫方号码。 - event_destination_number: 目的地号码,表示事件所属呼叫的目的地号码。 - event_network_addr: 事件来源网络地址,表示事件发生的网络地址。 - event_rdnis: 事件RDNIS,表示事件所属呼叫的RDNIS。 - event_destination_name: 目的地名称,表示事件所属呼叫的目的地名称。 - event_app_response: 应用响应,表示事件所属应用的响应。 - event_job_uuid: 任务UUID,表示事件所属任务的UUID。 - event_job_command: 任务命令,表示事件所属任务的命令。 - event_job_data: 任务数据,表示事件所属任务的数据。 - event_job_priority: 任务优先级,表示事件所属任务的优先级。 通过以上成员,可以获取到事件的各种信息和参数,从而实现对事件的处理和管理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值