Code cleanup

main
Yasen Pramatarov 2024-05-31 22:14:45 +03:00
parent 95a793aa49
commit fa5a7d821c
1 changed files with 7 additions and 11 deletions

18
jilo
View File

@ -207,31 +207,26 @@ jitsi_log_parse() {
fi
# locate participant pair selection event
elif [[ "$line" =~ ([0-9-]+\ [0-9:.]+)\ [A-Z]+:.*\[confId=${conferenceId}\ .*epId=([a-zA-Z0-9-]+)\ stats_id=([a-zA-Z0-9-]+)\ .*Selected\ pair\ for\ stream\ .*([0-9.]+):10000/udp/srflx\ \-\>\ ([0-9.]+):[0-9]+/udp/prflx ]]; then
elif [[ "$line" =~ ([0-9-]+\ [0-9:.]+)\ [A-Z]+:.*\[confId=${conferenceId}\ .*epId=${participant_endpoint_id}\ stats_id=${participant_stats_id}\ .*Selected\ pair\ for\ stream\ .*([0-9.]+):10000/udp/srflx\ \-\>\ ([0-9.]+):[0-9]+/udp/prflx ]]; then
participant_join_time="${BASH_REMATCH[1]}"
event_type='pair selected'
participant_endpoint_id="${BASH_REMATCH[2]}"
participant_stats_id="${BASH_REMATCH[3]}"
participant_IP="${BASH_REMATCH[5]}"
participant_IP="${BASH_REMATCH[3]}"
if [[ -n "$conferenceId" ]]; then
db_insert=$(printf "$db_insert_participant_template" "$conferenceId" "$participant_join_time" "$event_type" "$participant_endpoint_id" "$participant_stats_id" "$participant_IP")
db_query "$db_insert"
fi
# locate participant leaving event
elif [[ "$line" =~ ([0-9-]+\ [0-9:.]+)\ [A-Z]+:.*\[confId=${conferenceId}\ .*epId=([a-zA-Z0-9-]+)\ stats_id=([a-zA-Z0-9-]+)\]\ Endpoint\.expire.*:\ Expired\. ]]; then
elif [[ "$line" =~ ([0-9-]+\ [0-9:.]+)\ [A-Z]+:.*\[confId=${conferenceId}\ .*epId=${participant_endpoint_id}\ stats_id=${participant_stats_id}\]\ Endpoint\.expire.*:\ Expired\. ]]; then
participant_join_time="${BASH_REMATCH[1]}"
event_type='participant leaving'
participant_endpoint_id="${BASH_REMATCH[2]}"
participant_stats_id="${BASH_REMATCH[3]}"
participant_IP="${BASH_REMATCH[5]}"
if [[ -n "$conferenceId" ]]; then
db_insert=$(printf "$db_insert_participant_template" "$conferenceId" "$participant_join_time" "$event_type" "$participant_endpoint_id" "$participant_stats_id" "$participant_IP")
db_query "$db_insert"
# the participant left, forget about him
unset $participant_join_time $event_type $participant_endpoint_id $participant_stats_id $participant_IP
fi
# locate the corresponding conference ending event
elif [[ "$line" =~ ([0-9-]+\ [0-9:.]+)\ [A-Z]+:.*\[confId=([a-zA-Z0-9]+)\ .*conf_name=([^ ]+)@.*\]\ Conference\.expire ]]; then
end_time="${BASH_REMATCH[1]}"
@ -242,7 +237,8 @@ jitsi_log_parse() {
if [[ -n "$start_time" ]]; then
db_insert=$(printf "$db_insert_conference_template" "$jitsi_component" "$conferenceName" "$conferenceId" "$start_time" "$end_time")
db_query "$db_insert"
unset "start_times[$conferenceId]"
# the conference ended, forget about it
unset "start_times[$conferenceId]" $statr_time $end_time $conferenceId $conferenceName
fi
fi
;;