Freeswitch中CHANNEL_HANGUP外呼挂断事件

1.CHANNEL_HANGUP外呼挂断事件

  • 事件详细

##################  外呼挂断:#############################
[EslMessage{contentType=command/reply, headers=3, body=0 lines}]
2023-11-16T03:41:33.514+0800 INFO  c.e.c.v.s.c.i.FsServerEventHandler - eventReceived:CHANNEL_HANGUP
2023-11-16T03:41:33.514+0800 INFO  c.e.c.v.s.c.i.FsServerEventHandler - EventBody********:{variable_effective_caller_id_number=1000, =, variable_sip_network_ip=192.168.5.162, variable_sip_allow=INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, Other-Leg-Unique-ID=f6616956-15ad-40e6-975b-6d81aff8579e, variable_user_context=default, variable_rtp_use_ssrc=2237112328, Caller-Channel-Progress-Media-Time=1700134931262852, Caller-Dialplan=XML, variable_sip_reply_port=9726, variable_originate_disposition=SUCCESS, variable_sip_cseq=75499248, Channel-State-Number=10, variable_uuid=1f790466-9fc0-4f83-a098-6cf1eb943850, variable_remote_media_ip=192.168.5.162, Hangup-Cause=NORMAL_CLEARING, variable_call_uuid=1f790466-9fc0-4f83-a098-6cf1eb943850, Other-Leg-Destination-Number=voicemail, Caller-RDNIS=1000, variable_outbound_caller_id_name=10086, Caller-Profile-Created-Time=1700134930242850, Other-Leg-Privacy-Hide-Name=false, variable_rtp_use_pt=0, variable_dialed_user=1001, Caller-Screen-Bit=true, Caller-Logical-Direction=outbound, variable_hangup_after_bridge=false, variable_sip_profile_name=internal, variable_write_rate=8000, Other-Leg-Channel-Bridged-Time=0, variable_sofia_profile_url=sip:[email protected]:5060, variable_originate_failed_cause=USER_NOT_REGISTERED, Caller-Channel-Progress-Time=1700134928282858, variable_sip_from_tag=8Xr8g0917g09m, variable_sofia_profile_name=internal, variable_text_media_flow=disabled, [email protected]:9726, variable_recording_file=/data/RDPx64/webapps/fs_recordings/1f790466-9fc0-4f83-a098-6cf1eb943850_2023-11-16-19-42-10_1001_1000.wav, Other-Leg-Dialplan=XML, Other-Leg-Network-Addr=192.168.5.162, variable_originated_legs=f6616956-15ad-40e6-975b-6d81aff8579e;Outbound Call;default 192.168.5.97 1001, Caller-Network-Addr=192.168.5.162, variable_sip_contact_port=9726, variable_rtp_use_codec_name=PCMU, variable_originate_early_media=true, variable_sip_user_agent=Genesyslab.Sip.Endpoint 8.0.0.10 L-PSDK-Q-SIP-8-0.us.int.genesyslab.com-083010-021849   Genesyslab.Sip.Endpoint.Provider.CP 8.0.0.10 L-PSDK-Q-SIP-8-0.us.int.genesyslab.com-083010-021849, variable_DP_MATCH=ARRAY::1001|:1001, variable_sip_contact_host=192.168.5.162, variable_ringback=%(2000,4000,440,480), variable_bridge_to=f6616956-15ad-40e6-975b-6d81aff8579e, variable_write_codec=PCMU, variable_ep_codec_string=CORE_PCM_MODULE.PCMU@8000h@20i@64000b,CORE_PCM_MODULE.PCMA@8000h@20i@64000b, variable_sip_to_host=192.168.5.162, variable_remote_media_port=44758, Channel-Read-Codec-Name=PCMU, [email protected], variable_audio_media_flow=sendrecv, Channel-HIT-Dialplan=true, Caller-Channel-Last-Hold=0, variable_session_id=195, variable_bridge_uuid=f6616956-15ad-40e6-975b-6d81aff8579e, variable_sip_to_user=1000, variable_sip_recover_via=SIP/2.0/UDP 192.168.5.97;rport=5060;branch=z9hG4bKDU68ySpBUyryN, variable_sip_full_to=;tag=ea01aec4, Other-Leg-Privacy-Hide-Number=false, variable_recovery_profile_name=internal, Channel-Write-Codec-Rate=8000, Other-Leg-Source=mod_loopback, variable_rtp_last_audio_codec_string=PCMU@8000h@20i@1c, variable_direction=outbound, variable_rtp_use_codec_channels=1, Event-Name=CHANNEL_HANGUP, variable_accountcode=1000, variable_sip_network_port=9726, variable_sip_contact_user=1000, variable_rtp_use_codec_rate=8000, variable_channel_name=sofia/internal/[email protected]:9726, variable_remote_audio_media_flow=sendrecv, [email protected], variable_advertised_media_ip=192.168.5.97, variable_bridge_channel=loopback/voicemail-a, Answer-State=hangup, Channel-Write-Codec-Name=PCMU, Other-Leg-Screen-Bit=true, Caller-Channel-Resurrect-Time=0, variable_effective_caller_id_name=Extension 1000, Other-Leg-Channel-Resurrect-Time=0, Caller-Orig-Caller-ID-Number=0000000000, variable_sip_full_via=SIP/2.0/UDP 192.168.5.97;rport=5060;branch=z9hG4bKDU68ySpBUyryN, variable_dialed_extension=1001, variable_sip_outgoing_contact_uri=, Caller-Channel-Transfer-Time=0, variable_sip_contact_params=rinstance=eacf349ed3bb70b1;transport=udp, Caller-Channel-Created-Time=1700134928082851, Other-Leg-Context=default, variable_dtmf_type=rfc2833, variable_export_vars=dialed_extension, variable_rtp_audio_recv_pt=0, variable_original_read_rate=8000, Other-Leg-Callee-ID-Number=default 192.168.5.97 1001, variable_sip_full_from=;tag=8Xr8g0917g09m, variable_local_media_port=23938, Core-UUID=9674935c-bf3e-4391-941f-4108d7b0f6e6, variable_pre_transfer_caller_id_number=0000000000, Other-Leg-Caller-ID-Name=Extension 1000, variable_rtp_2833_recv_payload=101, variable_originate_causes=f6616956-15ad-40e6-975b-6d81aff8579e;NONE, variable_RECORD_STEREO=true, FreeSWITCH-Hostname=gcxi, variable_default_gateway=example.com, FreeSWITCH-IPv6=::1, FreeSWITCH-IPv4=192.168.5.97, Caller-Destination-Number=1001, Caller-Channel-Answered-Time=1700134930242850, Other-Leg-Logical-Direction=inbound, Caller-Callee-ID-Name=Outbound Call, variable_transfer_ringback=local_stream://moh, Event-Date-Timestamp=1700134939762847, variable_current_application_data=loopback/app=voicemail:default 192.168.5.97 1001, Channel-Read-Codec-Rate=8000, variable_sip_to_params=rinstance=eacf349ed3bb70b1;transport=udp, variable_read_rate=8000, Presence-Call-Direction=outbound, Unique-ID=1f790466-9fc0-4f83-a098-6cf1eb943850, variable_local_video_ip=192.168.5.97, Other-Type=originatee, Channel-Call-State=ACTIVE, Other-Leg-RDNIS=1000, Event-Calling-File=switch_channel.c, variable_dialed_domain=192.168.5.97, Other-Leg-Profile-Created-Time=1700134931262852, variable_rtp_use_timer_name=soft, Channel-Write-Codec-Bit-Rate=64000, variable_current_application=bridge, Caller-Channel-Hold-Accum=0, Other-Leg-Channel-Created-Time=1700134931262852, FreeSWITCH-Switchname=freeswitch01, Caller-Privacy-Hide-Number=false, variable_default_areacode=86, Other-Leg-Channel-Transfer-Time=0, variable_transfer_source=1700134930:24303aff-f112-4b56-8400-e7c971b07a53:bl_xfer:1001/default/XML, Caller-Channel-Bridged-Time=1700134931282847, Caller-Source=src/switch_ivr_originate.c, variable_rtp_use_codec_string=OPUS,G722,PCMU,PCMA,VP8, Caller-ANI=0000000000, variable_sip_from_host=192.168.5.97, Caller-Channel-Hangup-Time=0, variable_endpoint_disposition=ANSWER, variable_rtp_use_codec_ptime=20, variable_video_media_flow=sendrecv, Channel-Read-Codec-Bit-Rate=64000, Event-Calling-Function=switch_channel_perform_hangup, Caller-Profile-Index=2, Channel-Name=sofia/internal/[email protected]:9726, variable_sip_recover_contact=, Channel-Call-UUID=1f790466-9fc0-4f83-a098-6cf1eb943850, Caller-Transfer-Source=1700134930:24303aff-f112-4b56-8400-e7c971b07a53:bl_xfer:1001/default/XML, Other-Leg-Channel-Hangup-Time=0, Caller-Context=default, [email protected]:9726;rinstance=eacf349ed3bb70b1;transport=udp, variable_DIALSTATUS=SUCCESS, variable_sip_from_user=0000000000, variable_call_timeout=999, Other-Leg-Caller-ID-Number=1000, Event-Calling-Line-Number=3286, Caller-Unique-ID=1f790466-9fc0-4f83-a098-6cf1eb943850, Caller-Caller-ID-Number=1000, Caller-Caller-ID-Name=Outbound Call, variable_read_codec=PCMU, variable_rtp_local_sdp_str=v=0
, Channel-State=CS_EXECUTE, variable_callgroup=techsupport, [email protected], [email protected]:9726, Other-Leg-Callee-ID-Name=Outbound Call, Other-Leg-Orig-Caller-ID-Number=0000000000, variable_original_read_codec=PCMU, Other-Leg-Channel-Last-Hold=0, variable_remote_video_media_flow=inactive, Caller-Callee-ID-Number=default 192.168.5.97 1001, variable_local_media_ip=192.168.5.97, variable_rtp_2833_send_payload=101, variable_transfer_fallback_extension=operator, Caller-Channel-Name=sofia/internal/[email protected]:9726, Other-Leg-Channel-Answered-Time=0, Caller-Direction=outbound, variable_called_party_callgroup=techsupport, variable_toll_allow=domestic,international,local, variable_sip_local_network_addr=192.168.5.97, variable_sip_to_tag=ea01aec4, variable_sip_invite_domain=192.168.5.97, Other-Leg-Channel-Name=loopback/voicemail-a, variable_sip_call_id=d9159c0d-fed4-123c-ada9-000c291b6650, variable_sip_reply_host=192.168.5.162, variable_sip_destination_url=sip:[email protected]:9726;rinstance=eacf349ed3bb70b1;transport=udp, variable_outbound_caller_id_number=10086, Call-Direction=outbound, Other-Leg-Direction=outbound, Other-Leg-Channel-Progress-Media-Time=1700134931262852, Caller-Privacy-Hide-Name=false, Event-Date-Local=2023-11-16 19:42:19, variable_continue_on_fail=true, Other-Leg-ANI=0000000000, variable_sip_to_port=9726, Event-Date-GMT=Thu, 16 Nov 2023 11:42:19 GMT, variable_transfer_history=1700134930:24303aff-f112-4b56-8400-e7c971b07a53:bl_xfer:1001/default/XML,
, variable_local_video_port=29476, variable_last_bridge_role=originator, variable_signal_bond=f6616956-15ad-40e6-975b-6d81aff8579e, Other-Leg-Channel-Progress-Time=0, Event-Sequence=42829, variable_max_forwards=70, variable_is_outbound=true, variable_last_bridge_to=f6616956-15ad-40e6-975b-6d81aff8579e, Other-Leg-Channel-Hold-Accum=0}
2023-11-16T03:41:33.515+0800 INFO  c.e.c.v.s.c.i.FsServerEventHandler - 用户挂断, 主叫:1000 , 被叫:default 192.168.5.97 1001 , response:null ,hangup cause:NORMAL_CLEARING

  •  获取需要参数

 String callUuid = event.get("Channel-Call-UUID"); String eventDate = event.get("Event-Date-Local"); String logicalDirection = event.get("Caller-Logical-Direction"); String callDirection = event.get("Other-Leg-Logical-Direction"); String otherLegAni = event.get("Other-Leg-ANI"); //Other-Leg-ANI=0000000000 if(StringUtils.isNotEmpty(callDirection)&& !"0000000000".equals(otherLegAni)){ logicalDirection=callDirection; } String thisDn = event.get("variable_effective_caller_id_number");//当前分机 String otherDn = event.get("Caller-Caller-ID-Number");//主叫 String answerState = event.get("Answer-State");//话务状态->ringing String switchName = event.get("FreeSWITCH-Switchname"); String ani = event.get("Caller-Caller-ID-Number"); String dnis = event.get("Caller-Callee-ID-Number"); logger.info("【Fs EsEvent】->>>> onEventReleased EsEvent callUuid:{},eventDate:{}, logicalDirection:{}, thisDn:{},otherDn:{},answerState:{},switchName:{}", callUuid, eventDate, logicalDirection, thisDn, otherDn, answerState, switchName); Integer referenceId = Integer.valueOf(event.get("Event-Sequence"));

  •  websocket前端收到的事件

{
    "agentId": "21009",
    "ani": "15910979999",
    "callType": "inbound",
    "callUuid": "25f30ba4-223e-442c-92b8-2315e8a62c82",
    "calleder": "1000",
    "caller": "15910979999",
    "connId": "25f30ba4-223e-442c-92b8-2315e8a62c82",
    "dnis": "1000",
    "eventType": "EVENT_RELEASED",
    "mediaType": "voice",
    "messageType": "VoiceCallStateChangeMessage",
    "referenceId": 47934,
    "sessionId": "079dc84e-a643-4dd7-86fa-d9a991008c08",
    "thisDn": "1000"
}

2.CHANNEL_HANGUP_COMPLETE事件

CHANNEL_HANGUP_COMPLETE

CHANNEL_HANGUP_COMPLETE example  展开源码 

RECV EVENT

Event-Name: CHANNEL_HANGUP_COMPLETE

Core-UUID: 9b0de0b8-f55e-40d8-a2bd-179310b53493

FreeSWITCH-Hostname: myhost                    

FreeSWITCH-IPv4: 192.168.0.2                   

FreeSWITCH-IPv6: ::1                           

Event-Date-Local: 2009-10-09 20:08:26          

Event-Date-GMT: Sat, 10 Oct 2009 00:08:26 GMT  

Event-Date-Timestamp: 1255133306952270         

Event-Calling-File: switch_core_state_machine.c

Event-Calling-Function: switch_core_session_hangup_state

Event-Calling-Line-Number: 503                          

Hangup-Cause: NORMAL_CLEARING                           

Channel-State: CS_HANGUP                                

Channel-State-Number: 10                                

Channel-Name: sofia/internal/[email protected]           

Unique-ID: e5a82e39-6dc1-4d7d-a300-aa9cd4284073         

Call-Direction: inbound                                 

Presence-Call-Direction: inbound                        

Answer-State: answered                                  

Channel-Read-Codec-Name: GSM                            

Channel-Read-Codec-Rate: 8000                           

Channel-Write-Codec-Name: GSM                           

Channel-Write-Codec-Rate: 8000                          

Caller-Username: 1000                                   

Caller-Dialplan: XML                                    

Caller-Caller-ID-Name: 1000                             

Caller-Caller-ID-Number: 1000                           

Caller-Network-Addr: 192.168.0.104                      

Caller-Destination-Number: 3030                         

Caller-Unique-ID: e5a82e39-6dc1-4d7d-a300-aa9cd4284073  

Caller-Source: mod_sofia                                

Caller-Context: default                                 

Caller-Channel-Name: sofia/internal/[email protected]    

Caller-Profile-Index: 1                                 

Caller-Profile-Created-Time: 1255133286498223           

Caller-Channel-Created-Time: 1255133286498223           

Caller-Channel-Answered-Time: 1255133286504829          

Caller-Channel-Progress-Time: 0                         

Caller-Channel-Progress-Media-Time: 0                   

Caller-Channel-Hangup-Time: 1255133306952270            

Caller-Channel-Transfer-Time: 0                         

Caller-Screen-Bit: true                                 

Caller-Privacy-Hide-Name: false                         

Caller-Privacy-Hide-Number: false                       

variable_sip_received_ip: 192.168.0.104                 

variable_sip_received_port: 5060                        

variable_sip_via_protocol: udp                          

variable_sip_authorized: true                           

variable_sip_number_alias: 1000                         

variable_sip_auth_username: 1000                        

variable_sip_auth_realm: 192.168.0.2                    

variable_number_alias: 1000                             

variable_user_name: 1000                                

variable_domain_name: 192.168.0.2                       

variable_toll_allow: domestic,international,local       

variable_accountcode: 1000                              

variable_user_context: default                          

variable_effective_caller_id_name: Extension 1000       

variable_effective_caller_id_number: 1000               

variable_outbound_caller_id_name: FreeSWITCH            

variable_outbound_caller_id_number: 0000000000          

variable_callgroup: techsupport                         

variable_record_stereo: true                            

variable_default_gateway: example.com                   

variable_default_areacode: 918                          

variable_transfer_fallback_extension: operator          

variable_sip_from_params: transport=UDP                 

variable_sip_from_user: 1000                            

variable_sip_from_uri: [email protected]                 

variable_sip_from_host: 192.168.0.2                     

variable_sip_from_user_stripped: 1000                   

variable_sip_from_tag: 7bae8202                         

variable_sofia_profile_name: internal                   

variable_sip_req_params: transport=UDP                  

variable_sip_req_user: 3030                             

variable_sip_req_uri: [email protected]                  

variable_sip_req_host: 192.168.0.2                      

variable_sip_to_params: transport=UDP                   

variable_sip_to_user: 3030                              

variable_sip_to_uri: [email protected]                   

variable_sip_to_host: 192.168.0.2                       

variable_sip_contact_params: transport=UDP              

variable_sip_contact_user: 1000                         

variable_sip_contact_port: 60780                        

variable_sip_contact_uri: [email protected]:60780     

variable_sip_contact_host: 190.52.138.225               

variable_channel_name: sofia/internal/[email protected]  

variable_sip_call_id: ODZhNDk5YzlmZDg3YTExOWU4NDU3NmM2ZmI1MzFmNDU.

variable_sip_via_host: 190.52.138.225                             

variable_sip_via_port: 60780                                      

variable_sip_via_rport: 5060                                      

variable_max_forwards: 70                                         

variable_presence_id: [email protected]                            

variable_switch_r_sdp: v=0                                        

o=Z 0 0 IN IP4 190.52.138.225                                     

s=Z                                                               

c=IN IP4 190.52.138.225                                           

t=0 0                                                             

m=audio 60790 RTP/AVP 3 110 98 8 0 101                            

a=rtpmap:3 GSM/8000                                               

a=rtpmap:110 speex/8000                                           

a=rtpmap:98 iLBC/8000                                             

a=fmtp:98 mode=30                                                 

a=rtpmap:8 PCMA/8000                                              

a=rtpmap:0 PCMU/8000                                              

a=rtpmap:101 telephone-event/8000                                 

a=fmtp:101 0-15                                                   

variable_remote_media_ip: 190.52.138.225

variable_remote_media_port: 60790       

variable_write_codec: GSM               

variable_write_rate: 8000               

variable_local_media_ip: 192.168.0.2    

variable_local_media_port: 19878        

variable_endpoint_disposition: ANSWER   

variable_current_application_data: $1-192.168.0.2@default

variable_current_application: conference                 

variable_conference_name: $1-192.168.0.2                 

variable_sip_term_status: 200                            

variable_sip_term_cause: 16                              

variable_sip_user_agent: Zoiper rev.4688                 

variable_sip_hangup_disposition: recv_bye                

variable_read_codec: GSM                                 

variable_read_rate: 8000                                 

variable_hangup_cause: NORMAL_CLEARING                   

variable_hangup_cause_q850: 16                           

variable_digits_dialed: none                             

variable_start_stamp: 2009-10-09 20:08:06                

variable_profile_start_stamp: 2009-10-09 20:08:06        

variable_answer_stamp: 2009-10-09 20:08:06               

variable_end_stamp: 2009-10-09 20:08:26                  

variable_start_epoch: 1255133286                         

variable_start_uepoch: 1255133286498223                  

variable_profile_start_epoch: 1255133286                 

variable_profile_start_uepoch: 1255133286498223          

variable_answer_epoch: 1255133286                        

variable_answer_uepoch: 1255133286504829                 

variable_progress_epoch: 0                               

variable_progress_uepoch: 0                              

variable_progress_media_epoch: 0                         

variable_progress_media_uepoch: 0                        

variable_end_epoch: 1255133306                           

variable_end_uepoch: 1255133306952270                    

variable_last_app: conference                            

variable_last_arg: $1-192.168.0.2@default                

variable_caller_id: "1000" <1000>                        

variable_duration: 20                                    

variable_billsec: 20                                     

variable_progresssec: 0                                  

variable_answersec: 0                                    

variable_progress_mediasec: 0                            

variable_flow_billsec: 20                                

variable_mduration: 20454                                

variable_billmsec: 20448                                 

variable_progressmsec: 0                                 

variable_answermsec: 6                                   

variable_progress_mediamsec: 0                           

variable_flow_billmsec: 20454                            

variable_uduration: 20454047                             

variable_billusec: 20447441                              

variable_progressusec: 0                                 

variable_answerusec: 6606                                

variable_progress_mediausec: 0                           

variable_flow_billusec: 20454047                         

variable_rtp_audio_in_raw_bytes: 45765                   

variable_rtp_audio_in_media_bytes: 45630                 

variable_rtp_audio_in_packet_count: 1017                 

variable_rtp_audio_in_media_packet_count: 1014           

variable_rtp_audio_in_skip_packet_count: 8               

variable_rtp_audio_in_jb_packet_count: 0                 

variable_rtp_audio_in_dtmf_packet_count: 0               

variable_rtp_audio_in_cng_packet_count: 0                

variable_rtp_audio_in_flush_packet_count: 0              

variable_rtp_audio_out_raw_bytes: 44055                  

variable_rtp_audio_out_media_bytes: 44055                

variable_rtp_audio_out_packet_count: 979                 

variable_rtp_audio_out_media_packet_count: 979           

variable_rtp_audio_out_skip_packet_count: 0              

variable_rtp_audio_out_dtmf_packet_count: 0              

variable_rtp_audio_out_cng_packet_count: 0

你可能感兴趣的:(Freeswitch,算法,前端,数据库)