-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eddie murphy
committed
Sep 6, 2024
1 parent
c833064
commit 32540a6
Showing
81 changed files
with
1,279 additions
and
5,530 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
tags: eddiemurphy5/hep-connect:latest |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
FROM golang:1.17.2 as builder | ||
FROM node:22-alpine3.19 | ||
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories | ||
RUN apk update && apk add tzdata curl && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
|
||
ENV GO111MODULE=on GOPROXY=https://goproxy.cn,direct | ||
ENV NODE_ENV production | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN npm install -g pnpm | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o run . | ||
COPY package.json pnpm-lock.yaml /app/ | ||
|
||
FROM alpine:3.14.2 | ||
RUN pnpm i -P | ||
|
||
WORKDIR /app | ||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories | ||
RUN apk update && apk add tzdata curl net-tools && cp -r -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | ||
RUN echo "curl http://localhost:3000/metrics/prometheus" > /app/README.md | ||
|
||
COPY --from=builder /app/run . | ||
#COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo | ||
ENV TZ=Asia/Shanghai | ||
COPY . /app | ||
|
||
EXPOSE 9060/udp | ||
EXPOSE 3000 | ||
|
||
ENTRYPOINT ["/app/run"] | ||
|
||
CMD [ "node", "app.mjs" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,137 +1,35 @@ | ||
# V23 Roadmap, under developing | ||
# siphub功能介绍 | ||
|
||
- sipgrep-go merge into sipgrep-ui, so there are no sipgrep-ui or sipgrep-go, just one sipgrep. | ||
- using react + ant design as ui frame | ||
- using golang fiber as the web server, no nodejs | ||
- using [SequenceDiagram](https://github.com/davidje13/SequenceDiagram) to draw sip sequence dragram | ||
- add pagenation | ||
- add login page | ||
|
||
# 截图 | ||
|
||
this is the first version | ||
**搜索页面展示** | ||
![](docs/img/search.jpg) | ||
|
||
1. [x] 1. Search Page Done | ||
![](atta/2023-11-12-19-49-40.png) | ||
**时序图展示页面** | ||
![](docs/img/flow.jpg) | ||
|
||
2. [ ] 2. SIP Sequence Leg A Page Doing | ||
![](atta/2023-11-12-19-50-24.png) | ||
|
||
3. [ ] 3. SIP Sequence Leg B Page | ||
4. [ ] 4. SIP Sequence Import Page | ||
5. [ ] 5. Cron Job create daily Table | ||
6. [ ] 6. cluster frame | ||
7. [ ] 7. SIP Raw Message Compression | ||
|
||
# 功能列表 | ||
|
||
For production, Please use [siphub v22](https://github.com/wangduanduan/siphub/tree/master) | ||
- [x] 时序图搜索 | ||
- [x] 时序图展示 | ||
- [ ] 分表 | ||
- [ ] 收藏 | ||
- [ ] 导入pcap | ||
- [ ] 导入json | ||
- [ ] 导出json | ||
- [ ] AB Call-leg关联 | ||
|
||
# Feature | ||
## 依赖 | ||
|
||
- [ ] search call | ||
- [ ] show SIP sequence diagram | ||
- [ ] bind A-Leg and B-Leg | ||
- [ ] load balance | ||
- [ ] cluster | ||
- [ ] call statistic | ||
- PostgreSQL 16 | ||
|
||
## db | ||
# 架构图 | ||
|
||
- only support mysql 8 | ||
- you need create a db which name sipgrep, the sipgrep will create table auto | ||
- OpenSIPS、FreeSWITCH、Heplify 将SIP消息以HEP格式写入到hep-connect | ||
- hep-connect将消息写入数据库, hep-connect部署文档参考 https://github.com/wangduanduan/hep-connect | ||
- siphub提供web查询界面,负责从数据库查询和展示SIP消息 | ||
|
||
# Inter | ||
|
||
## OpenSIPS 2X | ||
|
||
test witch OpenSIPS 2.4 | ||
|
||
```bash | ||
# add hep listen | ||
listen=hep_udp:your_ip:9061 | ||
|
||
loadmodule "proto_hep.so" | ||
# replace SIP_HUB_IP_PORT with sipgrep‘s ip:port | ||
modparam("proto_hep", "hep_id","[hep_dst] SIP_HUB_IP_PORT;transport=udp;version=3") | ||
loadmodule "siptrace.so" | ||
modparam("siptrace", "trace_id","[tid]uri=hep:hep_dst") | ||
|
||
# add ite in request route(); | ||
if(!is_method("REGISTER") && !has_totag()){ | ||
sip_trace("tid", "d", "sip"); | ||
} | ||
``` | ||
|
||
## OpenSIPS 3.x | ||
|
||
``` | ||
socket=hep_udp:127.0.0.1:9060 | ||
loadmodule "proto_hep.so" | ||
modparam("proto_hep", "hep_id","[hid] SIPGREP_IP:SIPGREP_PORT;transport=udp;version=3") | ||
loadmodule "tracer.so" | ||
modparam("tracer", "trace_id","[tid]uri=hep:hid") | ||
route { | ||
... | ||
if (has_totag()) { | ||
route(r_seq_request); | ||
} else { | ||
trace("tid", "d", "sip"); | ||
} | ||
... | ||
} | ||
``` | ||
|
||
## FreeSWITCH | ||
|
||
fs version 1.6.8+ | ||
|
||
编辑: sofia.conf.xml | ||
|
||
用真实的sipgrep ip:port替换SIPGREP_IP:SIPGREP_PORT | ||
|
||
``` | ||
<param name="capture-server" value="udp:SIPGREP_IP:SIPGREP_PORT;hep=3;capture_id=100"/> | ||
``` | ||
|
||
```shell | ||
freeswitch@fsnode04> sofia global capture on | ||
|
||
+OK Global capture on | ||
freeswitch@fsnode04> sofia global capture off | ||
|
||
+OK Global capture off | ||
``` | ||
|
||
然后将下面两个文件的sip-capture设置为yes | ||
- sofia_internal.conf.xml | ||
- sofia_external.conf.xml | ||
|
||
|
||
``` | ||
<param name="sip-capture" value="yes"/> | ||
``` | ||
|
||
最后,建议重启一下fs. | ||
|
||
## heplify集成 | ||
|
||
参考 https://github.com/sipcapture/heplify | ||
|
||
heplify是一个go语言开发的,基于网卡抓包的方式,捕获sip消息的客户端程序,整个程序就是一个二进制文件,可以不依赖其他组件运行。 | ||
|
||
- -i 指定网卡。需要更具机器真实网卡进行修改 | ||
- -m SIP 指定抓SIP消息 | ||
- -hs 指定sipgrep-go的地址。需要根据sipgrep-go的真实地址进行修改 | ||
- -p 指定生成日志文件的位置 | ||
- -dim 排除某些类型的SIP包,例如排除OPTIONS和REGISTER注册的包 | ||
- -pr 指定抓包的端口范围。 | ||
|
||
``` | ||
nohup ./heplify -i eno1 \ | ||
-m SIP \ | ||
-hs 192.168.3.3:9060 \ | ||
-p "/var/log/" \ | ||
-dim OPTIONS,REGISTER \ | ||
-pr "5060-5061" & | ||
``` | ||
![](docs/img/arch.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import express from 'express' | ||
import bodyParser from 'body-parser' | ||
import { AppLoger, logger } from './logger.mjs' | ||
import dayjs from 'dayjs' | ||
import { route } from './router/api.mjs' | ||
import { queryRecord } from './db.mjs' | ||
|
||
const app = express() | ||
|
||
app.use(AppLoger()) | ||
app.use(bodyParser.urlencoded({ extended: false })) | ||
app.use(express.static('public')) | ||
app.set('view engine', 'ejs') | ||
|
||
app.get('/', async function (req, res) { | ||
let n = dayjs() | ||
let day = n.format('YYYY-MM-DD') | ||
let start = n.subtract(10, 'm').format('HH:mm:ss') | ||
let stop = n.format('HH:mm:ss') | ||
|
||
let result = await queryRecord({ | ||
day, | ||
start, | ||
stop, | ||
caller: '', | ||
callee: '', | ||
msg_min: 1 | ||
}) | ||
|
||
res.render('home/index', { | ||
day, | ||
start, | ||
stop, | ||
table: result.rows | ||
}) | ||
}) | ||
|
||
app.use('/api', route) | ||
|
||
app.listen(3000) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.