1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
|
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=rtpengine
PKG_VERSION:=11.5.1.49
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-mr$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/sipwise/rtpengine/tar.gz/mr$(PKG_VERSION)?
PKG_HASH:=33e9565ad221ba86bb985d3983a3871edc17c0b4221bc220fdb3715fce0a828a
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-mr$(PKG_VERSION)
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=
# When building in parallel, some files (like streambuf.c or dtmflib.c)
# are generated multiple times by the rtpengine build system.
# Intermittently they then contain garbage, leading to redefinition
# errors.
PKG_BUILD_PARALLEL:=0
PKG_BUILD_DEPENDS:=gperf/host perl/host
# With below variable set, $(PKG_SYMVERS_DIR)/rtpengine.symvers gets generated
# from kernel-module/Module.symvers.
PKG_EXTMOD_SUBDIRS:=kernel-module
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
ENGINE_DEPENDS := \
+glib2 \
+json-glib \
+libevent2 \
+libevent2-pthreads \
+libhiredis \
+libip4tc \
+libmosquitto \
+libopenssl \
+libpcap \
+libpcre2 \
+libwebsockets-openssl \
+libopus \
+xmlrpc-c \
+xmlrpc-c-client \
+zlib
ENGINE_DEPENDS_TRANSCODING := \
$(ENGINE_DEPENDS) \
+bcg729 \
+libffmpeg-full \
+libmariadb \
+libspandsp3
RECORDING_DEPENDS := \
+bcg729 \
+glib2 \
+libffmpeg-full \
+libmariadb \
+libopenssl \
+libcurl
RTPENGINE_USERID:=378
RTPENGINE_GROUPID:=$(RTPENGINE_USERID)
RTPENGINE_USER:=$(PKG_NAME)=$(RTPENGINE_USERID):$(PKG_NAME)=$(RTPENGINE_GROUPID)
define Package/rtpengine/Default
URL:=https://github.com/sipwise/rtpengine
endef
define Package/rtpengine/Template
$(call Package/rtpengine/Default)
TITLE:=Sipwise RTP Engine
CATEGORY:=Network
SECTION:=net
SUBMENU:=Telephony
USERID:=$(RTPENGINE_USER)
endef
define Package/rtpengine/description/Template
The Sipwise NGCP rtpengine is a proxy for RTP traffic and other UDP
based media traffic. It's meant to be used with the Kamailio SIP proxy
and forms a drop-in replacement for any of the other available RTP and
media proxies.
endef
define Package/rtpengine
$(call Package/rtpengine/Template)
VARIANT:=transcode
DEPENDS := \
$(patsubst +%,+PACKAGE_rtpengine:%,$(ENGINE_DEPENDS_TRANSCODING)) \
+IPV6:libip6tc
endef
define Package/rtpengine/conffiles
/etc/config/rtpengine
/etc/init.d/rtpengine
/etc/rtpengine/rtpengine.conf
endef
define Package/rtpengine/description
$(call Package/rtpengine/description/Template)
Please consider installing kmod-ipt-rtpengine.
endef
define Package/rtpengine/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/daemon/rtpengine $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/rtpengine.init $(1)/etc/init.d/rtpengine
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/rtpengine.conf $(1)/etc/config/rtpengine
$(INSTALL_DIR) $(1)/etc/rtpengine
$(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/rtpengine.conf \
$(1)/etc/rtpengine/rtpengine.conf
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/rtpengine.hotplug \
$(1)/etc/hotplug.d/iface/90-rtpengine
endef
define Package/rtpengine-no-transcode
$(call Package/rtpengine/Template)
TITLE+= (no transcoding)
VARIANT:=no-transcode
CONFLICTS:=rtpengine
DEPENDS := \
$(patsubst +%,+PACKAGE_rtpengine-no-transcode:%,$(ENGINE_DEPENDS)) \
+IPV6:libip6tc
endef
Package/rtpengine-no-transcode/conffiles=$(Package/rtpengine/conffiles)
define Package/rtpengine-no-transcode/description
$(call Package/rtpengine/description/Template)
This package comes without transcoding support.
Please consider installing kmod-ipt-rtpengine.
endef
Package/rtpengine-no-transcode/install=$(Package/rtpengine/install)
define Package/rtpengine-recording
$(call Package/rtpengine/Default)
TITLE:=Sipwise RTP Recording Daemon
CATEGORY:=Network
SECTION:=net
SUBMENU:=Telephony
USERID:=$(RTPENGINE_USER)
DEPENDS:=$(patsubst +%,+PACKAGE_rtpengine-recording:%,$(RECORDING_DEPENDS))
endef
define Package/rtpengine-recording/conffiles
/etc/config/rtpengine-recording
/etc/rtpengine/rtpengine-recording.conf
endef
define Package/rtpengine-recording/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) \
$(PKG_BUILD_DIR)/recording-daemon/rtpengine-recording \
$(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/rtpengine-recording.init \
$(1)/etc/init.d/rtpengine-recording
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/rtpengine-recording.conf \
$(1)/etc/config/rtpengine-recording
$(INSTALL_DIR) $(1)/etc/rtpengine
$(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/rtpengine-recording.conf \
$(1)/etc/rtpengine/rtpengine-recording.conf
endef
define Package/iptables-mod-rtpengine
$(call Package/rtpengine/Default)
TITLE:=Sipwise rtpengine iptables extension
CATEGORY:=Network
SECTION:=net
SUBMENU:=Firewall
DEPENDS:=+PACKAGE_iptables-mod-rtpengine:libxtables
endef
define Package/iptables-mod-rtpengine/install
$(INSTALL_DIR) $(1)/usr/lib/iptables
$(INSTALL_BIN) \
$(PKG_BUILD_DIR)/iptables-extension/libxt_RTPENGINE.so \
$(1)/usr/lib/iptables
endef
define KernelPackage/ipt-rtpengine
$(call Package/rtpengine/Default)
TITLE:=Sipwise rtpengine netfilter module
SUBMENU:=Netfilter Extensions
FILES:=$(PKG_BUILD_DIR)/kernel-module/xt_RTPENGINE.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoProbe,xt_RTPENGINE)
DEPENDS := \
+PACKAGE_kmod-ipt-rtpengine:kmod-crypto-aead \
+PACKAGE_kmod-ipt-rtpengine:kmod-crypto-hash \
+PACKAGE_kmod-ipt-rtpengine:kmod-ipt-core
MODPARAMS.xt_RTPENGINE := \
proc_uid=$(RTPENGINE_USERID) \
proc_gid=$(RTPENGINE_GROUPID)
USERID:=$(RTPENGINE_USER)
endef
define KernelPackage/ipt-rtpengine/conffiles
/etc/modules.d/ipt-rtpengine
endef
define KernelPackage/ipt-rtpengine/description
Netfilter kernel module for rtpengine
endef
MAKE_VARS+=RTPENGINE_VERSION=$(PKG_VERSION)
ifeq ($(BUILD_VARIANT),no-transcode)
MAKE_VARS+=with_transcoding=no
endif
# rtpengine uses Debian's dpkg utility programs if it can find them. But
# we don't want build host flags to leak into our cross-compile.
define Build/Prepare
$(call Build/Prepare/Default)
ifeq ($(QUILT),)
cd "$(PKG_BUILD_DIR)" && \
$(FIND) . -maxdepth 2 -name "*Makefile" | \
xargs -I{} $(SED) \
'/shell which dpkg-/s/dpkg/OpenWrt-has-no-dpkg/' {} && \
$(SED) 's|#!/usr/bin/perl|#!$(STAGING_DIR_HOSTPKG)/usr/bin/perl|' \
utils/const_str_hash
endif
endef
define Build/Configure
endef
define Build/Compile
ifneq ($(CONFIG_PACKAGE_kmod-ipt-rtpengine),)
RTPENGINE_VERSION=$(PKG_VERSION) $(MAKE) \
$(PKG_JOBS) \
-C $(PKG_BUILD_DIR)/kernel-module \
KSRC=$(LINUX_DIR) \
$(KERNEL_MAKE_FLAGS)
endif
ifneq ($(CONFIG_PACKAGE_iptables-mod-rtpengine),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/iptables-extension)
endif
ifneq ($(CONFIG_PACKAGE_rtpengine)$(CONFIG_PACKAGE_rtpengine-no-transcode),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/daemon)
endif
ifneq ($(CONFIG_PACKAGE_rtpengine-recording),)
$(call Build/Compile/Default,-C $(PKG_BUILD_DIR)/recording-daemon)
endif
endef
define Build/InstallDev
endef
# KernelPackage calls need to go first, otherwise hooks like
# collect_module_symvers won't get added.
$(eval $(call KernelPackage,ipt-rtpengine))
$(eval $(call BuildPackage,rtpengine-no-transcode))
$(eval $(call BuildPackage,iptables-mod-rtpengine))
$(eval $(call BuildPackage,rtpengine))
$(eval $(call BuildPackage,rtpengine-recording))
|