([])
- const [seqHeight, _] = useState(window.innerHeight)
- const seq = useLoaderData() as BaseType[]
-
- const seqList = seq.map((item, index) => {
- return (
-
-
- {formatLongTime(item.CreateTime)}
- length: {item.RawMsg.length}B
- protocol: {getProtocolName(item.SIPProtocol)}
-
-
-
- )
- })
-
- const items: TabsProps['items'] = [
- {
- key: 'leg-a',
- label: 'Leg A',
- children: (
-
-
-
-
-
- {seqList}
-
-
- ),
- },
- {
- key: 'leg-b',
- label: 'Leg B',
- children: 'Content of Tab Pane 2',
- },
- ]
-
- // useEffect(() => {
- // axios
- // .get(`/api/v1/call/${params.day}/${params.callID}/`)
- // .then((res) => {
- // res.data
- // setSeq(res.data)
- // })
- // .catch()
- // }, [])
-
- useEffect(() => {
- const diagram = new ssd.SequenceDiagram()
- const dom = createSeqHtml(seq, 0).html
- diagram.set(dom)
- diagram.addEventListener('click', (e: any) => {
- if (e.type === 'connect') {
- console.log(e)
- diagram.setHighlight(e.ln)
- let cid = 's-line-' + e.ln
- let el = document.getElementById(cid)
- if (el) el.scrollIntoView()
- }
- })
-
- if (ssdRef.current !== null) {
- ssdRef.current.appendChild(diagram.dom())
- paintLine('leg-a', data)
- }
- return () => {
- diagram.removeAllEventListeners()
- if (ssdRef.current) ssdRef.current.innerHTML = ''
- }
- }, [seq])
-
- return (
-
- {/* {params.day} {params.callID} */}
-
-
- )
-}
diff --git a/src/assets/react.svg b/src/assets/react.svg
deleted file mode 100644
index 6c87de9..0000000
--- a/src/assets/react.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/config.ts b/src/config.ts
deleted file mode 100644
index 0c243e3..0000000
--- a/src/config.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-export const lineColors = [
- '#8A2BE2',
- '#D2691E',
- '#5F9EA0',
- '#CD5C5C',
- '#FF69B4',
- '#90EE90',
- '#FFA07A',
- '#20B2AA',
- '#87CEFA',
- '#32CD32',
- '#7B68EE',
- '#C71585',
- '#808000',
- '#FF4500',
- '#DA70D6',
- '#00FF7F',
- '#EE82EE',
- '#9ACD32',
-]
diff --git a/src/flow.ts b/src/flow.ts
deleted file mode 100644
index 889b58f..0000000
--- a/src/flow.ts
+++ /dev/null
@@ -1,170 +0,0 @@
-export const data = [
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28181,
- CreateTime: '2023-11-11T15:03:33+08:00',
- DstHost: '192.168.1.51_5060',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'REGISTER sip:sipgrep.cc SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;rport;branch=z9hG4bKPjKxQC1r.CyyEdpj5k.FYv59nTAkO5uyS5\r\nRoute: \r\nMax-Forwards: 70\r\nFrom: "8011@sipgrep.cc" ;tag=PZAIljH3xWaiwplf2ivPnSfwcAtQQiMB\r\nTo: "8011@sipgrep.cc" \r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28181 REGISTER\r\nUser-Agent: Telephone 1.6\r\nContact: "8011@sipgrep.cc" \r\nExpires: 300\r\nAllow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 0,
- ResponseDesc: '',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: 'REGISTER',
- SIPProtocol: 17,
- SrcHost: '192.168.1.72_52648',
- TimestampMicro: 707083,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: 'Telephone 1.6',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28181,
- CreateTime: '2023-11-11T15:03:33+08:00',
- DstHost: '192.168.1.72_52648',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;received=192.168.1.72;rport=52648;branch=z9hG4bKPjKxQC1r.CyyEdpj5k.FYv59nTAkO5uyS5\r\nTo: "8011@sipgrep.cc" ;tag=dafd.fc95671f48a790189c5ca47d62af290f\r\nFrom: "8011@sipgrep.cc" ;tag=PZAIljH3xWaiwplf2ivPnSfwcAtQQiMB\r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28181 REGISTER\r\nServer: OpenSIPS (3.4.2 (x86_64/linux))\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 200,
- ResponseDesc: 'OK',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: '200',
- SIPProtocol: 17,
- SrcHost: '192.168.1.51_5060',
- TimestampMicro: 707158,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: '',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28182,
- CreateTime: '2023-11-11T15:08:28+08:00',
- DstHost: '192.168.1.51_5060',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'REGISTER sip:sipgrep.cc SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;rport;branch=z9hG4bKPjEmqtst7eg3JPu2qnqUw1YrHarioc9nsh\r\nRoute: \r\nMax-Forwards: 70\r\nFrom: "8011@sipgrep.cc" ;tag=YVMydCg1f2NfLMCqILVQ8Ul0aCn6mY5h\r\nTo: "8011@sipgrep.cc" \r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28182 REGISTER\r\nUser-Agent: Telephone 1.6\r\nContact: "8011@sipgrep.cc" \r\nExpires: 300\r\nAllow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 0,
- ResponseDesc: '',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: 'REGISTER',
- SIPProtocol: 17,
- SrcHost: '192.168.1.72_52648',
- TimestampMicro: 811460,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: 'Telephone 1.6',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28182,
- CreateTime: '2023-11-11T15:08:28+08:00',
- DstHost: '192.168.1.72_52648',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;received=192.168.1.72;rport=52648;branch=z9hG4bKPjEmqtst7eg3JPu2qnqUw1YrHarioc9nsh\r\nTo: "8011@sipgrep.cc" ;tag=dafd.755749fd48ba369859bb8d070d32fa04\r\nFrom: "8011@sipgrep.cc" ;tag=YVMydCg1f2NfLMCqILVQ8Ul0aCn6mY5h\r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28182 REGISTER\r\nServer: OpenSIPS (3.4.2 (x86_64/linux))\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 200,
- ResponseDesc: 'OK',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: '200',
- SIPProtocol: 17,
- SrcHost: '192.168.1.51_5060',
- TimestampMicro: 811540,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: '',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28183,
- CreateTime: '2023-11-11T15:13:23+08:00',
- DstHost: '192.168.1.51_5060',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'REGISTER sip:sipgrep.cc SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;rport;branch=z9hG4bKPjrbGH77cExMJHPDDXxgh9pjhy6cT2JBCm\r\nRoute: \r\nMax-Forwards: 70\r\nFrom: "8011@sipgrep.cc" ;tag=zxZQEQ7EalG9dK8WqSrOkg0djvPyXVWL\r\nTo: "8011@sipgrep.cc" \r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28183 REGISTER\r\nUser-Agent: Telephone 1.6\r\nContact: "8011@sipgrep.cc" \r\nExpires: 300\r\nAllow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 0,
- ResponseDesc: '',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: 'REGISTER',
- SIPProtocol: 17,
- SrcHost: '192.168.1.72_52648',
- TimestampMicro: 930661,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: 'Telephone 1.6',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28183,
- CreateTime: '2023-11-11T15:13:23+08:00',
- DstHost: '192.168.1.72_52648',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;received=192.168.1.72;rport=52648;branch=z9hG4bKPjrbGH77cExMJHPDDXxgh9pjhy6cT2JBCm\r\nTo: "8011@sipgrep.cc" ;tag=dafd.7ac09695b29da00c008f9795b7e85897\r\nFrom: "8011@sipgrep.cc" ;tag=zxZQEQ7EalG9dK8WqSrOkg0djvPyXVWL\r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28183 REGISTER\r\nServer: OpenSIPS (3.4.2 (x86_64/linux))\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 200,
- ResponseDesc: 'OK',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: '200',
- SIPProtocol: 17,
- SrcHost: '192.168.1.51_5060',
- TimestampMicro: 930759,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: '',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28184,
- CreateTime: '2023-11-11T15:13:44+08:00',
- DstHost: '192.168.1.51_5060',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'REGISTER sip:sipgrep.cc SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;rport;branch=z9hG4bKPjQYSt5iiLTHjulh-tfgKQZSZgOyYF92n-\r\nRoute: \r\nMax-Forwards: 70\r\nFrom: "8011@sipgrep.cc" ;tag=NXfCKTc9.scBrsHhTGo60Fozc6WmCzeF\r\nTo: "8011@sipgrep.cc" \r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28184 REGISTER\r\nUser-Agent: Telephone 1.6\r\nContact: "8011@sipgrep.cc" \r\nExpires: 0\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 0,
- ResponseDesc: '',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: 'REGISTER',
- SIPProtocol: 17,
- SrcHost: '192.168.1.72_52648',
- TimestampMicro: 614805,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: 'Telephone 1.6',
- },
- {
- CSeqMethod: 'REGISTER',
- CSeqNumber: 28184,
- CreateTime: '2023-11-11T15:13:44+08:00',
- DstHost: '192.168.1.72_52648',
- FromHost: 'sipgrep.cc',
- FromUser: '8011',
- FsCallID: '',
- LegUid: '',
- RawMsg: 'SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 192.168.1.72:52648;received=192.168.1.72;rport=52648;branch=z9hG4bKPjQYSt5iiLTHjulh-tfgKQZSZgOyYF92n-\r\nTo: "8011@sipgrep.cc" ;tag=dafd.231a58937a30e21d6fa96264d7b1f632\r\nFrom: "8011@sipgrep.cc" ;tag=NXfCKTc9.scBrsHhTGo60Fozc6WmCzeF\r\nCall-ID: oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw\r\nCSeq: 28184 REGISTER\r\nServer: OpenSIPS (3.4.2 (x86_64/linux))\r\nContent-Length: 0\r\n\r\n',
- ResponseCode: 200,
- ResponseDesc: 'OK',
- SIPCallID: 'oMDfqeY4EHHwovasP2Mn9x3aFzOy6Lvw',
- SIPMethod: '200',
- SIPProtocol: 17,
- SrcHost: '192.168.1.51_5060',
- TimestampMicro: 614876,
- ToHost: 'sipgrep.cc',
- ToUser: '1108',
- UserAgent: '',
- },
-]
diff --git a/src/index.css b/src/index.css
deleted file mode 100644
index 2c3fac6..0000000
--- a/src/index.css
+++ /dev/null
@@ -1,69 +0,0 @@
-:root {
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
- line-height: 1.5;
- font-weight: 400;
-
- color-scheme: light dark;
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
-
- font-synthesis: none;
- text-rendering: optimizeLegibility;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- -webkit-text-size-adjust: 100%;
-}
-
-a {
- font-weight: 500;
- color: #646cff;
- text-decoration: inherit;
-}
-a:hover {
- color: #535bf2;
-}
-
-body {
- margin: 0;
- display: flex;
- place-items: center;
- min-width: 320px;
- min-height: 100vh;
-}
-
-h1 {
- font-size: 3.2em;
- line-height: 1.1;
-}
-
-button {
- border-radius: 8px;
- border: 1px solid transparent;
- padding: 0.6em 1.2em;
- font-size: 1em;
- font-weight: 500;
- font-family: inherit;
- background-color: #1a1a1a;
- cursor: pointer;
- transition: border-color 0.25s;
-}
-button:hover {
- border-color: #646cff;
-}
-button:focus,
-button:focus-visible {
- outline: 4px auto -webkit-focus-ring-color;
-}
-
-@media (prefers-color-scheme: light) {
- :root {
- color: #213547;
- background-color: #ffffff;
- }
- a:hover {
- color: #747bff;
- }
- button {
- background-color: #f9f9f9;
- }
-}
diff --git a/src/interface.ts b/src/interface.ts
deleted file mode 100644
index 0a0bc56..0000000
--- a/src/interface.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-export interface BaseType {
- ID: number
- SIPCallID: string
- SIPMethod: string
- CreateTime: string
- CreateTimeShort?: string
- CreateTimeLong?: string
- ToUser: string
- LegUid: string
- FromUser: string
- FsCallID: string
- ResponseCode: number
- ResponseDesc: string
- CSeqMethod: string
- CSeqNumber: number
- FromHost: string
- ToHost: string
- SIPProtocol: number
- SIPProtocolName?: string
- IsRequest?: number
- UserAgent: string
- SrcHost: string
- DstHost: string
- TimestampMicro: number
- RawMsg: string
-}
-
-export interface DataType extends BaseType {
- MsgCount: number
-}
diff --git a/src/main.tsx b/src/main.tsx
deleted file mode 100644
index 3591e8b..0000000
--- a/src/main.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom/client'
-import App from './App.tsx'
-import SequenceDiagram from './SequenceDiagram'
-import axios from 'axios'
-//import 'normalize.css'
-
-import { createBrowserRouter, RouterProvider } from 'react-router-dom'
-const router = createBrowserRouter([
- {
- path: '/',
- element: ,
- },
- {
- path: '/call/:day/:callID',
- element: ,
- loader: async ({ params }) => {
- const res = await axios.get(`/api/v1/call/${params.day}/${params.callID}/`)
- return res.data
- },
- },
-])
-
-ReactDOM.createRoot(document.getElementById('root')!).render(
-
-
- ,
-)
diff --git a/src/util.ts b/src/util.ts
deleted file mode 100644
index 199dbeb..0000000
--- a/src/util.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import dayjs from 'dayjs'
-import { BaseType } from './interface'
-
-const dateFormat = 'YYYY-MM-DD HH:mm:ss'
-
-export function getProtocolName(num: number) {
- if (num === 6) {
- return 'TCP'
- }
- if (num === 17) {
- return 'UDP'
- }
- if (num === 22) {
- return 'TLS'
- }
- if (num === 50) {
- return 'ESP'
- }
- return 'Unknown'
-}
-
-export function stringToColor(str: string) {
- let hash = 0
- for (let i = 0; i < str.length; i++) {
- hash = str.charCodeAt(i) + ((hash << 5) - hash)
- }
-
- let color = '#'
-
- for (let i = 0; i < 3; i++) {
- const value = (hash >> (i * 8)) & 0xff
- const v16 = '00' + value.toString(16)
- color += v16.substring(v16.length - 2)
- }
- return color
-}
-
-const regEx = /\d+/
-export function isRequest(method: string) {
- return !regEx.test(method)
-}
-
-export function formatLongTime(t: string) {
- return dayjs(t).format(dateFormat)
-}
-
-export function createSeqHtml(seq: BaseType[], startIndex: number) {
- const res: string[] = [`autolabel "[]